├── README.md └── proxyjs.js /README.md: -------------------------------------------------------------------------------- 1 | # 修改后的chromium浏览器 2 | 可以代理window,document 3 | 百度云 链接: 4 | 链接:https://pan.baidu.com/s/1t4cZJxOnLEIr9J17aBYrqw 5 | 提取码:bq4o 6 | window_tao_,document_tao_对象原来的window,document 7 | 一些浏览器的native方法需要 bind 到 window_tao_,document_tao_上 8 | 建议在无痕模式下使用比较稳定一些 普通模式下很容易崩溃,第一次编译的就没这个问题 9 | -------------------------------------------------------------------------------- /proxyjs.js: -------------------------------------------------------------------------------- 1 | 2 | window_tao_["filter_"] = ["HTMLIFrameElement","pageYOffset","pageXOffset","hidden","visibilityState","nodeName","createElement","activeElement"]; 3 | 4 | window_tao_["windownonnative"] = ["Object","Array","Function"]; 5 | 6 | window_tao_["documentnonnative"] = []; 7 | 8 | 9 | 10 | 11 | function proxyfuncwindow(name) { 12 | if (window_tao_.windownonnative.indexOf(name) !== -1) { 13 | return window_tao_[name]; 14 | } 15 | return window_tao_[name].bind(window_tao_); 16 | } 17 | 18 | function proxyfuncdoc(name) { 19 | if (window_tao_.documentnonnative.indexOf(name) !== -1) { 20 | return document_tao_[name]; 21 | } 22 | return document_tao_[name].bind(document_tao_); 23 | } 24 | 25 | 26 | window = new Proxy( 27 | window_tao_,{ 28 | get: function (a, b, c) { 29 | 30 | //过滤 31 | if (window_tao_.filter_.indexOf(b) !== -1) { 32 | if (typeof (window_tao_[b]) == "function") { 33 | return proxyfuncwindow(b); 34 | } 35 | return window_tao_[b]; 36 | } 37 | 38 | console.log("window-get---> ",b,"value ---> ",window_tao_[b]); 39 | //先判断是否为 function 40 | if (typeof (window_tao_[b]) == "function") { 41 | return proxyfuncwindow(b); 42 | } 43 | 44 | return window_tao_[b]; 45 | 46 | }, 47 | 48 | set:function (x,y,z){ 49 | console.log("window-set----> ",y,"value ---> ",z); 50 | window_tao_[y] = z; 51 | return true; 52 | } 53 | } 54 | ); 55 | 56 | 57 | document = new Proxy( 58 | document_tao_, { 59 | get: function (a, b, c) { 60 | 61 | //过滤 62 | if (window_tao_.filter_.indexOf(b) !== -1) { 63 | if (typeof (document_tao_[b]) == "function") { 64 | return proxyfuncdoc(b); 65 | } 66 | return document_tao_[b]; 67 | } 68 | 69 | console.log("document-get---> ", b, "value ---> ", window_tao_[b]); 70 | 71 | if (typeof (document_tao_[b]) == "function") { 72 | return proxyfuncdoc(b); 73 | } 74 | 75 | return document_tao_[b]; 76 | 77 | }, 78 | set: function (x,y,z) { 79 | console.log("document-set----> ",y,"value ---> ",z); 80 | document_tao_[y] = z; 81 | return true; 82 | } 83 | }); 84 | --------------------------------------------------------------------------------