greasemonkey

Prevent default single click event on double click on a link in HTML

核能气质少年 提交于 2020-12-13 04:05:07
问题 My code is pretty simple: var clickCount = 0, clickEl = []; var manualClick = false; $(document).on('click', 'a', function (e) { if (e.altKey || e.ctrlKey || e.shiftKey) { return; } clickCount = clickCount + 1; clickEl[clickCount] = this; var that = this; if (1 === clickCount) { setTimeout(function () { if (2 === clickCount && clickEl[1] === clickEl[2]) { window.stop(); embed_anchor(that); } clickCount = 0; }, 250); } }); It basically checks if there is double click. If yes, it cancel the

Greasemonkey script on Firefox network error page

北战南征 提交于 2020-12-12 07:02:19
问题 I want to run a Greasemonkey script on Firefox network error pages, such as (but not limited to) this one: Can I do this with chrome:// URLs? If so, what are they? If not, is there another way? 回答1: Well, I was almost on the right track. Two things: Network error pages begin with about:neterror , not chrome:// . If you try to access ww.example.com (missing a w) then you will be redirected to about:neterror?e=dnsNotFound&u=http%3A//ww.example.com/&c=UTF-8&d=Firefox%20can%27t%20find%20the

How to run script in specify tab, and not effect the other side tab(Greasemonkey/Tampermonkey)

放肆的年华 提交于 2020-08-10 19:18:02
问题 How to run script in specify tab, and not effect the other side tab? like first tab keep going auto-refresh example.com as the same time new tab visit example.com(Non auto-refresh)? #Greasemonkey #Tampermonkey // ==UserScript== // @name Auto-Refresh // @include https://www.example.com // ==/UserScript== setTimeout(function(){ location.reload(); }, 5000); 回答1: The question is not clear enough for a definite answer. User-scripts normally do not have access to TAB data to know which tab they are

How to run script in specify tab, and not effect the other side tab(Greasemonkey/Tampermonkey)

依然范特西╮ 提交于 2020-08-10 19:17:02
问题 How to run script in specify tab, and not effect the other side tab? like first tab keep going auto-refresh example.com as the same time new tab visit example.com(Non auto-refresh)? #Greasemonkey #Tampermonkey // ==UserScript== // @name Auto-Refresh // @include https://www.example.com // ==/UserScript== setTimeout(function(){ location.reload(); }, 5000); 回答1: The question is not clear enough for a definite answer. User-scripts normally do not have access to TAB data to know which tab they are

TamperMonkey - message between scripts on different subdomains

笑着哭i 提交于 2020-07-18 10:21:38
问题 I have two scripts. Each runs on a different subdomain of our company "Example.com". Script #1 -- house.example.com Script #2 -- bob.fred.example.com Same domain, different subdomains. When a particular element appears on house.example.com , I need to send a message over to the script running on bob.fred.example.com Since Google extensions can exchange messages between extensions, there must be a way with TamperMonkey to exchange messages within the same extension, between scripts --

GreaseMonkey脚本:阻止Google转换搜索链接地址

落爺英雄遲暮 提交于 2020-04-05 23:53:23
现在访问Google越来越不稳定,往往是刚刚还可以搜索,搜索链接却打不开。观察后发现Google对搜索链接地址有做了转换,总要做如下类似跳转: 1 http://www.google.com.hk/url?sa=t &rct =j &q =%E6%9C%A8%E5%AD%90%E5%B1%8B &source =web &cd =1 &ved =0CGUQFjAA &url =http%3A%2F%2Fwww.mzwu.com%2F &ei =l7ilT_jBB8uSiQf99IGmAw &usg =AFQjCNFctvtehTHWHzB5A2MzvC7bM7qfpA &cad =rja 访问不了 http://www.google.com.hk/ ,跳转自然也就不成功了。那能不能复制出链接原地址,再粘贴到地址栏打开?测试后发现复制的链接地址也是转换后的。 继续分析发现:Google对搜索链接地址的转换过程是在客户端进行的,准确的说是在鼠标按下时进行的: 鼠标按下前的链接: 1 < a onmousedown ="return rwt(this,'','','','1','AFQjCNFctvtehTHWHzB5A2MzvC7bM7qfpA','','0CGUQFjAA',null,event)" class ="l" target ="_blank" href ="http:/

解释封装的匿名函数语法

感情迁移 提交于 2020-02-26 07:03:18
摘要 您能解释JavaScript中封装的匿名函数的语法背后的原因吗? 为什么这样做: (function(){})(); 但这不是: function(){}(); ? 我知道的 在JavaScript中,将创建一个命名函数,如下所示: function twoPlusTwo(){ alert(2 + 2); } twoPlusTwo(); 您还可以创建一个匿名函数并将其分配给变量: var twoPlusTwo = function(){ alert(2 + 2); }; twoPlusTwo(); 您可以通过创建一个匿名函数来封装代码块,然后将其包装在方括号中并立即执行: (function(){ alert(2 + 2); })(); 在创建模块化脚本时,这很有用,以避免因潜在冲突的变量而使当前范围或全局范围混乱(例如Greasemonkey脚本,jQuery插件等)。 现在,我明白了为什么这样做了。 方括号将内容括起来,仅显示结果(我敢肯定有一种更好的描述方式),例如 (2 + 2) === 4 。 我不明白的 但是我不明白为什么这不能同样有效: function(){ alert(2 + 2); }(); 你能跟我解释一下吗? #1楼 即使这是一个古老的问答,它仍然讨论了一个主题,该主题至今仍使许多开发人员陷入困境。

How can I auto-select a radio button with Greasemonkey? [duplicate]

本秂侑毒 提交于 2020-02-08 10:20:53
问题 This question already has an answer here : Greasemonkey to change value of Radio buttons in a form? (1 answer) Closed last year . I want select auto radio button with Greasemonkey. But I want select radio with label name. When I see that four radio button, Greasemonkey need select my option. Example: I want auto select label Instagram . <label for="ContentPlaceHolder1_answer3">Instagram</label> How can I select this radio button with Greasemonkey? <div class="row"> <input type="radio"

Select element in a frame

天涯浪子 提交于 2020-02-07 12:45:52
问题 My goal is to change a value from a to d inside the array options in menu.html using Greasemonkey extension in Firefox but my problem is that the element I am trying to select/access is loaded as a frame . I have been trying to solve this issue for some time now and I would be very happy if somone could help me out. I have got two files main.html and menu.html whose contents are: main.html (is the main page) <html> <head> <meta http-equiv="Pragma" content="no-cache"> <script language=

Select element in a frame

我的未来我决定 提交于 2020-02-07 12:45:08
问题 My goal is to change a value from a to d inside the array options in menu.html using Greasemonkey extension in Firefox but my problem is that the element I am trying to select/access is loaded as a frame . I have been trying to solve this issue for some time now and I would be very happy if somone could help me out. I have got two files main.html and menu.html whose contents are: main.html (is the main page) <html> <head> <meta http-equiv="Pragma" content="no-cache"> <script language=