userscripts

Regex to return all attributes of a web page that starts by a specific value

好久不见. 提交于 2019-12-13 11:21:29
问题 The question is simple, I need to get the value of all attributes whose value starts with http://example.com/api/v3? . For example, if a page contains <iframe src="http://example.com/api/v3?download=example%2Forg"> <meta twitter="http://example.com/api/v3?return_to=%2F"> Then I should get an array/list with 2 member : http://example.com/api/v3?return_to=%2F and http://example.com/api/v3?download=example%2Forg (the order doesn’t matter) . I don’t want the elements, just the attribute’s value.

How to switch to raw HTML in contenteditable for in place editing?

霸气de小男生 提交于 2019-12-13 10:31:37
问题 I'm writing a user script to edit the whole html page: one of the features I will include would allow to edit the selected text as raw HTML. This look easy, just insert <xmp> at the beginning of the selection, and </xmp> at the end. // from https://stackoverflow.com/a/8288313/2284570 var insertHtmlBeforeSelection, insertHtmlAfterSelection; (function() { function createInserter(isBefore) { return function(html) { var sel, range, node; if (window.getSelection) { // IE9 and non-IE sel = window

How to change all links in an ajax driven page?

吃可爱长大的小学妹 提交于 2019-12-13 07:55:05
问题 I have a userscript that modifies the href of all applicable links on an an IP-direct, Google search page: // ==UserScript== // @name _Modify select Google search links // @include http://YOUR_SERVER.COM/YOUR_PATH/* // @include http://62.0.54.118/* // ==/UserScript== var qLinks = document.querySelectorAll ("a[href*='?q=']"); for (var J = qLinks.length - 1; J >= 0; --J) { var oldHref = qLinks[J].getAttribute ('href'); var newHref = oldHref.replace (/\?q=/, "?&q="); //console.log (oldHref + "\n

How to parse a rendered web page containing javascript

强颜欢笑 提交于 2019-12-13 06:33:06
问题 How can one extract data from a rendered web page? In which java script would update the data with time. Is it possible to write user script which can access varibles from webpage java script? Please suggest possible way to achieve this. 回答1: according to Turing's Halting Problem Theorem, you can't. That's what we mean when we say that JavaScript is a Turing complete language. The only way is to execute the JavaScript and let it render the page. 回答2: it depends on your programming language.

“Uncaught SyntaxError: Unexpected token (” but there is no error

限于喜欢 提交于 2019-12-13 02:12:42
问题 I'm authoring a simple userscript that will give the backspace button navigation control like in windows (specifically this is for linux users) for Chromium browser. This script was working, then I made a few alterations to it (very simple stuff, commenting, tabbing, making it pretty), and now i'm getting this error: Uncaught SyntaxError: Unexpected token ( on this line document.head.appendChild(script); The script is located here - i'm pulling out my hair trying to figure this out. The

How do I get my redirecting script to add a random suffix to select sites?

 ̄綄美尐妖づ 提交于 2019-12-13 01:29:31
问题 I've a userscript that redirects to a random site from a list. (Reference: How to redirect to one out of given set of sites?) How do I get the script to add a random suffix to select sites, like wallbase.cc? Here's my script so far: // ==UserScript== // @name Multipage, MultiSite slideshow of sorts // @match http://*.breaktaker.com/* // @match http://*.imageshack.us/* // @match http://static.tumblr.com/* // @match http://withfriendship.com/images/* // @match http://failjudge.com/* // @match

How can I combine two userscripts into one?

馋奶兔 提交于 2019-12-13 01:12:58
问题 I wrote two scripts that are really similar, and I want them both to work together under one script, how can I do it? The First: // ==UserScript== // @name Normal Google // @include http://62.0.54.118/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js // @require https://gist.github.com/raw/2625891/waitForKeyElements.js // @grant GM_addStyle // ==/UserScript== /*- The @grant directive is needed to work around a design change introduced in GM 1.0. It restores the

DOM click() is not working on this button

♀尐吖头ヾ 提交于 2019-12-12 14:22:43
问题 When I use method click() to click the button, the submission failed. But, when I use the mouse to click the button on that webpage, (the submit form is same) it works. HTML file: <button xmlns="http://www.w3.org/1999/xhtml" class="ui-button button1" type="submit" id="create"> <span> <span>Create</span> </span> </button> My userscript file: document.getElementById("create").click(); How do I click the button using HTML DOM click()? 回答1: The click method does not always work. Try sending a

Possible to run userscript in IE11

女生的网名这么多〃 提交于 2019-12-12 07:26:09
问题 I have a custom userscript that I'm running in Chrome and Firefox using Tampermonkey/Greasemonkey. Is there any way of using this script in IE11? Or is there any plugins for IE11 that does what Tampermonkey/Greasemonkey does? 回答1: TrixIE WPF4.5 claims to emulate Greasemonkey on IE11. Unfortunately, the original Trixie and IE7Pro stopped working around IE8-ish. 回答2: A simple Google Search (I searched "greasemonkey for IE") yields various alternatives available for other browsers: http://en

XMLHttpRequest launches multiple times without initiating the onreadystatechange function

时间秒杀一切 提交于 2019-12-12 05:31:28
问题 The userscript in question: http://userscripts.org/scripts/show/130532 After the site it's been made for has been updated to HTML5, I had to update the script. However, it's got a really big problem now. When I launch the script's main function that contains the XMLHttpRequest, it simply spams the console with these requests until the browser simply crashes. Now, I looked around in both StackOverflow and in Google for anything that could help me, but there's nothing. If you proceed to try the