userscripts

How to reload only a userscript, i.e. without reloading the page?

两盒软妹~` 提交于 2019-12-02 03:54:48
I'm working on a Greasemonkey userscript for a web app that needs configuration steps before I can actually test my userscript's functionality. So every time I reload the page – to refresh my userscript from the updated file –, I have to reconfigure the web app before testing. Needless to say, this gets old very quickly. Is there a way to reload only the userscript , preferably from the userscript itself? I would want to e.g. bind the reload to a keyboard shortcut. I thought that this must be a very common need, but I came up empty-handed when trying to find a solution. Ben Connor Hansell

Getting jQuery and GM_addStyle to work in a Chrome userscript based off of a working Greasemonkey script

北慕城南 提交于 2019-12-02 01:05:15
I wrote a simple Greasemonkey script that enlarges thumbnail pictures in a flyover popup. It uses a lot of jQuery in it. It works just fine on Firefox. But not on Chrome since it doesn't support @require. I came across this solution for this matter. But the script didn't work on Chrome even after I integrated it with the get-around code. I just put all my script code inside the solution code's main function. Is it wrong? If anyone can point out where is the problem, and what I can do to get it right, it'll be very much appreciated. function addJQuery(callback) { var script = document

CKEditor variable is available in console, but not from a Chrome userscript?

吃可爱长大的小学妹 提交于 2019-12-02 00:44:43
I'm writing a Chrome userscript to locally auto-save content in a CKEditor . I'm using this CKEditor auto-save plugin as inspiration. I have written a function that fires every half second (via an interval) to register the CKEditor event handler: var intervalId = window.setInterval(function() { if (CKEDITOR) { window.clearInterval(intervalId); CKEDITOR.plugins.add("user-script-auto-save", { init : function(editor) { editor.on('key', startTimer); } }); } }, 500); However, it never properly completes, and complains that "CKEDITOR is undefined" on the if (CKEDITOR) statement. Meanwhile, if I drop

run user script on chrome://settings and similar urls

只愿长相守 提交于 2019-12-01 21:17:11
问题 Why doesn't tampermonkey work on urls such as chrome://history/ or chrome://settings/ ? Any way to run an user script on this pages as well? 回答1: Unfortunately, this isn't possible, because the chrome scheme ( chrome:// ) isn't supported in @match 's abilities. UserScripts also use Chrome's match spec, so a Chrome extension to do that wouldn't work either. From the linked spec: Host permissions and content script matching are based on a set of URLs defined by match patterns. A match pattern

run user script on chrome://settings and similar urls

回眸只為那壹抹淺笑 提交于 2019-12-01 19:07:30
Why doesn't tampermonkey work on urls such as chrome://history/ or chrome://settings/ ? Any way to run an user script on this pages as well? Unfortunately, this isn't possible, because the chrome scheme ( chrome:// ) isn't supported in @match 's abilities. UserScripts also use Chrome's match spec, so a Chrome extension to do that wouldn't work either. From the linked spec: Host permissions and content script matching are based on a set of URLs defined by match patterns. A match pattern is essentially a URL that begins with a permitted scheme ( http , https , file , or ftp , and that can

document.write() not working in userscript with Firefox

混江龙づ霸主 提交于 2019-12-01 11:30:29
问题 I have some userscripts that use var tab = window.open('', '_blank'); tab.document.write(myCustomHtml); tab.document.close(); to show an output to the user (myCustomHtml being some valid HTML I defined previously in the code). It sopped working in Firefox since version 27, now I only get an empty document. No console errors whatsoever. The newly opened document has only this content when inspected with Firefox' console <html> <head></head> <body> </body> </html> while the source code is empty

Keep same ID when converting from userscript in Chrome

纵饮孤独 提交于 2019-12-01 09:25:36
问题 I'm currently updating a userscript to a chrome extension, but since the new ID is different it won't update the old extension, but add a new one. Is there a way to convert a userscript into a Chrome extension and keep the same ID? Since there is no keyfile for userscript I think it could be possible, but how ? 回答1: Userscripts are converted to Chrome extensions when you load it. Follow these steps to create and maintain an extension with the same ID: Install the userscript. Visit chrome:/

Click doesn't work on this Google Translate button?

泪湿孤枕 提交于 2019-12-01 08:41:31
I am creating an Tampermonkey userscript that would automatically click the "star" button on Google Translate website and save my searches so that I can later view them and rehearse. This is the button that I am targeting: This is what I've got so far: // @match https://translate.google.com/#en/de/appetit/ var el = document.getElementById("gt-pb-star"); setTimeout(function(){ el.click(); },4000); I encountered 2 problems. @match should be every translate.google.com search and not just appetit. How do I specify the whole domain? I tried clicking the "star" button with click() method but it

Greasemonkey @require does not work in Chrome

纵饮孤独 提交于 2019-12-01 07:52:55
问题 I'm trying to add jQuery using Greasemonkey's @require / @include method, but it doesn't work. The following error shows up: Uncaught ReferenceError: $ is not defined (repeated 10 times) This is my sample code: // ==UserScript== // @description Bored, really bored. // @name MatteoSample // @namespace MatteoSampleNamespace // @include * // @include http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js // ==/UserScript== $(document).slideUp(); How can I fix it? 回答1: @ic is not a valid

Click doesn't work on this Google Translate button?

陌路散爱 提交于 2019-12-01 06:06:49
问题 I am creating an Tampermonkey userscript that would automatically click the "star" button on Google Translate website and save my searches so that I can later view them and rehearse. This is the button that I am targeting: This is what I've got so far: // @match https://translate.google.com/#en/de/appetit/ var el = document.getElementById("gt-pb-star"); setTimeout(function(){ el.click(); },4000); I encountered 2 problems. @match should be every translate.google.com search and not just appetit