• js


    !function(){
      var saf;
      ;(function(){
        var $toString = Function.toString
          , cacheI = []
          , cacheS = []
          , idxI = [].indexOf.bind(cacheI)
          , pushI = [].push.bind(cacheI)
          , pushS = [].push.bind(cacheS)
        Object.defineProperty(Function.prototype, 'toString', {
          "enumerable": !1, "configurable": !0, "writable": !0,
          "value": function toString() {
            return typeof this == 'function' && cacheS[idxI(this)] || $toString.call(this);
          }
        })
        function safe_func(func, name){
          if (-1 == idxI(func)){
            pushI(func)
            pushS(`function ${name || func.name || ''}() { [native code] }`)
          }
          return func
        };
        safe_func(Function.prototype.toString, 'toString')
        saf = safe_func
      })();
      window.vilame_getter = window.vilame_getter || {}
      !function(){
        // hook ajax
        try{ var _desc = Object.getOwnPropertyDescriptors(XMLHttpRequest.prototype).open; window.vilame_getter.v_open = _desc.value }catch(e){ return }
        var _new_val = saf(function open(){
          return window.vilame_getter.v_open.apply(this, arguments)
        })
        try{ Object.defineProperty(XMLHttpRequest.prototype, 'open', { value: _new_val, enumerable: _desc['enumerable'], configurable: _desc['configurable'], writable: _desc['writable'], }) }catch(e){  }
      }();
      !function(){
        try{ var _desc = Object.getOwnPropertyDescriptors(XMLHttpRequest.prototype).send; window.vilame_getter.v_send = _desc.value }catch(e){ return }
        var _new_val = saf(function send(){
          return window.vilame_getter.v_send.apply(this, arguments)
        })
        try{ Object.defineProperty(XMLHttpRequest.prototype, 'send', { value: _new_val, enumerable: _desc['enumerable'], configurable: _desc['configurable'], writable: _desc['writable'], }) }catch(e){  }
      }();
      !function(){
        try{ var _desc = Object.getOwnPropertyDescriptors(XMLHttpRequest.prototype).setRequestHeader; window.vilame_getter.v_setRequestHeader = _desc.value }catch(e){ return }
        var _new_val = saf(function setRequestHeader(){
          return window.vilame_getter.v_setRequestHeader.apply(this, arguments)
        })
        try{ Object.defineProperty(XMLHttpRequest.prototype, 'setRequestHeader', { value: _new_val, enumerable: _desc['enumerable'], configurable: _desc['configurable'], writable: _desc['writable'], }) }catch(e){  }
      }();
      !function(){
        try{ var _desc = Object.getOwnPropertyDescriptors(HTMLFormElement.prototype).submit; window.vilame_getter.v_submit = _desc.value }catch(e){ return }
        var _new_val = saf(function submit(){
          return window.vilame_getter.v_submit.apply(this, arguments)
        })
        try{ Object.defineProperty(HTMLFormElement.prototype, 'submit', { value: _new_val, enumerable: _desc['enumerable'], configurable: _desc['configurable'], writable: _desc['writable'], }) }catch(e){  }
      }()
      !function(){
        try{ var _desc = Object.getOwnPropertyDescriptors(Element.prototype).setAttribute; window.vilame_getter.v_setAttribute = _desc.value }catch(e){ return }
        var _new_val = saf(function setAttribute(){
          return window.vilame_getter.v_setAttribute.apply(this, arguments)
        })
        try{ Object.defineProperty(Element.prototype, 'setAttribute', { value: _new_val, enumerable: _desc['enumerable'], configurable: _desc['configurable'], writable: _desc['writable'], }) }catch(e){  }
      }()
      !function(){
        // hook fetch
        window.vilame_getter.v_fetch = window.fetch
        window.fetch = saf(function fetch(){
          return window.vilame_getter.v_fetch.apply(this, arguments)
        })
        window.vilame_getter.v_Request = function(){}
        window.Request = function(_Request) {
          var bind = Function.bind;
          var unbind = bind.bind(bind);
          function instantiate(constructor, args) {
            return new (unbind(constructor, null).apply(null, args));
          }
          var names = Object.getOwnPropertyNames(_Request);
          for (var i = 0; i < names.length; i++) {
            if (names[i]in Request)
              continue;
            var desc = Object.getOwnPropertyDescriptor(_Request, names[i]);
            Object.defineProperty(Request, names[i], desc);
          }
          function Request(url, config) {
            window.vilame_getter.v_Request(arguments)
            return instantiate(_Request, arguments)
          }
          Request.prototype = _Request.prototype
          return saf(Request);
        }(Request);
      }()
    }()
  • 相关阅读:
    (4.7)怎么捕获和记录SQL Server中发生的死锁?
    SQLSERVER排查CPU占用高的情况
    (4.6)sql server索引缺失提示
    (4.14)向上取整、向下取整、四舍五入取整的实例
    mysql大致学习路径
    (2)linux未使用eth0,未使用IPV4导致无法连接
    (4.13)sql server参数嗅探(parameter sniffing)
    完美女人
    关于box-sizing
    什么是担当
  • 原文地址:https://www.cnblogs.com/angdh/p/16445115.html
Copyright © 2020-2023  润新知