"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:window;_classCallCheck(this,e),this.container=t,this.containerHeight=t.innerHeight,this.eleList=[],this.lastVisibleEle=null,this.cbs=[],this.__start()}return _createClass(e,[{key:"__start",value:function(){var e=this;this.container.addEventListener("scroll",function(){e.__detect()}),this.container.addEventListener("resize",function(){e.containerHeight=e.container.innerHeight,e.__detect()})}},{key:"__detect",value:function(){var e=this;if(!this.eleList.length&&this.lastVisibleEle){if(null===this.lastVisibleEle)return;return this.cbs.forEach(function(t){return t(e.lastVisibleEle,null)}),void(this.lastVisibleEle=null)}var t=this.eleList.filter(function(t){var i=t.getBoundingClientRect();return i.topt.scrollTop+t.clientHeight,l=this.offsetLeft-t.offsetLeftt.scrollLeft+t.clientWidth,c=o&&!r;(o||r)&&e&&(t.scrollTop=this.offsetTop-t.offsetTop-t.clientHeight/2-n+this.clientHeight/2),(l||a)&&e&&(t.scrollLeft=this.offsetLeft-t.offsetLeft-t.clientWidth/2-s+this.clientWidth/2),(o||r||l||a)&&!e&&this.scrollIntoView(c)});var n=new visible,s=window.is_released,o=window.txt_released||"";n.onChange(function(e,t){if(e&&($(e).find(".action").removeClass("fixed-action").css({width:"auto",left:"auto"}),$(e).find(".action-placeholder").remove()),t){$(t).append('
');var i=$(t).find(".action");i.addClass("fixed-action"),i.css({width:$(t).width()+"px",left:t.getBoundingClientRect().left+"px"})}});var r=function(){return"_IMAGE_GIF_RENDER"in window&&setTimeout(function(){return window._IMAGE_GIF_RENDER()},300)},l=function(){for(var e={useful_count:["有用","/j/review/{REVIEW_ID}/useful"],useless_count:["没用","/j/review/{REVIEW_ID}/useless"],spoiler:["剧透提醒已提交,谢谢","/j/review/{REVIEW_ID}/spoiler"]},t=/disabled/,i=/(\w+_count)/,n=/spoiler/,s=get_cookie("ck"),o=document.querySelectorAll(".main-panel-useful"),r=null,l="",a=function(e){return e&&"true"===e.getAttribute("data-is_owner")},c=function(e){return e&&"true"===e.getAttribute("data-can_vote")},u=function(e){return e&&"true"===e.getAttribute("data-is_tv")},d=function(o){if(!s)return void(window.location.href="https://accounts.douban.com/login");o.stopPropagation();var r=o.target,d=r.className,v=d.match(i)||d.match(n),w="",_="",g="";if(!d.match(t)){if(v){if(a(o.currentTarget))return alert("不能给自己投票噢");if(!c(o.currentTarget)){var p=u(o.currentTarget)?"该剧尚未播出,不能投票噢":"该电影还未上映,不能投票噢";return alert(p)}w=v[0],g=e[w][0],_=e[w][1],l=o.currentTarget.getAttribute("data-rid"),_=_.replace("{REVIEW_ID}",l)}else if(!v||!l)return;var b=$.post(_,{ck:s},function(e){if(0==e.r){if("spoiler"===w)return f();h(e,w)}});b.fail(function(){alert("网络错误")}).always(function(){})}},f=function(t){var i=document.getElementById(l),n=i.querySelector(".spoiler");n.innerText=e.spoiler[0],n.className=n.className.replace("not-reported","disabled")},h=function(i,n){var s=document.getElementById(l);for(var o in e)if(void 0!==i[o]){var r=e[o][0]+" "+i[o],a=s.querySelector("."+o),c=a.className;(o===n||o!==n&&c.match(t))&&a.classList.toggle("disabled"),a.innerHTML=r}},v=o.length,w=0;w