阅读:5974回复:26
火狐63b4测试版帮忙修复一下脚本谢谢了!keys['Ctrl+Shift+c'] = function(event) { gBrowser.selectedTab = gBrowser.addTab(readFromClipboard());}; //打开剪切板中的网址谢谢大家帮忙修复一下!! |
|
1楼#
发布于:2018-09-09 20:55
63 后 gBrowser.addTab 、gBrowser.loadOneTab 之类的要加多一个参数。
gBrowser.addTab(readFromClipboard()); 改为 gBrowser.addTab(readFromClipboard(), { triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}) }); |
|
2楼#
发布于:2018-09-10 08:56
|
|
3楼#
发布于:2018-09-10 12:25
//关闭标签页后选择左侧标签
(function () { gBrowser.tabContainer.addEventListener("TabClose", tabCloseHandler, false); function tabCloseHandler(event) { var tab = event.target; gBrowser.selectedTab = tab; if (gBrowser.mCurrentTab._tPos != 0) { gBrowser.tabContainer.advanceSelectedTab(-1, true); } } })(); // 紧邻当前标签新建标签页 (function(){try{if(!gBrowser)return}catch(e){return}gBrowser.tabContainer.addEventListener("TabOpen",tabOpenHandler,false);function tabOpenHandler(event){var tab=event.target;gBrowser.moveTabTo(tab,gBrowser.mCurrentTab._tPos+1)}})(); 最新64夜版不起作用了,同求大神修复下 |
|
4楼#
发布于:2018-09-10 12:58
aunsen://关闭标签页后选择左侧标签第二個不用腳本直接修改config就行了 https://www.firefox.net.cn/read-76478 |
|
5楼#
发布于:2018-09-10 14:54
hdd60311:第二個不用腳本直接修改config就行了谢谢,现在就差关闭返回左边了,希望官方赶紧开发api吧,现在的左右扩展都要闪一下右边再返回左边,郁闷的不行 |
|
6楼#
发布于:2018-09-10 16:07
|
|
7楼#
发布于:2018-09-10 16:42
lonely_8:mCurrentTab 改为 selectedTab回到原帖有效,谢谢还有就是鼠标手势也不能用,手势扩展各种不爽,大大看看能修复不 (() => { 'use strict'; let ucjsMouseGestures = { lastX: 0, lastY: 0, directionChain: '', isMouseDownL: false, isMouseDownR: false, hideFireContext: false, shouldFireContext: false, GESTURES: { 'LU': {name: '转到页首', cmd: () => goDoCommand('cmd_scrollTop')}, 'LD': {name: '转到页尾', cmd: () => goDoCommand('cmd_scrollBottom')}, 'L': {name: '后退', cmd: () => getWebNavigation().canGoBack && getWebNavigation().goBack()}, 'R': {name: '前进', cmd: () => getWebNavigation().canGoForward && getWebNavigation().goForward()}, 'RUD': {name: '最小化窗口', cmd: () => window.minimize()}, 'LDR': {name: '最大化/恢复窗口', cmd: () => window.windowState == 1 ? window.restore() : window.maximize()}, 'DR': {name: '关闭标签页', cmd: () => gBrowser.removeCurrentTab()}, 'LR': {name: '打开新标签', cmd: () => BrowserOpenTab()}, 'RL': {name: '恢复关闭的标签页', cmd: () => undoCloseTab()}, 'UD': {name: '刷新页面', cmd: () => gBrowser.mCurrentBrowser.reload()}, 'UDU': {name: '跳过缓存刷新标签页', cmd: () => BrowserReloadSkipCache()}, 'RDR': {name: '打开历史窗口(侧边栏)', cmd: function(event) {SidebarUI.toggle("viewHistorySidebar"); }}, 'UL': {name: '激活左边标签页', cmd: () => gBrowser.tabContainer.advanceSelectedTab(-1, true)}, 'UR': {name: '激活右边标签页', cmd: () => gBrowser.tabContainer.advanceSelectedTab(+1, true)} }, init: function() { let self = this; ['mousedown', 'mousemove', 'mouseup', 'contextmenu', 'DOMMouseScroll'].forEach(type => { gBrowser.mPanelContainer.addEventListener(type, self, true); }); gBrowser.mPanelContainer.addEventListener('unload', () => { ['mousedown', 'mousemove', 'mouseup', 'contextmenu', 'DOMMouseScroll'].forEach(type => { gBrowser.mPanelContainer.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.createElement('hbox'); let canvas = document.createElementNS('http://www.w3.org/1999/xhtml', '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 = '#3133FF'; this.xdTrailAreaContext.lineJoin = 'round'; this.xdTrailAreaContext.lineCap = 'round'; this.xdTrailAreaContext.lineWidth = 4; 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(); })(); |
|
8楼#
发布于:2018-09-10 16:57
|
|
9楼#
发布于:2018-09-10 17:36
lonely_8:mPanelContainer、mCurrentBrowser、XULBrowserWindow.statusTextField.label请问这个脚本如何修复呢?在ff63b4上失效了,请指教一下。 // ==UserScript== // @name newTabByLongPress.uc.js // @description Lesezeichen mit länger gedrückter Linken Maustaste in neuem Tab öffnen // @include main // @version 0.8.4 Nur bei Lesezeichen ändern // @version 0.8.3 Link-Korrekturen // @version 0.8.2 Für Links aber nicht von Bildern // @version 0.8.1 Timer-Korrektur // ==/UserScript== (function () { 'use strict'; const WAIT = 250; // Zeitspanne die die Maustaste gedrückt werden muss, in Millisekunden const IN_BACKGROUND = true; // Tab im Hintergrund öffnen const RELATED_TO_CURRENT = true; // Link oder Lesezeichen direkt neben dem aktuellen Tab öffnen? var timeoutID; var longPress = false; function handleLongPress (e) { if (timeoutID) { clearTimeout(timeoutID); timeoutID = null; } if (e.button !== 0) return; if (e.altKey || e.ctrlKey || e.shiftKey) return; var node = e.target || e.originalTarget; if (!node) return; var url = getPlacesURI(e, node); if (!url) return; if (e.type === 'mousedown') { timeoutID = setTimeout(function () { addEventListener('click', function clk(e) { removeEventListener('click', clk, true); e.preventDefault(); e.stopPropagation(); }, true); gBrowser.loadOneTab(url, { relatedToCurrent: RELATED_TO_CURRENT, inBackground: IN_BACKGROUND, referrerURI: makeURI(gBrowser.currentURI.spec) }); longPress = true; }, WAIT); } else { clearTimeout(timeoutID); if (longPress && e.type === 'mouseup') { e.preventDefault(); longPress = false; } } } function getPlacesURI (e, node) { if (!node || !node.localName) return; var lnlc = node.localName.toLowerCase(); if (node._placesNode && PlacesUtils.nodeIsURI(node._placesNode) || (lnlc === 'treechildren' && (isBookmarkTree(node.parentNode) || isHistoryTree(node.parentNode)))) { return (lnlc === 'treechildren') ? getTreeInfo(e, 'uri') : node._placesNode.uri; } } function getTreeInfo (e, prop) { if (!('PlacesUtils' in window)) return ''; var tree = (e.target || e.originalTarget).parentNode; tree = tree.wrappedJSObject || tree; var row = {}, col = {}, obj = {}; var tbo = tree.treeBoxObject; tbo.getCellAt(e.clientX, e.clientY, row, col, obj); if (row.value === -1) return ''; try { var node = tree.view.nodeForTreeIndex(row.value); } catch(ex) {} if (!node || !PlacesUtils.nodeIsURI(node)) return ''; return node[prop]; } function isBookmarkTree(tree) { return isPlacesTree(tree) && /[:&]folder=/.test(tree.getAttribute("place")); } function isHistoryTree(tree) { if(!isPlacesTree(tree)) return false; var place = tree.getAttribute("place"); return !/[:&]folder=/.test(place) && !/[:&]transition=7(?:&|$)/.test(place); } function isPlacesTree(tree) { return tree.getAttribute("type") === "places"; } ['mousedown', 'mouseup', 'dragstart'].forEach(function (type) { addEventListener(type, handleLongPress, true); }); }()); |
|
10楼#
发布于:2018-09-10 17:42
脚本某天就会全部失效,还是尽早抛弃,我已经把脚本全删除了。尤其那个双击标签刷新非常好用,现在非常不习惯,因为脚本可以去除一些内页的限制,比如链接失败之类的,都可以使用,现在只能按f5了。
|
|
11楼#
发布于:2018-09-10 17:59
|
|
12楼#
发布于:2018-09-10 20:25
|
|
13楼#
发布于:2018-09-10 21:27
lonely_8:和楼主的失效原因问题一样。亲测有效,谢谢大大的帮忙,但下面这个脚本加上了也没有生效,请问又如何修改呢? // ==UserScript== // @name openLinkByLongPress.uc.js // @description Links in einem neuen Tab öffnen dazu linke Maustaste gedrückt halten // @include main // @version 0.0.1 Fx58 Kompatibel // ==/UserScript== (function() { 'use strict'; if (location != 'chrome://browser/content/browser.xul') { return; } const IN_BACKGROUND = true; // Tab in Hintergrund öffnen const RELATED_TO_CURRENT = true; // Link oder Lesezeichen neben dem aktuellen Tab öffnen? // WAIT = Wartezeit zum Öffnen in einem neuen Tab in Millisekunden let frameScript = function() { const WAIT = 300; let timeoutID; let longPress = false; ['mousedown', 'mouseup', 'dragstart'].forEach(function(type) { addEventListener(type, onClick, true); }); function onClick(event) { if (timeoutID) { clearTimeout(timeoutID); timeoutID = null; } if (event.button !== 0) return; if (event.altKey || event.ctrlKey || event.shiftKey) return; let node = event.target || event.originalTarget; if (!node) return; let url = findLink(node); if (!url) return; if (event.type === 'mousedown') { timeoutID = setTimeout(function() { addEventListener('click', function clk(event) { removeEventListener('click', clk, true); event.preventDefault(); event.stopPropagation(); }, true); sendAsyncMessage('openLinkByLongPress.uc.js', url.href); longPress = true; }, WAIT); } else { clearTimeout(timeoutID); if (longPress && event.type === 'mouseup') { event.preventDefault(); longPress = false; } } } function findLink(node) { if (!node || !node.tagName) { return null; } switch (node.tagName.toUpperCase()) { case 'A': return node; case 'AREA': if (node.href) { return node; } else { return findLink(node.parentNode); }; case 'B': case 'BIG': case 'CODE': case 'DIV': case 'EM': case 'H1': case 'I': case 'IMG': case 'NOBR': case 'P': case 'S': case 'SMALL': case 'SPAN': case 'STRONG': case 'SUB': case 'SUP': return findLink(node.parentNode); default: return null; }; } }; let frameScriptURI = 'data:,(' + frameScript.toString() + ')()'; window.messageManager.loadFrameScript(frameScriptURI, true); window.messageManager.addMessageListener('openLinkByLongPress.uc.js', function(message) { gBrowser.loadOneTab(message.data, { triggeringPrincipal: Services.scriptSecurityManager.createNullPrincipal({}), relatedToCurrent: RELATED_TO_CURRENT, inBackground: IN_BACKGROUND, referrerURI: makeURI(gBrowser.currentURI.spec) }); } ); }()); |
|
14楼#
发布于:2018-09-10 21:44
|
|
上一页
下一页