greasemonkey

Get clipboard contents with Greasemonkey

◇◆丶佛笑我妖孽 提交于 2019-12-01 08:44:03
问题 Is there the possbility to get the textual content of the clipboard to paste it automatically into a textarea clicking a button? Just found a method to copy data to it, but not to read data from it. 回答1: No, you cannot do this in javascript because it has proven to be a huge security hole. Likewise, the developers of Greasemonkey are unlikely to add this capability for the same reasons. You can write a Firefox add-on that does this, but I've never seen a (legit) use case. A technique that

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

Greasemonkey @require does not work in Chrome

纵饮孤独 提交于 2019-12-01 07:52:55
问题 I'm trying to add jQuery using Greasemonkey's @require / @include method, but it doesn't work. The following error shows up: Uncaught ReferenceError: $ is not defined (repeated 10 times) This is my sample code: // ==UserScript== // @description Bored, really bored. // @name MatteoSample // @namespace MatteoSampleNamespace // @include * // @include http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js // ==/UserScript== $(document).slideUp(); How can I fix it? 回答1: @ic is not a valid

Click a link with Javascript when there is no element ID

只愿长相守 提交于 2019-12-01 07:52:37
问题 Please forgive me if this has already been answered somewhere but I just can't find what I'm looking for. I'm using Greasemonkey for Firefox and Tampermonkey in Chrome to try to create a Javascipt to change how I interact with a webpage. Upon page load, I'd like to automatically open a link in a new tab in the background. This link is slightly different each time I load the page. The element from the webpage is this: <a href="/cgi/admin/user/ssh_login/*" target="_blank">SSH</a> The part with

How to download/read only the first 80KB of a file?

人盡茶涼 提交于 2019-12-01 07:28:48
问题 I am making a Greasemonkey script for a website that has many flash files. I'd like to make a hash of the flash, the problem is that the flash files are up to 10 megabytes. This is slow; I'd like to be able to only grab the first 80KB to hash. The end result would be an easy way to blacklist certain flash files containing unwanted content. How does my script grab only the first 80 KB (or so) of a file? 回答1: Send the range header in your AJAX request. For example: $.ajax ( { url: 'http:/

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

Adding javascript to a XML file transformed with XSLT using a Greasemonkey script

丶灬走出姿态 提交于 2019-12-01 07:02:26
问题 As follow up to my question here - How to transform an XML file with XSLT, using a Greasemonkey script? - I'm facing another problem: I want to use some basic javascript functions in my XSL template in order to control the display of some divs. However, no matter how I include these javascript functions, they don't seem to be recognized. I already investigated a lot but I can't seem to get around it. I tried 2 things: Adding the javascript in the XSL template in a <script> tag Appending a new

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

Using only CR as linebreak inside pre tag doesn't work

本秂侑毒 提交于 2019-12-01 04:29:14
问题 At work, we stumbled upon Bugzilla creating HTML output that led to lines much too long because the browser didn't break the lines. This was happening on Chrome, but not on Firefox 3.5, so we didn't really care. But Firefox 4 behaves just like Chrome, so we had to find another workaround. An example is: <html> <body> <pre> Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et

window.onload works in Firefox+Greasemonkey script but not in a Chrome userscript?

℡╲_俬逩灬. 提交于 2019-12-01 04:21:14
There is a page http://example.com/1.php that includes javascript file as usual: <script type="text/javascript" src="/util.js?1354729400"></script> This file contain function named exampleFunction which I need to use in my userscript. Also I have an user script: // ==UserScript== // @name SomeName // @namespace http://example.com/userscripts // @description Greets the world // @include http://example.com/* // ==/UserScript== window.onload = function () { console.log(exampleFunction); alert("LOADED!"); } which works perfectly in Firefox and returns an error in Chrome: Uncaught ReferenceError: