greasemonkey

Greasemonkey script only runs when page is reloaded

拥有回忆 提交于 2019-12-24 12:34:03
问题 I am working on a Greasemonkey script to turn some text into links on a a Rally page. The script works fine only when I reload the page. If I navigate to the page in any manner (links, browser forward/back) the script does not run, despite the fact that the Greasemonkey menu shows my script at the bottom, with a checkmark. Here is an example URL: https://rally1.rallydev.com/#/4745909548/detail/userstory/6138899084/changesets My matching rule: /^https://.*\.rallydev\.com/.*/changesets$/ I don

Greasemonkey script to pause video playback on non-active tabs

霸气de小男生 提交于 2019-12-24 11:07:44
问题 Often when browsing in Firefox, I'll right click on a link, and open it in a separate tab to view later, and go on reading the current page. When the link is a Youtube script, however, playback starts immediately even though the tab isn't active. Other video players (like fora.tv and TED.com) don't start playback until you activate that tab. Is there a greasemonkey script that I can use to make sure that videos (and especially Youtube videos) are paused unless their tab is active? 回答1: I

Get the contents of a class inside an iframe, with Greasemonkey

六眼飞鱼酱① 提交于 2019-12-24 09:58:27
问题 I have a Greasemonkey script which uses jQuery and detects if a "class" is present in the document. var damageMessage = $(".mw_error").text(); This works fine when the document loads and damageMessage holds a text string. The problem is that the "class" .mw_error is inside an iframe and when you click a new link inside, the iframe content loads without a page refresh but the contents of "class" do change and I want to get the new contents or text string. I’m guessing it’s because the document

GreaseMonkey: GM_xmlhttpRequest return value to calling function

别来无恙 提交于 2019-12-24 08:46:39
问题 ive been messing round with this for hours and im pulling my hair out at it. How do I return var a from myFunction to allow it to be set as var b which and then display the value of b in the alert message? Thanks! :) function myFunction(arg) { var a; GM_xmlhttpRequest({ method:"GET", url:"http://site.com/arg?" + arg, headers:{ "User-Agent":"monkeyagent", "Accept":"text/monkey,text/xml", }, onload:function(details) { a = details.responseText; } }); return a; } b = myFunction("blabla"); alert(b

Extract JSON from HTML Source in JavaScript

送分小仙女□ 提交于 2019-12-24 08:39:46
问题 I am in the process of building a simple Greasemonkey plugin that should do X action depending on a 'value' on the source of a page. Specifically, in the below, I would like to get at the 'value': <script type="application/ld+json"> [ { "value": "PEAR" } ] </script> In this case, reading PEAR to a variable. Thereafter, doing some logic. Is there an approach in Javascript that would work as this value isnt necessarily 'shown' on the page. 回答1: You would need to get the text content of the

jQuery+Greasemonkey: All sites affected, not limited to “window.location.href.indexOf”

橙三吉。 提交于 2019-12-24 07:53:59
问题 I'm trying to have code ran only on specific set of URLs. For the life of me I can not figure out why every website I click, it runs the code, and not limited to the sites I limit it to. // ==UserScript== // @name test // @namespace test1 // @description test2 // @include https://* // @version 1 // @grant none // @require http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js // ==/UserScript== $(document).ready(function () { if( (!window.location.href.indexOf("https://www.youtube

How to detect clicks on specific links in page with Greasemonkey?

末鹿安然 提交于 2019-12-24 07:45:51
问题 Ok... one of my virtual pet sites was down so I decided to tweak a Greasemonkey script for another site... the original script just pops up an alert when you find an egg so you don't click past it - I thought it would be simple to count how many eggs I came across. After 2 hours I finally found a way to keep a variable past page reloads - SUCCESS!! Then I decided I wanted to keep track of how many "steps" I was taking... ARGGGG!!!! Should be simple but isn't! On the page there are three

Userscript for creating a confirmation popup whenever submitting an issue or posting a comment via pressing Ctrl+Enter(the built-in hotkey) in GitHub

自作多情 提交于 2019-12-24 07:17:17
问题 Test URL: https://github.com/darkred/test/issues/new GitHub allows in the issues area for a public repo: submitting a new issue with just 1 character as title and no body, and posting a comment with just 1 character . The above happens to me quite a lot because the build-in hotkey for 'submiting an issue or comment' is Ctrl + Enter : I accidentally press that keyboard shortcut before my issue/comment text is ready. So, I'm trying to make a script (using Greasemonkey) that would show a

How do I make the new Google calendar event text wrap around using CSS?

爱⌒轻易说出口 提交于 2019-12-24 05:07:21
问题 I can't read the full title of my Google Calendar events, because they're truncated to fit in the day box. And so a printout isn't as useful as it could be. There used to be a greasemonkey plugin that changed the CSS to fix this, but Google have redesigned the calendar, and now the titles overlap each other and can't be read properly. What CSS do I now need to add to the page to make the event titles wrap nicely? This is the existing code of the Greasemonkey plugin: function buildStyle() {

Client-Side ajaxComplete Call Generating Infinite iframes

眉间皱痕 提交于 2019-12-24 04:38:04
问题 Alright, so here is my issue. I'm writing a Greasemonkey script to insert two iframes on an AJAXified site, but ajaxComplete gets caught in a loop and generates an excess number of iframes (sometimes one, sometimes five, etc...), gener. I've done my research and [I think] my problem is that I'm not binding the call to the document properly, but of this I am unsure. I'm not sure how you would do it differently than I already have. If you guys could point me in the right direction I'd be