marb
非常火狐
非常火狐
  • UID56238
  • 注册日期2017-12-25
  • 最后登录2023-04-12
  • 发帖数894
  • 经验1041枚
  • 威望0点
  • 贡献值1150点
  • 好评度50点
阅读:2074回复:6

正式版升级到62后uc失效了

楼主#
更多 发布于:2018-09-06 11:31
已经更新了https://github.com/Endor8/userChrome.js/tree/master/userChrome但依旧无效。不知道那个参数有变化请知道的告诉一下



//右键关闭标签页
    gBrowser.tabContainer.addEventListener("click",
    function(event) {
        if (event.target.localName == "tab" && event.button == 2 && !event.ctrlKey) {
            gBrowser.removeTab(event.target);
            event.stopPropagation();
            event.preventDefault();
        }
    },
false);





//双击左键刷新
    gBrowser.tabContainer.addEventListener("dblclick",
    function(event) {
        if (event.target.localName == "tab" && event.button == 0 && !event.ctrlKey) {
            gBrowser.reloadTab(event.target);
            event.stopPropagation();
            event.preventDefault();
        }
    },
false);

// ==UserScript==
// @name         Mouse Gestures (with Wheel Gesture and Rocker Gesture)
// @namespace    http://www.xuldev.org/
// @description  轻量级鼠标手势执行命令.
// @include      main
// @author       Gomita
// @version      1.0.20080201
// @homepage     http://www.xuldev.org/misc/ucjs.php
// ==/UserScript==

var ucjsMouseGestures = {

    // about:config
    enableWheelGestures: true,    // 滚轮手势 (Scroll wheel with holding right-click)
    enableRockerGestures: true,    // 摇杆手势 (Left-click with holding right-click and vice versa)

    _lastX: 0,
    _lastY: 0,
    _directionChain: "",
    _isMac: false,    // for Mac

    init: function()
    {
        this._isMac = navigator.platform.indexOf("Mac") == 0;
        gBrowser.tabpanels.addEventListener("mousedown", this, false);
        gBrowser.tabpanels.addEventListener("mousemove", this, false);
        gBrowser.tabpanels.addEventListener("mouseup", this, false);
        gBrowser.tabpanels.addEventListener("contextmenu", this, true);
        if (this.enableRockerGestures)
            gBrowser.tabpanels.addEventListener("draggesture", this, true);
        if (this.enableWheelGestures)
            gBrowser.tabpanels.addEventListener("DOMMouseScroll", this, false);
    },

    uninit: function()
    {
        gBrowser.tabpanels.removeEventListener("mousedown", this, false);
        gBrowser.tabpanels.removeEventListener("mousemove", this, false);
        gBrowser.tabpanels.removeEventListener("mouseup", this, false);
        gBrowser.tabpanels.removeEventListener("contextmenu", this, true);
        if (this.enableRockerGestures)
            gBrowser.tabpanels.removeEventListener("draggesture", this, true);
        if (this.enableWheelGestures)
            gBrowser.tabpanels.removeEventListener("DOMMouseScroll", this, false);
    },

    _isMouseDownL: false,
    _isMouseDownR: false,
    _suppressContext: false,
    _shouldFireContext: false,    // for Linux

    handleEvent: function(event)
    {
        switch (event.type) {
            case "mousedown":
                if (event.button == 2) {
                    this._isMouseDownR = true;
                    this._suppressContext = false;
                    this._startGesture(event);
                    if (this.enableRockerGestures && this._isMouseDownL) {
                        this._isMouseDownR = false;
                        this._suppressContext = true;
                        this._directionChain = "L>R";
                        this._stopGesture(event);
                    }
                }
                else if (this.enableRockerGestures && event.button == 0) {
                    this._isMouseDownL = true;
                    if (this._isMouseDownR) {
                        this._isMouseDownL = false;
                        this._suppressContext = true;
                        this._directionChain = "L<R";
                        this._stopGesture(event);
                    }
                }
                break;
            case "mousemove":
                if (this._isMouseDownR) {
                    this._progressGesture(event);
                }
                break;
            case "mouseup":
                if ((this._isMouseDownR && event.button == 2) ||
                    (this._isMouseDownR && this._isMac && event.button == 0 && event.ctrlKey)) {
                    this._isMouseDownR = false;
                    if (this._directionChain)
                        this._suppressContext = true;
                    this._stopGesture(event);
                    if (this._shouldFireContext) {
                        this._shouldFireContext = false;
                        this._displayContextMenu(event);
                    }
                }
                else if (this.enableRockerGestures && event.button == 0 && this._isMouseDownL) {
                    this._isMouseDownL = false;
                }
                break;
            case "contextmenu":
                if (this._suppressContext || this._isMouseDownR) {
                    this._suppressContext = false;
                    event.preventDefault();
                    event.stopPropagation();
                    if (this._isMouseDownR) {
                        this._shouldFireContext = true;
                    }
                }
                break;
            case "DOMMouseScroll":
                if (this.enableWheelGestures && this._isMouseDownR) {
                    event.preventDefault();
                    event.stopPropagation();
                    this._suppressContext = true;
                    this._directionChain = "W" + (event.detail > 0 ? "+" : "-");
                    this._stopGesture(event);
                }
                break;
            case "draggesture":
                this._isMouseDownL = false;
                break;
        }
    },

    _displayContextMenu: function(event)
    {
        var evt = event.originalTarget.ownerDocument.createEvent("MouseEvents");
        evt.initMouseEvent(
            "contextmenu", true, true, event.originalTarget.defaultView, 0,
            event.screenX, event.screenY, event.clientX, event.clientY,
            false, false, false, false, 2, null
        );
        event.originalTarget.dispatchEvent(evt);
    },

    _startGesture: function(event)
    {
        this._lastX = event.screenX;
        this._lastY = event.screenY;
        this._directionChain = "";
    },

    _progressGesture: function(event)
    {
        var x = event.screenX;
        var y = event.screenY;
        var distanceX = Math.abs(x - this._lastX);
        var distanceY = Math.abs(y - this._lastY);
        // minimal movement where the gesture is recognized
        const tolerance = 10;
        if (distanceX < tolerance && distanceY < tolerance)
            return;
        // determine current direction
        var direction;
        if (distanceX > distanceY)
            direction = x < this._lastX ? "L" : "R";
        else
            direction = y < this._lastY ? "U" : "D";
        // compare to last direction 开始比较鼠标的方向
        var lastDirection = this._directionChain.charAt(this._directionChain.length - 1);
        if (direction != lastDirection) {
            this._directionChain += direction;
            StatusPanel._label = "\uFEFF\u9F20\u6807\u624B\u52BF:" + this._directionChain;
        }
        // save current position 记录鼠标的坐标
        this._lastX = x;
        this._lastY = y;
    },

    _stopGesture: function(event)
    {
        try {
            if (this._directionChain)
                this._performAction(event);
            StatusPanel._label = "";
        }
        catch(ex) {
            StatusPanel._label = ex;
        }
        this._directionChain = "";
    },

//-------------自定义函数------------//
    _performAction: function(event)
    {
        // 映射. 支持自定义
        switch (this._directionChain) {
//MouseGesTures默认鼠标手势

            
            //书签保存
            case "R" : document.getElementById('menu_bookmarkThisPage').doCommand(); break;
            //阅读
            case "L" :document.getElementById('reader-mode-button').click();; break;
            
            // 全文翻译
            case "D": gBrowser.loadURI("javascript:{d=document;b=d.body;o=d.createElement('scri'+'pt');o.setAttribute('src','https://translate.google.cn/translate_a/element.js?cb=googleTranslateElementInit');o.setAttribute('type','text/javascript');b.appendChild(o);v=b.insertBefore(d.createElement('div'),b.firstChild);v.id='google_translate_element';v.style.display='none';p=d.createElement('scri'+'pt');p.text='function%20googleTranslateElementInit(){new%20google.translate.TranslateElement({pageLanguage:%22%22},%22google_translate_element%22);}';p.setAttribute('type','text/javascript');b.appendChild(p);}void%200;");break;
             // 下载
            case "U": document.getElementById("Tools:Downloads").doCommand(); break;
            // 代理
            //case "RD": var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
            pref.setIntPref("network.proxy.type", pref.getIntPref("network.proxy.type") == 2 ? 5 : 2); break;
            //case "RU": var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
            pref.setIntPref("network.proxy.type", pref.getIntPref("network.proxy.type") == 1 ? 5 : 1); break;
                //\

                 //未知的手势
            default: throw "\uFEFF\u672A\u77E5\u7684\u9F20\u6807\u624B\u52BF\uFF1A" + this._directionChain;
        }
    }
};
// エントリポイント
ucjsMouseGestures.init();
window.addEventListener("unload", function(){ ucjsMouseGestures.uninit(); }, false);
风葶云
小狐狸
小狐狸
  • UID37938
  • 注册日期2011-12-08
  • 最后登录2023-08-29
  • 发帖数16
  • 经验47枚
  • 威望0点
  • 贡献值4点
  • 好评度2点
  • 社区居民
  • 忠实会员
1楼#
发布于:2018-09-06 15:30
下载https://github.com/Endor8/userChrome.js/blob/master/userChrome/Dateien/firefox-anpassungen.zip
分别复制。
现在我是找不到能用的addonpage.uc
etjim
火狐狸
火狐狸
  • UID30046
  • 注册日期2009-08-12
  • 最后登录2024-05-18
  • 发帖数161
  • 经验224枚
  • 威望0点
  • 贡献值56点
  • 好评度13点
  • 忠实会员
  • 社区居民
2楼#
发布于:2018-09-06 15:51
风葶云:下载https://github.com/Endor8/userChrome.js/blob/master/userChrome/Dateien/firefox-anpassungen.zip
分别复制。

现在我是找不到能用的addonpa...
回到原帖
正在使用这个https://bbs.kafan.cn/thread-2115246-1-1.html楼主提供的AddonsPage.uc.js
marb
非常火狐
非常火狐
  • UID56238
  • 注册日期2017-12-25
  • 最后登录2023-04-12
  • 发帖数894
  • 经验1041枚
  • 威望0点
  • 贡献值1150点
  • 好评度50点
3楼#
发布于:2018-09-06 16:53
不搞了,所有uc都删除,能用扩展的用扩展,不能用的慢慢适应。反正都说uc最终要消亡,只是时间问题。关闭标签用Rights to Close EX扩展代替,刷新用Vimium扩展按两次空格键代替。
ultrang
小狐狸
小狐狸
  • UID25988
  • 注册日期2008-08-26
  • 最后登录2024-04-20
  • 发帖数32
  • 经验22枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 社区居民
  • 忠实会员
4楼#
发布于:2018-09-11 00:42
不用UC脚本了,迟早要退休的,不如早点适应吧。
xhlslan
小狐狸
小狐狸
  • UID33375
  • 注册日期2010-07-10
  • 最后登录2024-05-17
  • 发帖数88
  • 经验66枚
  • 威望0点
  • 贡献值26点
  • 好评度5点
  • 社区居民
  • 忠实会员
5楼#
发布于:2018-10-20 09:16
在这里168楼看见了一非常有用的东西https://bbs.kafan.cn/thread-2115246-1-1.html

在config-prefs.js里加上这段参数:

    pref("general.config.sandbox_enabled", false);
tulip17
千年狐狸
千年狐狸
  • UID34021
  • 注册日期2010-09-17
  • 最后登录2024-05-14
  • 发帖数980
  • 经验678枚
  • 威望1点
  • 贡献值420点
  • 好评度51点
  • 社区居民
  • 忠实会员
6楼#
发布于:2019-04-25 12:27
xhlslan:在这里168楼看见了一非常有用的东西https://bbs.kafan.cn/thread-2115246-1-1.html

在config-prefs.js里加上这段参数:

    pref("general.config.s...
回到原帖
在火狐66的配置目录下的prefs.js添加这行无效,火狐一启动这行就被自动删除
游客

返回顶部