We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
非常强大但我安装后只用了一两个功能,我不懂得代码,有一个自用多年的简单的脚本,但现在不支持e10s了。如果可能希望老师能够在百忙之中帮我改一下以支持多进程。谢谢!!//拖拽
非常强大但我安装后只用了一两个功能,我不懂得代码,有一个自用多年的简单的脚本,但现在不支持e10s了。如果可能希望老师能够在百忙之中帮我改一下以支持多进程。谢谢!!
location == "chrome://browser/content/browser.xul" && (function(event) { var self = arguments.callee; if (!event) { ["dragstart", "dragover", "drop"].forEach(function(type) { gBrowser.mPanelContainer.addEventListener(type, self, false); }); window.addEventListener("unload", function() { ["dragstart", "dragover", "drop"].forEach(function(type) { gBrowser.mPanelContainer.removeEventListener(type, self, false); }); }, false); return; } switch (event.type) { case "dragstart": { self.startPoint = [event.screenX, event.screenY]; self.sourceNode = event.target; event.target.localName == "img" && event.dataTransfer.setData("application/x-moz-file-promise-url", event.target.src); break; } case "dragover": { self.startPoint && (Components.classes["@mozilla.org/widget/dragservice;1"].getService(Components.interfaces.nsIDragService).getCurrentSession().canDrop = true); break; } case "drop": { if (self.startPoint && event.target.localName != "textarea" && (!(event.target.localName == "input" && (event.target.type == "text" || event.target.type == "password"))) && event.target.contentEditable != "true") { event.preventDefault(); event.stopPropagation(); var [subX, subY] = [event.screenX - self.startPoint[0], event.screenY - self.startPoint[1]]; var [distX, distY] = [(subX > 0 ? subX : (-subX)), (subY > 0 ? subY : (-subY))]; var direction; if (distX > distY) direction = subX < 0 ? "L" : "R"; else direction = subY < 0 ? "U" : "D"; if (event.dataTransfer.types.contains("application/x-moz-file-promise-url")) { if (direction == "D") { //搜索相似图片(Google) gBrowser.selectedTab = gBrowser.addTab("https://www.google.com/searchbyimage?image_url=" + encodeURIComponent(event.dataTransfer.getData("application/x-moz-file-promise-url"))); return; } if (direction == "U") { //搜索相似图片(百度) gBrowser.selectedTab = gBrowser.addTab("http://stu.baidu.com/i?rt=0&rn=10&ct=1&tn=baiduimage&objurl=" + encodeURIComponent(event.dataTransfer.getData("application/x-moz-file-promise-url"))); return; } if (direction == "L") { //复制图片地址 Components.classes['@mozilla.org/widget/clipboardhelper;1'].createInstance(Components.interfaces.nsIClipboardHelper).copyString(event.dataTransfer.getData("application/x-moz-file-promise-url")); return; } if (direction == "R") { //下载图片 saveImageURL(event.dataTransfer.getData("application/x-moz-file-promise-url"), null, null, null, null, null, document); return; } } else if (event.dataTransfer.types.contains("text/x-moz-url")) { if (direction == "U") { //新标签打开链接(前台) gBrowser.selectedTab = gBrowser.addTab(event.dataTransfer.getData("text/x-moz-url").split("\n")[0]); return; } if (direction == "D") { //新标签打开链接(前台) gBrowser.selectedTab = gBrowser.addTab(event.dataTransfer.getData("text/x-moz-url").split("\n")[0]); return; } } else { if (direction == "U") { //baidu搜索选中文字(前台)[识别URL并打开] /^\s_(?:(?:(?:ht|f)tps?://)?(?:(?:\w+?)(?:.(?:[\w-]+?))(?:.(?:[a-zA-Z]{2,5}))|(?:(?:\d+)(?:.\d+){3}))(?::\d{2,5})?(?:/\S|$)|data:text/[\u0025-\u007a]+)\s_$/.test(event.dataTransfer.getData("text/unicode")) && (gBrowser.selectedTab = gBrowser.addTab(event.dataTransfer.getData("text/unicode"))) || (gBrowser.selectedTab = gBrowser.addTab("https://www.baidu.com/s?wd=" + event.dataTransfer.getData("text/unicode"))); return; } if (direction == "D") { //google搜索选中文字(前台)[识别URL并打开] /^\s_(?:(?:(?:ht|f)tps?://)?(?:(?:\w+?)(?:.(?:[\w-]+?))(?:.(?:[a-zA-Z]{2,5}))|(?:(?:\d+)(?:.\d+){3}))(?::\d{2,5})?(?:/\S|$)|data:text/[\u0025-\u007a]+)\s_$/.test(event.dataTransfer.getData("text/unicode")) && (gBrowser.selectedTab = gBrowser.addTab(event.dataTransfer.getData("text/unicode"))) || (gBrowser.selectedTab = gBrowser.addTab("https://www.google.com/ncr#q=" + event.dataTransfer.getData("text/unicode"))); return; } if (direction == "L") { //自定义搜索选中文字(前台)[识别URL并打开] /^\s_(?:(?:(?:ht|f)tps?://)?(?:(?:\w+?)(?:.(?:[\w-]+?))(?:.(?:[a-zA-Z]{2,5}))|(?:(?:\d+)(?:.\d+){3}))(?::\d{2,5})?(?:/\S|$)|data:text/[\u0025-\u007a]+)\s_$/.test(event.dataTransfer.getData("text/unicode")) && (gBrowser.selectedTab = gBrowser.addTab(event.dataTransfer.getData("text/unicode"))) || (gBrowser.selectedTab = gBrowser.addTab("https://twitter.com/search?q=" + event.dataTransfer.getData("text/unicode"))); return; } if (direction == "R") { //翻译(前台)[识别URL并打开] /^\s_(?:(?:(?:ht|f)tps?://)?(?:(?:\w+?)(?:.(?:[\w-]+?))(?:.(?:[a-zA-Z]{2,5}))|(?:(?:\d+)(?:.\d+){3}))(?::\d{2,5})?(?:/\S|$)|data:text/[\u0025-\u007a]+)\s_$/.test(event.dataTransfer.getData("text/unicode")) && (gBrowser.selectedTab = gBrowser.addTab(event.dataTransfer.getData("text/unicode"))) || (gBrowser.selectedTab = gBrowser.addTab("https://translate.google.com/#auto/zh-CN/" + event.dataTransfer.getData("text/unicode"))); return; } } self.startPoint = 0; } } } })()`
The text was updated successfully, but these errors were encountered:
No branches or pull requests
非常强大但我安装后只用了一两个功能,我不懂得代码,有一个自用多年的简单的脚本,但现在不支持e10s了。如果可能希望老师能够在百忙之中帮我改一下以支持多进程。谢谢!!
//拖拽location == "chrome://browser/content/browser.xul" && (function(event) {
var self = arguments.callee;
if (!event) {
["dragstart", "dragover", "drop"].forEach(function(type) {
gBrowser.mPanelContainer.addEventListener(type, self, false);
});
window.addEventListener("unload", function() {
["dragstart", "dragover", "drop"].forEach(function(type) {
gBrowser.mPanelContainer.removeEventListener(type, self, false);
});
}, false);
return;
}
switch (event.type) {
case "dragstart":
{
self.startPoint = [event.screenX, event.screenY];
self.sourceNode = event.target;
event.target.localName == "img" && event.dataTransfer.setData("application/x-moz-file-promise-url", event.target.src);
break;
}
case "dragover":
{
self.startPoint && (Components.classes["@mozilla.org/widget/dragservice;1"].getService(Components.interfaces.nsIDragService).getCurrentSession().canDrop = true);
break;
}
case "drop":
{
if (self.startPoint && event.target.localName != "textarea" && (!(event.target.localName == "input" && (event.target.type == "text" || event.target.type == "password"))) && event.target.contentEditable != "true") {
event.preventDefault();
event.stopPropagation();
var [subX, subY] = [event.screenX - self.startPoint[0], event.screenY - self.startPoint[1]];
var [distX, distY] = [(subX > 0 ? subX : (-subX)), (subY > 0 ? subY : (-subY))];
var direction;
if (distX > distY) direction = subX < 0 ? "L" : "R";
else direction = subY < 0 ? "U" : "D";
if (event.dataTransfer.types.contains("application/x-moz-file-promise-url")) {
if (direction == "D") {
//搜索相似图片(Google)
gBrowser.selectedTab = gBrowser.addTab("https://www.google.com/searchbyimage?image_url=" + encodeURIComponent(event.dataTransfer.getData("application/x-moz-file-promise-url")));
return;
}
if (direction == "U") {
//搜索相似图片(百度)
gBrowser.selectedTab = gBrowser.addTab("http://stu.baidu.com/i?rt=0&rn=10&ct=1&tn=baiduimage&objurl=" + encodeURIComponent(event.dataTransfer.getData("application/x-moz-file-promise-url")));
return;
}
if (direction == "L") {
//复制图片地址
Components.classes['@mozilla.org/widget/clipboardhelper;1'].createInstance(Components.interfaces.nsIClipboardHelper).copyString(event.dataTransfer.getData("application/x-moz-file-promise-url"));
return;
}
if (direction == "R") {
//下载图片
saveImageURL(event.dataTransfer.getData("application/x-moz-file-promise-url"), null, null, null, null, null, document);
return;
}
} else if (event.dataTransfer.types.contains("text/x-moz-url")) {
if (direction == "U") {
//新标签打开链接(前台)
gBrowser.selectedTab = gBrowser.addTab(event.dataTransfer.getData("text/x-moz-url").split("\n")[0]);
return;
}
if (direction == "D") {
//新标签打开链接(前台)
gBrowser.selectedTab = gBrowser.addTab(event.dataTransfer.getData("text/x-moz-url").split("\n")[0]);
return;
}
} else {
if (direction == "U") {
//baidu搜索选中文字(前台)[识别URL并打开]
/^\s_(?:(?:(?:ht|f)tps?://)?(?:(?:\w+?)(?:.(?:[\w-]+?))(?:.(?:[a-zA-Z]{2,5}))|(?:(?:\d+)(?:.\d+){3}))(?::\d{2,5})?(?:/\S|$)|data:text/[\u0025-\u007a]+)\s_$/.test(event.dataTransfer.getData("text/unicode")) && (gBrowser.selectedTab = gBrowser.addTab(event.dataTransfer.getData("text/unicode"))) || (gBrowser.selectedTab = gBrowser.addTab("https://www.baidu.com/s?wd=" + event.dataTransfer.getData("text/unicode")));
return;
}
if (direction == "D") {
//google搜索选中文字(前台)[识别URL并打开]
/^\s_(?:(?:(?:ht|f)tps?://)?(?:(?:\w+?)(?:.(?:[\w-]+?))(?:.(?:[a-zA-Z]{2,5}))|(?:(?:\d+)(?:.\d+){3}))(?::\d{2,5})?(?:/\S|$)|data:text/[\u0025-\u007a]+)\s_$/.test(event.dataTransfer.getData("text/unicode")) && (gBrowser.selectedTab = gBrowser.addTab(event.dataTransfer.getData("text/unicode"))) || (gBrowser.selectedTab = gBrowser.addTab("https://www.google.com/ncr#q=" + event.dataTransfer.getData("text/unicode")));
return;
}
if (direction == "L") {
//自定义搜索选中文字(前台)[识别URL并打开]
/^\s_(?:(?:(?:ht|f)tps?://)?(?:(?:\w+?)(?:.(?:[\w-]+?))(?:.(?:[a-zA-Z]{2,5}))|(?:(?:\d+)(?:.\d+){3}))(?::\d{2,5})?(?:/\S|$)|data:text/[\u0025-\u007a]+)\s_$/.test(event.dataTransfer.getData("text/unicode")) && (gBrowser.selectedTab = gBrowser.addTab(event.dataTransfer.getData("text/unicode"))) || (gBrowser.selectedTab = gBrowser.addTab("https://twitter.com/search?q=" + event.dataTransfer.getData("text/unicode")));
return;
}
if (direction == "R") {
//翻译(前台)[识别URL并打开]
/^\s_(?:(?:(?:ht|f)tps?://)?(?:(?:\w+?)(?:.(?:[\w-]+?))(?:.(?:[a-zA-Z]{2,5}))|(?:(?:\d+)(?:.\d+){3}))(?::\d{2,5})?(?:/\S|$)|data:text/[\u0025-\u007a]+)\s_$/.test(event.dataTransfer.getData("text/unicode")) && (gBrowser.selectedTab = gBrowser.addTab(event.dataTransfer.getData("text/unicode"))) || (gBrowser.selectedTab = gBrowser.addTab("https://translate.google.com/#auto/zh-CN/" + event.dataTransfer.getData("text/unicode")));
return;
}
}
self.startPoint = 0;
}
}
}
})()`
The text was updated successfully, but these errors were encountered: