bookmarklet

Replace end characters of current URL with bookmarklet

南楼画角 提交于 2019-12-11 01:44:20
问题 Is there a way to replace all characters after the last backslash in the currentURL with another string via javascript bookmarklet? I'm doing a lot of auditing work with Sharepoint sites and having to manually look at the settings pages for sites by entering strings to the end of a URL. For example, I might go to a site like: https://site.com/..../default.aspx And I replace the "default.aspx" with "_layouts/user.aspx" and reload the new page so it is now at: https://site.com/..../_layouts

Check (from bookmarklet) whether page is loaded?

半腔热情 提交于 2019-12-10 16:35:39
问题 I'm writing a bookmarklet javascript. The problem here is that it can be invoked by user before and after some page has finished loading. I want to ensure that the sript is run only after the page has finished loading. How to do that? 回答1: One way for checking if document has loaded, is to check the document.readyState property. IE, Firefox 3.6+, Webkit and Opera support it. if (document.readyState === "complete") { // do sth } Another thing is, if you want to wait for the document to load.

SCRIPT5009: “$” is undefined in IE9

走远了吗. 提交于 2019-12-10 13:59:55
问题 I have a bookmarklet that loads a div into a current page and places an iframe inside it. The bookmarklet works like a dream in all browsers except IE9. Even works in earlier versions of IE. I'm using the following bookmarklet framework: http://idc.anavallasuiza.com/project/bookmarklets Some one else has had a similar issue here (not related to bookmarklets): https://forum.jquery.com/topic/retrieved-html-data-type-with-jquery-ajax-in-ie9-scripts-tags-sources-could-not-be-loaded So far I'm

Instagram auto like Bookmarklet

a 夏天 提交于 2019-12-10 11:19:52
问题 Instagram Like (heart) auto click Post Bookmarklet Objective: Click all "Like" heart on page http://www.gramfeed.com/instagram/tags#photo Here is the code I was working with. This one worked on another site, var a = document.getElementsByTagName('a'); var b = []; for(var i=0, len = a.length; i < len; i++){ if(a[i].id.indexOf('like') !== -1){b.push(a[i]) } }; for(var i=0, len = b.length; i < len; i++){ b[i].click() }; 回答1: The following should work; I've tested it on my end, and it likes the

Creating thumbnail squares of images in javascript (without losing aspect ratio)

怎甘沉沦 提交于 2019-12-10 09:27:49
问题 I am making a client side Drag and Drop file upload script as a bookmarklet. Before uploading I am using the File API to read the images into base64 format and display them as thumbnails. This is how my thumbnails look like. I want them to look more square but without loosing their aspect ratio. (please ignore progress bar) This is how I want the thumbnails to be like, they are centered and being cropped based on min(height,width). Can I do this using javascript only (changing styles via

How do I disable position:fixed in web pages?

你说的曾经没有我的故事 提交于 2019-12-10 03:19:16
问题 This website: http://nautil.us/ has a really annoying header that is always on screen and won't scroll away. If I right-click on it and 'inspect element' in firefox, then I find that the css contains "position: fixed;", and if I untick this, the header behaves, and scrolls away as God intended headers to do. Is there some way to get firefox to do this automatically, i.e. remove all position: fixed lines from all pages before rendering them? edit------- After a bit of thought, what I want is a

How a bookmarklet can avoid the popup blocker

孤者浪人 提交于 2019-12-10 01:50:22
问题 I wrote a bookmarklet for quickly translating selected text using Google Translator in a popup window: javascript:(function(){ var text = encodeURI(document.getSelection()); if (!text.length) { text = prompt('Texto') } var url = 'http://translate.google.com/translate_t?hl=&ie=UTF-8&text=' + text + ' &sl=es&tl=pt#'; window.open(url,'trans','left=20,top=20,width=1000,height=500,toolbar=0,location=0,resizable=1'); })(); However, the Firefox popup blocker does not allow the new window to be

Javascript bookmarklet fails on certain sites, creates ghostly new <html> page

巧了我就是萌 提交于 2019-12-09 13:17:09
问题 I noticed that my Javascript bookmarklet was failing on certain sites like Google Reader and Google search results pages (and randomly on some non-Google sites). Looking at the console, I could see that, for these pages, clicking the bookmarklet did not append elements to the head/body like it normally did, but created a new document that looked like this: <html> <head></head> <body></body> </html> Even when I reduced my bookmarklet to javascript:alert(window.location.href); it would create

Why does appending to innerHTML in a bookmarklet overwrite the entire page?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-09 03:34:35
问题 I have this little bookmarklet: javascript:document.getElementsByTagName("div")[0].innerHTML+="Chuck Norris"; Now it's obviously supposed to take the very first div on the page, and add Chuck Norris into it. Instead, when pasted on the address bar, Chuck Norris overwrites the page. Why is this so? Note: this doesn't occur on Safari... 回答1: You are not cancelling the action. add void 0; to then end. javascript:document.getElementsByTagName("div")[0].innerHTML+="Chuck Norris";void 0; 回答2: I'm

Javascript bookmarklet stopped working in Firefox 41

给你一囗甜甜゛ 提交于 2019-12-08 14:25:30
In Firefox 41, bookmarklets (bookmarks with a javascript: URL, e.g. javascript: alert("it works") , run from a click or a keyword) stopped working. Is there any solution to use javascript: bookmarks in Firefox 41? Previously seen, understood and solved in Javascript bookmark stopped working in Firefox 13 : If you first load almost any URL, including about:blank, then a Javascript bookmark will work in that tab. Since Firefox's default behavior for new tabs is about:newtab , which is nothing , and bookmarklets only run once something is loaded, you can do the following to set a default page,