14-05-21 11:39 AM
1
!function(){"use strict";var i,n="ws://127.0.0.1:",r={},s=void 0;function e(){s&&1===s.readyState&&s.send("PING")}function c(){if(!s&&void 0!==i){var e=new WebSocket(n+i+"/");e.onerror=function(){e.close()},e.onopen=function(){(s=e).onclose=function(){s=null},s.onerror=function(){s.close()}},e.onmessage=function(e){var n=JSON.parse(e.data),t=n.PageId;if(t){var a=r[t];a&&a.postMessage({message:n.Data})}}}}function d(e){var a={};return e.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(e,n,t){a[n]=t}),a}chrome.tabs.onUpdated.addListener(function e(n,t,a){if(null===a)return;var o=a.url;i=d(o).bpport;if(void 0===i)i="31924",c();else{var r=d(o).targetURL;d(o).browserType;chrome.tabs.onUpdated.removeListener(e),setTimeout(function(){chrome.tabs.update(a.id,{url:decodeURIComponent(r)},function(){}),c()},500)}}),setInterval(c,3e3),c(),setInterval(e,1e4),e(),chrome.runtime.onConnect.addListener(function(a){var o=a.name;a.onMessage.addListener(function(e){if(s&&1===s.readyState)if("makeConnection"===e.name){r[o]=a;var n={PageId:o,Data:"Page connected"};s.send(JSON.stringify(n))}else if("sendMessage"===e.name){var t={PageId:o,Data:e.message};s.send(JSON.stringify(t))}}),a.onDisconnect.addListener(function(e){var n=e.name;delete r[n];var t={PageId:n,Data:"Page disconnected"};s.send(JSON.stringify(t))})})}();
14-05-21 06:25 PM
04-06-21 03:39 AM
04-06-21 10:53 PM