查看: 3275|回复: 4
收起左侧

[可疑文件] 我遇到的一个可疑js文件

[复制链接]
skykitty
发表于 2009-6-23 23:41:41 | 显示全部楼层 |阅读模式
以下文件是我从互联网上面下载下来的,希望牛人能够分析一下,谢谢。

-----
Part 1 of 3

/*
embed ad
*/

var _hInterval = null;
var _hPInterval = null;
var _hShowWindow = null;
//350|280|5|2|2|3|10
var iWidth = 0;        //the width of the ad.
var iHeight = 0;       //the height of the ad.
var iPosition = 1;     //the position where the ad stay.
var iBorder = 1;       //the border style
var iShowType = 1;     //the way to display the ad
var iStartTime = 1;    //the delay time to show the ad
var iCloseTime = 10;   //the delay time to close the ad,when it's 0,don't need to close the ad by the programm

var isFirefox = false;
var isParent = false;
var isCreated = false;
var isLoaded  = false;
var isStartAdjust = false;   //whether to adjuct the ad in the parent window
var _hAdjustAd = null;

var  docHeight, docWidth, objTimer,posLeft = 0,posTop = 0;
///<summary>
///initialize relative parameters according to the user's settings
///</summary>
function getParams()
{
        var obj = param.split("|");
        try
        {
                iWidth = parseInt(obj[0],10);
                iHeight = parseInt(obj[1],10);
                iPosition = parseInt(obj[2],10);
                iBorder = parseInt(obj[3],10);
                iShowType = parseInt(obj[4],10);
                iStartTime = parseInt(obj[5],10);
                iCloseTime = parseInt(obj[6],10);
        }
        catch(e)
        {
                iWidth = 320;
                iHeight = 240;
                iPosition = 1;
                iBorder = 1;
                iShowType = 1;
                iStartTime = 3;
                iCloseTime = 0;
        }
}
this.$=function(objID){
        return document.getElementById(objID);
}
function closeWin()
{
        $("divContent").style.visibility = "hidden";
}
function closePWin()
{
        if(null != parent&&null != parent.document.getElementById("divContent")){               
                parent.document.getElementById("divContent").style.visibility = "hidden";       
        }
}
///<summary>
///create the div which contain the ad dynamically
///</summary>
///<param name=iType>1:no border; 2:qq style;3:sina style</param>
function createBorder(iType)
{       
        if(!isCreated)
        {
                if (navigator.userAgent.indexOf("Firefox")!=-1)
                {
                        isFirefox = true;
                }
               
                var _divContent = $("divContent");
                _divContent.style.position = "absolute";
                _divContent.style.top = "0";
                _divContent.style.visibility = "hidden";
                _divContent.style.zIndex = 99999;               

                var table = document.getElementById("tframe");               
                table.setAttribute("border","0");
                table.setAttribute("cellPadding","0");
                table.setAttribute("cellSpacing","0");
                table.setAttribute("bgColor","#ffffff");
               
                //no border
                if(iType == 1)
                {
                        //handle the title
                        var _divTitle = $("divTitle");
                        if(isFirefox)
                        {
                                _divTitle.addEventListener("click",closeWin,false);       
                        }
                        else
                        {
                                _divTitle.attachEvent("onclick",closeWin);
                        }       
                       
                        //handle the top row
                        var firstRow = table.rows[0];       
                        var cellLength = firstRow.cells.length;

                        for(var i=0;i<cellLength;i++)
                        {
                                var obj = firstRow.cells[0];               
                                obj.parentNode.removeChild(obj);
                        }       
                       
                        //handle the middle row
                        var midRow = table.rows[1];
                        cellLenght = midRow.cells.length;
                        for(var i=0;i<2;i++)
                        {
                                var obj = midRow.cells[0];                               
                                obj.parentNode.removeChild(obj);                               
                        }               
                       
                        midRow = table.rows[1];
                        for(var i=0;i<3;i++)
                        {                               
                                var obj = midRow.cells[1];                                       
                                obj.parentNode.removeChild(obj);

                        }
                        //alert(table.innerHTML);
                        var iframe = $("frmContent");
                        iframe.height = iHeight + "px";
                        iframe.width = iWidth + "px";
                        iframe.frameBorder = "0";                
                        iframe.scrolling = "auto"
                       
                        //handle the bottom row       
                        var botRow = table.rows[2]
                        for(var i=1;i<7;i++)
                        {                       
                                var obj = botRow.cells[0];                       
                                obj.parentNode.removeChild(obj);
                        }

                }
                //qq style
                if(iType == 2)
                {
       
                        var _divTitle = $("divTitle");
                        _divTitle.style.display = "none";
                        var iContentWidth = iWidth - 3 - 19 - 15 - 4;
                        var iContentHeight = iHeight - 24 - 4;

                        //handle the top row               
                        var firstRow = table.rows[0];
                        var td_16 = firstRow.cells[5];               
                        td_16.parentNode.removeChild(td_16);
                       
                        var td_11 = firstRow.cells[0];
                        td_11.setAttribute("width",3);
                        td_11.setAttribute("height",24);
                        td_11.setAttribute("background",base_url + "images/qqstyle_01.gif");

                        var td_12 = firstRow.cells[1];
                        td_12.setAttribute("width",iContentWidth);
                        td_12.setAttribute("height",24);
                        td_12.setAttribute("background",base_url + "images/qqstyle_02.gif");
                       
                        var td_13 = firstRow.cells[2];
                        td_13.setAttribute("align","left");
                        td_13.setAttribute("width",19);
                        td_13.setAttribute("background",base_url + "images/qqstyle_03.gif");
                       
                        var td_14 = firstRow.cells[3];
                        td_14.setAttribute("width",15);
                        td_14.setAttribute("height",24);
                        td_14.setAttribute("background",base_url + "images/qqstyle_04.gif")


                        if(isFirefox)
                        {
                                td_14.addEventListener("click",closeWin,false);       
                        }
                        else
                        {
                                td_14.attachEvent("onclick",closeWin);
                        }       
                       
                        var td_15 = firstRow.cells[4];
                        td_15.setAttribute("width",4);
                        td_15.setAttribute("height",24);
                        td_15.setAttribute("background",base_url + "images/qqstyle_05.gif");
                       
                        //handle the middle row
                        var midRow = table.rows[1];
                        var td_21 = midRow.cells[0];
                        var td_22 = midRow.cells[1];
                        var td_23 = midRow.cells[2];
                        var td_24 = midRow.cells[3];
                        var td_25 = midRow.cells[4];
                        var td_26 = midRow.cells[5];
                       
                        td_21.setAttribute("width",3);
                        td_21.setAttribute("bgColor","#bddefd");
                        td_21.setAttribute("height",iContentHeight);               
                       
                        td_23.setAttribute("colSpan",3);
                        var iframe = $("frmContent");
                        iframe.height = iHeight - 24 - 4 + "px";
                        iframe.width = iWidth - 3 - 4 + "px";
                        iframe.frameBorder = "0";                
                        iframe.scrolling = "auto";
                       
                        td_26.setAttribute("width",4)
                        td_26.setAttribute("bgColor","#bddefd")                       
                                               
                        td_22.parentNode.removeChild(td_22);
                        td_24.parentNode.removeChild(td_24);
                        td_25.parentNode.removeChild(td_25);
                       
                        //handle the bottom row
                        var botRow = table.rows[2];
                        var td_31 = botRow.cells[0];
                        for(var i=1;i<6;i++)
                        {                       
                                var obj = botRow.cells[1];                       
                                obj.parentNode.removeChild(obj);
                        }
                        td_31.setAttribute("colSpan",5);
                        td_31.setAttribute("height",5);               
                        td_31.setAttribute("bgColor","#bddefd");       
                       
                }
                //sina style
                if(iType == 3)
                {
                        var _divTitle = $("divTitle");
                        _divTitle.style.display = "none";
                        var iContentWidth = iWidth - 4 - 23 - 19 - 19 - 4;
                        var iContentHeight = iHeight - 27 - 4;
                       
                        //handle the top row
                        var firstRow = table.rows[0];
                        var td_11 = firstRow.cells[0];
                        var td_12 = firstRow.cells[1];
                        var td_13 = firstRow.cells[2];
                        var td_14 = firstRow.cells[3];
                        var td_15 = firstRow.cells[4];
                        var td_16 = firstRow.cells[5];
                       
                        td_11.setAttribute("width",4);
                        td_11.setAttribute("height",27);
                        td_11.setAttribute("background",base_url + "images/sinastyle_01.gif");
                       
                        td_12.setAttribute("width",iContentWidth);
                        td_12.setAttribute("height",27);
                        td_12.setAttribute("background",base_url + "images/sinastyle_02.gif");
                       
                        td_13.setAttribute("width",23);
                        td_13.setAttribute("height",27);
                        td_13.setAttribute("background",base_url + "images/sinastyle_03.gif");
                       
                        td_14.setAttribute("width",19);
                        td_14.setAttribute("height",27);
                        td_14.setAttribute("background",base_url + "images/sinastyle_04.gif");
                       
                        td_15.setAttribute("width",19);
                        td_15.setAttribute("height",27)
                        td_15.setAttribute("background",base_url + "images/sinastyle_05.gif");

                        if(isFirefox)
                        {
                                td_15.addEventListener("click",closeWin,false);       
                        }
                        else
                        {
                                td_15.attachEvent("onclick",closeWin);
                        }       

                        td_16.setAttribute("width",4);
                        td_16.setAttribute("height",27);
                        td_16.setAttribute("background",base_url + "images/sinastyle_06.gif");
                       
                        //handle the middle row               
                        var midRow = table.rows[1];
                        var td_21 = midRow.cells[0];
                        var td_22 = midRow.cells[1];
                        var td_23 = midRow.cells[2];
                        var td_24 = midRow.cells[3];
                        var td_25 = midRow.cells[4];
                        var td_26 = midRow.cells[5];

                       
                        td_21.setAttribute("width",4);
                        td_21.setAttribute("bgColor","#bddefd");
                        td_21.setAttribute("height",iContentHeight);
                       
                        td_23.setAttribute("colSpan","4");
                        var iframe = $("frmContent");
                        iframe.height = iHeight - 27 - 4 + "px";
                        iframe.width = iWidth - 4 - 4 + "px";
                        iframe.frameBorder = "0";
                        iframe.scrolling = "auto";       
                       
                        td_26.setAttribute("width","4px");
                        td_26.setAttribute("bgColor","#bddefd");                       
                                               
                        td_22.parentNode.removeChild(td_22);
                        td_24.parentNode.removeChild(td_24);
                        td_25.parentNode.removeChild(td_25);
                       
                        //handle the bottom row
                        var botRow = table.rows[2];
                        var td_31 = botRow.cells[0];
                        for(var i=1;i<6;i++)
                        {                       
                                var obj = botRow.cells[1];                       
                                obj.parentNode.removeChild(obj);
                        }
                        td_31.setAttribute("colSpan",6);
                        td_31.setAttribute("height",5);               
                        td_31.setAttribute("bgColor","#bddefd");               
                }       
                isCreated = true;
        }
}

[ 本帖最后由 skykitty 于 2009-6-23 23:43 编辑 ]
skykitty
 楼主| 发表于 2009-6-23 23:42:46 | 显示全部楼层
Part 2 of 3

function display(obj)
{
        var divContent = null;
        var _body = null;
       
        var type = parseInt(obj,10);
        //type when 1 means it's going to display the ad in the parent
        if(type == 1)
        {
                divContent = parent.document.getElementById("divContent");
                _body = parent.document.body;
        docWidth = parent.document.documentElement.clientWidth == 0 ? _body.clientHeight : parent.document.documentElement.clientWidth;
        docHeight = parent.document.documentElement.clientHeight == 0?_body.clientHeight:parent.document.documentElement.clientHeight;
        }
        else
        {
                divContent = $("divContent");
                _body = document.body;
                docWidth = document.documentElement.clientWidth==0?_body.clientWidth : document.documentElement.clientWidth;
                docHeight = document.documentElement.clientHeight==0?_body.clientHeight:document.documentElement.clientHeight;
        }

        //divide the body into 9 parts
        // 1   4   7
        // 2   5   8
        // 3   6   9
        var perWid = Math.round(docWidth / 3);
    var perHei = Math.round(docHeight / 3);
       
        switch(iPosition)
        {
                case 1 :
                  posLeft = 0;
                  posTop = 0;
                  break;
                case 2 :
                  posLeft = 0;
                  posTop = perHei;
                  break;
                case 3 :
                  posLeft = 0;
                  posTop = perHei * 2;
                  break;
                case 4 :
                  posLeft = perWid;
                  posTop = 0;
                  break;
                case 5 :
                  posLeft = perWid;
                  posTop = perHei;
                  break;
                case 6 :
                  posLeft = perWid;
                  posTop = perHei * 2;
                  break;
                case 7 :
                  posLeft = perWid * 2;
                  posTop = 0;
                  break;
                case 8 :
                  posLeft = perWid * 2;
                  posTop = perHei;
                  break;
                case 9 :
                  posLeft = perWid * 2;
                  posTop = perHei * 2;
                  break;
                default:
                  posLeft = perWid;
                  posTop = perHei;
                  break;
          }

          var leftAddwidth = parseInt(posLeft,10) + parseInt(iWidth,10);
          var docWidMinusiWid = parseInt(docWidth,10) - parseInt(iWidth,10);
          posLeft = leftAddwidth > parseInt(docWidth,10) ? (docWidMinusiWid > 0 ? docWidMinusiWid : 0) : (parseInt(posLeft,10));
          
          var topAddheight = parseInt(posTop,10) + parseInt(iHeight,10);
          var docHeiMinusiHei = parseInt(docHeight,10) - parseInt(iHeight,10);
          
      posTop = topAddheight > parseInt(docHeight,10) ? (docHeiMinusiHei > 0 ? docHeiMinusiHei : 0) : (parseInt(posTop,10));
          
          switch(iPosition)
      {
          case 7:
          case 8:
          case 9:
            posLeft = parseInt(posLeft,10) - 18;
          break;
      }
          
          // no need to move the ad when display,just show it
          if(iShowType == 1)
      {
          divContent.style.left = posLeft + "px";
          divContent.style.top = posTop + "px";
                  divContent.style.visibility = "visible";                  
      }
          else
          {
                  //set the original position just before move the ad
                  switch(iPosition)
          {
              case 3:
              case 6:
              case 9:
                 divContent.style.left = posLeft + "px";
                 divContent.style.top = docHeight + "px";         
              break;
              case 1:
              case 4:
              case 7:
                 divContent.style.left = posLeft + "px";
                 divContent.style.top = (-1) * perHei + "px";
              break;
              case 2:
                 divContent.style.left = (-1) * perWid + "px";
                 divContent.style.top = posTop + "px";
              break;
              case 8:
                 divContent.style.left = 3 * perWid + "px";
                 divContent.style.top = posTop + "px";
              break;
              default:
              break;
          }
                    divContent.style.visibility = "visible";
                  moveWin(type);
          }
}

///<summary>
///move the ad step by step,adjust the div's position
///</summary>
///<param name=type>type=1,the parent window,or itself</param>
function moveWin(type)
{
        var curTop = 0,curLeft = 0,step = 15;
        var div = null;

        if(type == 1) isParent = true;
        else isParent = false;
       
        if(isParent) div = parent.document.getElementById("divContent");
        else div = $("divContent");
       
        curTop = parseInt(div.style.top,10);
    curLeft = parseInt(div.style.left,10);
       
        switch(iPosition)
    {
        case 3:
        case 6:
        case 9:
        if(parseInt(curTop,10) > parseInt(posTop,10))
        {
            var minus = parseInt(curTop,10) - parseInt(posTop,10);
            var curMinus = (parseInt(minus,10) - parseInt(step,10)) >= 0 ? parseInt(step,10) : ((parseInt(step,10) - parseInt(minus,10)) >= 0 ? (parseInt(step,10) - parseInt(minus,10)) : 0);
            var newTop = parseInt(curTop,10) - parseInt(curMinus,10);
            
            div.style.top = newTop + "px";
            div.style.zIndex++;
            if(typeof(objTimer)=='undefined')objTimer =  setInterval(function(){moveWin(type);},1);                         
        }
        else
        {
            if(objTimer)
              clearInterval(objTimer);
        }
        
        break;
        case 1:
        case 4:
        case 7:
            if(parseInt(curTop,10) < parseInt(posTop,10))
            {
               var minus = parseInt(posTop,10) - parseInt(curTop,10);
               var curMinus = (parseInt(minus,10) - parseInt(step,10)) >= 0 ? parseInt(step,10) : ((parseInt(step,10) - parseInt(minus,10)) >= 0 ? (parseInt(step,10) - parseInt(minus,10)) : 0);
               var newTop = parseInt(curTop,10) + curMinus;
                          
               div.style.top = newTop + "px";
               div.style.zIndex++;
                          
               if(typeof(objTimer)=='undefined')objTimer = setInterval(function(){moveWin(type);},1);      
            }
            else
            {
               if(objTimer)
                clearInterval(objTimer);            }

        break;
        
        case 2:
            if(parseInt(curLeft,10) < parseInt(posLeft,10))
            {
               var minus = parseInt(posLeft,10) - parseInt(curLeft,10);
               var curMinus = (parseInt(minus,10) - parseInt(step,10)) >= 0 ? parseInt(step,10) : ((parseInt(step,10) - parseInt(minus,10)) >= 0 ? (parseInt(step,10) - parseInt(minus,10)) : 0);
               var newLeft = parseInt(curLeft,10) + curMinus;
               div.style.left = newLeft + "px";
               div.style.zIndex++;
               if(typeof(objTimer)=='undefined')objTimer = setInterval(function(){moveWin(type);},1);      
            }
            else
            {
               if(objTimer)
                clearInterval(objTimer);
            }
        break;
        
        case 5:
            div.style.top = posTop + "px";
            div.style.left = posLeft + "px";
        break;
        
        case 8:
            if(parseInt(curLeft,10) > parseInt(posLeft,10))
            {
               var minus = parseInt(curLeft,10) - parseInt(posLeft,10);
               var curMinus = (parseInt(minus,10) - parseInt(step,10)) >= 0 ? parseInt(step,10) : ((parseInt(step,10) - parseInt(minus,10)) >= 0 ? (parseInt(step,10) - parseInt(minus,10)) : 0);
               var newLeft = parseInt(curLeft,10) - curMinus;
               div.style.left = newLeft + "px";
               div.style.zIndex++;
               if(typeof(objTimer)=='undefined')objTimer = setInterval(function(){moveWin(type);},1);
            }
            else
            {
               if(objTimer)
                clearInterval(objTimer);
            }
        break;
        
        default:
        break;
    }
}
///<summary>
///handle the <a> element in parent window
///</summary>
function PCheckAd()
{
        try
        {
                var win = window.frames[0].parent;
                if (win.document.readyState != 'complete')
                {
                        return;
                }
                window.clearInterval(_hPInterval);
                _hPInterval = null;
                var doc = win.document;
                for (var i in doc.links)
                {
                        if (doc.links.target == "")
                        {
                                doc.links.target = "_top";
                        }
                }
                for (var i in doc.forms)
                {
                        if (doc.forms.target == "")
                        {
                                doc.forms.target = "_top";
                        }
                }
        }
        catch(e)
        {}
}
///<summary>
///handle the <a> element in current window
///</summary>
function CheckAd()
{
        try
        {
                var win = window.frames[0];
                if (win.document.readyState != 'complete')
                {
                        return;
                }
                window.clearInterval(_hInterval);
                _hInterval = null;
                var doc = win.document;
                for (var i in doc.links)
                {
                        if (doc.links.target == "")
                        {
                                doc.links.target = "_top";
                        }
                }
                for (var i in doc.forms)
                {
                        if (doc.forms.target == "")
                        {
                                doc.forms.target = "_top";
                        }
                }
        }catch(e){}
}
///<summary>
///call this function to display the ad in the current window
///</summary>
function displayAd()
{       
        createBorder(iBorder);
        display("0");
}
///<summary>
///call this function to display the ad in the parent window,when top.location != self.location happens,
///need to display the ad in the parent window too.In this function,need to register the close event to the some element.
///</summary>
function dispalyAdInP()
{
        if(isLoaded == false)
        {               
                if(isCreated)
                {
                        parent.document.getElementById("divContent").style.visibility = "visible";
                        isLoaded = true;
                        clearInterval(_hShowWindow);
                        isStartAdjust = true;
                        return;
                }
                if(null != parent)        {
                        createBorder(iBorder);
                        var divContent = $("divContent");
                        var pDiv = parent.document.createElement("div");
                        pDiv.setAttribute("id","divContent");
                        parent.document.body.appendChild(pDiv);
                       
                        parent.document.getElementById("divContent").innerHTML = divContent.innerHTML;
                        parent.document.getElementById("divContent").style.zIndex = 10000;       
       
                        parent.document.getElementById("divContent").style.position = "absolute";
                        parent.document.getElementById("divContent").style.top = "0";
                                       
       
                        var parCloseObj = null;               
                        switch(iBorder)
                        {
                                case 1:
                                        parCloseObj = parent.document.getElementById("divTitle");
                                break;
                                case 2:
                                        var table = parent.document.getElementById("tframe");
                                        parCloseObj = table.rows[0].cells[3];
                                break;
                                case 3:
                                        var table = parent.document.getElementById("tframe");
                                        parCloseObj = table.rows[0].cells[4];
                                break;
                                default:
                                break;
                        }               
                        if (navigator.userAgent.indexOf("Firefox")!=-1)
                        {
                                isFirefox = true;
                        }
       
                        if(isFirefox)
                        {
                                parCloseObj.addEventListener("click",closePWin,false);       
                        }
                        else
                        {
                                parCloseObj.attachEvent("onclick",closePWin);
                        }
                        display("1");
                }               
        }
        else
        {
                clearInterval(_hShowWindow);
                isStartAdjust = true;
        }
}
skykitty
 楼主| 发表于 2009-6-23 23:43:14 | 显示全部楼层
Part 3 of 3

function ShowParentWin()
{
        _hShowWindow = setInterval("dispalyAdInP();",100);
}
///<summary>
///adjust the ad window's position diynamically according to the size of window which it stay in
///</summary>

function adjustAdPos()
{
        if(null != parent&&isStartAdjust)
        {
                var _div = null;
                try
                {
                        _div = parent.document.getElementById("divContent");       
                }catch(e){}
                if(null != _div&&_div.style.visibility == "visible")
                {
                        var newAdTop = 0;
                        var newAdLeft = 0;
                        var curHeight = parent.document.documentElement.clientWidth == 0?parent.document.body.clientHeight : parent.document.documentElement.clientWidth;
                        var curWidth = parent.document.documentElement.clientHeight == 0?parent.document.body.clientHeight:parent.document.documentElement.clientHeight;               
                        //alert(curWidth + "|" + curHeight);
                        var perHei = Math.round(curHeight / 3);
                        var perWid = Math.round(curWidth / 3);
       
                        switch(iPosition)
                        {
                                case 1 :
                                  newAdLeft = 0;
                                  newAdTop = 0;
                                  break;
                                case 2 :
                                  newAdLeft = 0;
                                  newAdTop = perHei;
                                  break;
                                case 3 :
                                  newAdLeft = 0;
                                  newAdTop = perHei * 2;
                                  break;
                                case 4 :
                                  newAdLeft = perWid;
                                  newAdTop = 0;
                                  break;
                                case 5 :
                                  newAdLeft = perWid;
                                  newAdTop = perHei;
                                  break;
                                case 6 :
                                  newAdLeft = perWid;
                                  newAdTop = perHei * 2;
                                  break;
                                case 7 :
                                  newAdLeft = perWid * 2;
                                  newAdTop = 0;
                                  break;
                                case 8 :
                                  newAdLeft = perWid * 2;
                                  newAdTop = perHei;
                                  break;
                                case 9 :
                                  newAdLeft = perWid * 2;
                                  newAdTop = perHei * 2;
                                  break;
                                default:
                                  newAdLeft = perWid;
                                  newAdTop = perHei;
                                  break;
                        }
                        var leftAddwidth = parseInt(newAdLeft,10) + parseInt(iWidth,10);
                        var docWidMinusiWid = parseInt(curWidth,10) - parseInt(iWidth,10);
                        newAdLeft = leftAddwidth > parseInt(curWidth,10) ? (docWidMinusiWid > 0 ? docWidMinusiWid : 0) : (parseInt(newAdLeft,10));
                  
                        var topAddheight = parseInt(newAdTop,10) + parseInt(iHeight,10);
                        var docHeiMinusiHei = parseInt(curHeight,10) - parseInt(iHeight,10);
                  
                        newAdTop = topAddheight > parseInt(curHeight,10) ? (docHeiMinusiHei > 0 ? docHeiMinusiHei : 0) : (parseInt(newAdTop,10));
                       
                        _div.style.top = newAdTop + "px";
                        _div.style.left = newAdLeft + "px";
                }
        }
}
function startAdjust()
{
        _hAdjustAd = setInterval("adjustAdPos();",10000);
}


function EmbedShow()
{       
        //private field------------------------------------------------------------
        var _doc = document;
        var _body = _doc.body;
        var _divContent = null;
        var _frmContent = null;
        var _divTitle = null;
        var _IsFirefox = false;

        //public method------------------------------------------------------------
        function OnResize()
        {               
                var newAdTop = 0;
                var newAdLeft = 0;
                var curHeight = document.body.clientHeight;
                var curWidth = document.body.clientWidth;               
                var perHei = Math.round(curHeight / 3);
                var perWid = Math.round(curWidth / 3);

                switch(iPosition)
                {
                        case 1 :
                          newAdLeft = 0;
                          newAdTop = 0;
                          break;
                        case 2 :
                          newAdLeft = 0;
                          newAdTop = perHei;
                          break;
                        case 3 :
                          newAdLeft = 0;
                          newAdTop = perHei * 2;
                          break;
                        case 4 :
                          newAdLeft = perWid;
                          newAdTop = 0;
                          break;
                        case 5 :
                          newAdLeft = perWid;
                          newAdTop = perHei;
                          break;
                        case 6 :
                          newAdLeft = perWid;
                          newAdTop = perHei * 2;
                          break;
                        case 7 :
                          newAdLeft = perWid * 2;
                          newAdTop = 0;
                          break;
                        case 8 :
                          newAdLeft = perWid * 2;
                          newAdTop = perHei;
                          break;
                        case 9 :
                          newAdLeft = perWid * 2;
                          newAdTop = perHei * 2;
                          break;
                        default:
                          newAdLeft = perWid;
                          newAdTop = perHei;
                          break;
                }
                var leftAddwidth = parseInt(newAdLeft,10) + parseInt(iWidth,10);
                  var docWidMinusiWid = parseInt(curWidth,10) - parseInt(iWidth,10);
                  newAdLeft = leftAddwidth > parseInt(curWidth,10) ? (docWidMinusiWid > 0 ? docWidMinusiWid : 0) : (parseInt(newAdLeft,10));
          
                  var topAddheight = parseInt(newAdTop,10) + parseInt(iHeight,10);
                  var docHeiMinusiHei = parseInt(curHeight,10) - parseInt(iHeight,10);
          
              newAdTop = topAddheight > parseInt(curHeight,10) ? (docHeiMinusiHei > 0 ? docHeiMinusiHei : 0) : (parseInt(newAdTop,10));
               
                _div = $("divContent");
                _div.style.top = newAdTop + "px";
                _div.style.left = newAdLeft + "px";
        }
        function OnPResize()
        {               
                if(null != parent)
                {
                        _div = parent.document.getElementById("divContent");
                        var newAdTop = 0;
                        var newAdLeft = 0;
                        var curHeight = parent.document.documentElement.clientWidth == 0?parent.document.body.clientHeight : parent.document.documentElement.clientWidth;
                        var curWidth = parent.document.documentElement.clientHeight == 0?parent.document.body.clientHeight:parent.document.documentElement.clientHeight;       
                        var perHei = Math.round(curHeight / 3);
                        var perWid = Math.round(curWidth / 3);
       
                        switch(iPosition)
                        {
                                case 1 :
                                  newAdLeft = 0;
                                  newAdTop = 0;
                                  break;
                                case 2 :
                                  newAdLeft = 0;
                                  newAdTop = perHei;
                                  break;
                                case 3 :
                                  newAdLeft = 0;
                                  newAdTop = perHei * 2;
                                  break;
                                case 4 :
                                  newAdLeft = perWid;
                                  newAdTop = 0;
                                  break;
                                case 5 :
                                  newAdLeft = perWid;
                                  newAdTop = perHei;
                                  break;
                                case 6 :
                                  newAdLeft = perWid;
                                  newAdTop = perHei * 2;
                                  break;
                                case 7 :
                                  newAdLeft = perWid * 2;
                                  newAdTop = 0;
                                  break;
                                case 8 :
                                  newAdLeft = perWid * 2;
                                  newAdTop = perHei;
                                  break;
                                case 9 :
                                  newAdLeft = perWid * 2;
                                  newAdTop = perHei * 2;
                                  break;
                                default:
                                  newAdLeft = perWid;
                                  newAdTop = perHei;
                                  break;
                        }
                        var leftAddwidth = parseInt(newAdLeft,10) + parseInt(iWidth,10);
                        var docWidMinusiWid = parseInt(curWidth,10) - parseInt(iWidth,10);
                        newAdLeft = leftAddwidth > parseInt(curWidth,10) ? (docWidMinusiWid > 0 ? docWidMinusiWid : 0) : (parseInt(newAdLeft,10));
                  
                        var topAddheight = parseInt(newAdTop,10) + parseInt(iHeight,10);
                        var docHeiMinusiHei = parseInt(curHeight,10) - parseInt(iHeight,10);
                  
                        newAdTop = topAddheight > parseInt(curHeight,10) ? (docHeiMinusiHei > 0 ? docHeiMinusiHei : 0) : (parseInt(newAdTop,10));
                       
                        _div.style.top = newAdTop + "px";
                        _div.style.left = newAdLeft + "px";                       
                }
        }
       
        //private method-----------------------------------------------------------
        function _Init()
        {               
                try
                {
                        getParams();       
                       
                        if (top.location != self.location)
                        {                               
                                isParent = true;
                                setTimeout("ShowParentWin();",iStartTime * 1000);
                                setTimeout("closePWin();",iCloseTime * 1000);

                                parent.onresize = OnPResize;
                                //alert(parent.onresize);
                                if(document.all)startAdjust();
                                _hPInterval = window.setInterval("PCheckAd()", 100);
                                return;
                        }
       
                        _divContent = _doc.getElementById("divContent");
                        if (navigator.userAgent.indexOf("Firefox")!=-1)
                        {
                                _IsFirefox = true;
                        }               
                        //show the ad
                        isParent = false;
                        setTimeout("displayAd();",iStartTime * 1000);
                        if(iCloseTime != 0)setTimeout("closeWin();",iCloseTime * 1000);
                       
                        window.onresize = OnResize;
                        _hInterval = window.setInterval("CheckAd()", 100);
                        var img = new Image();
                        img.src = stat_path;
                }catch(e){}
        }
        //constractor--------------------------------------------------------------
        _Init();
}

-----
雨宫优子
发表于 2009-6-24 09:31:34 | 显示全部楼层
一晃眼过去...未发现异常...
skykitty
 楼主| 发表于 2009-6-24 20:59:26 | 显示全部楼层
这是电信的插入广告,我一旦发现,就封锁整个C段,有的时候是封锁整个B段,呵呵
您需要登录后才可以回帖 登录 | 快速注册

本版积分规则

手机版|杀毒软件|软件论坛| 卡饭论坛

Copyright © KaFan  KaFan.cn All Rights Reserved.

Powered by Discuz! X3.4( 沪ICP备2020031077号-2 ) GMT+8, 2025-11-17 03:26 , Processed in 0.144756 second(s), 16 queries .

卡饭网所发布的一切软件、样本、工具、文章等仅限用于学习和研究,不得将上述内容用于商业或者其他非法用途,否则产生的一切后果自负,本站信息来自网络,版权争议问题与本站无关,您必须在下载后的24小时之内从您的电脑中彻底删除上述信息,如有问题请通过邮件与我们联系。

快速回复 客服 返回顶部 返回列表