tampermonkey

Code works in console/scratchpad but not in a Greasemonkey script? [duplicate]

╄→гoц情女王★ 提交于 2019-12-01 12:51:04
This question already has an answer here: Code working in browser console but not in tampermonkey 1 answer I'm trying to write a script to make the map larger on Google Flights . I've got the jQuery working in the Firefox scratchpad. This script does exactly what I am trying to accomplish: $('div').filter(function(){ return $(this).css('width') == '648px' }).css({"width":"900px","height":"550px"}); but when I paste that into a Greasemonkey script, it doesn't work. If I add some console.logs to debug, I can verify that the script is running and the filter is working correctly, but it's not

Code works in console/scratchpad but not in a Greasemonkey script? [duplicate]

大城市里の小女人 提交于 2019-12-01 11:51:02
问题 This question already has an answer here : Code working in browser console but not in tampermonkey (1 answer) Closed 7 months ago . I'm trying to write a script to make the map larger on Google Flights. I've got the jQuery working in the Firefox scratchpad. This script does exactly what I am trying to accomplish: $('div').filter(function(){ return $(this).css('width') == '648px' }).css({"width":"900px","height":"550px"}); but when I paste that into a Greasemonkey script, it doesn't work. If I

jQuery .get for non https, in a userscript

旧时模样 提交于 2019-12-01 10:45:33
I made a script on my website that accesses a table on a different website. However, the other website is HTTP so chrome is telling me "This request has been blocked; the content must be served over HTTPS." $.get('http://www.kanjidamage.com/kanji', null, function searchKD () { /*function*/ }); So what I'm asking is: how can I access elements on a different website even if it's not HTTPS. You have this tagged as tampermonkey . If that is the case, use it. Tampermonkey allows one to bypass "mixed active content" restrictions by using GM_xmlhttpRequest Doc . So this complete Greasemonkey

trigger a HTML button when you press Enter

不羁的心 提交于 2019-12-01 10:22:21
问题 I am trying to make a button key "trigger" on a specific page using tampermonkey. Instead of using mouse click every time to click Button called "continue". So when I click keyboard button "ENTER" this hover button should be automatically clicked, theres any ready to use code while I can just put this HTML code. Thanks. <button id="simplicityPayment-START" type="submit" autocomplete="off" class="nf-btn nf-btn-primary nf-btn-solid nf-btn-oversize" data-uia="action-submit-payment">START

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

How to catch status 503 in tampermonkey

风格不统一 提交于 2019-12-01 07:33:10
I have a userscript that refreshes the page every second, but sometimes the website it's trying to refresh runs into the status 503 error, and that stops the script from running anymore. That means that script will no longer try refresh the page every second. How do I keep the script running after the page runs into the status 503 error? The error looks like this in the console: Failed to load resource: the server responded with a status of 503 (Service Unavailable) // ==UserScript== // @name script // @namespace name // @description example // @match *^https://example.com/$* // @version 1 //

jQuery .get for non https, in a userscript

两盒软妹~` 提交于 2019-12-01 07:28:28
问题 I made a script on my website that accesses a table on a different website. However, the other website is HTTP so chrome is telling me "This request has been blocked; the content must be served over HTTPS." $.get('http://www.kanjidamage.com/kanji', null, function searchKD () { /*function*/ }); So what I'm asking is: how can I access elements on a different website even if it's not HTTPS. 回答1: You have this tagged as tampermonkey. If that is the case, use it. Tampermonkey allows one to bypass

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

How to catch status 503 in tampermonkey

元气小坏坏 提交于 2019-12-01 04:36:56
问题 I have a userscript that refreshes the page every second, but sometimes the website it's trying to refresh runs into the status 503 error, and that stops the script from running anymore. That means that script will no longer try refresh the page every second. How do I keep the script running after the page runs into the status 503 error? The error looks like this in the console: Failed to load resource: the server responded with a status of 503 (Service Unavailable) // ==UserScript== // @name

How do I access an iframe's javascript from a userscript?

冷暖自知 提交于 2019-12-01 03:23:15
问题 I'm trying to use a Chrome userscript or a Tampermonkey script to modify a page with this structure: <body> content up here <iframe id="main" src="foo.dat"></iframe> </body> The iframe is same-origin. I need to access a function that's in iframe#main . I thought I could use unsafeWindow to get it but I keep getting nothing or undefined returned. I've tried a slew of things: Tried creating a new script element in the iframe , but it attaches to the parent even with $('frame#main').contents()