tampermonkey

Why doesn't this script work with successive page clicks?

纵饮孤独 提交于 2019-12-04 18:12:27
I am currently using the following script in Tampermonkey in Google Chrome: // ==UserScript== // @name Youtube opt in Ads per channel // @namespace schippi // @include http://www.youtube.com/watch* // @version 1 // ==/UserScript== var u = window.location.href; if (u.search("user=") == -1) { var cont = document.getElementById("watch7-user-header").innerHTML; var user=cont.replace(/.+\/user\//i,'').replace(/\?(?:.|\s)*/m,''); window.location.href = u+"&user="+user; } It seems to work perfectly in Firefox with Greasemonkey but in Google Chrome, it seems that it only works on the first click on a

Using jQuery in Tampermonkey

不羁岁月 提交于 2019-12-04 16:29:48
问题 I'm using Chrome 27.0.1453.116 m and have enabled "Experimental Javascript", however I'm unable to get jQuery to run on Tampermonkey. I have tried: // ==UserScript== // @name My Fancy New Userscript // @require http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js // ==/UserScript== var $ = unsafeWindow.jQuery; var jQuery = unsafeWindow.jQuery; However, I get an error on the line var $ = unsafeWindow.jQuery; highlighting unsafeWindow saying unsafeWindow was used before it was

How to replace @media (max-width) using Stylish or Greasemonkey?

余生颓废 提交于 2019-12-04 16:11:59
I'm having a problem viewing this website on my desktop browser. They have a responsive/fluid design that shows a mobile menu button instead of a horizontal nav-bar when the browser width is less than 990px. Since I'm using Firefox with 125% zoom, my desktop browser is less than 990px effective width. I looked into the CSS code and found the line. How can I use Stylish, Greasemonkey, or some other way to automatically replace the max-width value of "990px" with "800px"? @media (max-width:990px) { ... } I'm using Firefox 23 on Windows 7. Edit: Based on comments so far, I need to replace their

Tampermonkey's GM_xmlhttpRequest not implementing 'context' property?

て烟熏妆下的殇ゞ 提交于 2019-12-04 15:20:28
I have written a UserScript for Greasemonkey (Firefox) and am testing it for compatibility with Chrome's Tampermonkey, and getting errors in the developer console: Uncaught TypeError: Cannot read property 'profile_url' of undefined Uncaught TypeError: Cannot read property 'encoded_name' of undefined The errors seem to be referencing the onreadystatechanged callback of GM_xmlhttpRequest which is called like this: var flairs = document.querySelectorAll('span.flair'); var steam_re = /(?:(?:https?:\/\/)?www\.)?(?:steam|pc)(?:community\.com\/?(?:(id|profiles)\/?)?|[\s\-_]*id)?[\/:\s\|]*(.{2,}?)(?:[

How to detect if a userscript is installed from the Chrome Store?

巧了我就是萌 提交于 2019-12-04 15:01:48
I want to notify the user when an update for my Greasemonkey/UserScript is available. However when the user has installed the script from the Chrome Web Store, I don't want to bother because it has auto-update functionality. I first thought about using $.browser==chrome but it is also possible that a Chrome user has installed it using Tampermonkey. (Furthermore if the site would update jQuery, $.browser would stop working) So, is it possible to detect that it is a UserScript installed through the Chrome Web Store? Brock Adams Probably best to just let the user know that an update is available,

How to update tampermonkey script to a local file programmatically?

寵の児 提交于 2019-12-04 12:19:07
问题 For security reasons, Tampermonkey scripts are not saved in accessible files, but in a plugin data. The only way to edit them live is to use Tampermonkey's integrated editor. However, I'd rather use IDE, with all it's features. I also want to use webpack to pack the script from multiple files. To do that, I need a way to programmatically change the script in Tampermonkey to a new version. So far, what I did was manually copy&paste the new script into Tampermonkey's editor and that's really

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

瘦欲@ 提交于 2019-12-04 12:05:36
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? Brock Adams 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... What you really want is for your script to detect page changes. A hash is not normally the best

Gradient Filter on jQuery css() Method

送分小仙女□ 提交于 2019-12-04 11:08:36
I tried change some style one of page, I want style to change with using jQuery - css() method on userscript. I tried on jsfiddle , my browser using Tampermonkey Some attribute style changed but gradient filter not changed. here's is style on page : #site-header .meta-header { width: 100%; min-width: 960px; position: fixed; top: 0; left: 0; right: 0; height: 30px; background-color: #1484ce; filter: progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#FF1484CE', endColorstr='#FF1274B5'); background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #1484ce),

Adding a custom keyboard shortcut using userscript to Chrome with Tampermonkey

こ雲淡風輕ζ 提交于 2019-12-04 08:29:17
I would like to add some custom keyboard shortcuts to a certain web page. Using the accepted answer from this question as a guide: How can I add a JavaScript keyboard shortcut to an existing JavaScript Function? I made my own little function and added a listener: // ==UserScript== // @name ChartGame // @namespace http://www.chartgame.com/ // @version 0.1 // @description enter something useful // @match http://www.chartgame.com/play* // @copyright 2012+, You // ==/UserScript== function doc_keyUp(e) { switch(e.keyCode) { case 49: //1 mon_clk(3); break; case 50: mon_clk(6); break; case 83: //s

What is Greasemonkey/Tampermonkey doing to my jQuery object when I use GM_setValue?

我的未来我决定 提交于 2019-12-04 06:25:32
问题 I'm trying to select DOM elements into a Tampermonkey variable using GM_setValue , for later injection on different pages. I've created an example where I can do this in normal jQuery using .clone() , but when I set it as a value in Tampermonkey, it changes the value of the saved variable. Here's an HTML page to test the script on: <!DOCTYPE html> <html><head> <script data-require="jquery@*" data-semver="3.0.0" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.js"></script>