主题:  页内固定式浮动flash广告如何播放若干秒自动关闭?

vt40

职务:普通成员
等级:2
金币:1.0
发贴:273
#12006/8/23 22:44:35
页内固定式浮动flash广告如何播放若干秒自动关闭?

在21cn新浪等,大门户网站常有个浮动广告播放若干秒就自动关闭,请问怎么加入的.

二楼的是腾讯的.js,看不懂,请教...

编辑历史:[此帖最近一次被 vt40 编辑过(编辑时间:2006-08-23 22:55:00)]


vt40

职务:普通成员
等级:2
金币:1.0
发贴:273
#22006/8/23 22:54:10
075581143035
/* <config> */
var sh_tpl_ver="v6.0811 QQHP (scroll, freqcap, CTFix, LOCK)";
var _dateTime=getDateTime().split(",");
var shReportsDLL = "http://211.157.24.56/isapi_browser.dll/";
var shClient="SHTV_BAI_LI_DE_GARMENT_QQ_NEWS";
var sh3kRedir="";
var sh3kRedir2="";
var tr_click1="http://211.157.24.56/isapi_browser.dll/A?"+shClient+"}CT}}[random]}"+_dateTime[0]+"}"+_dateTime[1];
var sh3kView="http://211.157.24.56/isapi_browser.dll/A?"+shClient+"}VIEW}}[random]}"+_dateTime[0]+"}"+_dateTime[1];
var tr_click2="http://a619.g.akamai.net/7/619/2022/v001/ww3.shoshkeles.com/tencent/files/"+shClient+"/ct_"+shClient+".gif?RND=[random]";
var tr_view1="http://a619.g.akamai.net/7/619/2022/v001/ww3.shoshkeles.com/tencent/files/"+shClient+"/vw_"+shClient+".gif?RND=[random]";

var theSRC=(document.domain=='cntest.unitedvirtualities.com')?'http://cntest.unitedvirtualities.com/qq/'+shClient+'/' : 'http://adsrich.qq.com/inc/uvad/'+shClient+'/';
//var theSRC='http://vip.unitedsites.com.ar/Bue/shoshcamps/SHTV_BAI_LI_DE_GARMENT_QQ_NEWS/';

var dtdFix=(document.body.clientHeight==document.body.scrollHeight)?"documentElement":"body";

var shFlashVer=6, shNewWindow=1;
var laRelacion=100;

var freqCapViews=2;
var freqCapDays=1;

var flashWidth=400,flashHeight=320,shTop=38,shLeft=3,flashName=shClient+'.swf';

var hideIframesFlag=0;
var hideSelectsFlag=0;

var shPosMethod=2; // 1 = centrado, 2 = anclado;
var getObjParams=["IFRAME,IMG",590,90,1]; // (solo si shPosMethod es 2) mismos parametros que getObj()

var creative1_starts_collapsed=0; // por las dudas

// NEW.
var creative2_enabled=0;
var creative2_after_how_many_views=1;
var creative2_name=shClient+'_b.swf';
var creative2_starts_collapsed=1;



/* </config> */

/* <js> */
var theIndex = (window!=top);
window.onerror=function(){return true;}
var shPingers='',shViewCount=0;try{for(var shI=0;shI<10;shI++) shPingers+='<IMG NAME="shViewBox'+shI+'" HEIGHT=1 WIDTH=1 SRC="http://adsrich.qq.com/inc/uvad/invisible.gif">';shPingers='<DIV ID="allThePings" STYLE="position:absolute;top:-200px;display:none;">'+shPingers+'</DIV>';document.write(shPingers);document.close(); }catch(_e){}
function shRnd(){return parseInt(Math.random()*999)+1;}
function shRnd2(){return (!window.luckyNumber)?(window.luckyNumber=(parseInt(Math.random()*laRelacion)+1)):(window.luckyNumber);}
function getDateTime(){var shDate=new Date();var shDat1=shDate.getMonth()+1;shDat1=(shDat1<10?"0"+shDat1:shDat1);var shDat2=shDate.getDate();shDat2=(shDat2<10?"0"+shDat2:shDat2);shDat1+="-"+shDat2+"-"+shDate.getYear().toString().substring(2);shDat2=shDate.getHours();shDat2=(shDat2<10?"0"+shDat2:shDat2)+""+(shDate.getMinutes()<10?"0":"")+shDate.getMinutes();return shDat1+','+shDat2;}
function gimmeFixedDate(days){var cookieDate=new Date();cookieDate.setTime(cookieDate.getTime()+(days*24*3600000));cookieDate=cookieDate.toGMTString();return cookieDate;}
function shPingTo(whichVar){try{if(whichVar){whichVar=whichVar.replace(/\[.*random.*\]/gi, shRnd()); if(shViewCount==9) shViewCount=0; document.images['shViewBox'+(shViewCount++)].src=whichVar;}}catch(_e){}}
function shView(){try{if(1==shRnd2())shPingTo(sh3kView+'}'+shRealType.substring(0,3));for(var shI=0;shI<10;shI++){if(window["tr_view"+shI]){shPingTo(window["tr_view"+shI]);}}}catch(_e){}}
function shClick(){shReport('CT_'+conType());try{var urlToGo=sh3kRedir;if(shClick.arguments.length==1){urlToGo=shClick.arguments[0];urlToGo=urlToGo.replace(/\[.*timestamp.*\]/gi,shRnd());urlToGo=urlToGo.replace(/\[.*random.*\]/gi,shRnd());}for(var shI=0;shI<10;shI++)if(window["tr_click"+shI])shPingTo(window["tr_click"+shI]);if(urlToGo.charAt(urlToGo.length-1)=='}')shPingTo(urlToGo);}catch(_e){}}

function shGetFlashVer(){var v;try{v=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3").GetVariable("$version");return parseInt(v.substring(v.indexOf('WIN')+4));}catch(e){return 0;}}
try{var shType,navVe=navigator.appVersion,navUs=navigator.userAgent,navAp=navigator.appName,shFrameObject=(window.theIndex)?parent.parent:window; var shRealType=shType='XXXXX'; }catch(_e){}
if(navUs.indexOf('Win')!=-1&&navAp.indexOf('Internet Explorer')!=-1){shFlash=shGetFlashVer();shRealType=(shFlash>=shFlashVer)?('WE'+parseInt(navUs.substring(navUs.indexOf('MSIE')+4))+'F'+shFlash):'XXXXX';if(shRealType!='XXXXX')shType='WE4F4';}

function shGetCookie(coName){var firstByte=false, endByte=false, theCookie=unescape(documents.cookie);firstByte=theCookie.indexOf(coName+'=');if(firstByte>=0){firstByte+=coName.length+1;endByte=theCookie.indexOf('@UV',firstByte);if(endByte>=0)theCookie=theCookie.substring(firstByte,endByte);else theCookie=false;}else theCookie=false;return theCookie;}
function shWriteCookie(coName, covalue, coExp, coDomain){var theCookie=escape(coName)+'='+escape(covalue)+'@UV;'+(coExp?('expires='+coExp+';'):'')+'path=/;'+(coDomain?('domain='+coDomain+';'):'');documents.cookie=theCookie;}
function getMidnightOf(days){var cookieDate=new Date();cookieDate.setHours(23);cookieDate.setMinutes(59);cookieDate.setTime(cookieDate.getTime()+(days*3600000*24));cookieDate=cookieDate.toGMTString();return cookieDate;}

var cookieVal=shGetCookie(shClient);
var freqCapValid = ((!freqCapViews || !freqCapDays) || freqCapViews>cookieVal);

if((shType=='WE4F4'||shType=='WE4F5')&&shRealType.indexOf('WE4')==-1 & freqCapValid)
{

/* <timeline> */
shWriteCookie(shClient, ((cookieVal===false)? 1 : ++cookieVal), getMidnightOf(freqCapDays-1), document.domain);

var SHBIG=0;
var shObjeto=false;
var shPosType = 'center';
var sh_current_creative=1;

    var cookieVal_total_day=shGetCookie(shClient+"_TOTAL_DAY");
    if(creative2_enabled && (cookieVal_total_day>=creative2_after_how_many_views))
    {
        flashName=creative2_name;
        sh_current_creative=2;
    }

    shWriteCookie(shClient+"_TOTAL_DAY", ((cookieVal_total_day===false)? 1 : ++cookieVal_total_day), getMidnightOf(0), document.domain);

function shReport(command, args){var theParam1='A',theParam2=command,theParam3="",stringToPing=shReportsDLL+theParam1+'?'+shClient+'}'+theParam2+'}'+theParam3+'}'+parseInt(Math.random()*999);shPingTo(stringToPing);}
function shFlashObj(){ return '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" ID="sh_all_anim" STYLE="position:absolute;top:'+shTop+'px;left:'+shLeft+'px;z-index:1000;display:none;" width="'+flashWidth+'" height="'+flashHeight+'"><PARAM NAME=movie value="'+theSRC+flashName+'"><PARAM NAME=quality value=high><PARAM NAME="LOOP" value="false"><PARAM NAME="wmode" value="transparent"><PARAM NAME=SALIGN value=T><PARAM NAME=MENU value=FALSE></OBJECT>'; }

document.write(shFlashObj()+'<SCRIPT LANGUAGE="VBScript">Function flashGetVar(ByVal shFlashVarName)\nOn Error Resume Next\nflashGetVar=shFrameObject.document.all.sh_all_anim.GetVariable(shFlashVarName)\nIf flashGetVar Then shFrameObject.document.all.sh_all_anim.SetVariable shFlashVarName,""\nEnd Function<\/SCRIPT>');
document.close();

function shClose(){ shFinish(); }
function sh_finish(){ shFinish();}

function shFinish(){}
function shHideIt()
{
    //if(shObjeto) shObjeto.style.visibility="hidden";
}
function shShowIt()
{
}

function shCommand()
{
    var shResult = false;

    if((shResult=flashGetVar('SH_JS_CLICK')))
    {
        shClick();
    }

    if((shResult=flashGetVar('SH_JS_CLOSE'))){
        shMutexUnlock();
        shFinish();
    }

    if((shResult=flashGetVar('SH_JS_INTER')))
    {
        shReport(shResult);
    }
    if((shResult=flashGetVar('SH_JS_FINISH'))){
        shFinish();
        shMutexUnlock();
        sh_all_anim.style.display='none';
    }
    if((shResult=flashGetVar('SH_JS_EXPAND')))
    {
        SHBIG=1;
        shHideIt();
        shDoScroll();
        shFrameObject.onscroll=shDoScroll;
        shFrameObject.onresize=shDoScroll;
    }

    if((shResult=flashGetVar('SH_JS_COLLAPSE')))
    {
        SHBIG=0;
        shDoScroll();
        shMutexUnlock();
        shFrameObject.onscroll=shDoScroll;
        shFrameObject.onresize=shDoScroll;
    }

    setTimeout("shCommand()",200);

}

function shMutexUnlock()
{
    if(window.shMutexUnlocked) return;

    if(window.shUseMutex && window.mutex_unlock)
    {
        window.mutex_unlock();
    }

    window.shMutexUnlocked=1;
}

// no borrar esta funcion
function shScroll(){}

function shDoScroll()
{
    if(!window.shMutexFree) return;

    var x=0,y=0;
    if(shPosMethod==2)
        x=shGetX(shObjeto),y=shGetY(shObjeto);

    // el top cambia si esta expandido o contraido
    if(window.SHBIG)
    {
        var newTop = document[dtdFix].scrollTop + document[dtdFix].clientHeight - flashHeight - 100;
        sh_all_anim.style.posTop = (newTop>=100)? newTop : 100;
    }
    else
    {
        sh_all_anim.style.posTop = y+shTop;
    }

    // el left solamente depende del tipo de posicion (centrado/anclado)

    if(shPosMethod==1)
        var newLeft=(((document[dtdFix].clientWidth - flashWidth)/2) + shLeft);
    else
        var newLeft=x+shLeft;

    sh_all_anim.style.left = newLeft;
}
function shDontScroll(){ /*window.status='nada: ' + Math.random()*1000;*/ }

function f800x600()
{
    shHideIt();
    sh_all_anim.style.display = 'inline';
    sh_all_anim.style.visibility='visible';
    sh_all_anim.style.width=flashWidth-1;
    setTimeout("sh_all_anim.style.width=flashWidth;",100);
}
function getObj(theTags,theWidth,theHeight,thePos){theTags=theTags.toUpperCase().split(',');var laImageCount=0,losObjetos,theImage=false;for (var shA=0;shA<theTags.length;shA++){losObjetos=theTags[shA]=="IMG"?shFrameObject.document.images:shFrameObject.document.getElementsByTagName?shFrameObject.document.getElementsByTagName(theTags[shA]):shFrameObject.document.all.tags?shFrameObject.document.all.tags(theTags[shA]):false;if (losObjetos){for (var shI=0;shI<losObjetos.length;shI++){if((losObjetos[shI].width==theWidth&&losObjetos[shI].height==theHeight||losObjetos[shI].offsetWidth==theWidth&&losObjetos[shI].offsetHeight==theHeight)&&++laImageCount==thePos){theImage=losObjetos[shI];break;}} laImageCount=0;if(theImage)break;}} return theImage;}

function shPlayShoshkele()
{
    if(shPosMethod==2)
    {
        shObjeto=getObj(getObjParams[0],getObjParams[1],getObjParams[2],getObjParams[3]);
    }

    // Si el creativo empieza colapsado no debe usar las funciones de locking
    if(window["creative"+ sh_current_creative +"_starts_collapsed"]==1)
    {
        window.SHBIG=0;
        window.shUseMutex=0;
    }
    else
    {
        window.SHBIG=1;
        window.shUseMutex=(window.mutex_lock)?1:0;
    }

    window.shMutexFree=(!shUseMutex || mutex_lock()==0)?1:0;
    
    if(shMutexFree && (shPosMethod!=2 || shObjeto))
    {
        shFrameObject.onscroll=shDoScroll;
        shFrameObject.onresize=shDoScroll;
        shView();
        shDoScroll();
        setTimeout("f800x600()", 100);
    }
    else
    {
        setTimeout("shPlayShoshkele()",100);
    }
}

function shReposition()
{
}


function overwriteEvents()
{
    function contains(str, containsStr){ var str = str + ""; return ( str.indexOf(containsStr) != -1 )? true : false; }

    if( (shFramePointer.shPosType == "center" || shFramePointer.shPosType == "docked") && !contains(window.onresize, "UV.OR") )
    {
        window.siteResize = onresize;
        shFrameObject.onresize = shFramePointer.shReposition;
    }

    setTimeout("overwriteEvents();",200);
}
function shGetY(obj){var shY=0;while(obj){shY+=obj.offsetTop;obj=obj.offsetParent;} return shY;}
function shGetX(obj){var shX=0;while(obj){shX+=obj.offsetLeft;obj=obj.offsetParent;} return shX;}

function shCreate()
{
    if (shType!="XXXXX")
    {
        if((shFrameObject.document.readyState=="complete"||shFrameObject.document.readyState=="interactive")&&!shFrameObject.shFramePointer)
        {
            window.scrollMax = document[dtdFix].scrollHeight;
            shFrameObject.shFrameObject=window;shFrameObject.shFramePointer=window;
            if(window.theIndex)
            {
                var shScriptString=window.shReposition?'window.siteResize=window.onresize;window.onresize=shFramePointer.shReposition;':'';
                shScriptString+=window.shScroll?'window.onscroll=shFramePointer.shScroll;':'';
                shScriptString+=overwriteEvents+'overwriteEvents();';
                
                shFrameObject.document.body.insertAdjacentHTML('afterBegin',shFlashObj()+'<SPAN STYLE="display:none">OLAF<SCRIPT DEFER>'+shScriptString+'<\/SCRIPT><\/SPAN>');
            }
            else
            {
                if(window.shScroll) window.onscroll = shScroll;
                if(window.shReposition) window.onresize = shReposition;
                //eval(shScriptString);
            }
            
            window.setTimeout("window.sh_all_anim=shFrameObject.document.all.sh_all_anim;",100);
            window.setTimeout("shCommand();shPlayShoshkele();",500);
        }
        else
        {
            setTimeout('shCreate()',100);
        }
    }
}
if(window.theIndex) window.attachEvent("onload", shCreate);
else shCreate();

} /* </timeline> */

document.write('<div id="oClientCaps" style="position:absolute;top:-100px;behavior:url(#default#clientCaps)"></div>');
function conType(){return document.getElementById("oClientCaps").connectionType;}
if (1==shRnd2()) {
    var myFlash=shFlash<6?'NO':shFlash;
    shReport('FLASH_'+myFlash);
    shReport('SR_'+screen.width+'X'+screen.height);
    shReport(conType());
}
/* </js> */