(()=>{window.addComment=function(m){var u,p,f,c=m.document,o={commentReplyClass:"comment-reply-link",commentReplyTitleId:"reply-title",cancelReplyId:"cancel-comment-reply-link",commentFormId:"commentform",temporaryFormId:"wp-temp-form-div",parentIdFieldId:"comment_parent",postIdFieldId:"comment_post_ID"},k=m.MutationObserver||m.WebKitMutationObserver||m.MozMutationObserver,N="querySelector"in c&&"addEventListener"in m,D=!!c.documentElement.dataset;function x(){F(),k&&new k(O).observe(c.body,{childList:!0,subtree:!0})}function F(r){if(N&&(u=i(o.cancelReplyId),p=i(o.commentFormId),u)){let d=function(n){if((n.metaKey||n.ctrlKey)&&n.keyCode===13)return p.removeEventListener("keydown",d),n.preventDefault(),p.submit.click(),!1};var l=d;u.addEventListener("touchstart",L),u.addEventListener("click",L),p&&p.addEventListener("keydown",d);for(var t,a=function(n){var I=o.commentReplyClass;return n&&n.childNodes||(n=c),n=c.getElementsByClassName?n.getElementsByClassName(I):n.querySelectorAll("."+I),n}(r),e=0,y=a.length;e{var d=class{ver;type;finished;paged;genre_list;subjects;genre;baseAPI="https://node.wpista.com/v1/outer/";token;constructor(e){this.ver="1.0.1",this.type="movie",this.finished=!1,this.paged=1,this.genre_list=[],this.genre=[],this.subjects=[],this.token=e.token,this._create()}on(e,t,s){var a=document.querySelectorAll(t);a.forEach(n=>{n.addEventListener(e,s)})}_fetchGenres(){document.querySelector(".db--genres").innerHTML="",fetch(this.baseAPI+"genres?token="+this.token+"&type="+this.type).then(e=>e.json()).then(e=>{e.data.length&&(this.genre_list=e.data,this._renderGenre())})}_handleGenreClick(){this.on("click",".db--genreItem",e=>{let t=e.currentTarget;if(t.classList.contains("is-active")){let s=this.genre.indexOf(t.innerText);t.classList.remove("is-active"),this.genre.splice(s,1),this.paged=1,this.finished=!1,this.subjects=[],this._fetchData();return}document.querySelector(".db--list").innerHTML="",document.querySelector(".lds-ripple").classList.remove("u-hide"),t.classList.add("is-active"),this.genre.push(t.innerText),this.paged=1,this.finished=!1,this.subjects=[],this._fetchData()})}_renderGenre(){document.querySelector(".db--genres").innerHTML=this.genre_list.map(e=>`${e.name}`).join(""),this._handleGenreClick()}_fetchData(){fetch(this.baseAPI+"faves?token="+this.token+"&type="+this.type+"&paged="+this.paged+"&genre="+JSON.stringify(this.genre)).then(e=>e.json()).then(e=>{e.data.length?(document.querySelector(".db--list").classList.contains("db--list__card")?(this.subjects=[...this.subjects,...e.data],this._randerDateTemplate()):(this.subjects=[...this.subjects,...e.data],this._randerListTemplate()),document.querySelector(".lds-ripple").classList.add("u-hide")):(this.finished=!0,document.querySelector(".lds-ripple").classList.add("u-hide"))})}_randerDateTemplate(){let e=this.subjects.reduce((s,a)=>{let n=new Date(a.create_time),i=n.getFullYear(),r=n.getMonth()+1,l=`${i}-${r.toString().padStart(2,"0")}`;return Object.prototype.hasOwnProperty.call(s,l)?s[l].push(a):s[l]=[a],s},{}),t="";for(let s in e){let a=s.split("-");t+=`
${a[1]}
${a[0]}
`,t+=e[s].map(n=>`
${n.is_top250?'Top 250':""}
${n.douban_score>0?''+n.douban_score:""}${n.year>0?" \xB7 "+n.year:""}
`).join(""),t+="
"}document.querySelector(".db--list").innerHTML=t}_randerListTemplate(){document.querySelector(".db--list").innerHTML=this.subjects.map(e=>`
${e.is_top250?'Top 250':""}
${e.create_time}
${e.douban_score>0?''+e.douban_score:""}${e.year>0?" \xB7 "+e.year:""}
`).join("")}_handleScroll(){window.addEventListener("scroll",()=>{var e=window.scrollY||window.pageYOffset;document.querySelector(".block-more").offsetTop+-window.innerHeight{if(e.currentTarget.classList.contains("current"))return;this.genre=[],this.type=e.currentTarget.dataset.type,this.type!="book"?(this._fetchGenres(),document.querySelector(".db--genres")?.classList.remove("u-hide")):document.querySelector(".db--genres").classList.add("u-hide"),document.querySelector(".db--list").innerHTML="",document.querySelector(".lds-ripple").classList.remove("u-hide"),document.querySelector(".db--navItem.current").classList.remove("current"),e.target.classList.add("current"),this.paged=1,this.finished=!1,this.subjects=[],this._fetchData()})}_create(){if(document.querySelector(".db--container")){let e=document.querySelector(".db--container");if(e.dataset.token)this.token=e.dataset.token;else return;let t=document.querySelector(".db--navItem.current");t instanceof HTMLElement&&(this.type=t.dataset.type);let s=document.querySelector(".db--list");s.dataset.type&&(this.type=s.dataset.type),this.type=="movie"&&document.querySelector(".db--genres").classList.remove("u-hide"),this._fetchGenres(),this._fetchData(),this._handleScroll(),this._handleNavClick()}document.querySelector(".js-db")&&document.querySelectorAll(".js-db").forEach(e=>{let t=e,s=t.dataset.id,a=t.dataset.type,n=t.parentNode;fetch(this.baseAPI+`${a}/${s}?token=${this.token}`).then(i=>{i.json().then(r=>{if(r.data){let l=r.data,c=document.createElement("div");c.classList.add("doulist-item"),c.innerHTML=`
${l.douban_score}
${l.card_subtitle}
`,n.replaceWith(c)}})})}),document.querySelector(".db--collection")&&document.querySelectorAll(".db--collection").forEach(e=>{this._fetchCollection(e)})}_fetchCollection(e){let t=e.dataset.style?e.dataset.style:"card";fetch(obvInit.api+"v1/movies?type="+e.dataset.type+"&paged=1&genre=&start_time="+e.dataset.start+"&end_time="+e.dataset.end).then(s=>s.json()).then(s=>{if(s.length)if(t=="card")e.innerHTML+=s.map(a=>`
Marked ${a.create_time}
${a.douban_score}
${a.remark||a.card_subtitle}
`).join("");else{let a=s.reduce((i,r)=>(Object.prototype.hasOwnProperty.call(i,r.create_time)?i[r.create_time].push(r):i[r.create_time]=[r],i),{}),n="";for(let i in a)n+=`
${i}
`,n+=a[i].map(r=>`
${r.douban_score}
${r.remark||r.card_subtitle}
`).join(""),n+="
";e.innerHTML=n}})}};new d({token:window.WPD_TOKEN});})(); ; (()=>{var i=class{selector;timeFormat={second:"second ago",seconds:"seconds ago",minute:"minute ago",minutes:"minutes ago",hour:"hour ago",hours:"hours ago",day:"day ago",days:"days ago",week:"week ago",weeks:"weeks ago",month:"month ago",months:"months ago",year:"year ago",years:"years ago"};doms=[];VERSION="0.3.7";constructor(t){this.selector=t.selector,t.timeFormat&&(this.timeFormat=t.timeFormat),this.init(),setTimeout(()=>{this.refresh()},1e3*5);let o=``;document.querySelector(".site--footer__content").insertAdjacentHTML("afterend",o),document.querySelector(".icon--copryrights").addEventListener("click",()=>{document.querySelector(".site--footer__info").classList.toggle("active")})}init(){this.doms=Array.from(document.querySelectorAll(this.selector)),this.doms.forEach(t=>{t.innerText=this.humanize_time_ago(t.attributes.datetime.value)})}humanize_time_ago(t){let o=new Date(t),e=Date.now()/1e3-Number(o.getTime()/1e3);return e<3600?`${Math.ceil(e/60)} ${Math.ceil(e/60)==1?this.timeFormat.second:this.timeFormat.seconds}`:e<86400?`${Math.ceil(e/3600)} ${Math.ceil(e/3660)==1?this.timeFormat.hour:this.timeFormat.hours}`:e<86400*30?`${Math.ceil(e/86400)} ${Math.ceil(e/86400)==1?this.timeFormat.day:this.timeFormat.days}`:e<86400*30*12?`${Math.ceil(e/(86400*30))} ${Math.ceil(e/(86400*30))==1?this.timeFormat.month:this.timeFormat.months}`:o.getFullYear()+"-"+(o.getMonth()+1)+"-"+o.getDate()}refresh(){this.doms.forEach(t=>{t.innerText=this.humanize_time_ago(t.attributes.datetime.value)})}};new i({selector:".humane--time",timeFormat:window.timeFormat});var r=class{is_single=!1;post_id=0;is_archive=!1;VERSION="0.2.3";constructor(){let t=localStorage.getItem("theme")?localStorage.getItem("theme"):"auto",o=`
`;if(document.querySelector("body").insertAdjacentHTML("beforeend",o),document.querySelectorAll(".fixed--theme span").forEach(e=>{e.addEventListener("click",()=>{e.classList.contains("is-active")||(document.querySelectorAll(".fixed--theme span").forEach(a=>{a.classList.remove("is-active")}),e.dataset.actionValue=="dark"?(localStorage.setItem("theme","dark"),document.querySelector("body").classList.remove("auto"),document.querySelector("body").classList.add("dark"),e.classList.add("is-active")):e.dataset.actionValue=="light"?(localStorage.setItem("theme","light"),document.querySelector("body").classList.remove("auto"),document.querySelector("body").classList.remove("dark"),e.classList.add("is-active")):e.dataset.actionValue=="auto"&&(localStorage.setItem("theme","auto"),document.querySelector("body").classList.remove("dark"),document.querySelector("body").classList.add("auto"),e.classList.add("is-active")))})}),document.querySelector(".backToTop")){let e=document.querySelector(".backToTop");window.addEventListener("scroll",()=>{(window.scrollY||window.pageYOffset)>200?e.classList.add("is-active"):e.classList.remove("is-active")}),e.addEventListener("click",()=>{window.scrollTo({top:0,behavior:"smooth"})})}document.querySelector('[data-action="show-search"]').addEventListener("click",()=>{document.querySelector(".site--header__center .inner").classList.toggle("search--active")})}getCookie(t){if(0${t}`;document.querySelector("body").insertAdjacentHTML("beforeend",e),document.querySelector(".notice--wrapper").classList.add("is-active"),setTimeout(()=>{document.querySelector(".notice--wrapper").remove()},3e3)}};new r;})(); ; (()=>{var l=class{loading=!1;post_id;total=0;total_paged=1;paged=1;constructor(){document.querySelector(".post--ingle__comments")&&(this.post_id=document.querySelector(".post--ingle__comments").dataset.id,this.fetchComments(),this.init())}fetchComments(){fetch(window.commentDomain+"/post/"+this.post_id+"/comments?paged="+this.paged).then(c=>{c.json().then(m=>{let s=m.payload.comments;this.total=m.payload.total,this.total_paged=m.payload.total_paged,this.total_paged>1&&this.randerNav(),document.querySelector(".comments--title .count").innerHTML=this.total;let n=s.map(e=>{let o="";return e.children&&(o=`
    ${e.children.map(t=>`
  1. ${t.avatar}
    ${t.comment_text}
  2. `).join("")}
`),`
  • ${e.avatar}
    ${e.comment_text}
    ${o}
  • `}).join("");document.querySelector(".commentlist ").innerHTML=n})})}randerNav(){let c=this.paged==1?"disabled":"",s=` Older CommentsNewer Comments `;document.querySelector(".commentnav").innerHTML=s,document.querySelectorAll(".cnav-item").forEach(n=>{n.addEventListener("click",e=>{if(n.classList.contains("disabled"))return;console.log(n);let o=n.attributes["data-action"].value;console.log(o),o=="pre"?this.paged+=1:this.paged-=1,this.fetchComments()})})}init(){document.querySelector(".comment-form")&&document.querySelector(".comment-form")?.addEventListener("submit",c=>{if(c.preventDefault(),this.loading)return;let m=document.querySelector(".comment-form"),s=new FormData(m),n={};s.forEach((e,o)=>n[o]=e),this.loading=!0,fetch(window.commentDomain+"/post/"+this.post_id+"/comment",{method:"POST",body:JSON.stringify(n),headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{if(this.loading=!1,e.status!=200)return;let o=document.getElementById("cancel-comment-reply-link"),t=document.getElementById("respond"),a=document.getElementById("wp-temp-form-div"),i=e.data,r=`
  • ${i.avatar}
    ${i.comment_author}
    ${i.comment_text}
  • `,d=document.querySelector("#comment_parent")?.value;o.style.display="none",o.onclick=null,document.getElementById("comment_parent").value="0",a&&t&&(a.parentNode.insertBefore(t,a),a.parentNode.removeChild(a)),document.querySelector(".comment-body__fresh")&&document.querySelector(".comment-body__fresh")?.classList.remove("comment-body__fresh"),document.getElementById("comment").value="",d!="0"?(document.querySelector("#comment-"+d)?.insertAdjacentHTML("beforeend",'
      '+r+"
    "),console.log(d)):(document.querySelector(".no--comment")&&document.querySelector(".no--comment")?.remove(),document.querySelector(".commentlist")?.insertAdjacentHTML("beforeend",r));let p=document.querySelector(`#comment-${i.comment_ID}`);p&&p.scrollIntoView({behavior:"smooth"})})})}};new l;})();