var AD2={
};
(function (a) {
var slice=Array.slice||(function () {
var _slice=Array.prototype.slice;
return function (arr) {
return _slice.apply(arr,_slice.call(arguments,1))
}
})(),getType=function (v) {
var s=typeofv;
if(s==='object') {
if(v) {
if(typeofv.length==='number') {
s='array'
}
}else {
s='null'
}
}return s
},contains=function (superset,subset) {
return !find(subset,function (v,k) {
var sv=superset[k];
if(sv!==v) {
if(typeofsv=='object'&&typeofv=='object') {
return !contains(sv,v)
}else {
return true
}
}else {
return false
}
})
},equals=function (a,b) {
return contains(a,b)&&contains(b,a)
},isEmpty=function (o) {
var empty=true;
each(o,function (v,k,_break) {
empty=false;
return _break
});
return empty
},each=(function () {
var _break={
},arr_fn=function (numerable,fn,bind) {
for(var i=0,len=numerable.length;i<len;i++) {
if(fn.call(bind,numerable[i],i,_break)==_break) {
return i
}
}return -1
},iterator_type={
'string':function (numerable,fn,bind) {
return arr_fn(numerable.split(''),fn,bind)
},'array':arr_fn,'number':function (numerable,fn,bind) {
for(var i=0;i<numerable;i++) {
fn.call(bind,i,i)
}
},'object':function (numerable,fn,bind) {
for(var i in numerable) {
if(numerable.hasOwnProperty (i)) {
if(fn.call(bind,numerable[i],i,_break)==_break) {
return i
}
}
}return -1
}
},getIterator=function (o) {
return iterator_type[getType(o)]
};
return function (numerable,fn,bind) {
return getIterator(numerable)(numerable,fn,bind||numerable)
}
})(),find=function (numerable,fn,bind) {
var index=each(numerable,function (v,k,_break) {
if(fn.apply(bind,arguments)===true) {
return _break
}
});
return index==-1?null:numerable[index]
},filter=function (numerable,fn,bind) {
var valids=[];
each(numerable,function (v) {
if(fn.apply(bind,arguments)===true) {
valids.push(v)
}
});
return valids
},map=function (numerable,fn,bind,is_dictionary) {
var results;
if(is_dictionary) {
results={
};
each(numerable,function (v,k) {
results[k]=fn.apply(bind,arguments)
})
}else {
results=[];
each(numerable,function () {
results.push(fn.apply(bind,arguments))
})
}return results
},invoke=function (numerable,method_name,arg1,arg2,argN) {
var args=slice(arguments,2);
each(numerable,function (v,k) {
v[method_name].apply(v,args)
})
},unlink=function (object) {
if(object==null) {
return object
}if(typeofobject.length=='number'&&typeofobject!='string') {
return map(object,unlink)
}else if(typeofobject=='object') {
return map(object,unlink,null,true)
}return object
},mixdeep=function (r) {
if(!r) {
r={
}
}for(var i=1;i<arguments.length;i++) {
var s=arguments[i];
if(s) {
for(var j in s) {
if(r[j]&&typeofr[j]=='object'&&typeofs[j]=='object') {
arguments.callee(r[j],s[j])
}else {
r[j]=unlink(s[j])
}
}
}
}return r
},mix=function (r) {
if(!r) {
r={
}
}for(var i=1;i<arguments.length;i++) {
var s=arguments[i];
if(s) {
for(var j in s) {
r[j]=s[j]
}
}
}return r
},mixif=function (r) {
if(!r) {
r={
}
}for(var i=1;i<arguments.length;i++) {
var s=arguments[i];
if(s) {
for(var j in s) {
if(r[j]===undefined) {
r[j]=s[j]
}
}
}
}return r
},generateId=(function () {
var id=1;
return function () {
return 'auto_gen_'+id++
}
})(),Class={
proto:(function () {
var fn=function (instance,method) {
return this.prototype[method].apply(instance,slice(arguments,2))
};
return function (ctor) {
ctor.proto=fn
}
})(),create:function (proto,sp) {
var ctor=function () {
if(this.init) {
this.init.apply(this,arguments)
}
};
if(sp) {
var F=function () {
};
F.prototype=sp.prototype;
ctor.prototype=new F()
}var protos=slice(arguments,2);
protos.unshift(ctor.prototype,proto);
mix.apply(window,protos);
return ctor
}
},getObjectToStringFn=function (assign_token,pair_separator,need_last,need_encode) {
var encode=need_encode?encodeURIComponent:function (k) {
return k
};
return function (o) {
return map(o,function (v,k) {
if(k!=null) {
return k+assign_token+encode(v)
}
}).join(pair_separator)+(need_last?pair_separator:'')
}
};
mix(a,{
generateId:generateId,slice:slice,getType:getType,Object:{
equals:equals,isEmpty:isEmpty
},each:each,map:map,find:find,filter:filter,mix:mix,mixdeep:mixdeep,mixif:mixif,indexOf:function (arr,o) {
if(arr.indexOf) {
return arr.indexOf(o)
}for(var i=0;i<arr.length;i++) {
if(arr[i]===o) {
return i
}
}return -1
},buffer:function (runner,delay) {
if(!delay) {
return runner
}var timer;
return function () {
if(timer) {
clearTimeout(timer)
}var args=arguments;
timer=setTimeout(function () {
runner.apply(window,args)
},delay||100)
}
},Class:Class,format:function (s,config,reserve) {
return s.replace(//{([^
}]*)/}/g,(typeofconfig=='object')?function (m,i) {
var ret=config[i];
return ret==null&&reserve?m:ret
}:config)
},getObjectToStringFn:getObjectToStringFn,serializeStyles:getObjectToStringFn(':',';',true,false),serializeAttrs:getObjectToStringFn('=',' ',true,false),serializeQuery:getObjectToStringFn('=','&',false,true)
})
})(AD2);
(function (a) {
var el_template='<{tag} {attrs}style="{styles}">{inner}</{tag}>',each=a.each,propertyCache={
},patterns={
HYPHEN:/(-[a-z])/i,ROOT_TAG:/^body|html$/i
},ua=(function () {
var o={
ie:0,opera:0,gecko:0,webkit:0,mobile:null
};
var ua=navigator.userAgent,m;
if((/KHTML/).test(ua)) {
o.webkit=1
}m=ua.match(/AppleWebKit//([^/s]*)/);
if(m&&m[1]) {
o.webkit=parseFloat(m[1]);
if(/Mobile///.test(ua)) {
o.mobile="Apple"
}else {
m=ua.match(/NokiaN[^//]/);
if(m) {
o.mobile=m[0]
}
}
}if(!o.webkit) {
m=ua.match(/Opera[/s//]([^/s]*)/);
if(m&&m[1]) {
o.opera=parseFloat(m[1]);
m=ua.match(/OperaMini[^;
]/);
if(m) {
o.mobile=m[0]
}
}else {
m=ua.match(/MSIE/s([^;
]*)/);
if(m&&m[1]) {
o.ie=parseFloat(m[1])
}else {
m=ua.match(/Gecko//([^/s]*)/);
if(m) {
o.gecko=1;
m=ua.match(/rv:([^/s/)]*)/);
if(m&&m[1]) {
o.gecko=parseFloat(m[1])
}
}
}
}
}return o
})();
var walk=function (el,side) {
for(var nel=el;nel;nel=nel[side]) {
if(nel.nodeType==1) {
return nel
}
}
},buildHTML=function (styles,attrs,tag,inner) {
return a.format(el_template,{
tag:tag||'div',attrs:a.serializeAttrs(attrs||{
}),styles:a.serializeStyles(styles),inner:inner||''
})
},toCamel=function (property) {
if(!patterns.HYPHEN.test(property)) {
return property
}if(propertyCache[property]) {
return propertyCache[property]
}var converted=property;
while(patterns.HYPHEN.exec(converted)) {
converted=converted.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase())
}propertyCache[property]=converted;
return converted
},getStyle=(function () {
if(document.defaultView&&document.defaultView.getComputedStyle) {
return function (el,property) {
var value=null;
if(property=='float') {
property='cssFloat'
}var computed=document.defaultView.getComputedStyle(el,'');
if(computed) {
value=computed[toCamel(property)]
}return el.style[property]||value
}
}else if(document.documentElement.currentStyle&&ua.ie) {
return function (el,property) {
switch(toCamel(property)) {
case 'opacity':var val=100;
try{
val=el.filters['DXImageTransform.Microsoft.Alpha'].opacity
}catch(e) {
try{
val=el.filters('alpha').opacity
}catch(e) {
}
}return val/100;
case 'float':property='styleFloat';
default:var value=el.currentStyle?el.currentStyle[property]:null;
return (el.style[property]||value)
}
}
}else {
return function (el,property) {
return el.style[property]
}
}
})(),setStyle=(function () {
var px=/left|top|right|bottom|width|height/;
var transVal=function (k,v) {
if(px.test(k)&&typeofv=='number') {
v=v+'px'
}return v
};
if(ua.ie) {
return function (el,property,val) {
property=toCamel(property);
switch(property) {
case 'opacity':el.style.filter='alpha(opacity='+val*100+')';
if(!el.currentStyle||!el.currentStyle.hasLayout) {
el.style.zoom=1
}break;
case 'float':property='styleFloat';
default:el.style[property]=transVal(property,val)
}
}
}else {
return function (el,property,val) {
property=toCamel(property);
if(property=='float') {
property='cssFloat'
}el.style[property]=transVal(property,val)
}
}
})(),getDocumentScrollLeft=function (doc) {
doc=doc||document;
return Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft)
},getDocumentScrollTop=function (doc) {
doc=doc||document;
return Math.max(doc.documentElement.scrollTop,doc.body.scrollTop)
},getDocumentHeight=function () {
var scrollHeight=(document.compatMode!='CSS1Compat')?document.body.scrollHeight:document.documentElement.scrollHeight;
var h=Math.max(scrollHeight,getViewportHeight());
return h
},getDocumentWidth=function () {
var scrollWidth=(document.compatMode!='CSS1Compat')?document.body.scrollWidth:document.documentElement.scrollWidth;
var w=Math.max(scrollWidth,getViewportWidth());
return w
},getViewportHeight=function () {
var height=self.innerHeight;
var mode=document.compatMode;
if((mode||ua.ie)&&!ua.opera) {
height=(mode=='CSS1Compat')?document.documentElement.clientHeight:document.body.clientHeight
}return height
},getViewportWidth=function () {
var width&#
腾讯首页广告源码
最新推荐文章于 2021-11-22 13:29:39 发布