其他
if (!window.console) window.console = { log: function() {} };
if (typeof getComputedStyle == 'undefined') {
if (document.body.currentStyle) {
window.getComputedStyle = function(el) {
return el.currentStyle;
}
} else {
window.getComputedStyle = {};
}
}
(function(){
window.__zoom = 1;
(function(){
var validArr = ","+([0.875, 1, 1.125, 1.25, 1.375]).join(",")+",";
var match = window.location.href.match(/winzoom=(\d+(?:\.\d+)?)/);
if (match && match[1]) {
var winzoom = parseFloat(match[1]);
if (validArr.indexOf(","+winzoom+",")>=0) {
window.__zoom = winzoom;
}
}
})();
var isIE = false;
if (typeof version != 'undefined' && version >= 6 && version = 6 && version 0) break;
outerWidth += parseFloat(parent_style.paddingLeft) + parseFloat(parent_style.paddingRight) + parseFloat(parent_style.marginLeft) + parseFloat(parent_style.marginRight) + parseFloat(parent_style.borderLeftWidth) + parseFloat(parent_style.borderRightWidth);
parent = parent.parentNode;
}
return parent_width;
}
var getOuterW=function(dom){
var style=getComputedStyle(dom),
w=0;
if(!!style){
w = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight) + parseFloat(style.borderLeftWidth) + parseFloat(style.borderRightWidth);
}
return w;
};
var getOuterH =function(dom){
var style=getComputedStyle(dom),
h=0;
if(!!style){
h = parseFloat(style.paddingTop) + parseFloat(style.paddingBottom) + parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
}
return h;
};
var insertAfter = function(dom,afterDom){
var _p = afterDom.parentNode;
if(!_p){
return;
}
if(_p.lastChild === afterDom){
_p.appendChild(dom);
}else{
_p.insertBefore(dom,afterDom.nextSibling);
}
};
var getQuery = function(name,url){
var u = arguments[1] || window.location.search,
reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"),
r = u.substr(u.indexOf("\?")+1).match(reg);
return r!=null?r[2]:"";
};
(function(){
var images = document.getElementsByTagName('img');
var length = images.length;
var max_width = getMaxWith();
for (var i = 0; i 0) {
var img_style = getComputedStyle(images[i]);
var init_width = images[i].style.width;
if (init_width) {
images[i].setAttribute('_width', init_width);
if (init_width != 'auto') width_ = parseFloat(img_style.width);
}
var parent_width = getParentWidth(images[i])||max_width;
var width = width_ > parent_width ? parent_width : width_;
var img_padding_border = getOuterW(images[i])||0;
var img_padding_border_top_bottom = getOuterH(images[i])||0;
height = (width - img_padding_border) * ratio_ + img_padding_border_top_bottom;
images[i].style.cssText += ";width: " + width + "px;";
if (isIE) {
var url = images[i].getAttribute('data-src');
images[i].src = url;
} else {
if(width > 40 && height > 40){
images[i].className += ' img_loading';
}
images[i].src = "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==";
}
} else {
images[i].style.cssText += ";visibility: hidden;";
}
images[i].style.cssText += ";height: " + height + "px;";
}
})();
window.__videoDefaultRatio=16/9;
window.__getVideoWh = function(dom){
var max_width = getMaxWith(),
width = max_width,
ratio_ = dom.getAttribute('data-ratio')*1||(4/3),
arr = [4/3, 16/9],
ret = arr[0],
abs = Math.abs(ret - ratio_);
for(var j=1,jl=arr.length;j parent_width ? parent_width : width,
outerW = getOuterW(dom)||0,
outerH = getOuterH(dom)||0,
videoW = width - outerW,
videoH = videoW/ratio_,
height = videoH + outerH;
return {w:width,h:height,vh:videoH,vw:videoW,ratio:ratio_};
};
(function(){
var iframe = document.getElementsByTagName('iframe');
for (var i=0,il=iframe.length;i