(function(){
var inMovieBtn = T.get(‘in_movie_btn‘), inIndiviBtn = T.get(‘in_indivi_btn‘);
var indiviPop = T.query(‘.indivi-pop‘)[0], indiviPopCloseBtn = T.get(‘indivi_pop_close‘);
if(F.cookie.get(‘hideindivipop‘) || F.cookie.get(‘indivi‘)){
T.hide(indiviPop);
}
var hideIndiviPop = function(){
T.hide(indiviPop);
F.cookie.set(‘hideindivipop‘, ‘1‘);
};
var addIndiviCookie = function(){
if(!F.cookie.get(‘indivi‘)){
F.cookie.set(‘indivi‘, ‘1‘);
}
};
var delIndiviCookie = function(){
F.cookie.del(‘indivi‘);
};
var loveBtns = T.query(‘.info-layout .addMovie‘), IndiviChange = T.query(‘.Indivi-change‘);
// 点击删除图标
T.each(IndiviChange, function(ele, index){
var infoCon = T.q(‘info-con‘, ele);
if(infoCon) var length = infoCon.length;
if(infoCon) var delBtns = T.q(‘removeMovie‘, ele);
T.each(delBtns, function(i, b){
T.on(i, ‘click‘, function(e){
e = T.event.get(e);
T.event.stop(e);
length --;
if(T.dom.hasClass(infoCon[b], ‘last‘)){
var prevDom = T.dom.prev(infoCon[b]);
prevDom && T.dom.addClass(prevDom, ‘last‘);
}
T.dom.remove(infoCon[b]);
if(length > 4) T.observer.send(‘remove.change‘);
//如果没有内容 隐藏区块
if(length <= 0){
T.hide(ele);
}
//删除上报
var mid = T.dom.getAttr(i, ‘ref‘);
F.tool.stat.eventStat({type: "event", name: "media_dele", ext: [‘media=‘+ mid]});
});
});
});
// 点击心形图标
T.each(loveBtns, function(item, index){
var itemEm = T.q(‘istr‘, item)[0];
var $timer = 0, ttl = (T.browser.ie >= 9) ? 2000 : 600;
T.on(item, ‘click‘, function(e){
e = T.event.get(e);
T.event.stop(e);
var title = ‘喜欢这部电影‘, curTitle = ‘取消喜欢‘;
var isCurrent = T.dom.hasClass(item, ‘current‘);
var isStrong = T.q(‘strong‘, item);
var mid = T.dom.getAttr(item, ‘ref‘);
if(!isCurrent){
T.addClass(item, ‘current‘);
T.dom.setAttr(item, ‘title‘, curTitle);
T.dom.setStyle(itemEm, ‘visibility‘, ‘visible‘);
T.dom.setStyle(itemEm, ‘opacity‘, ‘1‘);
clearTimeout($timer);
$timer = setTimeout(function(){
T.addClass(item, ‘timeout‘);
T.dom.setStyle(itemEm, ‘visibility‘, ‘hidden‘);
T.dom.setStyle(itemEm, ‘opacity‘, ‘0‘);
},ttl);
//点击喜欢上报
F.tool.stat.eventStat({type: "event", name: "media_ding", ext: [‘media=‘+ mid]});
}else{
clearTimeout($timer);
T.removeClass(item, ‘current‘);
T.removeClass(item, ‘timeout‘);
T.dom.setAttr(item, ‘title‘, title);
//不喜欢上报
F.tool.stat.eventStat({type: "event", name: "media_cai", ext: [‘media=‘+ mid]});
}
});
});
//点击气泡关闭按钮
if(indiviPopCloseBtn) T.on(indiviPopCloseBtn, ‘click‘, hideIndiviPop);
//点击左右个性化按钮
if(inMovieBtn) T.on(inMovieBtn, ‘click‘, delIndiviCookie);
if(inIndiviBtn) T.on(inIndiviBtn, ‘click‘, addIndiviCookie);
})();
//切换效果
(function(){
var bodyNode = T.q(‘Indivi-change‘);
F.load(["tween", "slideTool"], function(){
T.each(bodyNode, function(ele){
var body = T.q("info-layout", ele)[0],
prev = T.q("indivi-btn-prev", ele)[0],
next = T.q("indivi-btn-next", ele)[0],
nodes = T.q("info-con", ele).length;
var actNum = function(){
if(T.dom.hasClass(ele, ‘small‘)){
return 3;
}
return T.query(‘body.w960‘).length ? 5 : 6;
}
if(!body || !prev || !next || nodes < 5){
T.hide(prev);
T.hide(next);
return;
};
var slider = new F.tool.slideTool({
body : body,
prev : prev,
next : next,
actNum : actNum(),//每次切换几个
margin : T.dom.hasClass(ele, ‘small‘) ? 16 : 20,
timer : 500
});
var updateSliderHandler = function(e){
var num = actNum();
slider.updateParam(num, ‘change‘);
};
if(!T.dom.hasClass(ele, ‘small‘)){
T.observer.add(‘response.change‘, updateSliderHandler);
T.observer.add(‘remove.change‘, updateSliderHandler);
}
});
//推荐特色主题
var IndiviFeatureInfo = T.query(‘.Indivi-feature .indivi-wrap‘);
var IndiviInnerHtml = T.query(‘.Indivi-feature .inner-html‘);
var timer = 0, timers = 0;
var ie = T.browser.ie;
T.each(IndiviFeatureInfo, function(item, index){
item.timer = null;
var nextJt = T.q(‘indivi-right-jt‘, item)[0];
var prevJt = T.q(‘indivi-left-jt‘, item)[0];
T.on(item, ‘mouseover‘, function(e){
clearTimeout(item.timer);
clearTimeout(timers);
if(ie < 8 && T.dom.hasClass(item, ‘indiv-1‘) || ie < 8 && T.dom.hasClass(item, ‘indiv-2‘) || ie < 8 && T.dom.hasClass(item, ‘indiv-3‘)){
T.dom.setStyle(item, ‘z-index‘, ‘5‘);
}
if(T.dom.getStyle(IndiviInnerHtml[index], ‘visibility‘) == ‘visible‘) return;
T.each(IndiviInnerHtml, function(ele, i){
T.dom.setStyle(ele, ‘visibility‘, ‘hidden‘);
});
T.addClass(item, ‘tween‘);
timers = setTimeout(function(){
F.tool.tween.add(IndiviInnerHtml[index], {
prop : ‘width‘,
method : F.math.tweener.easeOutQuint,
time : 300,
start : 200,
end : 580,
onComplete : function(){
}
});
T.dom.setStyle(IndiviInnerHtml[index], ‘visibility‘, ‘visible‘);
if(prevJt){T.dom.setStyle(prevJt, ‘visibility‘, ‘visible‘);}
if(nextJt){T.dom.setStyle(nextJt, ‘visibility‘, ‘visible‘);}
},300);
});
T.on(item, ‘mouseout‘, function(){
if(ie < 8 && T.dom.hasClass(item, ‘indiv-1‘) || ie < 8 && T.dom.hasClass(item, ‘indiv-2‘) || ie < 8 && T.dom.hasClass(item, ‘indiv-3‘)){
T.dom.setStyle(item, ‘z-index‘, ‘0‘);
}
item.timer = setTimeout(function(){
T.dom.setStyle(IndiviInnerHtml[index], ‘visibility‘, ‘hidden‘);
T.removeClass(IndiviInnerHtml[index].parentNode, ‘tween‘);
if(prevJt){T.dom.setStyle(prevJt, ‘visibility‘, ‘hidden‘);}
if(nextJt){T.dom.setStyle(nextJt, ‘visibility‘, ‘hidden‘);}
T.dom.setStyle(IndiviInnerHtml[index], ‘width‘, 200);
}, 100);
});
T.on(item.parentNode.parentNode, ‘mouseout‘, function(){
clearTimeout(timers);
});
});
});
})();
//风行猜点击上报
(function(){
var IndiviMod = T.query(‘.Indivi-mod‘);
var stp = null;
T.each(IndiviMod, function(item, index){
F.Event.delegate(item, ‘a‘, ‘mousedown‘, function(e){
stp = T.getAttr(item, ‘stp‘);
if(!stp || stp == null) return;
var href = this.getAttribute(‘href‘);
if(href) var match = href.match(/\d+/g);
if(match) var mediaid = String(match[0]);
if(stp && mediaid) F.tool.stat.guessEvent({mid: mediaid, et: ‘1‘, stp: stp});
});
});
})();