js framework(yahoo YUI)
<script type="text/javascript" src="http://assets.taobaocdn.com/tbra/1.0/tbra-fp.js?t=20090311.js"></script>
这个就是应用 yahoo YUI 上的
/*
TERMS OF USE - EASING EQUATIONS
Open source under the BSD License.
Copyright 2001 Robert Penner All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
经典framework。
firefox强制 弹窗: + 广告规则变化:
<script type="text/javascript" src="http://assets.taobaocdn.com/tbra/1.0/tbra-fp.js?t=20090311.js"></script> <script type="text/javascript"> (function(){var F=YAHOO.util,C=F.Dom,B=F.Event;var G=C.get("J_Logout");if(G){B.on(G,"click",function(H){B.preventDefault(H);var E=B.getTarget(H).href;var D=function(){location.href=E};F.Get.script("http://taobao.alipay.com/user/logout.htm",{onSuccess:D,onFailure:D,timeout:20})})}
var A=document.forms.search.q;if(A){A.focus()}B.on(A,"keydown",function(){B.removeListener(A,"keydown",arguments.callee);var D=new F.YUILoader({base:TB.env.path+"../../yui/2.6.0/build/"});D.addModule({name:"suggest",type:"js",fullpath:"http://assets.taobaocdn.com/app/fp/suggest_2009.js?t=20090227.js",requires:["autocomplete"]});
D.require("suggest");D.insert()})})();TB.widget.SimpleSlide.decorate("J_Slide",{triggersClass:"tb-slide-triggers",currentClass:"current",eventType:"mouse",effect:"scroll"});FP.CategoryListHover=function(){var C=YAHOO.util,B=C.Dom,A=C.Event;return{timerShow:null,timerHide:null,mouseOverHandler:function(){if(this.timerHide)
{this.timerHide.cancel()}this.timerShow=YAHOO.lang.later(100,this,function(){B.addClass(this,"hover")})},mouseOutHandler:function(){if(this.timerShow){this.timerShow.cancel()}this.timerHide=YAHOO.lang.later(100,this,function(){B.removeClass(this,"hover")})},init:function(D){D=B.get(D);if(!D){return }var E=B.getChildren(D);
A.on(E,"mouseover",this.mouseOverHandler);A.on(E,"mouseout",this.mouseOutHandler)}}}();FP.CategoryListHover.init("J_CategoryList");FP.Tab=function(B,H,K){var C=YAHOO.util,A=C.Dom,J=C.Event;if(!A.get(B)){return }if(K==false){var I=A.get(B).getElementsByTagName("ul")[0].getElementsByTagName("li");J.on(I,"click",function(D){J.stopEvent(D)})}
var G={eventType:"mouse",currentClass:"selected",autoSwitchToFirst:false,onSwitch:function(D){}};var F=TB.widget.SimpleTab.decorate(B,G);F.switchTab(Math.floor(Math.random()*H))};FP.Tab("J_HotProductTab",3,false);FP.Tab("J_SafeAndUnivTab",2);FP.Guessing=(function(){var B=YAHOO.util,A=B.Dom,O=B.Event;var J="J_GuessingLayer";var N,G,I,M=[];
var F="http://favorite.taobao.com/json/promote_banner.htm?count=6&pages=1&callback=FP.Guessing.render";var C="J_GuessingLayer";var L=function(){G=true;YAHOO.util.Get.script(F+(F.indexOf("?")==-1?"?":"&")+"t="+new Date().getTime(),{onSuccess:function(){N.hide();G=false},charset:"gbk"})};var K={};
K.render=function(S){var P=document.createElement("ul");A.get(J).appendChild(P);P.className="item";if(S&&typeof (S.items)!="undefined"&&S.items.length>=6){var Q=S.items.length,D=[];for(var E=0;E<6;++E){var T=S.items[E];D[D.length]='<li><a href="'+T.link+'" class="pic"><img src="'+encodeURI(T.picURL)+'" /></a>
<a href="'+T.link+'" class="desc">'+T.title+"</a></li>"}P.innerHTML=D.join("")}else{var R='<li><a href="http://auction1.taobao.com/auction/item_detail-db1-4a7b436dd431265877b74f2665e5ad60.jhtml" class="pic"><img src="http://pics.taobaocdn.com/bao/album/promotion/canixihuan1.jpg" /></a>
<a href="http://auction1.taobao.com/auction/item_detail-db1-4a7b436dd431265877b74f2665e5ad60.jhtml" class="desc">百搭羊毛绒毛衣</a></li><li><a href="http://auction1.taobao.com/auction/item_detail-0db2-3f1a0b33074c5cfb645b7010874985fc.jhtml" class="pic"><img src="http://pics.taobaocdn.com/bao/album/promotion/canixihuan2.jpg" /></a>
<a href="http://auction1.taobao.com/auction/item_detail-0db2-3f1a0b33074c5cfb645b7010874985fc.jhtml" class="desc">热卖休闲包包</a></li><li><a href="http://auction1.taobao.com/auction/item_detail-db2-8869cd987adf5df8e1ea7e198d7acd07.jhtml" class="pic"><img src="http://pics.taobaocdn.com/bao/album/promotion/canixihuan3.jpg" /></a>
<a href="http://auction1.taobao.com/auction/item_detail-db2-8869cd987adf5df8e1ea7e198d7acd07.jhtml" class="desc">男式名品内裤</a></li><li><a href="http://auction1.taobao.com/auction/item_detail-db2-a1eece9755c14883fff160335edd16c9.jhtml" class="pic"><img src="http://pics.taobaocdn.com/bao/album/promotion/canixihuan4.jpg" />
</a><a href="http://auction1.taobao.com/auction/item_detail-db2-a1eece9755c14883fff160335edd16c9.jhtml" class="desc">红酒面膜60ML</a></li><li><a href="http://auction1.taobao.com/auction/item_detail--90df9e4f4ed184950d88bd8c0dd08c93.jhtml" class="pic"><img src="http://pics.taobaocdn.com/bao/album/promotion/canixihuan5.jpg" />
</a><a href="http://auction1.taobao.com/auction/item_detail--90df9e4f4ed184950d88bd8c0dd08c93.jhtml" class="desc">乐扣摇水杯</a></li><li><a href="http://auction1.taobao.com/auction/item_detail-db2-cfe2f23c61b490d12be86d404f11290d.jhtml" class="pic"><img src="http://pics.taobaocdn.com/bao/album/promotion/canixihuan6.jpg" />
</a><a href="http://auction1.taobao.com/auction/item_detail-db2-cfe2f23c61b490d12be86d404f11290d.jhtml" class="desc">诺基亚N72</a></li>';P.innerHTML=R}H()};var H=function(){aObj=J.getElementsByTagName("A");O.on(aObj,"click",function(D){document.createElement("img").setAttribute("src",http://ju.atpanel.com/?url=http://www.atpanel.com?ad_id=&am_id=&cm_id=&pm_id=1500068013798a44e7d7)})};
K.init=function(){J=A.get(J);if(!J){return }if(J.getElementsByTagName("*").length==0){if(G){N.show();return }N=TB.util.Indicator.attach(J,{message:"正在加载数据...",useShim:true});N.show();L()}};return K})();FP.Guessing.init();FP.ExpressWay=(function(){var G=YAHOO.util,F=G.Dom,C=G.Event;
var A=function(E,I){var D;try{D=document.createElement('<iframe name="ew-frame" scrolling="no" frameborder="0" allowTransparency="true">')}catch(H){D=document.createElement("iframe");D.name="ew-frame";D.scrolling="no";D.frameBorder=0}F.addClass(D,"ew-frame");E.appendChild(D);D.src=I};
var B=function(D){C.stopEvent(D)};return{init:function(){var D=F.get("J_Expressway");C.on(F.getFirstChild(D).getElementsByTagName("a"),"click",B);this.tab=TB.widget.SimpleTab.decorate(D,{currentClass:"selected",eventType:"mouse",onSwitch:function(I){var H=D.getElementsByTagName("a")[I];var E=H.getAttribute("rel");
if(E){var J=F.get(E);if(!J.getElementsByTagName("iframe").length){if(F.hasClass(J,"loading")){F.removeClass(J,"loading")}A(J,H.href)}H.removeAttribute("rel")}}});this.tab.switchTab(0)}}})();FP.ExpressWay.init();FP.PYIndex=(function(){var H=YAHOO.util,B=H.Dom,Q=H.Event;var F=null,I="empty",O=null,J=null,C=null;
var A=function(){if(J){J.cancel()}O=YAHOO.lang.later(100,this,function(){var E=this.innerHTML.substring(0,1);var R=this.parentNode,D=B.getNextSibling(R);if(I=="empty"){B.addClass(R,"curr");B.addClass(D,"loading");I="loading";M(E,R,D)}else{if(I=="loaded"&&C){B.removeClass(F.getElementsByTagName("dt"),"curr");
B.removeClass(F.getElementsByTagName("dd"),"currDD");P(E);B.addClass(R,"curr");B.addClass(D,"currDD")}}})};var N=function(){if(O){O.cancel()}J=YAHOO.lang.later(100,this,function(){B.removeClass(F.getElementsByTagName("dt"),"curr");B.removeClass(F.getElementsByTagName("dd"),"currDD")})};
var G=function(E){var D=Q.getRelatedTarget(E);if(D!==this&&!B.isAncestor(this,D)){if(J){J.cancel()}O=YAHOO.lang.later(100,this,function(){B.addClass($D.getPreviousSibling(this),"curr");B.addClass(this,"currDD")})}};var L=function(E){var D=Q.getRelatedTarget(E);if(D!==this&&!B.isAncestor(this,D))
{if(O){O.cancel()}J=YAHOO.lang.later(100,this,function(){B.removeClass(B.getPreviousSibling(this),"curr");B.removeClass(this,"currDD")})}};var M=function(E,R,D){YAHOO.util.Get.script("/index_inc/cms_inc.php?path=py_index&t=20080625",{onSuccess:function(){if(!FP.PYIndex.json){return }B.replaceClass(D,"loading","currDD");
B.removeClass(D,"loading");C=FP.PYIndex.json;P(E);I="loaded"},charset:"gbk"})};var P=function(D){if(C[D]){var R=["<h4><span>类目</span></h4><ul>"];var T=["<h4><span>品牌</span></h4><ul>"];for(var E=0,S=C[D].length;E<S;E++){if(C[D][E][0]!==""&&C[D][E][1]!=="")
{if(C[D][E][2]=="类目"){R[R.length]='<li><a href="http://ju.atpanel.com/?url='+C[D][E][1].replace(/#.+$/,"")+'?ad_id=&am_id=&cm_id=&pm_id=1500102657703260afff" target="_blank">'+C[D][E][0]+"</a></li>"}else{if(C[D][E][2]=="品牌")
{T[T.length]='<li><a href="http://ju.atpanel.com/?url='+C[D][E][1].replace(/#.+$/,"")+'?ad_id=&am_id=&cm_id=&pm_id=1500102657703260afff" target="_blank">'+C[D][E][0]+"</a></li>"}}}}R[R.length]="</ul>";T[T.length]="</ul>";B.get("py:"+D).innerHTML=((R.length===2)?"":(R.join("")))+((T.length===2)?"":(T.join("")));C[D]=null}};
var K={};K.init=function(D){F=B.get(D);if(!F){return }var R=F.getElementsByTagName("a"),E=F.getElementsByTagName("dd");if(R.length!=25||E.length!=25){return }Q.on(R,"mouseover",A);Q.on(R,"mouseout",N);Q.on(E,"mouseover",G);Q.on(E,"mouseout",L);Q.on(R,"click",function(S){Q.stopEvent(S)})};return K})();FP.PYIndex.init("J_PYIndex");
FP.P4p=(function(){var D=YAHOO.util.Dom,E=YAHOO.util.Event;var varName="p4presult";var p4pKeyWord=D.get("indexp4p").getAttribute("title");var SPI="http://tmatch.p4p.cn.yahoo.com/kcbad?adcount=18&catcount=3&pid=619362_1007&ip=10.1.19.139&p4p="+varName+"&catid=16,30,1801&keyword="+p4pKeyWord+"&t="+new Date().getTime();
var _renderAd=function(ret,renderer,showDesc){var adDiv=document.createElement("li");var price=parseFloat(ret.GOODSPRICE/100).toFixed(2);price=price.replace(/\.(\d{2})/,".<sub>$1</sub>");adDiv.innerHTML='<a href="'+ret.EURL+'" title="'+ret.TITLE+'" target="_blank" ><b><img src="'+ret.TBGOODSLINK+'"/></b>
<span class="title">'+ret.TITLE+'</span><span class="price"><sup>¥</sup>'+price+"</span></a>";return adDiv};var _bulidDom=function(container){var data=eval(varName);if(!data||data.length===0){container.style.display="none";return }D.removeClass(container,"loading");D.addClass(container,"hot-buy");
var contentBody=document.createElement("ul");D.addClass(contentBody,"product-list");container.appendChild(contentBody);var rets=data;for(var i=0;i<rets.length;i++){contentBody.appendChild(_renderAd(rets[i],{},false))}var _loadAt=function(pmid){var cImg=document.createElement("img");
cImg.src="http://ju.atpanel.com/?url=http://www.atpanel.com?&ad_id=&am_id=&cm_id=&pm_id=15001021071407811a88";return true};var listb=D.getElementsByClassName("product-list","ul")[0];var aArr=listb.getElementsByTagName("a");E.on(aArr,"click",_loadAt);container.style.display=""};
return{init:function(){var container=YAHOO.util.Dom.get("indexp4p");D.addClass(container,"loading");YAHOO.util.Get.script(SPI,{onSuccess:function(o){try{_bulidDom(container)}catch(e){}},varName:varName})}}})();YAHOO.util.Event.on(window,"scroll",function()
{YAHOO.util.Event.removeListener(window,"scroll",arguments.callee);FP.P4p.init()});FP.popupAD=(function(){var A=YAHOO.util.Event;var F="_tb_defaultbackpop_",D="http://www.taobao.com/promotion/defaultbackpop.html";var C=function(){var I=new Date();
var J=I.getHours()*3600+I.getMinutes()*60+I.getSeconds();var L=24*3600;var K=L-J;var H=(function(){var M=TB.bom.getCookie(F)||0;M>3?M=3:M=parseInt(M)+1;return M})();TB.bom.setCookie(F,H,K/L,TB.bom.pickDocumentDomain(),"/")};
var B=function(){var H=window.open("about:blank","_backad","width=760,height=480,toolbar=no,location=no,directories=no,status=yes,resizable=no,scrollbars=no");H.blur();H.opener.focus();H.location=D};
var E=function(){try{B()}catch(H){A.on(document,"click",G)}finally{C()}};var G=function(I){try{var H=A.getTarget(I).tagName.toLowerCase();if(Array.indexOf(["input","select","option","button"],H)!=-1){return }}catch(J){}A.removeListener(document,"click",arguments.callee);
try{B()}catch(J){}};return{init:function(){A.on(window,"load",function(){var H=TB.bom.getCookie(F)&1;if(H==1){return }setTimeout(E,2000)})}}})();FP.popupAD.init();(function(){var A=parseInt(TB.bom.getCookie("tg"));
if((A&1)==1){YAHOO.util.Get.script("http://www.taobao.com/help/wizard/wizard.js?t=20070813.js")}})();</script> <script type="text/javascript" src="http://assets.taobaocdn.com/js/app/directional_promo/directional_promo.js?t=20090306.js"></script>
本文来自博客园,作者:CarlZeng,转载请注明原文链接:https://www.cnblogs.com/backuper/archive/2009/03/23/1419465.html
需求沟通链接 扫客服加群:
![](https://images.cnblogs.com/cnblogs_com/backuper/933606/o_240408031754_%E6%89%AB%E5%AE%A2%E6%9C%8D%E5%8A%A0%E7%BE%A4.png)