60楼#
发布于:2019-08-20 11:19
![]() |
|
61楼#
发布于:2019-09-03 13:11
膜拜大神
|
|
62楼#
发布于:2019-09-04 08:44
求助firefox 69,AutoPopup.uc.js脚本不工作
// ==UserScript==// @name AutoPopup.uc.js // @description Auto popup menulist/menupopup // @compatibility Firefox 30.0+ // @author GOLF-AT, modified by gsf & aborix // @version 2019.05.05 // ==UserScript== (function() { const showDelay = 200; const hideDelay = 500; var overElt = null; var PopElt = null; var PopTimer = null; var HideTimer = null; var AlwaysPop = false; var searchBar = null; if (window.BrowserSearch) searchBar = BrowserSearch.searchBar; // Fx support all of CSS syntax: # indicates id, . represents class, or [id='demo'] var BlackIDs = []; // whitelist, and trigger action var whiteIDs = [ { id: 'omnibar-defaultEngine', popMemu: 'omnibar-engine-menu', run: function(overElem) { document.getElementById('omnibar-in-urlbar').click(0); } }, { id: 'ucjs_zoom_statuslabel', popMemu: 'ucjs_zoom-context', run: null }, { id: 'UserScriptLoader-icon', popMemu: 'UserScriptLoader-popup', run: null }, { id: 'readLater', popMemu: 'readLater-popup', run: null //function(overElem) {PopElt.popup();} }, { id: 'foxyproxy-toolbar-icon', popMemu: 'foxyproxy-toolbarbutton-popup', run: null } ]; var whitesInx = -1; var popupPos = ['after_start', 'end_before', 'before_start', 'start_before']; var menuPanelID = 'appMenu-popup'; var downPanelID = 'downloadsPanel'; var widgetPanelID = 'customizationui-widget-panel'; var overflowPanel = document.getElementById('widget-overflow'); if (overflowPanel) { overflowPanel.addEventListener('popupshowing', function() { this.open = true; }); overflowPanel.addEventListener('popuphiding', function() { this.open = false; }); } function IsWidgetBtn(elt) { try { return elt.hasAttribute('widget-id') && elt.getAttribute('widget-type') == 'view'; } catch(e) { return false; } } function IsSearchBtn(elt) { return (elt && elt.className == 'searchbar-search-button') || whitesInx == 0; } function IsPanelMenuBtn(elt) { return elt && elt.id == 'PanelUI-menu-button'; } function IsDownloadBtn(elt) { return elt && elt.localName == 'toolbarbutton' && elt.id == 'downloads-button'; } function IsButton(elt) { return elt && (elt.localName == 'button' || elt.localName == 'toolbarbutton'); } function IsMenuButton(elt) { return IsPanelMenuBtn(elt) || IsDownloadBtn(elt) || IsWidgetBtn(elt) || (IsButton(elt) && getPopupMenu(elt)); } function IsOverflowButton(elt) { return elt && elt == document.getElementById('nav-bar-overflow-button'); } function IsUrlbarDropmarker(elt) { try { return elt.getAttribute('anonid') == 'historydropmarker'; } catch(e) { return false; } } function IsAutoComplete(elt) { try { return elt.getAttribute('type').substr(0, 12) == 'autocomplete'; } catch(e) { return false; } } function isBlackNode(elt) { return BlackIDs.some(function(css) { try { var nodes = document.querySelectorAll(css); } catch(e) { return false; } for (var node of nodes) { if (node == elt) return true; } return false; }) } function getPopupNode(node) { if (whitesInx > -1 && PopElt) return PopElt; if (IsSearchBtn(node)) return node; if (IsOverflowButton(node)) return node; var elt, isPop, s; for (; node != null; node = node.parentNode) { if (node == PopElt) return node; isPop = false; // Node isn't Popup node s = node.localName; if (s == 'menupopup' || s == 'popup' || s == 'menulist' || IsAutoComplete(node) || IsMenuButton(node)) { isPop = true; } else if (s == 'dropmarker') { if (node.getAttribute('type') == 'menu') { elt = node.parentNode; if (elt.firstChild.localName == 'menupopup') isPop = true; } else if (IsUrlbarDropmarker(node)) isPop = true; } else if (s == 'menu') { isPop = (node.parentNode.localName == 'menubar'); } else if (IsButton(node)) { for (elt = node; (elt = elt.nextSibling) != null;) { if (elt.localName == 'dropmarker' && elt.boxObject.width > 0 && elt.boxObject.height > 0) break; } if (elt) break; } if (isPop) break; } if (PopElt && node) { // Whether node is child of PopElt for (elt = node.parentNode; elt != null; elt = elt.parentNode) { if (elt == PopElt) return PopElt; } } return isPop ? node : null; } function getPopupMenu(elt) { if (whitesInx > -1 && PopElt) return PopElt; var node = elt ? elt.querySelector('menupopup') || elt.childNodes : null; if (nodes) { for (let node of nodes) { if (node.localName == 'menupopup') return node; } } var s = elt.getAttribute('popup'); return s ? document.getElementById(s) : null; } function getPopupPos(elt) { var x, y, pos, box; for (pos = 0, x = elt.boxObject.screenX, y = elt.boxObject.screenY; elt != null; elt = elt.parentNode) { if (elt.localName == 'window' || !elt.parentNode) break; else if (elt.localName != 'toolbar' && elt.localName != 'hbox' && elt.localName != 'vbox'); else if (elt.boxObject.height >= 3 * elt.boxObject.width) { if (elt.boxObject.height >= 45) { pos = 9; break; } } else if (elt.boxObject.width >= 3 * elt.boxObject.height) { if (elt.boxObject.width >= 45) { pos = 8; break; } } } try { box = elt.boxObject; x = (pos & 1) ? (x <= box.width / 2 + box.screenX ? 1 : 3) : (y <= box.height / 2 + box.screenY ? 0 : 2); } catch(e) { x = 0; } return popupPos[x]; } function AutoPopup() { PopTimer = null; if (!overElt) return; if (whitesInx > -1 && PopElt && whiteIDs[whitesInx].run) { whiteIDs[whitesInx].run(overElt); return; } if (!PopElt) PopElt = overElt; if (overElt.localName == 'dropmarker') { if (IsUrlbarDropmarker(overElt)) overElt.click(); else PopElt.showPopup(); } else if (overElt.localName == 'menulist') { overElt.open = true; } else if (IsPanelMenuBtn(overElt)) { PanelUI.show(); PopElt = document.getElementById(menuPanelID); } else if (IsWidgetBtn(overElt)) { var cmdEvent = document.createEvent('xulcommandevent'); cmdEvent.initCommandEvent('command', true, true, window, 0, false, false, false, false, null); overElt.dispatchEvent(cmdEvent); PopElt = document.getElementById(widgetPanelID); } else if (IsDownloadBtn(overElt)) { PopElt = document.getElementById(downPanelID); DownloadsPanel.showPanel(); } else if (IsSearchBtn(overElt)) { searchBar.openSuggestionsPanel(); } else if (IsOverflowButton(overElt)) { if (!overflowPanel.open) { overElt.click(); PopElt = overflowPanel; } } else { PopElt = getPopupMenu(overElt); try { let Pos = getPopupPos(overElt); PopElt.removeAttribute('hidden'); PopElt.openPopup(overElt, Pos, 0, 0, false, false, null); } catch(e) { PopElt = null; } } } function HidePopup() { try { if (overElt.localName == 'dropmarker') { try { PopElt.parentNode.closePopup(); } catch(e) { } } else if (overElt.localName == 'menulist') PopElt.open = false; else if (IsDownloadBtn(overElt)) DownloadsPanel.hidePanel(); //else if (IsPanelMenuBtn(overElt) || IsWidgetBtn(overElt)) else if (PopElt && PopElt.hidePopup) PopElt.hidePopup(); else if (PopElt.popupBoxObject) PopElt.popupBoxObject.hidePopup(); else if (IsSearchBtn(overElt)) searchBar.textbox.closePopup(); else if (IsPanelMenuBtn(overElt)) PanelUI.hide(); } catch(e) { } HideTimer = null; overElt = PopElt = null; } function MouseOver(e) { if (!AlwaysPop && !document.hasFocus()) return; var popNode, n = e.originalTarget; whitesInx = -1; // gsf :some,forEach,filter等数组遍历方法接受第二个参数,表作用域this,可不用call了 if (n.hasAttribute('id') && whiteIDs.some(function(k,i,me) { if (k.id == n.id) { overElt = n; whitesInx = i; PopElt = document.getElementById(k.popMemu); PopTimer = setTimeout(AutoPopup, showDelay); return true; } })) return; popNode = getPopupNode(e.originalTarget); if (!popNode || (popNode && popNode.disabled) || isBlackNode(popNode)) { MouseOut(); return; } if (HideTimer) { window.clearTimeout(HideTimer); HideTimer = null; } try { if (IsAutoComplete(popNode)) return; for (var elt = popNode; elt != null; elt = elt.parentNode) { if (elt.localName == 'menupopup' || elt.localName == 'popup') return; } } catch(e) { } if (PopElt && popNode == PopElt && PopElt != overElt) return; if (overElt && popNode != overElt) HidePopup(); overElt = popNode; PopElt = null; PopTimer = setTimeout(AutoPopup, showDelay); } function MouseOut() { if (PopTimer) { window.clearTimeout(PopTimer); PopTimer = null; } if (!HideTimer && PopElt) HideTimer = window.setTimeout(HidePopup, hideDelay); } window.addEventListener('mouseover', MouseOver, false); })(); |
|
63楼#
发布于:2019-09-04 08:45
求助脚本 firefox 69
// ==UserScript==// @name Mousegestures.uc.js // @namespace Mousegestures@gmail.com // @description 自定义鼠标手势,自用 DIY版 // @author 紫云飞&黒仪大螃蟹 // @homepageURL http://www.cnblogs.com/ziyunfei/archive/2011/12/15/2289504.html // @include chrome://browser/content/browser.xhtml // @charset UTF-8 // ==/UserScript== (() => { 'use strict'; let ucjsMouseGestures = { lastX: 0, lastY: 0, directionChain: '', isMouseDownL: false, isMouseDownR: false, hideFireContext: false, shouldFireContext: false, GESTURES: { 'L': {name: '后退', cmd: () => getWebNavigation().canGoBack && getWebNavigation().goBack()}, 'R': {name: '前进', cmd: () => getWebNavigation().canGoForward && getWebNavigation().goForward()}, 'U': {name: '向上滚动', cmd: () => goDoCommand('cmd_scrollPageUp')}, 'D': {name: '向下滚动', cmd: () => goDoCommand('cmd_scrollPageDown')}, 'DL': {name: '恢复关闭的标签', cmd: function() { try { document.getElementById('History:UndoCloseTab').doCommand(); } catch (ex) { if ('undoRemoveTab' in gBrowser) gBrowser.undoRemoveTab(); else throw "Session Restore feature is disabled." } } }, 'DR': {name: '关闭当前标签', cmd: function(event) { gBrowser.removeCurrentTab(); }}, 'UD': {name: '刷新当前页面', cmd: function() {document.getElementById("Browser:Reload").doCommand();}}, //'DU': {name: '网址向上一层', cmd: function() { loadURI(content.location.host + content.location.pathname.replace(/\/[^\/]+\/?$/, ""));}}, 'UL': {name: '激活左边的标签页', cmd: function(event) {gBrowser.mTabContainer.advanceSelectedTab(-1, true);}}, 'UR': {name: '激活右边的标签页', cmd: function(event) {gBrowser.mTabContainer.advanceSelectedTab(+1, true);}}, //'RL': {name: '打开新标签', cmd: function() { BrowserOpenTab(); }}, //'LR': {name: '添加/移除书签', cmd: function() {document.getElementById("Browser:AddBookmarkAs").doCommand(); } }, //'RDR': {name: '关闭右边的标签页', cmd: function(event) { gBrowser.removeTabsToTheEndFrom(gBrowser.mCurrentTab); }}, //'LDL': {name: '关闭其他所有标签页', cmd: function(event) {gBrowser.removeAllTabsBut(gBrowser.mCurrentTab); }}, 'RU': {name: '转到页首', cmd: () => goDoCommand('cmd_scrollTop')}, 'RD': {name: '转到页尾', cmd: () => goDoCommand('cmd_scrollBottom')}, //'LU': {name: '聚焦到地址栏', cmd: function(event) { openLocation(); }}, //'LD': {name: '查看页面信息', cmd: function(event) { BrowserPageInfo(); }}, //'RLRL': {name: '重启浏览器', cmd: function(event) { Services.startup.quit(Services.startup.eAttemptQuit | Services.startup.eRestart); }}, //'LRLR': {name: '重启浏览器', cmd: function(event) { Services.startup.quit(Services.startup.eAttemptQuit | Services.startup.eRestart); }}, //'URDLU': {name: '关闭浏览器', cmd: function(event) { goQuitApplication(); }}, //'DRU': {name: '打开附加组件', cmd: function(event) { BrowserOpenAddonsMgr(); }}, //'URD': {name: '打开选项', cmd: function(event) { openPreferences(); }}, //'LDR': {name: '打开历史窗口(侧边栏)', cmd: function(event) {SidebarUI.toggle("viewHistorySidebar"); }}, //'RDL': {name: '打开书签工具栏', cmd: function(event) { var bar = document.getElementById("PersonalToolbar"); setToolbarVisibility(bar, bar.collapsed); }}, }, init: function() { let self = this; ['mousedown', 'mousemove', 'mouseup', 'contextmenu', 'DOMMouseScroll'].forEach(type => { gBrowser.tabpanels.addEventListener(type, self, true); }); gBrowser.tabpanels.addEventListener('unload', () => { ['mousedown', 'mousemove', 'mouseup', 'contextmenu', 'DOMMouseScroll'].forEach(type => { gBrowser.tabpanels.removeEventListener(type, self, true); }); }, false); }, handleEvent: function(event) { switch (event.type) { case 'mousedown': if (event.button == 2) { this.isMouseDownR = true; this.hideFireContext = false; [this.lastX, this.lastY, this.directionChain] = [event.screenX, event.screenY, '']; } if (event.button == 0) { this.isMouseDownR = false; this.stopGesture(); } break; case 'mousemove': if (this.isMouseDownR) { let[subX, subY] = [event.screenX - this.lastX, event.screenY - this.lastY]; let[distX, distY] = [(subX > 0 ? subX : (-subX)), (subY > 0 ? subY : (-subY))]; let direction; if (distX < 10 && distY < 10) return; if (distX > distY) direction = subX < 0 ? 'L' : 'R'; else direction = subY < 0 ? 'U' : 'D'; if (!this.xdTrailArea) { this.xdTrailArea = document.createXULElement('hbox'); let canvas = document.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'canvas'); canvas.setAttribute('width', window.screen.width); canvas.setAttribute('height', window.screen.height); this.xdTrailAreaContext = canvas.getContext('2d'); this.xdTrailArea.style.cssText = '-moz-user-focus: none !important;-moz-user-select: none !important;display: -moz-box !important;box-sizing: border-box !important;pointer-events: none !important;margin: 0 !important;padding: 0 !important;width: 100% !important;height: 100% !important;border: none !important;box-shadow: none !important;overflow: hidden !important;background: none !important;opacity: 0.9 !important;position: fixed !important;z-index: 2147483647 !important;'; this.xdTrailArea.appendChild(canvas); gBrowser.selectedBrowser.parentNode.insertBefore(this.xdTrailArea, gBrowser.selectedBrowser.nextSibling); } if (this.xdTrailAreaContext) { this.hideFireContext = true; this.xdTrailAreaContext.strokeStyle = '#CC33CC'; this.xdTrailAreaContext.lineJoin = 'round'; this.xdTrailAreaContext.lineCap = 'round'; this.xdTrailAreaContext.lineWidth = 3; this.xdTrailAreaContext.beginPath(); this.xdTrailAreaContext.moveTo(this.lastX - gBrowser.selectedBrowser.boxObject.screenX, this.lastY - gBrowser.selectedBrowser.boxObject.screenY); this.xdTrailAreaContext.lineTo(event.screenX - gBrowser.selectedBrowser.boxObject.screenX, event.screenY - gBrowser.selectedBrowser.boxObject.screenY); this.xdTrailAreaContext.closePath(); this.xdTrailAreaContext.stroke(); this.lastX = event.screenX; this.lastY = event.screenY; } if (direction != this.directionChain.charAt(this.directionChain.length - 1)) { this.directionChain += direction; XULBrowserWindow.statusTextField.label = this.GESTURES[this.directionChain] ? '手势: ' + this.directionChain + ' ' + this.GESTURES[this.directionChain].name : '未知手势:' + this.directionChain; } } break; case 'mouseup': if (this.isMouseDownR && event.button == 2) { if (this.directionChain) this.shouldFireContext = false; this.isMouseDownR = false; this.directionChain && this.stopGesture(); } break; case 'contextmenu': if (this.isMouseDownR || this.hideFireContext) { this.shouldFireContext = true; this.hideFireContext = false; event.preventDefault(); event.stopPropagation(); } break; case 'DOMMouseScroll': if (this.isMouseDownR) { this.shouldFireContext = false; this.hideFireContext = true; this.directionChain = 'W' + (event.detail > 0 ? '+' : '-'); this.stopGesture(); } break; } }, stopGesture: function() { if (this.GESTURES[this.directionChain]) this.GESTURES[this.directionChain].cmd(); if (this.xdTrailArea) { this.xdTrailArea.parentNode.removeChild(this.xdTrailArea); this.xdTrailArea = null; this.xdTrailAreaContext = null; } this.directionChain = ''; setTimeout(() => XULBrowserWindow.statusTextField.label = '', 2000); this.hideFireContext = true; } }; ucjsMouseGestures.init(); })(); |
|
64楼#
发布于:2019-09-04 08:46
求助脚本 firefox 69
// ==UserScript== // @name TabPlus.uc.js // @description 自用整合版标签增强 // @updateURL https://raw.githubusercontent.com/xinggsf/uc/master/tabPlus.uc.js // @namespace TabPlus@gmail.com // @include chrome://browser/content/browser.xhtml // @include chrome://browser/content/bookmarks/bookmarksPanel.xul // @include chrome://browser/content/history/history-panel.xul // @include chrome://browser/content/places/places.xul // @startup tabPlusManager.startup(); // @shutdown tabPlusManager.shutdown(); // @version 2017.5.27 // @Note xinggsf 2017.5.20 修正新建标签按钮右键新开网址后弹出菜单,修正“关闭当前标签页回到左边标签”失效 // @Note xinggsf 2016.5.15 用API判断是否为FX可用地址 // @Note xinggsf 2015.12.18 增加右击新建按钮新开剪贴板中的网址 // @Note xinggsf 2015.1.28 整合,并去掉经常产生BUG的地址栏输入新开功能 // @Note 2014.09.18 最后一次修正整合 by defpt // ==/UserScript== (function () { Cu.import('resource://gre/modules/Services.jsm'); /* 下列代码firefox 47+失效,注释之 // 新标签打开:书签、历史、搜索栏 let s = openLinkIn.toString(); s = s.replace('w.gBrowser.selectedTab.pinned', '(!w.isTabEmpty(w.gBrowser.selectedTab) || $&)') .replace(/&&\s+w\.gBrowser\.currentURI\.host != uriObj\.host/, '') .replace(/loadInBackground = false;/g, 'loadInBackground = aInBackground;'); try { (new Function('openLinkIn = ' + s)()); } catch (e) {} //地址栏新标签打开 try { location.href.startsWith('chrome://browser/content/browser.x') && eval("gURLBar.handleCommand="+gURLBar.handleCommand.toString().replace(/^\s*(load.+);/gm, "if(/^javascript:/.test(url)||isTabEmpty(gBrowser.selectedTab)){loadCurrent();}else{this.handleRevert();gBrowser.loadOneTab(url, {postData: postData, inBackground: false, allowThirdPartyFixup: true});}")); }catch(e){} //自动关闭下载产生的空白标签 eval("gBrowser.mTabProgressListener = " + gBrowser.mTabProgressListener.toString().replace(/(?=var location)/, '\ if (aWebProgress.DOMWindow.document.documentURI == "about:blank"\ && aRequest.QueryInterface(nsIChannel).URI.spec != "about:blank") {\ aWebProgress.DOMWindow.setTimeout(function() {\ !aWebProgress.isLoadingDocument && aWebProgress.DOMWindow.close();\ }, 100);\ }\ ')); // 关闭当前标签页回到左边标签,firefox 47+失效,改用tabclose事件 try { eval("gBrowser._blurTab = " + gBrowser._blurTab.toString() .replace('this.selectedTab = tab;', "this.selectedTab = aTab.previousSibling || tab;")); } catch (e) {} */ //中键点击bookmark菜单不关闭 try { eval('BookmarksEventHandler.onClick =' + BookmarksEventHandler.onClick .toString().replace('node.hidePopup()', '')); eval('checkForMiddleClick =' + checkForMiddleClick.toString() .replace('closeMenus(event.target);', '')); } catch (e) {} if (location.href.startsWith('chrome://browser/content/browser.x')) { //当地址栏失去焦点后恢复原来的地址 gURLBar.addEventListener("blur", function () { this.handleRevert(); }, !1); //中键点击地址栏自动复制网址 gURLBar.addEventListener("click", function (e) { if (e.button === 1) goDoCommand('cmd_copy'); }, !1); //当搜索栏失去焦点后清空 if (BrowserSearch.searchBar && !document.getElementById('omnibar-defaultEngine')) { BrowserSearch.searchBar.addEventListener("blur", function () { this.value = ""; }, !1); } } class TabPlus{ constructor(wnd) { this.window = wnd; this.tab = null; const c = wnd.gBrowser.tabContainer; c.addEventListener('mouseover', this, !1); c.addEventListener('mouseout', this, !1); c.addEventListener('click', this, !1); c.addEventListener('TabClose', this, !1); c.addEventListener('contextmenu', this, !1); const newTabBtn = this.window.document.getAnonymousElementByAttribute(c, "class", "tabs-newtab-button"); newTabBtn.setAttribute("tooltiptext","左键:新建标签页\n中键:恢复刚关闭的标签\n右键:新开剪贴板中的网址"); newTabBtn.removeAttribute("onclick"); newTabBtn.addEventListener('click', this.handleNewTabButton.bind(this), !0); } destroy(){ const c = this.window.gBrowser.tabContainer; c.removeEventListener('mouseover', this); c.removeEventListener('mouseout', this); c.removeEventListener('click', this); c.removeEventListener('TabClose', this); c.removeEventListener('contextmenu', this); const newTabBtn = this.window.document.getAnonymousElementByAttribute(c, "class", "tabs-newtab-button"); newTabBtn.removeEventListener('click', this.handleNewTabButton.bind(this)); } handleNewTabButton(ev) { //if (ev.button === 0) this.window.BrowserOpenTab(ev); if (ev.button === 1) { this.window.undoCloseTab(); } //右键点击新建按钮打开剪贴板中的网址 else if (ev.button === 2) { /* openNewTabWith('about:blank'); gURLBar.select(); goDoCommand('cmd_paste'); gBrowser.loadOneTab(url, {inBackground:false}); */ const reg = /^([\w\-]+\.)+[a-z]{2,3}(:\d+)?(\/\S*)?$/i; let url = readFromClipboard(); if (reg.test(url)) url = 'http://' + url; try { switchToTabHavingURI(url, true); } catch (ex) { BrowserSearch.loadSearchFromContext(url); } } } handleEvent(ev) { const t = ev.target; switch (ev.type) { case "mouseover": if (this.tab !== t && t.tagName === 'tab') { this.tab = t; this.tid = setTimeout(() => { if (this.tab) { this.window.gBrowser.selectedTab = this.tab; this.tab = null; } }, 300);//delay 300ms } break; case "mouseout": this.tab = null; if (this.tid) { clearTimeout(this.tid); this.tid = null; } break; case "TabClose"://关闭当前标签页回到左边标签 if (this.window.gBrowser.selectedTab === t) { this.window.gBrowser.tabContainer.selectedIndex--; ev.preventDefault(); ev.stopPropagation(); } break; case "click": if (ev.button === 1) { console.log(t); if (t.matches("tab")) {//复制tab的网址 let url = t.linkedBrowser.currentURI.spec; //Services.clipboard.setData(url, ,); Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper).copyString(url, !1); ev.preventDefault(); ev.stopPropagation(); } } //右键关闭标签页,ctrl+右键打开菜单 else if (ev.button === 2 && t.tagName === "tab" && !ev.ctrlKey) { ev.preventDefault(); this.window.gBrowser.removeTab(t); ev.stopPropagation(); } break; case "contextmenu": if ((!ev.ctrlKey && t.matches('tab')) || ev.originalTarget.matches('.tabs-newtab-button')) { ev.preventDefault(); ev.stopPropagation(); } break; } } } const _winList = new Map(); const WindowListener = { onOpenWindow(xulWindow) { const window = xulWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow); function onWindowLoad() { window.removeEventListener('load', onWindowLoad); if (window.document.documentElement.getAttribute('windowtype') == 'navigator:browser') { _winList.set(window, new TabPlus(window)); } } window.addEventListener('load', onWindowLoad); }, onCloseWindow(xulWindow) { const window = xulWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow); if (_winList.has(window)) { _winList.get(window).destroy(); _winList.delete(window); } }, onWindowTitleChange(xulWindow, newTitle) {} }; window.tabPlusManager = { startup() { const windows = Services.wm.getEnumerator('navigator:browser'); while (windows.hasMoreElements()) { const domwindow = windows.getNext().QueryInterface(Ci.nsIDOMWindow); domwindow && _winList.set(domwindow, new TabPlus(domwindow)); } Services.wm.addListener(WindowListener); }, shutdown() { for (let obj of _winList) { obj.destroy(); } //_winList.clear(); _winList = null; Services.wm.removeListener(WindowListener); } }; })(); tabPlusManager.startup(); |
|
65楼#
发布于:2019-09-04 14:22
AutoPopup.uc.js 看本贴 53 楼。
Mousegestures.uc.js //1、 XULBrowserWindow.statusTextField.label = this.GESTURES[this.directionChain] ? '手势: ' + this.directionChain + ' ' + this.GESTURES[this.directionChain].name : '未知手势:' + this.directionChain; //替换为 XULBrowserWindow.setOverLink(this.GESTURES[this.directionChain] ? '手势: ' + this.directionChain + ' ' + this.GESTURES[this.directionChain].name : '未知手势:' + this.directionChain, null); //2、 setTimeout(() => XULBrowserWindow.statusTextField.label = '', 2000); //替换为 setTimeout(() => XULBrowserWindow.setOverLink('', null), 2000); //3、 document.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'canvas') //替换为 document.createElement('canvas') //4、删除所有的 .boxObject TabPlus.uc.js getAnonymousElementByAttribute(c, "class", "tabs-newtab-button"); //替换为 querySelector(".tabs-newtab-button, #tabs-newtab-button"); |
|
66楼#
发布于:2019-09-04 16:15
|
|
67楼#
发布于:2019-09-04 16:23
鼠标右键打开剪切板 连接的脚本
location.href.startsWith('chrome://browser/content/browser.x') && window.addEventListener("click", function (e) { if (e.button === 2 && e.originalTarget.matches(".tabs-newtab-button")) { let url = readFromClipboard(); try { switchToTabHavingURI(url, true); } catch (ex) { var reg = /[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+\.?/; if (!reg.test(url)) { url = 'https://www.baidu.com/s?wd=' + encodeURIComponent(url); } else { if (url.substring(4, 0).toLowerCase() == "http") { url = encodeURIComponent(url); } else { url = 'http://' + encodeURIComponent(url); } } switchToTabHavingURI(url, true); } e.preventDefault(); e.stopPropagation(); } }, false);请大神帮忙修改,哪里有错误? |
|
68楼#
发布于:2019-09-04 16:43
求助lonely_8老大,在69无法排除about:blank和about:newtab 了
(function() { // 新标签打开:主页按钮(排除about:blank和about:newtab) try { eval("BrowserHome = " + BrowserHome.toString() .replace(/switch \(where\) {/, "where = (gBrowser.currentURI.spec!="+"'about:blank' && gBrowser.currentURI.spec!="+"'about:newtab' || gBrowser.webProgress.isLoadingDocument"+") ? 'tab' : 'current'; $&")); }catch(e){} })(); |
|
69楼#
发布于:2019-09-04 16:49
|
|
70楼#
发布于:2019-09-04 20:48
zhouhuajdsh:求助lonely_8老大,在69无法排除about:blank和about:newtab 了gBrowser.webProgress.isLoadingDocument 替换为 ['busy', 'pending'].some(attr => gBrowser.selectedTab.hasAttribute(attr)) @anywlan #67 楼,没发现有问题。 |
|
71楼#
发布于:2019-09-06 21:15
|
|
72楼#
发布于:2019-09-06 22:18
zhouhuajdsh:老大,在隐私窗口图标显示和右键功能不正常回到原帖删除 if(document.getElementById('undoclosetab-button')) return; 这一行,在 CustomizableUI.createWidget({ 的前面加上 if(!document.getElementById('undoclosetab-button')) 在 .replace(/\.undoTabMenu/g, '') 的后面加上 .replace('window', 'uCTBtn.ownerGlobal') |
|
73楼#
发布于:2019-09-06 23:26
|
|
74楼#
发布于:2019-09-07 14:43
图片:微信截图_20190907143914.png ![]() 你好,我想请教一下【AnotherButton.uc】脚本的问题,我首先依据你的说法,将xul等能改的都改了,但是有个问题,就是克隆这个历史记录的时候,会无端端多出重复的一节,以前FF67的时候是好好的。 因为代码太长,这里就不贴出来,而是以附件形式,附件里含有AnotherButton.uc脚本和_anoBtn配置文件,不知要怎么样才能修复呢?谢谢! |
|
|