tampermonkey

How to paste text in Pastebin using JavaScript

China☆狼群 提交于 2019-11-30 20:49:28
I'm using Tampermonkey (the same as Greasemonkey, but for Chrome) to make a script. The idea is to paste the text I write into Pastebin. The text was written in other website. I saw I can do it using GM_xmlhttpRequest, but it doesn't work. This is my code: var charac = new Array(50); var i =0 function callkeydownhandler(evnt) { var ev = (evnt) ? evnt : event; var code=(ev.which) ? ev.which : event.keyCode; charac[i]= code; i++; } if (window.document.addEventListener) { window.document.addEventListener("keydown", callkeydownhandler, false); } else { window.document.attachEvent("onkeydown",

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

我只是一个虾纸丫 提交于 2019-11-30 09:45:37
问题 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 . 回答1: You need to check if the current pathname includes channel before reassigning a new href function LocalMain () { if(!location.pathname

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

倖福魔咒の 提交于 2019-11-30 09:44:35
问题 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? 回答1: Set up a MutationObserver to watch for the target word. Then use HTML5 Audio

Why isn't my Greasemonkey script updating?

冷暖自知 提交于 2019-11-30 08:12:58
I've got a Greasemonkey script for Firefox. The script includes this meta-block and some lines of code. I want to update my script on the server and then automatically update the browser's scripts. The requireSecureUpdates option is off. What am I doing wrong? My 1.meta.js // ==UserScript== // @name Ibood autosubmit // @include https://*.ibood.com/* // @include http://*.ibood.com/* // @include * // @version 1.1 // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js // @grant GM_addStyle // @downloadURL http://www.tipsvoorbesparen.nl/1.user.js // @updateURL http://www

Greasemonkey/Tampermonkey @match for a page with parameters

独自空忆成欢 提交于 2019-11-30 06:15:31
I'm working on a script that must be executed in a certain page, depending on the parameters it has. The URL is like this: http://example.com/page.php?key1=value1&key2=value2&... And I need to match it when page.php has the key1=value1 among its parameters. Now I'm using @match http://example.com/page.php?key1=value1&* But it doesn't match if page.php has no other parameters. It also won't match if key1 is not the first parameter either. Is there any way to match a page according to a parameter? @match only works on the protocol/scheme, host, and pathname of a URL. To trigger off the query

How to paste text in Pastebin using JavaScript

北城余情 提交于 2019-11-30 05:27:53
问题 I'm using Tampermonkey (the same as Greasemonkey, but for Chrome) to make a script. The idea is to paste the text I write into Pastebin. The text was written in other website. I saw I can do it using GM_xmlhttpRequest, but it doesn't work. This is my code: var charac = new Array(50); var i =0 function callkeydownhandler(evnt) { var ev = (evnt) ? evnt : event; var code=(ev.which) ? ev.which : event.keyCode; charac[i]= code; i++; } if (window.document.addEventListener) { window.document

Tampermonkey select a dropdown value with name

女生的网名这么多〃 提交于 2019-11-29 17:59:20
I want Tampermonkey to change a select drop down to a specific country. The HTML is formatted like; <label>Country</label> <span class="select_wrapper"> <select name="shipping_country_id"> <option value="46">Afghanistan</option> <option value="47">Albania</option> <option value="42">United Kingdom</option> <option value="43" selected="">United States</option> </select> <span class="value">United States</span> </span> I have tried; ("select[name='shipping_country_id'] option[value='42']", clickNode, true); and (document.querySelector && document.querySelector('select[name="shipping_country_id"]

Can't fix my script to log the way I need it

只谈情不闲聊 提交于 2019-11-29 17:51:17
So this is really getting on my nerves. I needed to explain this a bit better so here it is. I'm trying to make my script log in google's console a specific way. I've got some images to help explain.. Let's hop on in. So first, this is how it's currently logging.. Which is good so far. I'm happy with this. It's not one big array, nice and neat. Image below: ( https://i.gyazo.com/81fc8d76b34a81f4fff7fc23e94f1bf1.png ) So this is the last log emitted(You can see in the image above.) It's just edited to the way I need it to log: [[346,453],[346,452],[346,452],[346,453],[346,453],[347,453],[347

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