greasemonkey

Why doesn't my jQuery-UI script execute in Greasemonkey? It runs in the Firebug console

妖精的绣舞 提交于 2019-11-29 15:44:02
I have tried quite a bit of research on this because this is my first Greasemonkey script: // ==UserScript== // @name Codecademy Resizeable Code // @description Adds jQuery resizable to editor // @namespace http://chrisneetz.com // @include http://www.codecademy.com/courses/* // ==/UserScript== $('#editor').resizable({ alsoResize: ".ace_scroller, .ace_editor, .ace_content, .ace_sb, .ace_print_margin_layer", handles: "n, s" }); I have tried Greasemonkey's recommendations and I'm not sure if it's a compatibility issue or not. Third Party Libraries I have wrapped it in a document ready and it

How do I pop up a custom form/dialog in a Greasemonkey script?

空扰寡人 提交于 2019-11-29 15:14:08
问题 I have been working on a script to use as a plugin in Firefox, and have come across the need to pop up a custom form when a certain button is clicked. I need to be able to create the entire form myself and then parse the entered data to render images on the original site. How do I do this? 回答1: Okay, here is a complete script example, showing how to pop up a form and interact with its controls. Note that it uses jQuery -- which makes it vastly easier/shorter/simpler. // ==UserScript== //

How to correctly work on a GreaseMonkey userscript using git?

隐身守侯 提交于 2019-11-29 14:25:04
问题 I am working on a userscript for Firefox, so I use GreaseMonkey. Moreover, to facilitate the development, I use git to update the different versions of my code. Now, let me try to explain the issue. When I add to GreaseMonkey the userscript from my local git directory, then new files are created in the gm_scripts folder of my Firefox profile. GreaseMonkey use these files as source and not my git directory, so if I want to modify my code and test some stuff, I have to change the files inside

Adding a @grant value breaks my Greasemonkey+jQuery script?

♀尐吖头ヾ 提交于 2019-11-29 14:12:24
When I add the @grant for GM_xmlhttpRequest, I get: Error: Permission denied to access property 'call' in the jQuery file. If I remove the grant, it works fine. // ==UserScript== // @name Dimi Test // @namespace Dimi // @include about:addons // @version 1 // @grant GM_xmlhttpRequest // @include http://*.myDomain.*/* // ==/UserScript== var $J = unsafeWindow.jQuery; $J(unsafeWindow.document).ready(function(){ alert('Hello'); }); Brock Adams See "Error: Permission denied to access property 'handler'" . You can no longer invoke the target-page's jQuery like that. (Note that in @grant none mode

Replace array-mapped variables with the actual variable name/string?

纵然是瞬间 提交于 2019-11-29 13:44:06
问题 I am trying to edit a Greasemonkey/jQuery script. I can't post the link here. The code is obfuscated and compressed with minify. It starts like this: var _0x21e9 = ["\x67\x65\x74\x4D\x6F\x6E\x74\x68", "\x67\x65\x74\x55\x54\x43\x44\x61\x74\x65", ... After "decoding" it, I got this: var _0x21e9=["getMonth","getUTCDate","getFullYear", ... It is a huge list (500+ ). Then, it has some variables like this: month = date[_0x21e9[0]](), day = date[_0x21e9[1]](), ... _0x21e9[0] is getMonth, _0x21e9[1]

XPath or querySelector?

冷暖自知 提交于 2019-11-29 12:25:39
问题 XPath can do everything querySelector can do, and more, so when would you ever choose the latter? I haven't seen any speed benchmarks comparing the two, so right now I'm choosing based on syntax conciseness, which seems kind of arbitrary. Edit: I probably should have stated that I'm writing Greasemonkey scripts for Firefox, so I'm not worried about cross-browser compatibility, and would rather not include any libraries. 回答1: What browser are you using? In Safari (or the iPhone), querySelector

Protect Greasemonkey scripts?

最后都变了- 提交于 2019-11-29 12:24:51
I know that anything that is downloaded and is in the user's possession is going to be pretty hard to protect, but I'm just wanting to hear opinions. I'm thinking of selling a script (made with Greasemonkey...), and I want to be able to prevent the user from easily viewing the source code, or sending it to others. Thanks in advance. Josiah As with any javascript, complete protection is impossible due to the nature of the language, see: Javascript library: to obfuscate or not to obfuscate - that is the question and How can I obfuscate (protect) JavaScript? However, you can obfuscate your

console.log is not working when used in a Firefox, Greasemonkey script

半世苍凉 提交于 2019-11-29 12:16:45
问题 My userscript prints some information using console.log() . This works fine in Chrome, but when I install this userscript in Firefox (Greasemonkey), the web console in Firefox is not displaying anything. I searched for a solution and some suggested to use unsafeWindow but it is also not showing any output. Moreover unsafeWindow cannot be used for chrome. I even installed Firebug but it was no use. How can I resolve this? For example, I tried this userscript in Firefox: // ==UserScript== //

“Normal” button-clicking approaches are not working in Greasemonkey script?

荒凉一梦 提交于 2019-11-29 11:42:20
Here is the button on the page: <a id="dispatchOnJobButton" class="ui-btn ui-btn-corner-all ui-shadow ui-btn-up-c" href="#" data-role="button" data-theme="c" data-disabled="false"> <span class="ui-btn-inner ui-btn-corner-all" aria-hidden="true"> <span class="ui-btn-text">Dispatch on next job</span> </span> </a> I need Greasemonkey to click it. I tried many different methods, but none seem to fire whatever function it is supposed to run. var clickEvent = document.createEvent("MouseEvents"); clickEvent.initEvent("click", true, true); document.getElementById('dispatchOnJobButton').dispatchEvent

@require-ing jQuery overwrites the page's $ variable

自古美人都是妖i 提交于 2019-11-29 11:36:40
I'm @require -ing jQuery for my Greasemonkey script with this line in my script file: // @require https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js and it works quite well; I can use $('#id') to access the DOM. However, the $ variable of the 'real' page is modified (where $ is jQuery 1.2.xx): I get an error that $.include is not defined. I thought the sandbox model of Greasemonkey would prevent that the variables of the target-page are overwritten? How can I ensure that the inclusion of javascript libraries does not affect the 'real' website, but only my Greasemonkey script?