神剑山庄资源网 Design By www.hcban.com
可是那些破站点让人太郁闷了...不是弹出广告,就是满屏幕飘浮动广告....气死我了...

所以做了一个超简陋的浏览器,把页面中的 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;
        }
    }
}

function init(){
    i1.onkeydown=function(){ if(event.keyCode==13)n2(); }
    resizeWin();
    i1.focus();
    i1.select();
    if(session_exists(strSessionName)){ i1.value=session_get(strSessionName); n2(); }
    setInterval(checkMe,200);
}

function resizeWin(){
    document.getElementById("f1").style.height=document.body.clientHeight-25;
}

function n0(){
    n1(this.href);
    return(false);
}

function n1(str){
    i1.value=str;
    n2();
}

function n2(){
    str=i1.value;
    if(i1=="")return;
    if(!/^http:\/\//i.test(str))str="http://"+str;
    document.title="Book Viewer - Loading...";
    xp.open("get",str);
    xp.onreadystatechange=n22;
    xp.send("");
}

function n22(){
    var str;
    if(this.readyState==4){
        if(this.status==200){
            str=adodb_binary2string(this.getAttribute("responseBody"));
            str=str.replace(/<script[\s\S]+?\/script>/gi,"").replace(/<iframe[\s\S]+?\/iframe>/gi,"").replace(/on(load|mouseover|mouseout|mousemove|focus|blur|keydown|keyup|keypress|change|readystatechange|click|dblclick|mousewheel) *= *\"[\s\S]+?\"/gi,"");
            f1.document.open();
            f1.document.write("<base href=\""+i1.value.substring(0,i1.value.lastIndexOf("/")+1)+"\" \/>");
            try{
                f1.document.write(str);
            }catch(e){}
            f1.document.close();
            f1.document.body.focus();
            document.title="Book Viewer - Ready";
        }
    }
}

function cancelErr(){ return(true); }

html_encode=function(strV){
    return(strV.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/ /g,"&nbsp;").replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r\n/g,"<br>"));
}

function adodb_binary2string(b){
    var adodbStream=new ActiveXObject("ADODB.Stream"); 
    adodbStream.Type=1;//1=adTypeBinary
    adodbStream.Open();
    adodbStream.write(b);
    adodbStream.position=0;
    adodbStream.Type=2;
    adodbStream.charset="_autodetect_all";
    var re=adodbStream.readText();
    adodbStream=null;
    return(re);
}

function session_delete(strName){
    var str, reg, expt, dt;
    if(!session_exists(strName))return;
    strName=escape(strName);
    strValue="";
    dt=new Date();
    dt.setYear(1980);
    expt=";expires="+dt.toGMTString()+";";
    str=strName+"="+strValue+expt;
    document.cookie=str;
}

function session_get(strName){
    var str, reg;
    str=document.cookie;
    strName=escape(strName);
    reg=new RegExp(strName+"=([^;]+)");
    if(!reg.test(str))return;
    return(unescape(str.match(reg)[1]));
}

function session_set(strName,strValue,blnExpireAfterClose){
    var str, reg, expt, dt;
    strName=escape(strName);
    strValue=escape(strValue);
    dt=new Date();
    dt.setYear(2099);
    expt=blnExpireAfterClose?"":";expires="+dt.toGMTString()+";";
    str=strName+"="+strValue+expt;
    document.cookie=str;
}

function session_exists(strName){
    var str, reg;
    str=document.cookie;
    strName=escape(strName);
    reg=new RegExp(strName+"=(.+);?");
    if(!reg.test(str)){return(false);}else{return(true);}
}

function xmlhttp(){
    // declare all the private variable
    var aryArgu, aryOnPropertyChange_AttachedEvents, aryRequestHeaders, blnAsyn, objRequest, objSelf, objThat, strMethod, strProtocol, strToBeSend, strUID, strUrl;
    // declare all the private functions
    var defaultEvent_onreadystatechange, getXMLRequester, init, realEvent_onreadystatechange, uid;

    
    // declare public variable
    this.blnSendDefaultHeader=false;
    this.readyState=0;
    this.responseText="";
    this.responseXML="";
    this.status=-1;

    // public event
    this.onreadystatechange=defaultEvent_onreadystatechange;

    // public method
    this.attachEvent=function(eventHandle,functionHandle){
        var eventHandle=String(eventHandle).toLowerCase();
        switch(eventHandle){
            case "onreadystatechange":
                if(this.onreadystatechange!=defaultEvent_onreadystatechange){
                    this.onreadystatechange=defaultEvent_onreadystatechange;
                    aryOnPropertyChange_AttachedEvents=new Array();
                }
                aryOnPropertyChange_AttachedEvents.push(functionHandle);
                return(true);
            break;
            default:
                return("Not reallized yet.");
            break;
        }
    }

    this.deleteRequestHeader=function(strName){
        delete aryRequestHeaders[strName];
    }

    this.detachEvent=function(eventHandle,functionHandle){
        var eventHandle=String(eventHandle).toLowerCase();
        switch(eventHandle){
            case "onreadystatechange":
                if(this.onreadystatechange!=defaultEvent_onreadystatechange){
                    this.onreadystatechange=defaultEvent_onreadystatechange;
                    aryOnPropertyChange_AttachedEvents=new Array();
                    return(true);
                }
                for(var i=0;i<aryOnPropertyChange_AttachedEvents.length;i++){
                    if(aryOnPropertyChange_AttachedEvents[i]==functionHandle){
                        aryOnPropertyChange_AttachedEvents.splice(i,1);
                        break;
                    }
                }
                return(true);
            break;
            default:
                return("Not reallized yet.");
            break;
        }
    }

    this.flush=function(){
        try{ this.readyState=objRequest.readyState; }catch(e){}
        try{ this.responseText=objRequest.responseText; }catch(e){}
        try{ this.responseXML=objRequest.responseXML; }catch(e){}
        try{ this.status=objRequest.status; }catch(e){}
    }

    this.getAllResponseHeaders=function(){
        return(objRequest.getAllResponseHeaders());
    }

    this.getAttribute=function(strName,strRef){
        switch(strName){
            case "allHeaders":
                return(objRequest.getAllResponseHeaders());
            case "asyn":
                return(blnAsyn);
            case "header":
                return(objRequest.getResponseHeader(strRef));
            case "method":
                return(strMethod);
            case "protocol":
                return(strProtocol);
            case "readyState":
                return(objRequest.readyState);
            case "responseBody":
                return(objRequest.responseBody);
            case "responseText":
                return(objRequest.responseText);
            case "responseXML":
                return(objRequest.responseXML);
            case "send": case "sendString": case "strSend":
                return(strToBeSend);
            case "status":
                return(objRequest.status);
            case "uid":
                return(strUID);
            case "url":
                return(strUrl);

            default:
                return(false);
        }
    }

    this.getResponseHeader=function(strHeaderName){
        return(objRequest.getResponseHeader(strHeaderName));
    }

    this.init=init;

    this.open=function(method,url,asyn){
        var theURL;
        strMethod=String(method).toLowerCase()=="POST"?"POST":"GET";
        strUrl=String(url);
        blnAsyn=String(asyn).toLowerCase()=="false"?false:true;
        strProtocol=strUrl.match(/http:\/\//i)?"http":"other";
        theURL=strUrl
        //if(strProtocol=="http")theURL=strUrl+(strUrl.indexOf(".")==-1?"\/":"")+(strUrl.indexOf("?")==-1?"?":"&")+uid()+"=true";
        objRequest.open(strMethod,theURL,blnAsyn);
    }

    this.reset=init;

    this.send=function(strSend){
        strToBeSend=String(strSend);
        for(var i in aryRequestHeaders){
            objRequest.setRequestHeader(i,aryRequestHeaders[i]);
        }
        if(this.blnSendDefaultHeader){
            objRequest.setRequestHeader("Content-Length",strToBeSend.length);
        }
        objRequest.onreadystatechange=realEvent_onreadystatechange;
        objRequest.send(strToBeSend);
    }

    this.setRequestHeader=function(strName,strValue){
        aryRequestHeaders[strName]=strValue;
    }

    // private functions
    function defaultEvent_onreadystatechange(){}

    function getXMLRequester(){
        var xmlhttp_request = false;
        try{
            if( window.ActiveXObject ){
                for( var i = 5; i > -1; i-- ){
                    try{
                        if( i == 2 ){
                            xmlhttp_request = new ActiveXObject( "Microsoft.XMLHTTP" );
                        }else{
                            xmlhttp_request = new ActiveXObject( "Msxml2.XMLHTTP." + i + ".0" );
                        }
                        break;
                    }catch(e){
                        xmlhttp_request = false;
                    }
                }
            }else if( window.XMLHttpRequest ){
                xmlhttp_request = new XMLHttpRequest();
            }
        }catch(e){
            xmlhttp_request = false;
        }
        return xmlhttp_request;
    }

    function init(){
        // init private variable
        aryArgu=new Array();
        aryOnPropertyChange_AttachedEvents=new Array();
        aryRequestHeaders=new Array();
        blnAsyn=true;
        objRequest=getXMLRequester();
        objSelf=this;
        objThat=this;
        strMethod="GET";
        strProtocol="unknown";
        strResponseText="";
        strToBeSend="";
        strUID=strUID?strUID:uid();
        strUrl="";
        // init public variable
        this.blnSendDefaultHeader=false;

        // regist this object to window
        window[strUID]=this;
    }

    function realEvent_onreadystatechange(){
        objThat.flush();
        if(objThat.onreadystatechange==defaultEvent_onreadystatechange){
            for(var i=0;i<aryOnPropertyChange_AttachedEvents.length;i++){
                try{
                    if(typeof(aryOnPropertyChange_AttachedEvents[i])=="function"){
                        aryOnPropertyChange_AttachedEvents[i].call(objThat);
                    }else if(typeof(aryOnPropertyChange_AttachedEvents[i])=="string"){
                        eval(aryOnPropertyChange_AttachedEvents[i]);
                    }
                }catch(e){alert("004"+e.description)}
            }
        }else{
            try{
                if(typeof(objThat.onreadystatechange)=="function"){
                    objThat.onreadystatechange();
                }else if(typeof(objThat.onreadystatechange)=="string"){
                    eval(objThat.onreadystatechange);
                }
            }catch(e){alert("005"+e.description)}
        }
    }

    function uid(){
        return("u"+(new Date()).getTime().toString(35)+parseInt(Math.random()*999999).toString(35));
    }

    
    // do init
    this.init();

}




window.onload=init;
window.onresize=resizeWin;
window.onerror=cancelErr;
</script>
</head>
<body>
<input id="i1"><br>
<iframe id="f1"></iframe>
</body>    
标签:
超简陋浏览器

神剑山庄资源网 Design By www.hcban.com
神剑山庄资源网 免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
神剑山庄资源网 Design By www.hcban.com

评论“超简陋浏览器”

暂无超简陋浏览器的评论...

《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线

暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。

艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。

《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。