-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
1 lines (1 loc) · 2.8 KB
/
index.html
1
<!doctypehtml><html><head><title>Page Sandbox</title><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"><base target=_blank><style>body{padding:0 .5em}.box{margin-top:1em}#txtURL{width:100%;height:2em;text-indent:.5em;padding:.25em 0}#btnGo{width:100%;font-size:1.5em}#list a{margin:1em}</style></head><body><div class=box><input id=txtURL value=www.google.com autofocus></div><div class=box><button id=btnGo disabled=disabled>初始化中...</button></div><div class=box><span>切换线路:</span> <select id=selNode disabled=disabled><option value=aliyun-hk>轻量云-香港(直连)</option><option value=aliyun-sg>轻量云-新加坡(直连)</option><option value=cf-aliyun-hk>轻量云-香港(CF 加速)</option><option value=cf-aliyun-sg>轻量云-新加坡(CF 加速)</option></select></div><div class=box id=list></div><script>var i=100,c=103,r=200,n=navigator.serviceWorker;function a(){return location.href.replace(/[^/]+$/,"/")}function e(){selNode.disabled=!1,n.addEventListener("message",function(t){var e=t.data,o=e[0],n=e[1];switch(o){case c:selNode.querySelector("*[value="+n+"]").selected=!0;break;case r:l(i),(new Image).src="https://www.google.com/favicon.ico"}})}function o(t){txtURL.value=t}function l(t,e){var o=n.controller;o?o.postMessage([t,e]):console.log("ctl is null")}btnGo.onclick=function(){var t=txtURL.value.trim();0<=t.indexOf("-----")&&(t=t.split("-----").pop(),txtURL.value=t),function o(t){var e=document.createElement("a");e.rel="noopener",e.href=t,e.click()}(function e(t){return a()+"-----"+t}(function n(t){return/^https?:\/\//i.test(t)?t:/\.(com|cn|net|org|tv)$/.test(t)?"https://"+t:"https://www.google.com/search?q="+encodeURIComponent(t)}(t)))},txtURL.onkeypress=function(t){13===t.keyCode&&btnGo.onclick()},txtURL.setSelectionRange(0,txtURL.value.length),selNode.onchange=function(){l(102,this.options[this.selectedIndex].value)};var t=[["google",""],["youtube",""],["twitter","twitter.com/google"],["flickr",""],["quora","www.quora.com/topic/JavaScript-programming-language"],["twitch","www.twitch.tv"],["reddit",""],["wiki","zh.wikipedia.org"],["gist","gist.github.com"],["facebook","facebook.com/Google/"],["blogger",""]];window.onload=function(){list.innerHTML=t.map(function(t){var e=t[0];return"<a rel=noopener href=/-----https://"+(t[1]||"www."+e+".com")+"><img width=128 height=128 src=ico/"+e+".png></a>"}).join("")},function s(){console.log("JsProxy v0.0.1 https://github.com/EtherDream/jsproxy/"),self.isSecureContext?n&&self.ReadableStream?(btnGo.disabled=!1,btnGo.textContent="Go",n.getRegistration().then(function(t){t?(e(),l(i)):n.register(a()+"x.js").then(e)["catch"](o)})):txtURL.value="浏览器版本过低,推荐使用最新版 Chrome 浏览器":txtURL.value="本程序需要 HTTPS 站点"}()</script></body></html>