幸福都是奋斗出来的
var deviceWidth = document.documentElement.clientWidth;
if(deviceWidth>750){
document.documentElement.style.fontSize=750/7.50+"px";
}else{
document.documentElement.style.fontSize=deviceWidth/7.50+"px";
}
function orientNotice(){
window.location.reload();
}
if (window.attachEvent) {
window.attachEvent("onorientationchange" in window ? "orientationchange" : "resize", function () {
setTimeout(orientNotice, 200);
})
} else if (window.addEventListener) {
window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function () {
setTimeout(orientNotice, 200);
},false)
}
var vjAcc="860010-1601010100";
var wrUrl="http://cntv.wrating.com/";
var wrVideoUrl="http://cntv.wrating.com/";
var kEvent=(function(){
return {
addEvent: function(element, name, observer, useCapture) {
try{
element=Dom.$id(element);
if(element.addEventListener){
if(name==='mouseenter')
element.addEventListener('mouseover',withoutChildFunction(observer),useCapture);
else if(name==='mouseleave')
element.addEventListener('mouseout',withoutChildFunction(observer),useCapture);
else
element.addEventListener(name, observer, useCapture);
}else if(element.attachEvent){
element.attachEvent('on' + name, observer);
}
}catch(e){}
}
}
})();
/*
dom
*/
var Dom={
/*
node
*/
$id:function(nodeId){
if(typeof nodeId=='string'){
return document.getElementById(nodeId);
}else if(typeof nodeId=='object'){
return nodeId;
}else{
return false;
}
},
/*
class
*/
isClass:function(className, node){
if((!node)||(!className)){return null;}
var reFlag=false;
if(node.className==className){
reFlag=true;
}
return reFlag;
},
hasClass:function(className, node){
if((!className)||(!node)||(!node.className)){return false;}
return (new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)').test(node.className));
},
addClass:function(className, node){
if((!className)||(!node)){return false;}
if(Dom.hasClass(className, node)){return true;}
var newClassName=node.className?node.className+' '+className:className;
node.className=newClassName;
return true;
},
removeClass:function(className, node){
if(!(Dom.hasClass(className, node))){return;}
var nodeClassName=node.className;
if(nodeClassName==className){
nodeClassName="";
}else{
nodeClassName=nodeClassName.replace(new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', 'g'), "").replace(/^\s*/,"");
}
node.className=nodeClassName;
}
};
var withoutChildFunction=function(func){
return function(e){
var parent=e.relatedTarget;//上一响应mouseover/mouseout事件的元素
while(parent!=this&&parent){//假如存在这个元素并且这个元素不等于目标元素(被赋予mouseenter事件的元素)
try{
parent=parent.parentNode;}//上一响应的元素开始往上寻找目标元素
catch(e){
break;
}
}
if(parent!=this)//以mouseenter为例,假如找不到,表明当前事件触发点不在目标元素内
func(e);//运行目标方法,否则不运行
}
}
/*标签切换*/
function module(div){
var tabs=div+"_tabs_ELMT1521684063797688";
var lis = document.getElementById(tabs).getElementsByTagName('li');
var len=lis.length;
var hascur=0;
if(len>0){
hascur = lis[0].getAttribute("id");
}
var cont=div+"_content_";
function show(cur){
return function(){
for(var i=0;i if(lis[i]!=null&&lis[i]!=""){ var curstr = (cont+lis[i].getAttribute('id')).substring(cont.length); if(curstr==cur){ Dom.addClass("cur",lis[i]); Dom.$id(cont+lis[i].getAttribute('id')).style.display="block"; }else{ Dom.removeClass("cur",lis[i]); Dom.$id(cont+lis[i].getAttribute('id')).style.display="none"; } } }
/*$(".bottummarkmodule").each(function(i){
var curstr = $(this).attr("id").substring(cont.length);
if((cont+cur)==$(this).attr("id")){
$("#"+curstr).addClass("cur");
Dom.$id($(this).attr("id")).style.display="block";
}else{
$("#"+curstr).removeClass("cur");
Dom.$id($(this).attr("id")).style.display="none";
}
});*/
}
}
function fnEvent(affair){
for(var t=0;t if(Dom.hasClass(lis[t].getAttribute("id"),"cur")){ hascur=lis[t].getAttribute("id"); } kEvent.addEvent(lis[t].getAttribute("id"),affair,show(lis[t].getAttribute("id"))); } /*for(var t=0;t if(Dom.hasClass($(lis[t]).attr("id"),"cur")){ hascur=$(lis[t]).attr("id"); } kEvent.addEvent($(lis[t]).attr("id"),affair,show($(lis[t]).attr("id"))); }*/ show(hascur)(); } this.initTabs=function(){fnEvent("click");} this.initTabsHover=function(){fnEvent("mouseenter");} } /*应用到页面模块上*/ (new module("model_01")).initTabsHover();
var pagecode="A-012-029-001";
(function () {
var showMoreNChildren = function ($children, n) {
//显示某jquery元素下的前n个隐藏的子元素
var $hiddenChildren = $children.filter(":hidden");
var cnt = $hiddenChildren.length;
for (var i = 0; i < n && i < cnt ; i++) {
$hiddenChildren.eq(i).show();
}
return cnt - n;//返回还剩余的隐藏子元素的数量
}
jQuery.showMore = function (selector) {
if (selector == undefined) { selector = ".showMoreNChildren" }
//对页中现有的class=showMorehandle的元素,在之后添加显示更多条,并绑定点击行为
$(selector).each(function () {
var pagesize = $(this).attr("pagesize") || 5;
var $children = $(this).children();
if ($children.length > pagesize) {
for (var i = pagesize; i < $children.length; i++) {
$children.eq(i).hide();
}
$("
if (showMoreNChildren($children, pagesize) <= 0) {
//如果目标元素已经没有隐藏的子元素了,就隐藏"点击更多的按钮条"
$(this).hide();
};
});
}
});
}
})();
$.showMore(".showMoreNChildren, .text01");