超簡陋瀏覽器
2024-08-26 00:15:50
供稿:網友
可是那些破站點讓人太郁悶了...不是彈出廣告,就是滿屏幕飄浮動廣告....氣死我了...
所以做了一個超簡陋的瀏覽器,把頁面中的 JS 基本上全禁掉了(禁用JS的正則不是很好,此外CSS里的沒禁掉,不過目前反正夠俺用就好了),順便把 iframe 也全部干掉
還可以自動記得上次瀏覽的頁面,打開就直接進入,看書的時候就不怕打斷了
因為超簡陋,所以連 表單也不支持,只支持鏈接,哈哈,看書倒是夠用了....
代碼中的 偽session 處理 和 俺自己封裝的 xmlhttp 值得一看
不能直接運行,保存到本地,另存為 HTA 使用,哈哈
代碼如下:
<head>
<title>Book Viewer</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<style>
body { margin:0px; padding:0px; overflow:auto; border-style:none; font-size:12px; background-color:buttonface; }
iframe { width:100%; border-style:none; position:absolute; top:25px; }
#i1 { height:22px; line-height:18px; width:100%; border:1px solid #666; margin:0px 2px; padding:0px 10px; }
</style>
<script>
strSessionName="bookviewer_lastURL";
lastURL="";
xp=new xmlhttp();
function checkMe(){
if(i1.value!=lastURL){
lastURL=i1.value;
session_set(strSessionName,lastURL);
}
try{
for(var i=0;i<f1.document.links.length;i++)f1.document.links[i].onclick=n0;
}catch(e){}
if(/book/.5seecn/i.test(lastURL))f1.document.body.onkeydown=chkKey;
}
function chkKey(){
var allLinks;
if(f1.event.keyCode==39){
allLinks=f1.document.links;
for(var i=0;i<allLinks.length;i++)if(/下一頁/.test(allLinks[i].innerHTML)){
i1.value=allLinks[i].href; n2(); return;
}
}else if(f1.event.keyCode==37){
allLinks=f1.document.links;
for(var i=0;i<allLinks.length;i++)if(/上一頁/.test(allLinks[i].innerHTML)){
i1.value=allLinks[i].href; n2(); return;