bookmarklet

Load a page and apply javascript in a single bookmark

末鹿安然 提交于 2019-11-28 14:33:34
I have a bookmark that opens my a google calendar page ( http://www.google.com/calendar/renderOnline ) and a bookmarklet that applies some javascript on it: javascript:document.getElementById('gadgetcell').setAttribute('style','width:300px');document.getElementsByClassName('sn-frame')[0].setAttribute('style','width:300px'); Is there a way to combine these into a single bookmarklet so that i don't have to click twice all the time? Thank you! You could use an extension to get the same behavior. For example in Safari you would create a button that launches the URL and an injected script that runs

Identify & Extract the title/description of an Image (Data Scraping Pinterest)

狂风中的少年 提交于 2019-11-28 08:50:55
How can Javascript/jQuery be used to identify the description or title corresponding to an image on a webpage with multiple images and descriptions? The page title can be extracted very easily, but the title may not correspond to the image especially if there are many images present on the page var title = document.title; I believe this has been done successfully by Pinterest's Pin-it bookmarklet. I'm guessing it has to do with an algorithm to find the nearest h1 , h2 , h3 or the image's alt attributes, then fallback to the document.title if the algorithm fails to identify the image's

How to convert a bookmarklet into a Greasemonkey userscript?

余生颓废 提交于 2019-11-28 07:50:11
Is there a easy way to do this. And is there anything that needs to be changed due to differences in how it is ran? Brock Adams The easiest way to do this: Run the bookmarklet code through a URL decoder . so that javascript:alert%20('Hi%20Boss!')%3B , for example, becomes: javascript:alert ('Hi Boss!'); Strip the leading javascript: off. Result: alert ('Hi Boss!'); Add this code to the end of your Greasemonkey file. For example, create a file named, Hello World.user.js , with this code: // ==UserScript== // @name Hello World! // @description My first GM script from a bookmarklet // @include

Copy text to clipboard from bookmarklet

冷暖自知 提交于 2019-11-28 06:59:40
I'm trying to write a little bookmarklet that can extract some text from the active page and load that into the clipboard. The extraction is easy enough, but I'm really stuck doing the clipboard-copying part. Currently, I'm just alert ing the text and hitting Ctrl + C to copy the text from the message-box, which isn't ideal. I've read How to Copy to Clipboard in JavaScript and other questions that suggest I use zeroclipboard , but I have no idea how one would make that work from a bookmarklet , considering I have to load external flash and javascript resources to be able to use the library. I

Find all instances of 'old' in a webpage and replace each with 'new', using a javascript bookmarklet

不羁的心 提交于 2019-11-28 05:31:34
What I want to do is replace all instances of 'old' in a webpage with 'new' in a JS bookmarklet or a greasemonkey script. How can I do this? I suppose jQuery or other frameworks are okay, as there're hacks to include them in both bookmarklets as well as greasemonkey scripts. A function that is clobber-proof. That mean's this won't touch any tags or attributes, only text. function htmlreplace(a, b, element) { if (!element) element = document.body; var nodes = element.childNodes; for (var n=0; n<nodes.length; n++) { if (nodes[n].nodeType == Node.TEXT_NODE) { var r = new RegExp(a, 'gi'); nodes[n]

jQuery to identify URL and append parameters

不问归期 提交于 2019-11-28 05:26:24
问题 This jQuery code will run as a bookmarklet in the wordpress editor. The bookmarklet / jQuery code will edit the text in the content field and append a parameter (ex. ?parameter) to the end of the URL. The URL is always the same domain name (ex. domain.com). However the URL will often contain directories (ex. domain.com/directory/index.html?parameter). I need the jQuery code to append regardless of what is after the domain name. The most complex situation would be domain.com/directory/index

Add a bookmark that is only javascript, not a URL

流过昼夜 提交于 2019-11-28 04:50:58
I'm thinking that the reason I can't do this is because it might be a huge security hole, but here goes... I want to have a bookmark on my browser (FF3, preferably) that is only a snippet of javascript code. It would merely construct a URL based on the current date and then do a window.location = on that URL. I know that I could make a page and keep it on my local machine and just refer to it that way, but I was just wondering if you could bypass that step and actually have the "location" of the bookmark really just be javascript. I could have sworn that this was possible years ago, but I can

scripting a google docs form submission

大城市里の小女人 提交于 2019-11-28 04:12:38
I'm trying to create a bookmarklet that parses a page and sends the results to a googledocs spreadsheet via a form that I've defined. The relevent bit of the script is: var form = document.createElement("form"); form.action = "http://spreadsheets.google.com/formResponse?formkey=Fd0SHgwQ3YwSFd5UHZpM1QxMlNOdlE6MA&ifq"; form.method = "POST"; form.id="ss-form"; form.innerHTML = ["<input id='entry_0' name = 'entry.0.single' value = '" + orderDate + "'/>", "<input name = 'entry.2.single' value = '" + email + "'/>", "<input name = 'entry.3.single' value = '" + customerID + "'/>", ].join(""); form

Load external JS from bookmarklet?

孤人 提交于 2019-11-28 03:18:33
How can I load an external JavaScript file using a bookmarklet? This would overcome the URL length limitations of IE and generally keep things cleaner. Miguel Ventura 2015 Update Content security policy will prevent this from working in many sites now. For example, the code below won't work on Facebook. 2008 answer Use a bookmarklet that creates a script tag which includes your external JS. As a sample: javascript:(function(){document.body.appendChild(document.createElement('script')).src='** your external file URL here **';})(); Firefox and perhaps others support multiline bookmarklets, no

Is it possible to load multiple different version of jQuery on the same page?

你离开我真会死。 提交于 2019-11-27 22:40:14
问题 I'm making a bookmarklet which will load jQuery if the object is not found. The loading will check on the version of jQuery. The code is like: (function(){ var myBkl = { loadScript: function(src) { if(window.jQuery && window.jQuery.fn.jquery == '1.3.2'){ return; } var s = document.createElement('script'); s.setAttribute('src', src); s.setAttribute('type', 'text/javascript'); document.getElementsByTagName('head')[0].appendChild(s); }, whenLoaded: function(callback){ if (typeof(window.jQuery) !