/* sohutv 2017-04-10 18:12:01 */ "undefined"!=typeof dojo?dojo.provide("org.cometd"):(this.org=this.org||{},org.cometd={}),org.cometd.JSON={},org.cometd.JSON.toJSON=org.cometd.JSON.fromJSON=function(e){throw"Abstract"},org.cometd.Utils={},org.cometd.Utils.isString=function(e){return void 0===e||null===e?!1:"string"==typeof e||e instanceof String},org.cometd.Utils.isArray=function(e){return void 0===e||null===e?!1:e instanceof Array},org.cometd.Utils.inArray=function(e,t){for(var n=0;n0;){var t=u[0],n=t[0],i=t[1];{if(n.url!==e.url||n.sync!==e.sync)break;u.shift(),e.messages=e.messages.concat(n.messages),this._debug("Coalesced",n.messages.length,"messages from request",i.id)}}}function t(e,t){if(this.transportSend(e,t),t.expired=!1,!e.sync){var n=this.getConfiguration().maxNetworkDelay,i=n;t.metaConnect===!0&&(i+=this.getAdvice().timeout),this._debug("Transport",this.getType(),"waiting at most",i,"ms for the response, maxNetworkDelay",n);var s=this;t.timeout=this.setTimeout(function(){t.expired=!0,t.xhr&&t.xhr.abort();var n="Request "+t.id+" of transport "+s.getType()+" exceeded "+i+" ms max network delay";s._debug(n),s.complete(t,!1,t.metaConnect),e.onFailure(t.xhr,e.messages,"timeout",n)},i)}}function n(e){var n=++c,i={id:n,metaConnect:!1};d.length=0&&d.splice(s,1),u.length>0){var o=u.shift(),a=o[0],r=o[1];if(this._debug("Transport dequeued request",r.id),i)this.getConfiguration().autoBatch&&e.call(this,a),n.call(this,a),this._debug("Transport completed request",t.id,a);else{var c=this;this.setTimeout(function(){c.complete(r,!1,r.metaConnect),a.onFailure(r.xhr,a.messages,"error","Previous request failed")},0)}}}function o(e){if(null!==l)throw"Concurrent metaConnect requests not allowed, request id="+l.id+" not yet completed";var n=++c;this._debug("Transport",this.getType(),"metaConnect send, request",n,"envelope",e);var i={id:n,metaConnect:!0};t.call(this,e,i),l=i}var a=new org.cometd.Transport,r=org.cometd.Transport.derive(a),c=0,l=null,d=[],u=[];return r.complete=function(e,t,n){n?i.call(this,e):s.call(this,e,t)},r.transportSend=function(e,t){throw"Abstract"},r.transportSuccess=function(e,t,n){t.expired||(this.clearTimeout(t.timeout),this.complete(t,!0,t.metaConnect),n&&n.length>0?e.onSuccess(n):e.onFailure(t.xhr,e.messages,"Empty HTTP response"))},r.transportFailure=function(e,t,n,i){t.expired||(this.clearTimeout(t.timeout),this.complete(t,!1,t.metaConnect),e.onFailure(t.xhr,e.messages,n,i))},r.send=function(e,t){t?o.call(this,e):n.call(this,e)},r.abort=function(){a.abort();for(var e=0;e0;){var r=org.cometd.JSON.toJSON(e.messages.slice(s,s+o)),c=e.url.length+encodeURI(r).length;if(c>n){if(1===o){var l="Bayeux message too big ("+c+" bytes, max is "+n+") for transport "+this.getType();return void this.setTimeout(function(){i.transportFailure(e,t,"error",l)},0)}--o}else a.push(o),s+=o,o=e.messages.length-s}var d=e;if(a.length>1){var u=0,h=a[0];this._debug("Transport",this.getType(),"split",e.messages.length,"messages into",a.join(" + ")),d=this._mixin(!1,{},e),d.messages=e.messages.slice(u,h),d.onSuccess=e.onSuccess,d.onFailure=e.onFailure;for(var f=1;f=0){c=!0,m.splice(v,1);var b=l[g][0],y=l[g][1];delete l[g],m.length>0&&(l[m.join(",")]=[b,y]);break}}}c&&this._debug("Transport",this.getType(),"removed envelope, envelopes",l),s.call(this,n),t&&u.close(1e3,"Disconnect")},a.onClose=function(e,t){this._debug("Transport",this.getType(),"closed",e,t,u),r=c;for(var n in d)this.clearTimeout(d[n]);d={};for(var i in l){var s=l[i][0],o=l[i][1];o&&(f=!1),s.onFailure(u,s.messages,"closed "+e+"/"+t)}l={},null!==u&&h&&u.close(1e3,"Close"),h=!1,u=null},a.registered=function(e,t){o.registered(e,t),i=t},a.accept=function(e,t,n){return r&&!!org.cometd.WebSocket&&i.websocketEnabled===!0},a.send=function(e,t){this._debug("Transport",this.getType(),"sending",e,"metaConnect =",t);for(var i=[],s=0;s0)ee._info("Appending message type to URI "+s+o+" is not supported, disabling 'appendMessageTypeToURL' configuration"),ve.appendMessageTypeToURL=!1;else{var a=s.split("/"),r=a.length-1;s.match(/\/$/)&&(r-=1),a[r].indexOf(".")>=0&&(ee._info("Appending message type to URI "+s+" is not supported, disabling 'appendMessageTypeToURL' configuration"),ve.appendMessageTypeToURL=!1)}}function o(){for(var e in de)for(var t=de[e],n=0;n",e),se=e)}function r(){return"disconnecting"===se||"disconnected"===se}function c(){return++oe}function l(e,t,i,s,o){try{return t.call(e,s)}catch(a){ee._debug("Exception during execution of extension",i,a);var r=ee.onExtensionException;if(n(r)){ee._debug("Invoking extension exception callback",i,a);try{r.call(ee,a,i,o,s)}catch(c){ee._info("Exception during execution of exception callback in extension",i,c)}}return s}}function d(e){for(var t=0;t0)for(var s=0;s0;--s){var o=n.slice(0,s).join("/")+"/*";s===i&&h(o,t),o+="*",h(o,t)}}function p(){null!==he&&org.cometd.Utils.clearTimeout(he),he=null}function g(e){p();var t=pe.interval+ue;ee._debug("Function scheduled in",t,"ms, interval =",pe.interval,"backoff =",ue,e),he=org.cometd.Utils.setTimeout(ee,e,t)}function m(e,t,n,i){for(var s=0;s0||le===!0?ce.push(e):m(!1,[e],!1)}function b(){ue=0}function y(){ue0&&m(!1,e,!1)}function x(){if(--re,0>re)throw"Calls to startBatch() and endBatch() are not paired";0===re&&!r()&&!le&&_()}function w(){if(!r()){var e={channel:"/meta/connect",connectionType:Z.getType()};me||(e.advice={timeout:0}),a("connecting"),ee._debug("Connect sent",e),m(!1,[e],!0,"connect"),a("connected")}}function T(){a("connecting"),g(function(){w()})}function C(e){e&&(pe=ee._mixin(!1,{},ve.advice,e),ee._debug("New advice",pe))}function S(e){p(),e&&Z.abort(),ae=null,a("disconnected"),re=0,b(),ce.length>0&&(ye.call(ee,void 0,ce,"error","Disconnected"),ce=[])}function B(e){ae=null,o(),r()?(ie.reset(),C(ve.advice)):C(ee._mixin(!1,pe,{reconnect:"retry"})),re=0,le=!0,X=e;var t="1.0",n=ie.findTransportTypes(t,ne,ve.url),i={version:t,minimumVersion:"0.9",channel:"/meta/handshake",supportedConnectionTypes:n,advice:{timeout:pe.timeout,interval:pe.interval}},s=ee._mixin(!1,{},X,i);Z=ie.negotiateTransport(n,t,ne,ve.url),ee._debug("Initial transport is",Z.getType()),a("handshaking"),ee._debug("Handshake sent",s),m(!1,[s],!1,"handshake")}function I(){a("handshaking"),le=!0,g(function(){B(X)})}function N(e){f("/meta/handshake",e),f("/meta/unsuccessful",e);var t=!r()&&"none"!==pe.reconnect;t?(y(),I()):S(!1)}function O(e){if(e.successful){ae=e.clientId;var t=ie.negotiateTransport(e.supportedConnectionTypes,e.version,ne,ve.url);if(null===t)throw"Could not negotiate transport with server; client "+ie.findTransportTypes(e.version,ne,ve.url)+", server "+e.supportedConnectionTypes;Z!==t&&(ee._debug("Transport",Z,"->",t),Z=t),le=!1,_(),e.reestablish=ge,ge=!0,f("/meta/handshake",e);var n=r()?"none":pe.reconnect;switch(n){case"retry":b(),T();break;case"none":S(!1);break;default:throw"Unrecognized advice action "+n}}else N(e)}function R(e,t){N({successful:!1,failure:!0,channel:"/meta/handshake",request:t,xhr:e,advice:{reconnect:"retry",interval:ue}})}function U(e){f("/meta/connect",e),f("/meta/unsuccessful",e);var t=r()?"none":pe.reconnect;switch(t){case"retry":T(),y();break;case"handshake":ie.reset(),b(),I();break;case"none":S(!1);break;default:throw"Unrecognized advice action"+t}}function E(e){if(me=e.successful){f("/meta/connect",e);var t=r()?"none":pe.reconnect;switch(t){case"retry":b(),T();break;case"none":S(!1);break;default:throw"Unrecognized advice action "+t}}else U(e)}function D(e,t){me=!1,U({successful:!1,failure:!0,channel:"/meta/connect",request:t,xhr:e,advice:{reconnect:"retry",interval:ue}})}function L(e){S(!0),f("/meta/disconnect",e),f("/meta/unsuccessful",e)}function H(e){e.successful?(S(!1),f("/meta/disconnect",e)):L(e)}function j(e,t){L({successful:!1,failure:!0,channel:"/meta/disconnect",request:t,xhr:e,advice:{reconnect:"none",interval:0}})}function A(e){f("/meta/subscribe",e),f("/meta/unsuccessful",e)}function P(e){e.successful?f("/meta/subscribe",e):A(e)}function W(e,t){A({successful:!1,failure:!0,channel:"/meta/subscribe",request:t,xhr:e,advice:{reconnect:"none",interval:0}})}function J(e){f("/meta/unsubscribe",e),f("/meta/unsuccessful",e)}function F(e){e.successful?f("/meta/unsubscribe",e):J(e)}function q(e,t){J({successful:!1,failure:!0,channel:"/meta/unsubscribe",request:t,xhr:e,advice:{reconnect:"none",interval:0}})}function M(e){f("/meta/publish",e),f("/meta/unsuccessful",e)}function V(e){void 0===e.successful?e.data?f(e.channel,e):ee._debug("Unknown message",e):e.successful?f("/meta/publish",e):M(e)}function Q(e,t){M({successful:!1,failure:!0,channel:t.channel,request:t,xhr:e,advice:{reconnect:"none",interval:0}})}function z(e){if(e=d(e),void 0!==e&&null!==e){C(e.advice);var t=e.channel;switch(t){case"/meta/handshake":O(e);break;case"/meta/connect":E(e);break;case"/meta/disconnect":H(e);break;case"/meta/subscribe":P(e);break;case"/meta/unsubscribe":F(e);break;default:V(e)}}}function K(e){var t=de[e];if(t)for(var n=0;ne?"0"+e:e}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,i,s,o,a,r=gap,c=t[e];switch(c&&"object"==typeof c&&"function"==typeof c.toJSON&&(c=c.toJSON(e)),"function"==typeof rep&&(c=rep.call(t,e,c)),typeof c){case"string":return quote(c);case"number":return isFinite(c)?String(c):"null";case"boolean":case"null":return String(c);case"object":if(!c)return"null";if(gap+=indent,a=[],"[object Array]"===Object.prototype.toString.apply(c)){for(o=c.length,n=0;o>n;n+=1)a[n]=str(n,c)||"null";return s=0===a.length?"[]":gap?"[\n"+gap+a.join(",\n"+gap)+"\n"+r+"]":"["+a.join(",")+"]",gap=r,s}if(rep&&"object"==typeof rep)for(o=rep.length,n=0;o>n;n+=1)i=rep[n],"string"==typeof i&&(s=str(i,c),s&&a.push(quote(i)+(gap?": ":":")+s));else for(i in c)Object.hasOwnProperty.call(c,i)&&(s=str(i,c),s&&a.push(quote(i)+(gap?": ":":")+s));return s=0===a.length?"{}":gap?"{\n"+gap+a.join(",\n"+gap)+"\n"+r+"}":"{"+a.join(",")+"}",gap=r,s}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(e){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(e){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(e,t,n){var i;if(gap="",indent="","number"==typeof n)for(i=0;n>i;i+=1)indent+=" ";else"string"==typeof n&&(indent=n);if(rep=t,!t||"function"==typeof t||"object"==typeof t&&"number"==typeof t.length)return str("",{"":e});throw new Error("JSON.stringify")}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(e,t){var n,i,s=e[t];if(s&&"object"==typeof s)for(n in s)Object.hasOwnProperty.call(s,n)&&(i=walk(s,n),void 0!==i?s[n]=i:delete s[n]);return reviver.call(e,t,s)}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),function(e){function t(e,t){if(t)for(var n in t)"content-type"!==n.toLowerCase()&&e.setRequestHeader(n,t[n])}function n(){var n=new org.cometd.LongPollingTransport,i=org.cometd.Transport.derive(n);return i.xhrSend=function(n){return e.ajax({url:n.url,async:n.sync!==!0,type:"POST",contentType:"application/json;charset=UTF-8",data:n.body,xhrFields:{withCredentials:!0},beforeSend:function(e){return t(e,n.headers),!0},success:n.onSuccess,error:function(e,t,i){n.onError(t,i)}})},i}function i(){var n=new org.cometd.CallbackPollingTransport,i=org.cometd.Transport.derive(n);return i.jsonpSend=function(n){e.ajax({url:n.url,async:n.sync!==!0,type:"GET",dataType:"jsonp",jsonp:"jsonp",data:{message:n.body},beforeSend:function(e){return t(e,n.headers),!0},success:n.onSuccess,error:function(e,t,i){n.onError(t,i)}})},i}org.cometd.JSON.toJSON=JSON.stringify,org.cometd.JSON.fromJSON=JSON.parse,e.Cometd=function(e){var t=new org.cometd.Cometd(e);return org.cometd.WebSocket&&(t.registerTransport("websocket",new org.cometd.WebSocketTransport),t.websocketEnabled=!0),t.registerTransport("long-polling",new n),t.registerTransport("callback-polling",new i),t},e.cometd=new e.Cometd}(jQuery),function(e){e.cookie&&(org.cometd.COOKIE.set=e.cookie,org.cometd.COOKIE.get=e.cookie),e.cometd.registerExtension("reload",new org.cometd.ReloadExtension)}(jQuery),sohuHD.initHistory=function(){},sohuHD.user={},sohuHD.initLogin&&sohuHD.initLogin(),function(e){var t=e("#gNewSearch");sohuHD.focusClear(t);var n={type:t.width()>200?"normal":"mini"};window.hidResult=sohuHD._searchInit(t,null,n)}(jQuery),sohuHD.history=function(e){var t=function(){},n={delUrl:"//his.tv.sohu.com/his/del.do",cleanUrl:"//his.tv.sohu.com/his/delAll.do?plat=12",getUrl:"//his.tv.sohu.com/his/get.do?&c=1&callback=?",importUrl:"//his.tv.sohu.com/his/pingbatch.do",encode:document.charset||document.characterSet||"gbk",pagesize:20,page:1,getPassport:function(){return sohuHD.passport.getPassport()},islogin:function(){return!!this.getPassport()},getLocalHistory:function(){var t=e.cookie("savehistory");if(!t)return[];t=t.split("%2C");for(var n,i=[],s=0,o=t.length;o>s;s++)n=t[s].split("^"),i.push({pid:n[0],vid:n[1],order:n[2],t:n[3],mix:n[4],url:n[5],title:unescape(n[6]),timestamp:parseInt(n[7]),nurl:n[8]});return i.reverse()},getRemoteHistory:function(i){var s=i.passport,o=i.pagesize||n.pagesize,a=i.page||n.page,r=i.encode||n.encode,c=i.scope||window,l=i.callback||t,d=i.error||t,u=i.htype||"0",h=i.videotype||"2";s||(s=n.getPassport()),s&&e.getJSON(n.getUrl+"&passport="+s+"&encode="+r+"&pagesize="+o+"&page="+a+"&videotype="+h+"&htype="+u,function(e){l.call(c,e)},null,function(){d.call(c)})},delLocalItems:function(){var t=Array.prototype.slice.call(arguments);if(0==t.length)return void n.clearLocal();var i=function(e){for(var n=0,i=t.length;i>n;n++)if(e.vid==t[n])return!0;return!1},s=function(e){for(var t=[],n=0,s=e.length;s>n;n++)i(e[n])||t.push(e[n]);return t.reverse()},o=function(e){for(var t,n=[],i=0,s=e.length;s>i;i++)t=e[i],n.push([t.pid,t.vid,t.order,t.newTime,t.mix,t.url,t.title,t.playTime,t.nurl].join("^"));return n.join(escape(","))};e.cookie("savehistory",o(s(n.getLocalHistory())),{path:"/",domain:"tv.sohu.com",expires:1e3})},delRemoteItems:function(i,s,o,a,r){r||(r=n.getPassport()),"[object Object]"==Object.prototype.toString.call(i)&&(i=[i]),s=s||t,o=o||t,a=a||window;var c=function(e){for(var t=[],n=0,i=e.length;i>n;n++)t.push(e[n].vid+"|"+e[n].pid);return t.join(";")};r&&i.length&&e.getJSON(this.delUrl+"?callback=?&passport="+r+"&vs="+c(i)+"&c=1",function(e){s.call(a,e)},null,function(){o.call(a)})},clearLocal:function(){e.cookie("savehistory","",{path:"/",domain:"tv.sohu.com",expires:-1})},clearRemote:function(e){if(e||(e=n.getPassport()),e){var t=document.getElementById("hiddenPostForm");if(!t){var i=document.createElement("div");i.style.display="none",i.innerHTML='
',document.body.appendChild(i),t=document.getElementById("hiddenPostForm")}t.submit()}},clear:function(){n.clearLocal(),n.clearRemote()},imports:function(i,s,o,a,r){r||(r=n.getPassport()),s=s||t,o=o||t,a=a||window,"[object Object]"==Object.prototype.toString.call(i)&&(i=[i]);for(var c=[],l=0,d=i.length;d>l;l++)c.push(i[l].vid+"|"+i[l].t+"|"+i[l].timestamp);e.get(this.importUrl+"?encode="+this.encode+"&passport="+r+"&c=1&vts="+c.reverse().join(";"),function(e){s.call(a,e)},function(){o.call(a)},"jsonp")}};return n}(jQuery),function(e){e.extend(sohuHD,{namespace:function(){var t=Array.prototype.slice.call(arguments);e.each(t,function(e,t){var n=t.split(".");"undefined"==typeof window[n[0]]&&(window[n[0]]={});for(var i=window[n[0]],s=1,o=n.length;o>s;s++)i[n[s]]=i[n[s]]||{},i=i[n[s]]})},inherit:function(t,n,i){var s=function(){};s.prototype=n.prototype,t.prototype=new s,t.prototype.constructor=t,t.prototype.superClass=n.prototype,i=i||{},e.extend(t.prototype,i),n.prototype.constructor===Object.prototype.constructor&&(n.prototype.constructor=n)},isMobile:function(){var e=window.navigator.userAgent,t=/iphone|ipod|ipad/gi.test(e),n=/android/gi.test(e),i=/IEMobile/.test(e);return t||n||i}()})}(jQuery),function(e,t){var n=sohuHD.history,i=function(){var e=window.navigator.userAgent,t=/iphone|ipod|ipad/gi.test(e),n=/android/gi.test(e),i=/IEMobile/.test(e);return t||n||i}(),s=document.charset||document.characterSet||"gbk";"gb2312"==s.toLowerCase()&&(s="gbk");var o={historyFn:n,charset:s,isMobile:i,init:function(e){this.container=e.container,this.initialed=!0,this.initTmpl(),this.initEvent()},initEvent:function(){this.container.on("mouseenter",".his-item",function(){e(this).addClass("on")}).on("mouseleave",".his-item",function(){e(this).removeClass("on")}),this.initLoginEvent(),this.initLogoutEvent()},initLoginEvent:function(){var t=this.loginWrap.find(".hd-tab li"),n=this.loginWrap.find(".his-list-tab");this.loginWrap.on("click",".hd-tab li",function(i){var s=e(i.currentTarget),o=s.data("tab");return this.currentTab=o,s.hasClass("on")||(t.removeClass("on"),s.addClass("on"),n.hide(),n.filter("[data-tab="+o+"]").show()),!1}.bind(this));var i={del:function(e){var t=e.parents(".his-item"),n=t.data("vid"),i=t.data("plid");t.animate({height:0},"fast",function(){t.remove(),this.deleteRemoteRecord(n,i),this.loginWrap.find("li[data-vid="+n+"]").remove()}.bind(this))},clearpop:function(e){this.loginWrap.find(".h-clear-pop").show()},clear:function(e){this.historyFn.clearRemote(),this.loginWrap.find(".his-list-tab").html(""),this.loginWrap.find(".h-clear-pop").hide()},clearCancel:function(){this.loginWrap.find(".h-clear-pop").hide()}};this.loginWrap.on("click",".h-btn",function(t){var n=e(t.currentTarget),s=n.data("action");return i[s]&&i[s].call(this,n),!1}.bind(this))},initLogoutEvent:function(){var t={clearpop:function(){this.logoutWrap.find(".h-clear-pop").show()},clear:function(e){this.historyFn.clearLocal(),this.logoutWrap.find(".h-clear-pop").show(),this.logoutWrap.html(this.logoutRender.render({videos:[]}))},clearCancel:function(){this.logoutWrap.find(".h-clear-pop").hide()},del:function(e){var t=e.parents(".his-item"),n=t.data("vid");t.animate({height:0},"fast",function(){this.historyFn.delLocalItems(n),t.remove(),this.logoutWrap.find(".his-item").length||this.logoutWrap.html(this.logoutRender.render({videos:[]}))}.bind(this))}};this.logoutWrap.on("click",".h-btn",function(n){var i=e(n.currentTarget),s=i.data("action");return t[s]&&t[s].call(this,i),!1}.bind(this))},initTmpl:function(){var e='<%@ h:helper %>';this.container.html(t.render(e,{})),this.loginWrap=this.container.find(".h-login-wrap"),this.logoutWrap=this.container.find(".h-logout-wrap");var n='<%@ h:helper %><% if ( videos.length ) { %>
<% } else { %>
\u6e05\u7a7a\u8bb0\u5f55

\u6700\u8fd1\u60a8\u8fd8\u6ca1\u6709\u4efb\u4f55\u89c2\u770b\u8bb0\u5f55

\u767b\u5f55\u53ef\u6c38\u4e45\u4fdd\u5b58\u89c2\u770b\u8bb0\u5f55,\u5e76\u540c\u6b65\u5230\u5404\u7ec8\u7aef

<% } %>';this.logoutRender=new t(n),this.logoutRender.registHelper({getInfo:function(e){var t=function(e){e/=1;var t=Math.floor(e/60),n=e%60;return 10>t&&(t="0"+t),10>n&&(n="0"+n),t+":"+n},n=t(e.t),i="\u5df2\u770b\u5230"+n;return i}});var i='<%@ h:helper %><% var video, i, len; %><% if ( videos.length ) { %>
<% } else { %>

\u6700\u8fd1\u60a8\u8fd8\u6ca1\u6709\u4efb\u4f55\u89c2\u770b\u8bb0\u5f55

<% } %>';this.loginRender=new t(i),this.loginRender.registHelper({getInfo:function(e){var t={1:"\u7f51\u9875",2:"ipad",3:"iphone\u624b\u673a",5:"Symbian\u624b\u673a",6:"ifox",7:"IePad",8:"360\u684c\u9762",9:"Q+",10:"Android\u624b\u673a",11:"Android Pad",12:"\u641c\u72d0\u5f71\u97f3","-2":"\u5176\u4ed6"},n=function(e){e/=1;var t=Math.floor(e/60),n=e%60;return 10>t&&(t="0"+t),10>n&&(n="0"+n),t+":"+n},i=t[""+e.client];i=i||"";var s=n(e.t);return 2==e.status?i+=" \u5df2\u770b\u5b8c":i=i+" \u5df2\u770b\u5230"+s,i}})},getPassport:function(){return sohuHD.passport.getPassport()},islogin:function(){return!!this.getPassport()},preData:function(t){t=t||[];var n,i=[];return e.each(t,function(e,t){window.vid==t.vid?(n=t,n.isPlaying=!0):i.push(t)}),n&&i.unshift(n),i},showLogin:function(){this.loginWrap.show(),this.historyFn.getRemoteHistory({callback:function(e){e=e||{};var t=this.container.find("#his-all");t.html(this.loginRender.render({videos:this.preData(e.videos)}))}.bind(this),encode:this.charset}),this.historyFn.getRemoteHistory({htype:"1",callback:function(e){e=e||{};var t=this.container.find("#his-tv");t.html(this.loginRender.render({videos:this.preData(e.videos)}))}.bind(this),encode:this.charset})},showLogout:function(){this.logoutWrap.show();var e=this.historyFn.getLocalHistory();this.logoutWrap.html(this.logoutRender.render({videos:this.preData(e)}))},upload:function(){var e=this.historyFn.getLocalHistory();e.length&&this.historyFn.imports(e,function(e){e&&e.status/1==1&&(this.uploaded=!0,this.historyFn.clearLocal())},function(){},this)},open:function(){this.reset(),this.opened=!0,this.islogin()?(this.showLogin(),this.uploaded||this.upload()):this.showLogout()},close:function(){this.opened=!1,this.container.find(".h-clear-pop").hide().height(),this.loginWrap.hide(),this.logoutWrap.hide()},reset:function(){this.loginWrap.hide(),this.logoutWrap.hide()},deleteRemoteRecord:function(e,t){this.historyFn.delRemoteItems([{vid:e,pid:t}])}};sohuHD.navhistory=o}(jQuery,sohuHD.Template),function(e,t){sohuHD.namespace("sohuHD.navrss");var n={hasitem:'
\u66f4\u65b0\u63d0\u9192\u6e05\u7a7a\u63d0\u9192
'},i={list:'<%@ h:helper %>',listmobile:'<%@ h:helper %>',recom:'<%@ h:helper %><% var item; var max = 3; var i = 0; %><% while ( i++ < 3 && ( item = items.pop() ) ) { %>
  • \u63d0\u9192\u6211<%= helper.truncateCN( item.detail.playListName, 28, true ) %>
  • <% } %>'},s=function(){var e=window.navigator.userAgent,t=/iphone|ipod|ipad/gi.test(e),n=/android/gi.test(e),i=/IEMobile/.test(e);return t||n||i}(),o=new t(i.list);o.compile(),o.registHelper({getWatchTimeTip:function(e){var t,n,i,s="";if("his"==e.type){var t=e.interDays/1;t>=365?s=Math.floor(t/365)+"\u5e74\u524d\u770b\u8fc7":t>=180?s="\u534a\u5e74\u524d\u770b\u8fc7":t>=30?s=Math.floor(t/30)+"\u6708\u524d\u770b\u8fc7":t>0?s=t+"\u5929\u524d\u770b\u8fc7":0==t&&(n=this.trim(e.vTime),i=(new Date).getTime()-new Date(n.substr(0,4),n.substr(5,2)-1,n.substr(8,2),n.substr(11,2),n.substr(14,2),n.substr(17,2)).getTime(),i=Math.floor(i/1e3),s=i>3600?Math.floor(i/3600)+"\u5c0f\u65f6\u524d\u770b\u8fc7":i>60?Math.floor(i/60)+"\u5206\u949f\u524d\u770b\u8fc7":"\u521a\u521a\u770b\u8fc7")}return s},getUpdateOrderTip:function(e){var t,n="",i=e.cid;return 9001==e.cid?(t=e.remindCount,t>99&&(t="99+"),n="\u4f5c\u8005\uff1a"+this.truncateCN(e.author,8,!0)+"\u66f4\u65b0"+t+"\u4e2a\u89c6\u9891"):(n="\u66f4\u65b0\u81f3",n=7==i?n+e.plIssueTime+"\u671f":n+e.plOrder+"\u96c6"),n}}),e.extend(sohuHD.navrss,{opened:!1,subUrl:"//my.tv.sohu.com/user/a/subscribe/batchAdd.do",getUrl:"//push.my.tv.sohu.com/user/a/subscribe/listRemind.do?plat=100&isWeb=1&keyWordTypes=1,8,15",delUrl:"//my.tv.sohu.com/user/a/subscribe/delete.do",consumeUrl:"//my.tv.sohu.com/user/a/subscribe/push/delete.do",delunsub:"//push.my.tv.sohu.com/user/a/subscribe/delete.do",encode:document.charset||document.characterSet||"gbk",isMobile:s,recomData:null,getPassport:function(){return sohuHD.passport.getPassport()},consume:function(t,n){var i=this.getPassport();n=n||function(){},i&&t&&e.getJSON(this.consumeUrl+"?callback=?&passport="+i+"&playlistid="+t,function(e){n(e)})},unsubscribe:function(t,n){var i=this.getPassport();n=n||function(){},i&&t&&e.getJSON(this.delUrl+"?callback=?&passport="+i+"&playlistid="+t,function(e){n(e)})},unsub:function(t,n,i){i=i||function(){},t&&(n&&8==n?e.getJSON(this.delunsub+"?callback=?",{keyWords:t,keyWordType:8},function(e){e&&1==e.status&&i()}):i())},subscribe:function(t,n,i){var s=this.getPassport(),o=function(){};t=t?"&playlistids="+t:"",n=n||o,i=n||o,e.getJSON(this.subUrl+"?plat=604&passport="+s+t+"&callback=?",function(e){n(e||{})},null,function(){i()})},cleanNotification:function(){e.getJSON("//my.tv.sohu.com/user/a/subscribe/push/delete.do?callback=?&isCleanAll=1&keyWordType=1&passport="+this.getPassport())},init:function(s){s=s||{},this.originalConfig=s,this.container=e(s.container),this.container.append(n.hasitem),this.isMobile&&this.container.addClass("isMobile"),this.list=this.container.find(".hd-list"),this.recomList=this.container.find("#rss-recom-list"),this.recomTmpl=new t(i.recom),this.initEvent()},initEvent:function(){this.isMobile||this.list.on("mouseenter",".hd-list li",function(){e(this).addClass("on")}).on("mouseleave",".hd-list li",function(){e(this).removeClass("on")});var t={del:function(e){var t=e.parents(".rss-item"),n=t.data("plid"),i=e.data("kwt"),s=function(){t.find(".rss-del-btn").hide(),t.find(".hd-bub").hide()}.bind(this);8!=i?(sohuHD.pingback(e.data("url")),s()):this.unsub(n,i,s)},sub:function(e){var t=e.data("plid"),n=e.parent(".rss-recom-item");n.fadeOut(function(){n.remove(),this.recomData.length?this.replaceRecomItem(e):this.container.find(".rss-recom-item").length||this.container.find(".hd-recom").hide()}.bind(this)),this.subscribe(t,function(e){})},cleanNotification:function(){this.list.find(".hd-bub").hide(),this.list.find(".rss-item .rss-del-btn").hide(),this.cleanNotification()}};this.container.on("click",".rss-btn",function(n){var i=e(n.currentTarget),s=i.data("action");return t[s]?(t[s].call(this,i),!1):void 0}.bind(this)),this.list.on("click","a",function(t){var n=e(this),i=n.parents(".rss-item"),s=i.find(".hd-bub");if(s.length){i.data("plid");s.remove(),i.find(".rss-del-btn").hide()}})},replaceRecomItem:function(){var e=this.recomData.pop();if(e){var n='<%@ h:helper %>
  • \u63d0\u9192\u6211<%= helper.truncateCN( item.detail.playListName, 28, true ) %>
  • ';this.recomList.append(t.render(n,{item:e}))}},reset:function(){this.list.show(),this.container.find(".hd-noCont-wrap").hide(),this.recomList.html("")},getRecom:function(t){t=t||{},t.callback=t.callback||function(){};var n="gb2312"==this.encode.toLowerCase()?"gbk":this.encode,i="//my.tv.sohu.com/user/a/subscribe/recommendPl.do?callback=?&rejectsubs=1&isWeb=1&size=10&encoding="+n,s=this;this.recomData&&this.recomData.length>=3?t.callback.call(t.scope||window,this.recomData):e.getJSON(i,function(e){s.recomData=e.data,t.callback.call(t.scope||window,e.data)})},showRecom:function(){this.list.hide(),this.container.find(".hd-noCont-wrap").show(),this.container.find(".hd-recom").show(),this.getRecom({callback:function(e){e&&e.length&&this.recomList.html(this.recomTmpl.render({items:e}))}.bind(this)})},showlist:function(){var t="gb2312"==this.encode.toLowerCase()?"gbk":this.encode,n=this.getPassport();e.getJSON(this.getUrl+"&callback=?&passport="+n+"&encoding="+t,function(e){e=e||{};var t=e.data;t&&t.length?(e._count=0,t.forEach(function(t){t.remindCount&&(e._count=e._count+t.remindCount),"wemedia"==t.type&&(t.cid=9001)}),this.list.html(o.render({data:e,items:t})).show()):this.showRecom()}.bind(this))},open:function(){return this.getPassport()?(this.opened=!0,this.reset(),this.showlist(),void this.container.show()):void this.close()},close:function(){this.opened=!1,this.container.hide()}})}(jQuery,sohuHD.Template),function(e,t,n){var i=function(e,t,n){n=n||{cache:!0},messagebus.subscribe(e,t,null,null,n)},s={emitter:new n,on:function(e,t,n){this.emitter.on(e,t,n)},one:function(e,t){this.on(e,t,!0)},emit:function(e,t){this.emitter.emit(e,t)},subscribe:i,init:function(){this.close(),this.cometd=e.cometd,org.cometd.WebSocket=!1,this.initEvent()},initEvent:function(){this.eventInitialed||(this.eventInitialed=!0,this.subscribe("com.sohu.login.userinfo",function(t,n){this.connect(n),this.emit("user.msg",{count:n.message||0}),this.loadVideoMsgCount();var i=e.getJSON("//my.tv.sohu.com/user/a/message/unreadCount.do?callback=?");i.done(function(e){e=e||{};var t=(e.syscount||0)+(e.sharecount||0)+(e.lettercount||0)+(e.opencount||0);e.count=t,this.emit("user.msg",e)}.bind(this))}.bind(this)),this.subscribe("com.sohu.logout",function(){this.close()}.bind(this)),e(window).unload(function(){this.close()}.bind(this)))},loadVideoMsgCount:function(){var t=sohuHD.user.passport,n="//push.my.tv.sohu.com/user/a/subscribe/push/count.do?callback=?&plat=100&type=0&isWeb=1&hisRemind=1&wemediaRemind=1",i=e.getJSON(n+"&passport="+t);i.done(function(e){e=e||{};var t=(e.count||0)+(e.hisCount||0)+(e.wemediaCount||0);e.count=t,this.emit("video.msg",e)}.bind(this))},connect:function(e){var t=sohuHD.user.passport,n=e.cometUrl||"",i=this.cometd;if(!t)try{t=sohuHD.passport.getPassport()}catch(s){}var o=function(e){},a=function(n){n.successful===!0&&i.batch(function(){i.subscribe("/"+t,function(e){if("undefined"!=typeof e.data.remind){var t={count:(e.data.remind||0)+(e.data.wemediaPushCount||0)};this.emit("video.msg",t)}}.bind(this)),i.subscribe("/"+e.id,function(e){e=e||{};var t=e.data||{};t.syscount=t.msg||0,t.sharecount=t.sharemsg||0,t.lettercount=t.sharemsg||0,t.opencount=t.opencount||0,t.count=t.syscount+t.sharecount+t.lettercount+t.opencount,this.emit("user.msg",t)}.bind(this))}.bind(this))}.bind(this);i.configure({url:n}),i.addListener("/meta/handshake",a),i.addListener("/meta/connect",o),i.handshake()},connectSyncLogin:function(){if(sohuHD.cookie("scanlogin")){var t="http://61.135.176.191/cometd",n=function(e){},i=function(t){t.successful===!0&&cometd.batch(function(){window.syncLogin=cometd.subscribe("/"+sohuHD.cookie("scanlogin"),function(t){sohuHD.cookie("scanlogin")==t.data.rand&&(window.scanloginCallback=function(e){1==e.status&&window.location.reload()},e.getScript("//my.tv.sohu.com/user/a/show/scanlogin.do?callback=scanloginCallback&c="+t.data.md5))})})};cometd.configure({url:t}),cometd.addListener("/meta/handshake",i),cometd.addListener("/meta/connect",n),cometd.handshake()}},close:function(){this.cometd&&this.cometd.disconnect(!0)}};i("com.sohu.login",function(){s.init()},{cache:!0,execTime:1});var o={emitter:new n,on:function(e,t,n){this.emitter.on(e,t,n)},one:function(e,t){this.on(e,t,!0)},emit:function(e,t){this.emitter.emit(e,t)},subscribe:i,hisInitiaed:!1,rssInitialed:!1,init:function(){this.container=e("#navLocker"),this.initTmpl(),this.initEvent()},initTmpl:function(){var e='<%@ h:helper %><% if ( isIE ) { %>
    <% } else { %><% if ( isIE ) { %>