userscripts

How to correctly work on a GreaseMonkey userscript using git?

好久不见. 提交于 2019-11-30 09:26:52
I am working on a userscript for Firefox, so I use GreaseMonkey . Moreover, to facilitate the development, I use git to update the different versions of my code. Now, let me try to explain the issue. When I add to GreaseMonkey the userscript from my local git directory, then new files are created in the gm_scripts folder of my Firefox profile. GreaseMonkey use these files as source and not my git directory, so if I want to modify my code and test some stuff, I have to change the files inside the gm_scripts. This means that I can not commit the modification, I first have to copy the files from

How to overwrite a function using a userscript?

删除回忆录丶 提交于 2019-11-30 07:42:32
I want to change parts of the webpage display, is it possible to overwrite a function with a userscript? Below is the function I would like overwritten (also found Here ): function StartDrawing() { if ((typeof (systemsJSON) != "undefined") && (systemsJSON != null)) { var stellarSystemsLength = systemsJSON.length; $('#mapDiv').empty(); if (stellarSystemsLength > 0) { InitializeRaphael(); var i = 0; for (i = 0; i < stellarSystemsLength; i++){ var stellarSystem = systemsJSON[i]; DrawSystem(stellarSystem) } } } } This would allow me to run my own drawing algorithms. How do I do this with a

Is it possible to determine if Chrome is in incognito mode via a user-script?

纵饮孤独 提交于 2019-11-30 06:41:44
I asked this question before but didn't make it clear that I meant in user script, not in JavaScript from a webpage.So I'll be more clear now. Is it possible to determine if Google Chrome is in incognito mode via a user-script (basically a script run as an extension in the browser, not a script being run on a webpage)? If you are developing an Extension then you can use the tabs API to determine if a window/tab incognito. More information can be found on code.google.com . If you are just working with a webpage or a userscript, it is not easy, and it is designed to be that way. However, I have

How to compile a Google Chrome extension out of code I found at userscripts.org?

亡梦爱人 提交于 2019-11-30 05:11:34
问题 I came across this userscript which works in Google Chrome. I want to use it as Google Chrome extension as this will give me experience to convert many other codes from userscripts to Google Chrome Extensions. Can someone give me a step by step tutorial of how to make a Google Chrome Extension out of this userscript code? // ==UserScript== // @name Facebook Ads Hider // @author Jose Luis Martin // @namespace http://joseluismartin.info // @description Hide Ads on Facebook // @include http:/

Adding jQuery UI to Greasemonkey script fails with external CSS file

天大地大妈咪最大 提交于 2019-11-30 04:57:42
I'm trying to add jquery-ui to a Greasemonkey script. my full code: test.user.js : // ==UserScript== // @name Test // @namespace rajat.khandelwal // @description Test script // @include * // @require js/jquery-1.6.2.min.js // @require js/jquery-ui-1.8.16.custom.min.js // @require css/ui-darkness/jquery-ui-1.8.16.custom.css // ==/UserScript== alert('hi'); and In current directory I added JS and CSS directory. It throws error saying syntax error in css Error: syntax error Source File: file:///C:/Users/Rajat/AppData/Roaming/Mozilla/Firefox/Profiles/poxivdqy.default/gm_scripts/test/jquery-ui

Accessing iframes from a Chrome content-script extension

≯℡__Kan透↙ 提交于 2019-11-30 01:58:44
I'm writing a Chrome extension that needs to alter a popular web app when loaded. Unfortunately, most of the UI of that web app is rendered inside an iframe, and although the address of that iframe matches my content_scripts match declaration, the user script only gets invoked for the top frame. Q: Is there a method of accessing HTML rendered inside an iframe from a Chrome content script extension? If yes, what permissions and other manifest options should I specify? Thanks. I've resolved the problem. The following option has to be specified in the content_scripts section of the manifest.json:

Run Greasemonkey on html files located on the local filesystem?

走远了吗. 提交于 2019-11-30 01:31:36
I have an API documentation lying around on my Harddrive and to ease my workflow, I have written a simple script that modifies the page for my needs. I've developed it using FireBug on FireFox. @include -ing webpages works correctly, but Greasemonkey does not seem to detect pages on the local file-system? I would like to have an include like // @include *R13/Python*R13/* Which should match for example file:///Z:/Eigene%20Dateien/Cinema4D/Documentations/R13/Python%20R13/modules/c4d/index.html But it is not recognized. How can I achieve that the userscript runs on local html files, too? Thanks

How can I have a Tampermonkey userscript play a sound when a specific word appears on a page?

走远了吗. 提交于 2019-11-29 16:58:55
In a chat room, when someone pastes a certain word into the chat I want the browser to make a noise to alert me. It seems like Tampermonkey should be able to do this, but I don't know how to start and searching turns up few, and inapplicable results . (This other question seems close but the answer just plays a sound every 5 seconds no matter what!) How can a userscript alert when a target word appears via AJAX? Set up a MutationObserver to watch for the target word. Then use HTML5 Audio to play the desired sound. This complete working script watches for the text "just now" and plays a

How to make a script redirect only once every time an appropriate page loads?

岁酱吖の 提交于 2019-11-29 16:50:44
I'm writing a Tampermonkey script that I want to use to redirect from youtube.com/* to a YouTube channel address. window.addEventListener ("load", LocalMain, false); function LocalMain () { location.replace("https://www.youtube.com/channel/*"); } When the script is running it redirects to the channel URL but then keeps running and continuously redirects . You need to check if the current pathname includes channel before reassigning a new href function LocalMain () { if(!location.pathname.includes('/channel/')) { location.replace("https://www.youtube.com/channel/*"); } } Also note you don't

How to change the name field of an <input> in an AJAX-driven page?

血红的双手。 提交于 2019-11-29 16:48:14
For this target page (Sorry but SO doesn't allow hyperlinks to 62.0.54.118): http://62.0.54.118/search?&q=42&oq=42&sourceid=chrome&ie=UTF-8&filter=0 , I want to change the name field of an <input> by default with a userscript. The input is: <input class="gsfi" id="lst-ib" name="q" maxlength="2048" value="42"...> I want to change it to: <input class="gsfi" id="lst-ib" name="&q" maxlength="2048" value="42"...> That is, I Want to change the q into &q in the name field of the input by default. I try to write a script, (that doesn't work): // ==UserScript== // @name Normal Google Input // @include