greasemonkey

How do I import this Greasemonkey script, that uses CDATA, to Chrome?

这一生的挚爱 提交于 2020-01-01 17:12:11
问题 I've got following code that works fine on Greasemonkey but not in Chrome: // ==UserScript== // @name SO // @namespace stackoverflow.com // @include *stackoverflow.com/* // @version 1 // ==/UserScript== changeHeaderColor(); function changeHeaderColor() { GM_addStyle((<><![CDATA[ //body { color: white; background-color: black } #custom-header {background-color: rgb(251,122,35)} #nav-questions {background-color: rgb(251,122,35)} #nav-tags {background-color: rgb(251,122,35)} #nav-users

How to monitor a static HTML page for changes with Greasemonkey? Use a hash?

余生颓废 提交于 2020-01-01 14:49:24
问题 I want my Greasemonkey script to run ONLY when the static page it's accessing has the exact same content as before... Now I have the ability to set a variable containing a hash of this page. I'm looking for a way to hash the page on the fly, so that I can compare my hash to the generated hash... Any ideas on how to accomplish this, on the fly, hashing? 回答1: From your question: I want my Greasemonkey script to run ONLY when the static page it's accessing has the exact same content as before...

How to sync locally hosted Greasemonkey scripts across multiple machines?

倾然丶 夕夏残阳落幕 提交于 2020-01-01 08:21:31
问题 I wish to have access to my Greasemonkey scripts across all machines I use. I already enabled the ' Enable Firefox Sync for User Scripts ' setting on Greasemonkey's settings dialog, but then I read that it only syncs externally hosted scripts . Then I attempted to set up synching with the following method: I moved Greasemonkey's ' gm_scripts ' folder (located in %appdata%\Mozilla\Firefox\Profiles\<profile name> ) to a OneDrive folder. I created a symlink in the original place pointing to the

Load and parse remote url with greasemonkey

心已入冬 提交于 2020-01-01 07:21:17
问题 How can I write a Greasemonkey script that will go through a list of URLs (on the same domain) and enable an XPath query to be performed on the resulting DOM? Thanks 回答1: Use GM_xmlhttpRequest for the request, and createContextualFragment for HTML parsing. See Best Addons for Greasemonkey for an example using createContextualFragment. For parsing of valid XML you can just use DOMParser.parseFromString. EDIT: Here's a very simple but complete example to show how everything fits together: // =

Load and parse remote url with greasemonkey

蹲街弑〆低调 提交于 2020-01-01 07:21:08
问题 How can I write a Greasemonkey script that will go through a list of URLs (on the same domain) and enable an XPath query to be performed on the resulting DOM? Thanks 回答1: Use GM_xmlhttpRequest for the request, and createContextualFragment for HTML parsing. See Best Addons for Greasemonkey for an example using createContextualFragment. For parsing of valid XML you can just use DOMParser.parseFromString. EDIT: Here's a very simple but complete example to show how everything fits together: // =

jQuery UI Dialog Throw Errors When Invoked from Greasemonkey

江枫思渺然 提交于 2020-01-01 07:10:29
问题 I'm getting this awkward error any time I try and create a dialog from Greasemonkey... I believe it has to do with the limitations of XPCNativeWrapper https://developer.mozilla.org/en/XPCNativeWrapper#Limitations_of_XPCNativeWrapper , though I am not 100% sure. None of the core jQuery methods that I've used have caused errors (append, css, submit, keydown, each, ...). It is possible that this could be an error in Greasemonkey or due to the interaction between Greasemonkey and jquery ui, but I

Update page to add new link using Greasemonkey

╄→尐↘猪︶ㄣ 提交于 2020-01-01 06:33:05
问题 JScript does my head in most days, but poorly designed sites do it even more. Foursquare's is one such example in respect of its superusers. Desired Outcome A greasemonkey script that will look through each occurrence of the DIV class searchResult , and after the DIV class name append two new A HREF elements similar to these: <a href="/venue/venueid/edit">Manage venue</a> <a href="/edit_venue?vid=venueid">Edit venue</a> Scenairo I would like to make the life of their superusers a little

How to inject a JavaScript function to all web page using Firefox extension

非 Y 不嫁゛ 提交于 2020-01-01 03:41:11
问题 I am developing a Firefox addon. What I want to do is to inject a custom JavaScript function. i.e. function foo() {..} So all the pages can call the foo without define it first. I have look from other answer such as: http://groups.google.com/group/greasemonkey-users/browse_thread/thread/3d82a2e7322c3fce But it requires modification on the web page. What if perhaps I want to inject the function foo into Google.com? Is it possible to do so? I can do it with a userscript, but I want to use the

Automatically run JavaScript code upon loading a specific website

北城余情 提交于 2019-12-31 22:27:53
问题 I've written scripts to filter out threads and posts in a programming forum by author. But you need to post the code into the web console for each page individually. I was wondering if it were possible and if so how (using either firefox or chrome), to set your browser up to run a specific script upon loading a specific site? Is it possible as an extension or plugin? 回答1: You can use Tampermonkey for Google Chrome Tampermonkey is the most popular userscript manager for Google Chrome.

Userscript code works in Firefox but not in Chrome? (unsafeWindow)

家住魔仙堡 提交于 2019-12-31 05:37:11
问题 I am using this userscript in Firefox that counts unread tweets in Tweetdeck and colors the new tweets. It works fine with Firefox (Greasemonkey), but in Chrome I'm not getting anything. Here is the code: // ==UserScript== // @name TweetDeck Unread Notifications // @include https://tweetdeck.twitter.com // @include https://tweetdeck.twitter.com/* // @grant none // ==/UserScript== var head, style; head = document.getElementsByTagName('head')[0]; style = document.createElement('style'); style