zoukankan      html  css  js  c++  java
  • 禁止firefox 重定向脚本 武胜

    // ==UserScript==
    // @name           Google direct Link
    // @namespace      http://userscripts.org/users/tommy
    // @author         .
    // @description    remove google search and image link redirection to speed up your browsing and hide referrer
    // @include        *.google.*/*
    // @version        0.0.5
    // @run-at         document-start
    // ==/UserScript==


    var hideReferer = true,
        newTab = true,
        showCache = false;

    var ua = navigator.userAgent,
        wK = ua.toLowerCase().indexOf('webkit') > -1,
        S = location.protocol === 'https:';

    function addEvent(a, b, c) {
        if (a.addEventListener) {
            a.addEventListener(b, c, false);
        }
    }

    function removeEvent(a, b, c) {
        if (a.removeEventListener) {
            a.removeEventListener(b, c, false);
        }
    }

    if (Object.defineProperty) {
        Object.defineProperty(window, 'rwt', {
            value: function() {},
            writable: false,
            configurable: false
        })
    } else {
        window.__defineGetter__('rwt', function() {
            return function() {}
        })
    }

    if (showCache) {
        addEvent(window, 'DOMNodeInserted', cache);
    }

    function cache() {
        var cc = document.querySelectorAll('.vshid');
        if (cc) {
            for (var i = 0; i < cc.length; ++i) {
                cc[i].style.display = 'inline';
            }
        }
    }

    function proxy(e) {
        if (e && e.localName == 'a' && (e.className == 'l' || e.className == 'rg_l' || e.parentNode.className == 'vshid' || e.parentNode.className == 'gl')) {
            var m = /&imgurl=([^&]+)/.exec(e.href);
            if (m) e.href = m[1];
            if (newTab) e.target = "_blank";
            if (hideReferer) {
                if (wK) {
                    e.rel = "noreferrer";
                } else if (!S && e.href.indexOf('http-equiv="refresh"') == -1) {
                    e.href = 'data:text/html, <meta http-equiv="refresh" content="0;URL=' + encodeURIComponent(e.href) + '" charset="utf-8">';
                }
            }
        }
    }

    function doStuff(e) {
        var a = e.target;
        if (a.localName != 'a') {
            for (; a; a = a.parentNode){
                proxy(a);
            }
        } else {
            proxy(a);
        }
    }

    addEvent(window, "mousedown", doStuff);

  • 相关阅读:
    Echarts
    Django入门--模型系统(二):常用查询及表关系的实现
    Django入门--模型系统(一):模型基础
    Django入门--自定义过滤器与标签
    Django入门--模板标签、继承与引用
    Django入门--模板变量、过滤器及静态文件
    类的继承
    https://docs.python.org/3.6/library/index.html
    9*9
    赋值,浅复制,深复制
  • 原文地址:https://www.cnblogs.com/zeroone/p/2729117.html
Copyright © 2011-2022 走看看