$host='http://client.pc.letv.com';
if(typeof Base=='undefined'){window.Base={}}
(function(){var topics={},caches={},observer,cache;observer=function(id){var callbacks,topic=id&&topics[id];if(!topic){callbacks=$.Callbacks();topic={publish:callbacks.fire,subscribe:callbacks.add,unsubscribe:callbacks.remove};if(id){topics[id]=topic}}return topic};cache=function(id){var cacheObj=id&&caches[id];if(!cacheObj){var os=Base.observer(id);var _value=null;cacheObj={set:function(value){_value=value;os.publish(value)},get:function(){return _value},subscribe:os.subscribe,unsubscribe:os.unsubscribe};if(id){caches[id]=cacheObj}}return cacheObj};Base.observer=observer;Base.cache=cache})();
(function(){window.pcEvent=function(type,param){if(!type)return;Base.observer('pcEvent-'+type).publish(param)};var isPc=false,isIE=$.browser.msie;try{if(isIE){window.external.jsToPc('js:checkIsPc')}else{window.cef_jsToPc('js:checkIsPc')}isPc=true}catch(e){isPc=false}Base.CustomEvent={resize:function(handle){if(isPc){Base.observer('pcEvent-resize').subscribe(handle)}else{$(window).resize(handle)}},wndModeSwitch:function(handle){Base.observer('pcEvent-wndModeSwitch').subscribe(handle)},minimize:function(handle){Base.observer('pcEvent-minimize').subscribe(handle)},unbind:function(type,handle){switch(type){case'resize':if(isPc){Base.observer('pcEvent-resize').unsubscribe(handle)}else{$(window).unbind('resize',handle)}break;case'minimize':Base.observer('pcEvent-minimize').unsubscribe(handle)}},popWndPlay:function(handle){Base.observer('pcEvent-popwndplay').subscribe(handle)}}})();
(function(){Base.CustomEvent.resize(dyCss)})();
(function(){var Json={toStr:function(obj){switch(typeof(obj)){case'string':return'"'+obj.replace(/(["\\])/g,'\\$1')+'"';case'array':return'['+obj.map(arguments.callee).join(',')+']';case'object':if(obj instanceof Array){var strArr=[];var len=obj.length;for(var i=0;i<len;i++){strArr.push(arguments.callee(obj[i]))}return'['+strArr.join(',')+']'}else if(obj==null){return'null'}else{var string=[];for(var property in obj)string.push(arguments.callee(property)+':'+arguments.callee(obj[property]));return'{'+string.join(',')+'}'}case'number':return obj;case false:return obj;case undefined:default:return''}},toJson:function(str){return eval('('+str+')')}};Base.Json=Json})();
(function(){var handles={};var isIE=$.browser.msie;window.pcToJs=function(){var param=Base.Json.toJson(arguments[1]);var handle=handles[param.to];if(!handle)return;for(var i=0,len=handle.length;i<len;i++){handle[i](param)}};window.addPcListener=function(type,handle){if(typeof handle!='function')return;if(!handles[type]){handles[type]=[]}handles[type].push(handle)};var pcInterface=function(type,setting){type=type||'';setting=setting||{};var param;switch(type){case'playVideo':var ref=encodeURIComponent(location.href.replace(/ref=[^&]+&?/,'').replace(/\?$|&$/,''));if(setting.url){if(setting.url.indexOf('?')<0){setting.url+='?ref='+ref}else{setting.url+='&ref='+ref}}var url=$host+'/play/'+setting.vid+'?ref='+ref;param={to:'player',cmd:'play',vsource:'letv',url:url+(setting.htime?'&htime='+setting.htime:''),follow:''};break;case'saveHistory':param={to:'webHistory',cmd:'save',url:location.href,type:$config.$product};break;case'fullPreview':param={to:'fullPreview',cmd:'action',url:location.href};break;case'wndModeContrller':param={to:'wndModeContrller',cmd:''};break;case'openUrl':var target;switch(setting.target){case'userCenter':default:target='userCenter';break}param={to:target,cmd:'openUrl',url:''};break;default:param={}}try{$.extend(param,setting);param=Base.Json.toStr(param);if(isIE){window.external.jsToPc(param)}else{window.cef_jsToPc(param)}try{console.log('jsToPc: '+Base.Json.toStr(param))}catch(e){}}catch(e){if($.browser.msie&&$.browser.version==6)return;try{console.log('pc客户端接口jsToPc异常：'+Base.Json.toStr(param))}catch(e){}}};var pcSynInterface={getMacId:function(){try{var macidStr;if(isIE){macidStr=window.external.getMacId().split(',')}else{macidStr=window.cef_getMacId().toString().split(',')}return{macid_md5:macidStr[0],macid:macidStr[1]}}catch(e){return{macid_md5:'error',macid:'error'}}},getClientLc:function(){try{if(isIE){return window.external.getLc()}else{return window.cef_getLc().toString()}}catch(e){return'error'}},getLog:function(size){try{size=(size||10)*1024;if(isIE){return window.external.getLog(size)}else{return window.cef_getLog(size).toString()}}catch(e){return'error'}},selectFolder:function(){try{if(isIE){return window.external.selectFolder()}else{return window.cef_selectFolder().toString()}}catch(e){return'error'}},openPage:function(type){try{if(isIE){window.external.openPage(type)}else{window.cef_openPage(type)}}catch(e){}},openFolder:function(path){try{if(isIE){window.external.openFolder(path)}else{window.cef_openFolder(path)}}catch(e){}},setUserInfo:function(ssouid,token,isvip,nickname){var obj=ssouid&&token&&isvip?{uid:ssouid,token:token,isvip:isvip,nickname:nickname}:undefined;var str=Base.Json.toStr(obj);try{if(isIE){window.external.setUserInfo(str)}else{window.cef_setUserInfo(str)}}catch(e){}},getCoagentId:function(){try{if(isIE){return window.external.getCoagentId()}else{return window.cef_getCoagentId().toString()}}catch(e){return'client_letvclient'}},getVersion:function(){try{if(isIE){return window.external.getVersion()}else{return window.cef_getVersion().toString()}}catch(e){return''}},isDownloadAppComplete:function(){try{if(isIE){return parseInt(window.external.isDownloadAppComplete())}else{return parseInt(window.cef_isDownloadAppComplete().toString())}}catch(e){return 0}},isMobileConnect:function(){try{if(isIE){return parseInt(window.external.isMobileConnect())}else{return parseInt(window.cef_isMobileConnect().toString())}}catch(e){return 0}},startInstallApp:function(installInfo){try{if(isIE){window.external.startInstallApp(installInfo)}else{window.cef_startInstallApp(installInfo)}}catch(e){}},openPlayRecorderTab:function(){try{if(isIE){window.external.openPlayRecorderTab()}else{window.cef_openPlayRecorderTab()}}catch(e){}}};Base.pcInterface=pcInterface;Base.pcSynInterface=pcSynInterface})();
(function(){Base.pcInterface('saveHistory')})();
if(typeof Model=='undefined'){window.Model={}}
(function(){var Request={getInfo:function(){var param={"to":"updater","from":"updateui","cmd":"getInfo"};Base.pcInterface('',param)},start:function(){var param={"to":"updater","from":"updateui","cmd":"start"};Base.pcInterface('',param)}};var Response={_handles:{},addListener:function(type,handle){if(!this._handles[type]){this._handles[type]=[]}if(typeof handle!='function')return;this._handles[type].push(handle)}};window.addPcListener('updateui',function(param){if(param.cmd){var fns=Response._handles[param.cmd]||[];for(var i=0,len=fns.length;i<len;i++){fns[i](param)}}});Model.UpdateVersion={Request:Request,Response:Response}})();
(function(){function addEvent(){$('#setting-page').click(function(){Base.pcSynInterface.openPage('setting')});$('#version').click(function(){var targetNode=$(this).closest('p'),now=targetNode.attr('now'),newer=targetNode.attr('newer');location.href=$host+'/version?nowver='+now+'&newver='+newer})}function checkVersion(){Model.UpdateVersion.Response.addListener('getInfo',function(param){var data=param.data,targetNode=$('#version').closest('p');targetNode.attr({now:data.nowVersion,newer:data.newVersion});if(data.nowVersion!=data.newVersion){targetNode.addClass('active')}});Model.UpdateVersion.Request.getInfo()}function main(){addEvent();checkVersion()}main()})();
$(document).ready(function(){$(document).bind('contextmenu',function(){return false});document.body.onmousewheel=null;$(document).bind('selectstart',function(evt){var tagName=evt.target.tagName;if(tagName!="INPUT"&&tagName!='TEXTAREA'&&!$(evt.target).is('.debug-msg div')){return false}})});
var _hmt=_hmt||[];(function(){var hm=document.createElement("script");hm.src="//hm.baidu.com/hm.js?efe74280b7b052428887dddeb57cce30";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(hm,s)})();
(function(){var nodes={left:$('div.menu'),right:$('div.ice-body')};Base.CustomEvent.resize(resizeFn);function resizeFn(){var wh=$(window).height();nodes.left.height(wh);nodes.right.height(wh-20)}resizeFn();nodes.left.find('div.ice').show()})();
(function(){var Request={get:function(){var param={"to":"settinger","from":"settingui","cmd":"get"};Base.pcInterface('',param)},set:function(data){var param={"to":"settinger","from":"settingui","cmd":"set","data":data};Base.pcInterface('',param)},setDefault:function(){var param={"to":"settinger","from":"settingui","cmd":"setDefault"};Base.pcInterface('',param)}};var Response={_handles:{},addListener:function(type,handle){if(!this._handles[type]){this._handles[type]=[]}if(typeof handle!='function')return;this._handles[type].push(handle)}};window.addPcListener('settingui',function(param){var fns=Response._handles[param.cmd]||[];for(var i=0,len=fns.length;i<len;i++){fns[i](param)}});Model.Setting={Request:Request,Response:Response}})();
if(typeof Widget=='undefined'){window.Widget={}}
(function(){var Dialog=function(model,param){param.container=param.container||'body';this.dialogNode=model.slice(0,1)=='#'?$(model):$(model).appendTo(param.container);this.width=param.width||this.dialogNode.outerWidth();this.height=param.height||this.dialogNode.outerHeight();if(param.hasShadow){this.shadow=$('<div class="white-body" style="display: none;"></div>').appendTo(param.container)}if(param.isOverFlash){this.overFlashFrame=$('<iframe style="position: absolute;visibility: hidden;overflow: hidden;width:'+this.width+'px;height:'+this.height+'px;"></iframe>').appendTo(param.container)}this.shadowEvent=typeof param.shadowEvent=='undefined'?true:param.shadowEvent;this.hiddenFn=param.hiddenFn;this.addEvent();this.resize()};Dialog.prototype={show:function(){this.dialogNode.css('visibility','visible');this.overFlashFrame&&this.overFlashFrame.css('visibility','visible');this.shadow&&this.shadow.show()},hide:function(){this.dialogNode.css('visibility','hidden');this.overFlashFrame&&this.overFlashFrame.css('visibility','hidden');this.shadow&&this.shadow.hide();this.hiddenFn&&this.hiddenFn()},setCenter:function(){var ww=$(window).width(),wh=$(window).height();this.dialogNode.css('top',(wh-this.height)/2);this.shadow&&this.shadow.css({width:ww,height:wh})},resize:function(){if(this.overFlashFrame){this.overFlashFrame.css({width:this.dialogNode.outerWidth(),height:this.dialogNode.outerHeight(),left:this.dialogNode.offset().left-this.dialogNode.parent().offset().left,top:this.dialogNode.offset().top-this.dialogNode.parent().offset().top})}},addEvent:function(){var self=this;if(this.shadow&&this.shadowEvent){this.shadow.click(function(){self.hide()})}Base.CustomEvent.resize($.proxy(this.resize,this))}};Widget.Dialog=Dialog})();
(function(){var _dialogs=[];var isShowing=false;function showDialog(){if(!isShowing&&_dialogs.length){isShowing=true;var obj=_dialogs.shift();switch(obj.type){case'info':infoDialog.show(obj.msg,obj.time);break;case'info2':info2Dialog.show(obj.msg,obj.subMsg,obj.time);break;case'alert':alertDialog.show(obj.msg,obj.submsg,obj.cb);break;case'confirm':confirmDialog.show(obj.msg,obj.cb);break;case'confirm2':confirm2Dialog.show(obj.delCb,obj.reloadCb);break}}}function info(msg,time){_dialogs.push({type:'info',msg:msg,time:time});showDialog()}function info2(msg,subMsg,time){_dialogs.push({type:'info2',msg:msg,subMsg:subMsg,time:time});showDialog()}function alert(msg,submsg,cb){_dialogs.push({type:'alert',msg:msg,submsg:submsg,cb:cb});showDialog()}function confirm(msg,cb){_dialogs.push({type:'confirm',msg:msg,cb:cb});showDialog()}function confirm2(delCb,reloadCb){_dialogs.push({type:'confirm2',delCb:delCb,reloadCb:reloadCb});showDialog()}var infoDialog={dialog:null,_model:['<div class="hint ht-250">','<table width="100%" cellspacing="0" cellpadding="0" border="0">','<tbody><tr>','<td class="t-l">&nbsp;</td>','<td class="t-c">&nbsp;</td>','<td class="t-r">&nbsp;</td>','</tr>','<tr>','<td class="c-l">&nbsp;</td>','<td class="c-c"><p id="advise-info-msg" class="p-c">成功追剧到播放单</p></td>','<td class="c-r">&nbsp;</td>','</tr>','<tr>','<td class="b-l">&nbsp;</td>','<td class="b-c">&nbsp;</td>','<td class="b-r">&nbsp;</td>','</tr></tbody>','</table>','</div>'].join(''),initDialog:function(){this.dialog=new Widget.Dialog(this._model,{isOverFlash:true,hiddenFn:function(){isShowing=false;showDialog()}})},show:function(msg,time){if(!this.dialog){this.initDialog()}$('#advise-info-msg').html(msg);this.dialog.show();var self=this;setTimeout(function(){self.dialog.hide()},time||1500)}};var info2Dialog={dialog:null,_model:['<div class="hint ht-400 ht-commen">','<h2 id="advise-info2-msg" class="ht-commen-title"></h2>','<p id="advise-info2-submsg" class="ht-commen-con"></p>','</div>'].join(''),initDialog:function(){this.dialog=new Widget.Dialog(this._model,{isOverFlash:true,hiddenFn:function(){isShowing=false;showDialog()}})},show:function(msg,subMsg,time){if(!this.dialog){this.initDialog()}$('#advise-info2-msg').html(msg||'');$('#advise-info2-submsg').html(subMsg||'');this.dialog.show();var self=this;setTimeout(function(){self.dialog.hide()},time||1500)}};var alertDialog={dialog:null,_model:['<div class="hint ht-400">','<table width="100%" cellspacing="0" cellpadding="0" border="0">','<tbody><tr>','<td class="t-l">&nbsp;</td>','<td class="t-c">&nbsp;</td>','<td class="t-r">&nbsp;</td>','</tr>','<tr>','<td class="c-l">&nbsp;</td>','<td class="c-c"><ul class="ht-file">','<li id="advise-alert-msg" class="li01">无法找到视频文件</li>','<li id="advise-alert-submsg" class="li02">请确认视频文件是否被移动或删除</li>','<li class="li03"><a id="advise-alert-btn" class="btn" title="" href="#">确定</a></li>','</ul></td>','<td class="c-r">&nbsp;</td>','</tr>','<tr>','<td class="b-l">&nbsp;</td>','<td class="b-c">&nbsp;</td>','<td class="b-r">&nbsp;</td>','</tr></tbody>','</table>','</div>'].join(''),initDialog:function(){var self=this;this.dialog=new Widget.Dialog(this._model,{hasShadow:true,hiddenFn:function(){isShowing=false;showDialog()}})},show:function(msg,submsg,cb){var self=this;if(!this.dialog){this.initDialog()}$('#advise-alert-msg').html(msg||'');$('#advise-alert-submsg').html(submsg||'');$('#advise-alert-btn').unbind('click').bind('click',function(){self.dialog.hide();cb&&cb()});this.dialog.show()}};var confirmDialog={dialog:null,_model:['<div class="hint ht-400">','<table width="100%" cellspacing="0" cellpadding="0" border="0">','<tbody><tr>','<td class="t-l">&nbsp;</td>','<td class="t-c">&nbsp;</td>','<td class="t-r">&nbsp;</td>','</tr>','<tr>','<td class="c-l">&nbsp;</td>','<td class="c-c"><dl class="clear-play">','<dt id="advise-confirm-msg">您确定清空播放记录？</dt>','<dd><a id="advise-confirm-submit" class="btn" href="#">确定</a><a id="advise-confirm-cancel" class="btn" href="#">取消</a></dd>','</dl></td>','<td class="c-r">&nbsp;</td>','</tr>','<tr>','<td class="b-l">&nbsp;</td>','<td class="b-c">&nbsp;</td>','<td class="b-r">&nbsp;</td>','</tr></tbody>','</table>','</div>'].join(''),initDialog:function(){var self=this;this.dialog=new Widget.Dialog(this._model,{hasShadow:true,hiddenFn:function(){isShowing=false;showDialog()}});$('#advise-confirm-cancel').click(function(){self.dialog.hide()})},show:function(msg,cb){var self=this;if(!this.dialog){this.initDialog()}$('#advise-confirm-msg').html(msg);$('#advise-confirm-submit').unbind('click').bind('click',function(){self.dialog.hide();cb&&cb()});this.dialog.show()}};var confirm2Dialog={dialog:null,_model:['<div class="dialog" id="reload-advise">','<div class="dialog-bg"></div>','<a id="reload-advise-close" href="#" class="shutdown"></a>','<div class="dialog-con">','<div class="tit-content">该视频已被删除或移动</div>','<div class="btns">','<a id="reload-advise-del" href="#" class="ui-dialog-btns-gray">删除该项</a>','<a id="reload-advise-reload" href="#" class="ui-dialog-btns-gray">重新下载</a>','</div>','</div>','</div>'].join(''),initDialog:function(){var self=this;this.dialog=new Widget.Dialog(this._model,{hasShadow:true,hiddenFn:function(){isShowing=false;showDialog()}});$('#reload-advise-close').click(function(){self.dialog.hide()})},show:function(delCb,reloadCb){var self=this;if(!this.dialog){this.initDialog()}$('#reload-advise-del').unbind('click').bind('click',function(){self.dialog.hide();delCb&&delCb()});$('#reload-advise-reload').unbind('click').bind('click',function(){self.dialog.hide();reloadCb&&reloadCb()});this.dialog.show()}};Widget.advise={info:info,info2:info2,alert:alert,confirm:confirm,confirm2:confirm2}})();
(function(){var nodes={setDefault:$('#set-default'),startWithComputer:$('#start-with-computer'),autoDownload:$('#auto-download'),smallApp:$('#small-app'),closeApp:$('#close-app'),closePopWindow:$('#close-pop-windows'),downloadLimit:$('#download-limit'),downloadLimitNum:$('#download-limit a'),downloadLimitList:$('#download-limit-list'),downloadFolder:$('#download-folder'),downloadFolderSelect:$('#download-folder-select'),openFolder:$('#open-download-folder'),completeShutdown:$('#complete-shutdown')};function main(){addEvent();Model.Setting.Request.get()}function init(result){var data=result.data;data.startWithComputer=='1'?nodes.startWithComputer.addClass('active'):nodes.startWithComputer.removeClass('active');data.autoDownload=='1'?nodes.autoDownload.addClass('active'):nodes.autoDownload.removeClass('active');nodes.smallApp.removeClass('active');nodes.closeApp.removeClass('active');data.closeType=='small'?nodes.smallApp.addClass('active'):nodes.closeApp.addClass('active');data.closePopWindows=='1'?nodes.closePopWindow.addClass('active'):nodes.closePopWindow.removeClass('active');data.completeShutdown=='1'?nodes.completeShutdown.addClass('active'):nodes.completeShutdown.removeClass('active');nodes.downloadLimitNum.html(data.downloadLimit);nodes.downloadFolder.html(data.downloadFolder).attr('title',data.downloadFolder)}function addEvent(){Model.Setting.Response.addListener('get',init);Model.Setting.Response.addListener('setDefault',init);nodes.setDefault.click(function(){Model.Setting.Request.setDefault();showTip(this)});nodes.startWithComputer.click(function(){$(this).toggleClass('active');Model.Setting.Request.set({startWithComputer:$(this).hasClass('active')?1:0});showTip(this)});nodes.autoDownload.click(function(){$(this).toggleClass('active');Model.Setting.Request.set({autoDownload:$(this).hasClass('active')?1:0});showTip(this)});nodes.smallApp.click(function(){$(this).addClass('active');nodes.closeApp.removeClass('active');Model.Setting.Request.set({closeType:'small'});showTip(this)});nodes.closeApp.click(function(){$(this).addClass('active');nodes.smallApp.removeClass('active');Model.Setting.Request.set({closeType:'close'});showTip(this)});nodes.closePopWindow.click(function(){$(this).toggleClass('active');Model.Setting.Request.set({closePopWindows:$(this).hasClass('active')?1:0});showTip(this)});nodes.completeShutdown.click(function(){$(this).toggleClass('active');Model.Setting.Request.set({completeShutdown:$(this).hasClass('active')?1:0});showTip(this)});nodes.downloadLimit.click(function(evt){evt.stopPropagation();nodes.downloadLimitList.fadeIn('fast')});nodes.downloadLimitList.delegate('li','click',function(){nodes.downloadLimitList.hide();var num=$(this).find('a').html();nodes.downloadLimitNum.html(num);Model.Setting.Request.set({downloadLimit:num});showTip(this)});$(document).click(function(){nodes.downloadLimitList.hide()});nodes.downloadFolderSelect.click(function(){var folder=Base.pcSynInterface.selectFolder();if(folder=='error'){Widget.advise.alert('请设置下载路径到非系统盘');return}if(folder){nodes.downloadFolder.html(folder).attr('title',folder);Model.Setting.Request.set({downloadFolder:folder});showTip(this)}});nodes.openFolder.click(function(){var path=$.trim(nodes.downloadFolder.html());Base.pcSynInterface.openFolder(path)})}function showTip(node){var tipNode=$(node).closest('dd,dt').find('em.ico-yes').stop().show();clearTimeout(tipNode[0].autoTime);tipNode[0].autoTime=setTimeout(function(){tipNode.fadeOut('fast')},600)}main()})();
