greasemonkey

Remove Alert box before it pops up [duplicate]

坚强是说给别人听的谎言 提交于 2021-02-19 04:37:45
问题 This question already has answers here : How to override the alert function with a userscript? (2 answers) Closed 5 years ago . I am trying to remove an Alert box on an external site with Grease Monkey and jQuery. HTML: <!DOCTYPE html> <html> <body> <script>alert("Remove this Alert box with GreaseMonkey.");</script> <p>Hello world</p> </body> </html> GreaseMonkey script (currently without the jQuery part): // ==UserScript== // @name Remove Alert box // @include http://www.example.com/alert

What's a simple way in Google Chrome to insert Javascript into sites?

不打扰是莪最后的温柔 提交于 2021-02-05 18:57:27
问题 I would like to be able to add custom snippets of javascript to any site that matches a regex. This is mostly because of sites that I use daily because of specialized content, but which have a poor design. I want to be able to do something like: Visit site See that sidebar overwrites content Whip out developer tools, find div id for sidebar Edit a snippet of javascript which is executed on document.ready for this domain: $('#sidebar-right').remove(); A bit of searching for user scripts tells

What's a simple way in Google Chrome to insert Javascript into sites?

早过忘川 提交于 2021-02-05 18:52:48
问题 I would like to be able to add custom snippets of javascript to any site that matches a regex. This is mostly because of sites that I use daily because of specialized content, but which have a poor design. I want to be able to do something like: Visit site See that sidebar overwrites content Whip out developer tools, find div id for sidebar Edit a snippet of javascript which is executed on document.ready for this domain: $('#sidebar-right').remove(); A bit of searching for user scripts tells

What's a simple way in Google Chrome to insert Javascript into sites?

孤街浪徒 提交于 2021-02-05 18:50:21
问题 I would like to be able to add custom snippets of javascript to any site that matches a regex. This is mostly because of sites that I use daily because of specialized content, but which have a poor design. I want to be able to do something like: Visit site See that sidebar overwrites content Whip out developer tools, find div id for sidebar Edit a snippet of javascript which is executed on document.ready for this domain: $('#sidebar-right').remove(); A bit of searching for user scripts tells

Can I Make Greasmonkey Scripts Run On Text Files?

余生长醉 提交于 2021-01-27 21:16:28
问题 My web-server serves up the logs as plain text. Is it possible to use Greasemonkey to do some formatting of the logs or is it only possible to use it on HTML content? Could I force the text into HTML on load then process it after? 回答1: Yes, Greasemonkey works on text files. Note that when a browser such as Firefox or Chrome displays a plain text file, the browser wraps it in a dynamic <pre> element, like so: <html><head>...</head> <body> <pre> <!-- Actual content of text file is here. --> <

Why does setTimeout and setInterval run too fast? [duplicate]

我的梦境 提交于 2020-12-15 20:24:32
问题 This question already has answers here : Calling a function when using setTimeout() and setInterval() in JavaScript (3 answers) Closed 4 years ago . function process(){ window.location.reload(false); } function looping(){ setTimeout(process(), 10000); } var looper = setInterval(looping(), 10000); I'm trying to reload a page every 10 seconds, but the above code will too frequently reload the page. Why? 回答1: function process(){ window.location.reload(false); } function looping(){ setTimeout

Why does setTimeout and setInterval run too fast? [duplicate]

南笙酒味 提交于 2020-12-15 20:22:52
问题 This question already has answers here : Calling a function when using setTimeout() and setInterval() in JavaScript (3 answers) Closed 4 years ago . function process(){ window.location.reload(false); } function looping(){ setTimeout(process(), 10000); } var looper = setInterval(looping(), 10000); I'm trying to reload a page every 10 seconds, but the above code will too frequently reload the page. Why? 回答1: function process(){ window.location.reload(false); } function looping(){ setTimeout

Why does setTimeout and setInterval run too fast? [duplicate]

青春壹個敷衍的年華 提交于 2020-12-15 20:16:30
问题 This question already has answers here : Calling a function when using setTimeout() and setInterval() in JavaScript (3 answers) Closed 4 years ago . function process(){ window.location.reload(false); } function looping(){ setTimeout(process(), 10000); } var looper = setInterval(looping(), 10000); I'm trying to reload a page every 10 seconds, but the above code will too frequently reload the page. Why? 回答1: function process(){ window.location.reload(false); } function looping(){ setTimeout

How to simulate a keypress in a Greasemonkey script?

拥有回忆 提交于 2020-12-13 07:32:13
问题 I have found lots of info online about how to use the initEvent and dispatchEvent functions, but I can't for the life of me get them to work in practice. I'm trying to get a script to press the Enter key every 5 seconds. My userscript code (minus irrelevant metadata) is below: // ==UserScript== // @namespace http://userscripts.org/scripts/show/153134 // @require https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js // // @grant unsafeWindow // // ==/UserScript== $(function(){

Prevent default single click event on double click on a link in HTML

前提是你 提交于 2020-12-13 04:05:35
问题 My code is pretty simple: var clickCount = 0, clickEl = []; var manualClick = false; $(document).on('click', 'a', function (e) { if (e.altKey || e.ctrlKey || e.shiftKey) { return; } clickCount = clickCount + 1; clickEl[clickCount] = this; var that = this; if (1 === clickCount) { setTimeout(function () { if (2 === clickCount && clickEl[1] === clickEl[2]) { window.stop(); embed_anchor(that); } clickCount = 0; }, 250); } }); It basically checks if there is double click. If yes, it cancel the