主頁 > 知識庫 > 用來通知論壇有新貼子的hta代碼

用來通知論壇有新貼子的hta代碼

熱門標簽:服務器配置 鐵路電話系統(tǒng) 網(wǎng)站文章發(fā)布 呼叫中心市場需求 銀行業(yè)務 美圖手機 智能手機 檢查注冊表項
做了個用來通知論壇有新貼子的hta

把下面的代碼copy到本地另存為hta雙擊就可以執(zhí)行了,出現(xiàn)新帖子會在右下角冒個窗口出來通知,10s后自動關(guān)閉通知窗口
復制代碼 代碼如下:

html>
head>
title>Blue Idea Board Watcher - By Hutia/title>
!-- 程序設(shè)置,如果希望程序在任務欄顯示,請將showintaskbar改為yes -->
hta:application id="app1" singleinstance="yes" contextmenu="yes"
 sysmenu="yes" windowstate="normal" maximizeButton="no" minimizeButton="yes"
 applicationName="BlueIdeaBoardWatcher" version="1.0" innerBorder="no"
 caption="yes" showintaskbar="no" border="thin" />
!-- 語種 gb2312 -->
meta http-equiv="content-type" content="text/html; charset="gb2312"> 
!-- 樣式表 -->
style>
body, td {
    margin:0px;
    padding:5px;
    overflow:auto;
    font-size:12px;
}

h3 {
    font-size:14px;
}

iframe {
    display:none;
}
/style>
script>
//******全局變量區(qū)*****
// 經(jīng)典論壇 > Dreamweaver  Javascript專欄
url="http://bbs.blueidea.com/forumdisplay.php?fid=1";

// 刷新間隔 10s
intervals=10000;

//初始化組件
try{
    var xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    var adodbStream=new ActiveXObject("ADOD"+"B.St"+"ream");
}catch(e){
    document.write("h3>加載失敗,組件被禁止/h3>");
}

thisDomain=location.href.substring(0,location.href.lastIndexOf("\/"));
//將上次訪問的結(jié)果保存在ree中用來與下次作對比
ree=new Array();
//用于判斷是否初始化完畢的變量
inited=false;
//保存打開的窗口的數(shù)組
theWin=new Array();

//初始化函數(shù)
function init(){
    startCheck();
}

//發(fā)送get請求
function startCheck(){
    xmlHttp.open("get",url,true);
    xmlHttp.send();
    xmlHttp.onreadystatechange=checkState;
}

//確認xmlHttp返回的結(jié)果
function checkState(){
    if (xmlHttp.readyState==4){
        if (xmlHttp.status==200){
            //解碼獲得返回值
            var strHTML=b2s(xmlHttp.responseBody);
            var iStart=strHTML.search(/table cellspacing=0 cellpadding=0 width="99%" border=0>/i);
            var iEnd=strHTML.indexOf("\r\n\/table>\r\n",iStart);
            strHTML=strHTML.substring(iStart,iEnd);
            try{
                f1.document.open();
                f1.document.clear();
                f1.document.write(strHTML);
                f1.document.close();
            }catch(e){}
            //將返回值中的鏈接改成絕對地址
            for(var i=0;if1.document.links.length;i++){
                f1.document.links[i].href=f1.document.links[i].href.replace(thisDomain,"http://www.blueidea.com/bbs");
            }
            var result=new Array();
            try{
                var theTable=f1.document.all.tags("TABLE")[1];
                for(var i=1;itheTable.rows.length;i++){
                    strU=theTable.rows[i].cells[3].firstChild.href;
                    strT=theTable.rows[i].cells[3].firstChild.innerHTML;
                    strC=theTable.rows[i].cells[6].innerText;
                    if(inited){
                        if(ree[strU]!=strC){
                            ree[strU]=strC;
                            result[strU]=strT;
                        }
                    }else{
                        ree[strU]=strC;
                    }
                }
                inited=true;
                for(var i in result){
                    popupWin(i,result[i]);
                }
            }catch(e){}
        }
        setTimeout(startCheck,intervals);
        return(false);
    }
}

//彈出窗口
function popupWin(strURL,strText){
    var mx=screen.availWidth;
    var my=screen.availHeight;
    var w=200;
    var h=150;

    theRow=d1.insertRow(0);
    theCell=theRow.insertCell();
    theCell.innerHTML="li>a target=\"_blank\" href=\""+strURL+"\">"+strText+"/a>";

    strHTML="html>head>title>"+strText+"/title>";
    strHTML+="style>body{margin:0px;padding:6px;background-Color:#D0FFD0;overflow:auto;}\r\n";
    strHTML+="div{width:100%;height:100%;overflow:hidden;text-overflow:ellipsis;";
    strHTML+="text-indent:12px;border:#999 1px solid;cursor:hand;color:#005500;}/style>";
    strHTML+="body onload=\"setTimeout('window.close();',10000);\">";
    strHTML+="div onclick=\"window.open('"+strURL+"');window.close();\">";
    strHTML+=strText;
    strHTML+="/div>/body>/html>";
    for(var i=0;itheWin.length;i++){
        if(theWin[i].closed){
            var n=parseInt(my/120);
            var l=parseInt(i/n)+1;
            var strModal="dialogWidth="+w+"px;dialogHeight="+h+"px;dialogLeft="+(mx-w*l)+"px;dialogTop="+(my-h*(i%n+1));
            theWin[i]=showModelessDialog("about:blank",strText,strModal);
            theWin[i].document.open();
            theWin[i].document.clear();
            theWin[i].document.write(strHTML);
            theWin[i].document.close();
            theWin[i].focus();
            return(false);
        }
    }
    var n=parseInt(my/120);
    var l=parseInt(i/n)+1;
    var strModal="dialogWidth="+w+"px;dialogHeight="+h+"px;dialogLeft="+(mx-w*l)+"px;dialogTop="+(my-h*(i%n+1));
    theWin[i]=showModelessDialog("about:blank",strText,strModal);
    theWin[i].document.open();
    theWin[i].document.clear();
    theWin[i].document.write(strHTML);
    theWin[i].document.close();
    theWin[i].focus();
    return(false);
}

function b2s(b){
    adodbStream.Type=1;//1=adTypeBinary
    adodbStream.Open();
    adodbStream.write(b);
    adodbStream.position=0;
    adodbStream.Type=2;
    adodbStream.charset="gb2312";
    //adodbStream.charset="_autodetect_all";
    var re=adodbStream.readText();
    adodbStream.close();
    return(re);
}

window.attachEvent("onload",init);

/script>
/head>

body>
h3>Latest:/h3>
table id=d1>/table>
iframe id="f1">/iframe>
/body>
/html>

標簽:新疆 上海 長治 樂山 紅河 河南 滄州 沈陽

巨人網(wǎng)絡(luò)通訊聲明:本文標題《用來通知論壇有新貼子的hta代碼》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266