mirror of
https://github.com/jkjoy/typecho-theme-farallon.git
synced 2026-06-10 01:24:29 +00:00
第一次上传
This commit is contained in:
Vendored
+1
@@ -0,0 +1 @@
|
||||
.md-view *{box-sizing:border-box;color:#424242}.md-h1,.md-h2,.md-h3,.md-h4,.md-h5,.md-h6{font-weight:700}.md-code{display:block;margin:1rem 0;padding:1rem;color:#f5f5f5;border-radius:5px;background-color:#424242}.md-code-inline{display:inline-block;padding:.125rem .25rem;color:#ef6c00;background-color:#fff3e0}.md-ul,.md-ol{padding-left:2rem;margin:1rem 0}.md-ul>li,.md-ol>li{margin-top:.5rem}.md-ul>li:first-child,.md-ol>li:first-child{margin-top:0}.md-ul ul,.md-ol ul{margin:.5rem 0 0 0}.md-blockquote{display:block;padding:1rem 0 1rem 1rem;margin:1rem 0;border-left:.5rem solid #bdbdbd;border-radius:5px;background-color:#eee;overflow:auto;word-break:break-word !important}.md-a{position:relative;cursor:pointer;text-decoration:underline transparent;color:#ef6c00}.md-a::before{content:"";border-bottom:.1rem solid #ef6c00;position:absolute;bottom:0;left:0;width:0;transition:width .3s ease}.md-a:hover::before{width:100%}.md-hr{border:0;border-top:.09rem dashed #bdbdbd;border-bottom:0;margin:.5rem 0}.md-sub,.md-sup{font-size:.75rem}.md-sub{bottom:-.25rem}.md-sup{top:-.25rem}.md-img{margin:1rem 0;padding:.5rem;background-color:#eee;border-radius:5px;max-width:100%}.md-strong{font-weight:700}.md-em{font-style:italic}.md-del{text-decoration:line-through}.md-mark{background-color:#ffeb3b}.md-table-outer{width:100%;overflow:auto}.md-table{border-collapse:collapse;display:table;width:100%;text-align:center;margin:1rem 0}.md-thead{background-color:#eceff1}.md-th,.md-td{padding:.5rem;border:.0625rem solid #d5d5d5;white-space:nowrap}.md-th{font-weight:700}.md-tr:nth-child(even){background-color:#eee}
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
/* PrismJS 1.29.0
|
||||
https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript&plugins=highlight-keywords+autoloader */
|
||||
code[class*=language-],pre[class*=language-]{color:#000;background:0 0;text-shadow:0 1px #fff;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{text-shadow:none;background:#b3d4fc}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{text-shadow:none;background:#b3d4fc}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#f5f2f0}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#708090}.token.punctuation{color:#999}.token.namespace{opacity:.7}.token.boolean,.token.constant,.token.deleted,.token.number,.token.property,.token.symbol,.token.tag{color:#905}.token.attr-name,.token.builtin,.token.char,.token.inserted,.token.selector,.token.string{color:#690}.language-css .token.string,.style .token.string,.token.entity,.token.operator,.token.url{color:#9a6e3a;background:hsla(0,0%,100%,.5)}.token.atrule,.token.attr-value,.token.keyword{color:#07a}.token.class-name,.token.function{color:#dd4a68}.token.important,.token.regex,.token.variable{color:#e90}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}
|
||||
Vendored
+246
@@ -0,0 +1,246 @@
|
||||
/* PrismJS 1.29.0
|
||||
https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript+aspnet+c+csharp+cpp+css-extras+git+go+java+jq+json+json5+jsonp+markup-templating+php+plsql+python+sql&plugins=line-numbers+show-language+toolbar+copy-to-clipboard */
|
||||
code[class*=language-],
|
||||
pre[class*=language-] {
|
||||
color: #ccc;
|
||||
background: 0 0;
|
||||
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
||||
font-size: 1em;
|
||||
text-align: left;
|
||||
white-space: pre;
|
||||
word-spacing: normal;
|
||||
word-break: normal;
|
||||
word-wrap: normal;
|
||||
line-height: 1.5;
|
||||
-moz-tab-size: 4;
|
||||
-o-tab-size: 4;
|
||||
tab-size: 4;
|
||||
-webkit-hyphens: none;
|
||||
-moz-hyphens: none;
|
||||
-ms-hyphens: none;
|
||||
hyphens: none
|
||||
}
|
||||
|
||||
pre[class*=language-] {
|
||||
padding: 1em;
|
||||
margin: .5em 0;
|
||||
overflow: auto
|
||||
}
|
||||
|
||||
:not(pre)>code[class*=language-],
|
||||
pre[class*=language-] {
|
||||
background: #2d2d2d
|
||||
}
|
||||
|
||||
:not(pre)>code[class*=language-] {
|
||||
padding: .1em;
|
||||
border-radius: .3em;
|
||||
white-space: normal
|
||||
}
|
||||
|
||||
.token.block-comment,
|
||||
.token.cdata,
|
||||
.token.comment,
|
||||
.token.doctype,
|
||||
.token.prolog {
|
||||
color: #999
|
||||
}
|
||||
|
||||
.token.punctuation {
|
||||
color: #ccc
|
||||
}
|
||||
|
||||
.token.attr-name,
|
||||
.token.deleted,
|
||||
.token.namespace,
|
||||
.token.tag {
|
||||
color: #e2777a
|
||||
}
|
||||
|
||||
.token.function-name {
|
||||
color: #6196cc
|
||||
}
|
||||
|
||||
.token.boolean,
|
||||
.token.function,
|
||||
.token.number {
|
||||
color: #f08d49
|
||||
}
|
||||
|
||||
.token.class-name,
|
||||
.token.constant,
|
||||
.token.property,
|
||||
.token.symbol {
|
||||
color: #f8c555
|
||||
}
|
||||
|
||||
.token.atrule,
|
||||
.token.builtin,
|
||||
.token.important,
|
||||
.token.keyword,
|
||||
.token.selector {
|
||||
color: #cc99cd
|
||||
}
|
||||
|
||||
.token.attr-value,
|
||||
.token.char,
|
||||
.token.regex,
|
||||
.token.string,
|
||||
.token.variable {
|
||||
color: #7ec699
|
||||
}
|
||||
|
||||
.token.entity,
|
||||
.token.operator,
|
||||
.token.url {
|
||||
color: #67cdcc
|
||||
}
|
||||
|
||||
.token.bold,
|
||||
.token.important {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
.token.italic {
|
||||
font-style: italic
|
||||
}
|
||||
|
||||
.token.entity {
|
||||
cursor: help
|
||||
}
|
||||
|
||||
.token.inserted {
|
||||
color: green
|
||||
}
|
||||
|
||||
pre[class*=language-].line-numbers {
|
||||
position: relative;
|
||||
padding-left: 3.8em;
|
||||
counter-reset: linenumber
|
||||
}
|
||||
|
||||
pre[class*=language-].line-numbers>code {
|
||||
position: relative;
|
||||
white-space: inherit
|
||||
}
|
||||
|
||||
.line-numbers .line-numbers-rows {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
top: 0;
|
||||
font-size: 100%;
|
||||
left: -3.8em;
|
||||
width: 3em;
|
||||
letter-spacing: -1px;
|
||||
border-right: 1px solid #999;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none
|
||||
}
|
||||
|
||||
.line-numbers-rows>span {
|
||||
display: block;
|
||||
counter-increment: linenumber
|
||||
}
|
||||
|
||||
.line-numbers-rows>span:before {
|
||||
content: counter(linenumber);
|
||||
color: #999;
|
||||
display: block;
|
||||
padding-right: .8em;
|
||||
text-align: right
|
||||
}
|
||||
|
||||
div.code-toolbar {
|
||||
position: relative
|
||||
}
|
||||
|
||||
div.code-toolbar>.toolbar {
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
top: .3em;
|
||||
right: .2em;
|
||||
transition: opacity .3s ease-in-out;
|
||||
opacity: 0
|
||||
}
|
||||
|
||||
div.code-toolbar:hover>.toolbar {
|
||||
opacity: 1
|
||||
}
|
||||
|
||||
div.code-toolbar:focus-within>.toolbar {
|
||||
opacity: 1
|
||||
}
|
||||
|
||||
div.code-toolbar>.toolbar>.toolbar-item {
|
||||
display: inline-block
|
||||
}
|
||||
|
||||
div.code-toolbar>.toolbar>.toolbar-item>a {
|
||||
cursor: pointer
|
||||
}
|
||||
|
||||
div.code-toolbar>.toolbar>.toolbar-item>button {
|
||||
background: 0 0;
|
||||
border: 0;
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
line-height: normal;
|
||||
overflow: visible;
|
||||
padding: 0;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none
|
||||
}
|
||||
|
||||
div.code-toolbar>.toolbar>.toolbar-item>a,
|
||||
div.code-toolbar>.toolbar>.toolbar-item>button,
|
||||
div.code-toolbar>.toolbar>.toolbar-item>span {
|
||||
color: #bbb;
|
||||
font-size: .8em;
|
||||
padding: 0 .5em;
|
||||
background: #f5f2f0;
|
||||
background: rgba(224, 224, 224, .2);
|
||||
box-shadow: 0 2px 0 0 rgba(0, 0, 0, .2);
|
||||
border-radius: .5em
|
||||
}
|
||||
|
||||
div.code-toolbar>.toolbar>.toolbar-item>a:focus,
|
||||
div.code-toolbar>.toolbar>.toolbar-item>a:hover,
|
||||
div.code-toolbar>.toolbar>.toolbar-item>button:focus,
|
||||
div.code-toolbar>.toolbar>.toolbar-item>button:hover,
|
||||
div.code-toolbar>.toolbar>.toolbar-item>span:focus,
|
||||
div.code-toolbar>.toolbar>.toolbar-item>span:hover {
|
||||
color: inherit;
|
||||
text-decoration: none
|
||||
}
|
||||
|
||||
.pre-mac {
|
||||
position: relative;
|
||||
margin-top: -7px;
|
||||
top: 21px;
|
||||
left: 10px;
|
||||
width: 100px;
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
.pre-mac>span {
|
||||
float: left;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.pre-mac>span:nth-child(1) {
|
||||
background: red;
|
||||
}
|
||||
|
||||
.pre-mac>span:nth-child(2) {
|
||||
background: sandybrown;
|
||||
}
|
||||
|
||||
.pre-mac>span:nth-child(3) {
|
||||
background: limegreen;
|
||||
}
|
||||
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
+61
@@ -0,0 +1,61 @@
|
||||
(()=>{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<y;e++)(t=a[e]).addEventListener("touchstart",S),t.addEventListener("click",S)}}function L(r){var t,a,e=i(o.temporaryFormId);e&&f&&(i(o.parentIdFieldId).value="0",t=e.textContent,e.parentNode.replaceChild(f,e),this.style.display="none",a=(e=(e=i(o.commentReplyTitleId))&&e.firstChild)&&e.nextSibling,e&&e.nodeType===Node.TEXT_NODE&&t&&(a&&a.nodeName==="A"&&a.id!==o.cancelReplyId&&(a.style.display=""),e.textContent=t),r.preventDefault())}function S(r){var t=i(o.commentReplyTitleId),t=t&&t.firstChild.textContent,d=this,a=C(d,"belowelement"),e=C(d,"commentid"),y=C(d,"respondelement"),l=C(d,"postid"),d=C(d,"replyto")||t;a&&e&&y&&l&&m.addComment.moveForm(a,e,y,l,d)===!1&&r.preventDefault()}function O(r){for(var t=r.length;t--;)if(r[t].addedNodes.length)return void F()}function C(r,t){return D?r.dataset[t]:r.getAttribute("data-"+t)}function i(r){return c.getElementById(r)}return N&&c.readyState!=="loading"?x():N&&m.addEventListener("DOMContentLoaded",x,!1),{init:F,moveForm:function(h,t,b,e,y){var l,d,n,I,R,v,E,h=i(h),b=(f=i(b),i(o.parentIdFieldId)),w=i(o.postIdFieldId),s=i(o.commentReplyTitleId),g=(s=s&&s.firstChild)&&s.nextSibling;if(h&&f&&b){y===void 0&&(y=s&&s.textContent),I=f,R=o.temporaryFormId,v=i(R),E=(E=i(o.commentReplyTitleId))?E.firstChild.textContent:"",v||((v=c.createElement("div")).id=R,v.style.display="none",v.textContent=E,I.parentNode.insertBefore(v,I)),e&&w&&(w.value=e),b.value=t,u.style.display="",h.parentNode.insertBefore(f,h.nextSibling),s&&s.nodeType===Node.TEXT_NODE&&(g&&g.nodeName==="A"&&g.id!==o.cancelReplyId&&(g.style.display="none"),s.textContent=y),u.onclick=function(){return!1};try{for(var T=0;T<p.elements.length;T++)if(l=p.elements[T],d=!1,"getComputedStyle"in m?n=m.getComputedStyle(l):c.documentElement.currentStyle&&(n=l.currentStyle),(l.offsetWidth<=0&&l.offsetHeight<=0||n.visibility==="hidden")&&(d=!0),l.type!=="hidden"&&!l.disabled&&!d){l.focus();break}}catch{}return!1}}}}(window);})();
|
||||
/*! This file is auto-generated */
|
||||
|
||||
;
|
||||
(()=>{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=>`<span class="db--genreItem${this.genre_list.includes(e.name)?" is-active":""}">${e.name}</span>`).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+=`<div class="db--listBydate"><div class="db--titleDate "><div class="db--titleDate__day">${a[1]}</div><div class="db--titleDate__month">${a[0]}</div></div><div class="db--dateList__card">`,t+=e[s].map(n=>`<div class="db--item">${n.is_top250?'<span class="top250">Top 250</span>':""}<img src="${n.poster}" referrerpolicy="no-referrer" class="db--image"><div class="db--score ">${n.douban_score>0?'<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" ><path d="M12 20.1l5.82 3.682c1.066.675 2.37-.322 2.09-1.584l-1.543-6.926 5.146-4.667c.94-.85.435-2.465-.799-2.567l-6.773-.602L13.29.89a1.38 1.38 0 0 0-2.581 0l-2.65 6.53-6.774.602C.052 8.126-.453 9.74.486 10.59l5.147 4.666-1.542 6.926c-.28 1.262 1.023 2.26 2.09 1.585L12 20.099z"></path></svg>'+n.douban_score:""}${n.year>0?" \xB7 "+n.year:""}</div><div class="db--title"><a href="${n.link}" target="_blank">${n.name}</a></div></div>`).join(""),t+="</div></div>"}document.querySelector(".db--list").innerHTML=t}_randerListTemplate(){document.querySelector(".db--list").innerHTML=this.subjects.map(e=>`<div class="db--item">${e.is_top250?'<span class="top250">Top 250</span>':""}<img src="${e.poster}" referrerpolicy="no-referrer" class="db--image"><div class="ipc-signpost ">${e.create_time}</div><div class="db--score ">${e.douban_score>0?'<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" ><path d="M12 20.1l5.82 3.682c1.066.675 2.37-.322 2.09-1.584l-1.543-6.926 5.146-4.667c.94-.85.435-2.465-.799-2.567l-6.773-.602L13.29.89a1.38 1.38 0 0 0-2.581 0l-2.65 6.53-6.774.602C.052 8.126-.453 9.74.486 10.59l5.147 4.666-1.542 6.926c-.28 1.262 1.023 2.26 2.09 1.585L12 20.099z"></path></svg>'+e.douban_score:""}${e.year>0?" \xB7 "+e.year:""}</div><div class="db--title"><a href="${e.link}" target="_blank">${e.name}</a></div>
|
||||
</div>
|
||||
</div>`).join("")}_handleScroll(){window.addEventListener("scroll",()=>{var e=window.scrollY||window.pageYOffset;document.querySelector(".block-more").offsetTop+-window.innerHeight<e&&document.querySelector(".lds-ripple").classList.contains("u-hide")&&!this.finished&&(document.querySelector(".lds-ripple").classList.remove("u-hide"),this.paged++,this._fetchData())})}_handleNavClick(){this.on("click",".db--navItem",e=>{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=`<div class="doulist-subject">
|
||||
<div class="doulist-post"><img decoding="async" referrerpolicy="no-referrer" src="${l.poster}"></div>
|
||||
<div class="doulist-content">
|
||||
<div class="doulist-title"><a href="${l.link}" class="cute" target="_blank" rel="external nofollow">${l.name}</a></div>
|
||||
<div class="rating"><span class="allstardark"><span class="allstarlight" style="width:55%"></span></span><span class="rating_nums"> ${l.douban_score} </span></div>
|
||||
<div class="abstract">${l.card_subtitle}</div>
|
||||
</div>
|
||||
</div>`,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=>`<div class="doulist-item">
|
||||
<div class="doulist-subject">
|
||||
<div class="db--viewTime ">Marked ${a.create_time}</div>
|
||||
<div class="doulist-post"><img referrerpolicy="no-referrer" src="${a.poster}"></div><div class="doulist-content"><div class="doulist-title"><a href="${a.link}" class="cute" target="_blank" rel="external nofollow">${a.name}</a></div><div class="rating"><span class="allstardark"><span class="allstarlight" style="width:75%"></span></span><span class="rating_nums">${a.douban_score}</span></div><div class="abstract">${a.remark||a.card_subtitle}</div></div></div></div>`).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+=`<div class="db--date">${i}</div><div class="db--dateList">`,n+=a[i].map(r=>`<div class="db--card__list"">
|
||||
<img referrerpolicy="no-referrer" src="${r.poster}">
|
||||
<div>
|
||||
<div class="title"><a href="${r.link}" class="cute" target="_blank" rel="external nofollow">${r.name}</a></div>
|
||||
<div class="rating"><span class="allstardark"><span class="allstarlight" style="width:75%"></span></span><span class="rating_nums">${r.douban_score}</span></div>
|
||||
${r.remark||r.card_subtitle}
|
||||
</div>
|
||||
</div>`).join(""),n+="</div>";e.innerHTML=n}})}};new d({token:window.WPD_TOKEN});})();
|
||||
|
||||
;
|
||||
(()=>{var o=class{getCookie(e){if(0<document.cookie.length){var i=document.cookie.indexOf(e+"=");if(i!=-1){i=i+e.length+1;var t=document.cookie.indexOf(";",i);return t==-1&&(t=document.cookie.length),document.cookie.substring(i,t)}}return""}setCookie(e,i,t){var s=new Date;s.setTime(s.getTime()+24*t*60*60*1e3);var d="expires="+s.toUTCString();document.cookie=e+"="+i+";"+d+";path=/"}showNotice(e,i="success"){let t=`<div class="notice--wrapper">${e}</div>`;document.querySelector("body").insertAdjacentHTML("beforeend",t),document.querySelector(".notice--wrapper").classList.add("is-active"),setTimeout(()=>{document.querySelector(".notice--wrapper").remove()},3e3)}};var a=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=[];constructor(e){this.selector=e.selector,e.timeFormat&&(this.timeFormat=e.timeFormat),this.init(),setTimeout(()=>{this.refresh()},1e3*5)}init(){this.doms=Array.from(document.querySelectorAll(this.selector)),this.doms.forEach(e=>{e.innerText=this.humanize_time_ago(e.attributes.datetime.value)})}humanize_time_ago(e){let i=new Date(e),t=Date.now()/1e3-Number(i.getTime()/1e3);return t<3600?`${Math.ceil(t/60)} ${Math.ceil(t/60)==1?this.timeFormat.second:this.timeFormat.seconds}`:t<86400?`${Math.ceil(t/3600)} ${Math.ceil(t/3660)==1?this.timeFormat.hour:this.timeFormat.hours}`:t<86400*30?`${Math.ceil(t/86400)} ${Math.ceil(t/86400)==1?this.timeFormat.day:this.timeFormat.days}`:t<86400*30*12?`${Math.ceil(t/(86400*30))} ${Math.ceil(t/(86400*30))==1?this.timeFormat.month:this.timeFormat.months}`:i.getFullYear()+"-"+(i.getMonth()+1)+"-"+i.getDate()}refresh(){this.doms.forEach(e=>{e.innerText=this.humanize_time_ago(e.attributes.datetime.value)})}},l=a;var n=class extends o{singleSelector=".post--single";likeButtonSelctor=".like-btn";articleSelector=".post--item";viewSelector=".article--views";actionDomain;text="";likeButton=null;post_id;is_single=!1;constructor(e){if(super(),this.singleSelector=e.singleSelector??this.singleSelector,this.likeButtonSelctor=e.likeButtonSelctor??this.likeButtonSelctor,this.articleSelector=e.articleSelector??this.articleSelector,this.viewSelector=e.viewSelector??this.viewSelector,this.actionDomain=e.actionDomain,this.text=e.text??this.text,this.is_single=!!document.querySelector(this.singleSelector),this.is_single){let i=document.querySelector(this.singleSelector);this.post_id=i.dataset.id??"",this.initArticleLike()}}initArticleLike(){this.likeButton=document.querySelector(this.likeButtonSelctor),this.likeButton&&(fetch(this.actionDomain+"post/"+this.post_id+"/like").then(e=>{e.json().then(i=>{this.likeButton.querySelector(".count").innerText=i.likes})}),this.likeButton.addEventListener("click",()=>{this.handleLike()}),this.getCookie("like_"+this.post_id)&&this.likeButton.classList.add("is-active"))}handleLike(){if(this.getCookie("like_"+this.post_id))return this.showNotice("You have already liked this post");if(this.likeButton){let e=this.actionDomain+"post/"+this.post_id+"/like";fetch(e,{method:"post"}).then(i=>i.json()).then(i=>{this.showNotice("Thanks for your like");let t=this.likeButton?.querySelector(".count");t&&(t.innerText=i.likes),this.setCookie("like_"+this.post_id,"1",1)}),this.likeButton?.classList.add("is-active")}}},h=n;var c=class extends o{is_single=!1;post_id=0;is_archive=!1;VERSION="0.4.1";like_btn;selctor=".like-btn";actionDomain=window.actionDomain;constructor(){super(),this.initCopyright(),this.initThemeSwitch(),this.initBack2Top(),this.initSearch()}initSearch(){document.querySelector('[data-action="show-search"]').addEventListener("click",()=>{document.querySelector(".site--header__center .inner").classList.toggle("search--active")})}initBack2Top(){if(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"})})}}initCopyright(){let e=`<div class="site--footer__info">
|
||||
Theme <a href="https://fatesinger.com/101971" target="_blank">farallon</a> by bigfa / version ${this.VERSION}
|
||||
</div>`;document.querySelector(".site--footer__content").insertAdjacentHTML("afterend",e),document.querySelector(".icon--copryrights").addEventListener("click",()=>{document.querySelector(".site--footer__info").classList.toggle("active")})}initThemeSwitch(){let e=localStorage.getItem("theme")?localStorage.getItem("theme"):"auto",i=`<div class="fixed--theme">
|
||||
<span class="${e=="dark"?"is-active":""}" data-action-value="dark">
|
||||
<svg fill="none" height="24" shape-rendering="geometricPrecision" stroke="currentColor" stroke-linecap="round"
|
||||
stroke-linejoin="round" stroke-width="1.5" viewBox="0 0 24 24" width="24"
|
||||
style="color: currentcolor; width: 16px; height: 16px;">
|
||||
<path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
|
||||
</svg>
|
||||
</span>
|
||||
<span class="${e=="light"?"is-active":""}" data-action-value="light">
|
||||
<svg fill="none" height="24" shape-rendering="geometricPrecision" stroke="currentColor" stroke-linecap="round"
|
||||
stroke-linejoin="round" stroke-width="1.5" viewBox="0 0 24 24" width="24"
|
||||
style="color: currentcolor; width: 16px; height: 16px;">
|
||||
<circle cx="12" cy="12" r="5"></circle>
|
||||
<path d="M12 1v2"></path>
|
||||
<path d="M12 21v2"></path>
|
||||
<path d="M4.22 4.22l1.42 1.42"></path>
|
||||
<path d="M18.36 18.36l1.42 1.42"></path>
|
||||
<path d="M1 12h2"></path>
|
||||
<path d="M21 12h2"></path>
|
||||
<path d="M4.22 19.78l1.42-1.42"></path>
|
||||
<path d="M18.36 5.64l1.42-1.42"></path>
|
||||
</svg>
|
||||
</span>
|
||||
<span class="${e=="auto"?"is-active":""}" data-action-value="auto">
|
||||
<svg fill="none" height="24" shape-rendering="geometricPrecision" stroke="currentColor" stroke-linecap="round"
|
||||
stroke-linejoin="round" stroke-width="1.5" viewBox="0 0 24 24" width="24"
|
||||
style="color: currentcolor; width: 16px; height: 16px;">
|
||||
<rect x="2" y="3" width="20" height="14" rx="2" ry="2"></rect>
|
||||
<path d="M8 21h8"></path>
|
||||
<path d="M12 17v4"></path>
|
||||
</svg>
|
||||
</span>
|
||||
</div>`;document.querySelector("body").insertAdjacentHTML("beforeend",i),document.querySelectorAll(".fixed--theme span").forEach(t=>{t.addEventListener("click",()=>{t.classList.contains("is-active")||(document.querySelectorAll(".fixed--theme span").forEach(s=>{s.classList.remove("is-active")}),t.dataset.actionValue=="dark"?(localStorage.setItem("theme","dark"),document.querySelector("body").classList.remove("auto"),document.querySelector("body").classList.add("dark"),t.classList.add("is-active")):t.dataset.actionValue=="light"?(localStorage.setItem("theme","light"),document.querySelector("body").classList.remove("auto"),document.querySelector("body").classList.remove("dark"),t.classList.add("is-active")):t.dataset.actionValue=="auto"&&(localStorage.setItem("theme","auto"),document.querySelector("body").classList.remove("dark"),document.querySelector("body").classList.add("auto"),t.classList.add("is-active")))})})}};new h({singleSelector:".post--single",articleSelector:".post--item",likeButtonSelctor:".like-btn",actionDomain:window.actionDomain});new c;new l({selector:".humane--time",timeFormat:window.timeFormat});})();
|
||||
Vendored
+629
@@ -0,0 +1,629 @@
|
||||
(() => {
|
||||
// <stdin>
|
||||
window.addComment = function(v) {
|
||||
var I, C, h, E = v.document, b = { 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" }, e = v.MutationObserver || v.WebKitMutationObserver || v.MozMutationObserver, r = "querySelector" in E && "addEventListener" in v, n = !!E.documentElement.dataset;
|
||||
function t() {
|
||||
d(), e && new e(o).observe(E.body, { childList: true, subtree: true });
|
||||
}
|
||||
function d(e2) {
|
||||
if (r && (I = g(b.cancelReplyId), C = g(b.commentFormId), I)) {
|
||||
let t3 = function(e3) {
|
||||
if ((e3.metaKey || e3.ctrlKey) && 13 === e3.keyCode)
|
||||
return C.removeEventListener("keydown", t3), e3.preventDefault(), C.submit.click(), false;
|
||||
};
|
||||
var t2 = t3;
|
||||
I.addEventListener("touchstart", l), I.addEventListener("click", l);
|
||||
C && C.addEventListener("keydown", t3);
|
||||
for (var n2, d2 = function(e3) {
|
||||
var t4 = b.commentReplyClass;
|
||||
e3 && e3.childNodes || (e3 = E);
|
||||
e3 = E.getElementsByClassName ? e3.getElementsByClassName(t4) : e3.querySelectorAll("." + t4);
|
||||
return e3;
|
||||
}(e2), o2 = 0, i = d2.length; o2 < i; o2++)
|
||||
(n2 = d2[o2]).addEventListener("touchstart", a), n2.addEventListener("click", a);
|
||||
}
|
||||
}
|
||||
function l(e2) {
|
||||
var t2, n2, d2 = g(b.temporaryFormId);
|
||||
d2 && h && (g(b.parentIdFieldId).value = "0", t2 = d2.textContent, d2.parentNode.replaceChild(h, d2), this.style.display = "none", n2 = (d2 = (d2 = g(b.commentReplyTitleId)) && d2.firstChild) && d2.nextSibling, d2 && d2.nodeType === Node.TEXT_NODE && t2 && (n2 && "A" === n2.nodeName && n2.id !== b.cancelReplyId && (n2.style.display = ""), d2.textContent = t2), e2.preventDefault());
|
||||
}
|
||||
function a(e2) {
|
||||
var t2 = g(b.commentReplyTitleId), t2 = t2 && t2.firstChild.textContent, n2 = this, d2 = m(n2, "belowelement"), o2 = m(n2, "commentid"), i = m(n2, "respondelement"), r2 = m(n2, "postid"), n2 = m(n2, "replyto") || t2;
|
||||
d2 && o2 && i && r2 && false === v.addComment.moveForm(d2, o2, i, r2, n2) && e2.preventDefault();
|
||||
}
|
||||
function o(e2) {
|
||||
for (var t2 = e2.length; t2--; )
|
||||
if (e2[t2].addedNodes.length)
|
||||
return void d();
|
||||
}
|
||||
function m(e2, t2) {
|
||||
return n ? e2.dataset[t2] : e2.getAttribute("data-" + t2);
|
||||
}
|
||||
function g(e2) {
|
||||
return E.getElementById(e2);
|
||||
}
|
||||
return r && "loading" !== E.readyState ? t() : r && v.addEventListener("DOMContentLoaded", t, false), { init: d, moveForm: function(e2, t2, n2, d2, o2) {
|
||||
var i, r2, l2, a2, m2, c, s, e2 = g(e2), n2 = (h = g(n2), g(b.parentIdFieldId)), y = g(b.postIdFieldId), p = g(b.commentReplyTitleId), u = (p = p && p.firstChild) && p.nextSibling;
|
||||
if (e2 && h && n2) {
|
||||
void 0 === o2 && (o2 = p && p.textContent), a2 = h, m2 = b.temporaryFormId, c = g(m2), s = (s = g(b.commentReplyTitleId)) ? s.firstChild.textContent : "", c || ((c = E.createElement("div")).id = m2, c.style.display = "none", c.textContent = s, a2.parentNode.insertBefore(c, a2)), d2 && y && (y.value = d2), n2.value = t2, I.style.display = "", e2.parentNode.insertBefore(h, e2.nextSibling), p && p.nodeType === Node.TEXT_NODE && (u && "A" === u.nodeName && u.id !== b.cancelReplyId && (u.style.display = "none"), p.textContent = o2), I.onclick = function() {
|
||||
return false;
|
||||
};
|
||||
try {
|
||||
for (var f = 0; f < C.elements.length; f++)
|
||||
if (i = C.elements[f], r2 = false, "getComputedStyle" in v ? l2 = v.getComputedStyle(i) : E.documentElement.currentStyle && (l2 = i.currentStyle), (i.offsetWidth <= 0 && i.offsetHeight <= 0 || "hidden" === l2.visibility) && (r2 = true), "hidden" !== i.type && !i.disabled && !r2) {
|
||||
i.focus();
|
||||
break;
|
||||
}
|
||||
} catch (e3) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} };
|
||||
}(window);
|
||||
})();
|
||||
/*! This file is auto-generated */
|
||||
|
||||
;
|
||||
(() => {
|
||||
// <stdin>
|
||||
var FARALLON_DOUBAN = class {
|
||||
ver;
|
||||
type;
|
||||
finished;
|
||||
paged;
|
||||
genre_list;
|
||||
subjects;
|
||||
genre;
|
||||
baseAPI = "https://node.wpista.com/v1/outer/";
|
||||
token;
|
||||
constructor(config) {
|
||||
this.ver = "1.0.1";
|
||||
this.type = "movie";
|
||||
this.finished = false;
|
||||
this.paged = 1;
|
||||
this.genre_list = [];
|
||||
this.genre = [];
|
||||
this.subjects = [];
|
||||
this.token = config.token;
|
||||
this._create();
|
||||
}
|
||||
on(t, e, n) {
|
||||
var a = document.querySelectorAll(e);
|
||||
a.forEach((item) => {
|
||||
item.addEventListener(t, n);
|
||||
});
|
||||
}
|
||||
_fetchGenres() {
|
||||
document.querySelector(".db--genres").innerHTML = "";
|
||||
fetch(
|
||||
this.baseAPI + "genres?token=" + this.token + "&type=" + this.type
|
||||
).then((response) => response.json()).then((t) => {
|
||||
if (t.data.length) {
|
||||
this.genre_list = t.data;
|
||||
this._renderGenre();
|
||||
}
|
||||
});
|
||||
}
|
||||
_handleGenreClick() {
|
||||
this.on("click", ".db--genreItem", (t) => {
|
||||
const self = t.currentTarget;
|
||||
if (self.classList.contains("is-active")) {
|
||||
const index = this.genre.indexOf(self.innerText);
|
||||
self.classList.remove("is-active");
|
||||
this.genre.splice(index, 1);
|
||||
this.paged = 1;
|
||||
this.finished = false;
|
||||
this.subjects = [];
|
||||
this._fetchData();
|
||||
return;
|
||||
}
|
||||
document.querySelector(".db--list").innerHTML = "";
|
||||
document.querySelector(".lds-ripple").classList.remove("u-hide");
|
||||
self.classList.add("is-active");
|
||||
this.genre.push(self.innerText);
|
||||
this.paged = 1;
|
||||
this.finished = false;
|
||||
this.subjects = [];
|
||||
this._fetchData();
|
||||
return;
|
||||
});
|
||||
}
|
||||
_renderGenre() {
|
||||
document.querySelector(".db--genres").innerHTML = this.genre_list.map((item) => {
|
||||
return `<span class="db--genreItem${this.genre_list.includes(item.name) ? " is-active" : ""}">${item.name}</span>`;
|
||||
}).join("");
|
||||
this._handleGenreClick();
|
||||
}
|
||||
_fetchData() {
|
||||
fetch(
|
||||
this.baseAPI + "faves?token=" + this.token + "&type=" + this.type + "&paged=" + this.paged + "&genre=" + JSON.stringify(this.genre)
|
||||
).then((response) => response.json()).then((t) => {
|
||||
if (t.data.length) {
|
||||
if (document.querySelector(".db--list").classList.contains("db--list__card")) {
|
||||
this.subjects = [...this.subjects, ...t.data];
|
||||
this._randerDateTemplate();
|
||||
} else {
|
||||
this.subjects = [...this.subjects, ...t.data];
|
||||
this._randerListTemplate();
|
||||
}
|
||||
document.querySelector(".lds-ripple").classList.add("u-hide");
|
||||
} else {
|
||||
this.finished = true;
|
||||
document.querySelector(".lds-ripple").classList.add("u-hide");
|
||||
}
|
||||
});
|
||||
}
|
||||
_randerDateTemplate() {
|
||||
const result = this.subjects.reduce((result2, item) => {
|
||||
const date = new Date(item.create_time);
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth() + 1;
|
||||
const key = `${year}-${month.toString().padStart(2, "0")}`;
|
||||
if (Object.prototype.hasOwnProperty.call(result2, key)) {
|
||||
result2[key].push(item);
|
||||
} else {
|
||||
result2[key] = [item];
|
||||
}
|
||||
return result2;
|
||||
}, {});
|
||||
let html = ``;
|
||||
for (let key in result) {
|
||||
const date = key.split("-");
|
||||
html += `<div class="db--listBydate"><div class="db--titleDate "><div class="db--titleDate__day">${date[1]}</div><div class="db--titleDate__month">${date[0]}</div></div><div class="db--dateList__card">`;
|
||||
html += result[key].map((movie) => {
|
||||
return `<div class="db--item">${movie.is_top250 ? '<span class="top250">Top 250</span>' : ""}<img src="${movie.poster}" referrerpolicy="no-referrer" class="db--image"><div class="db--score ">${movie.douban_score > 0 ? '<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" ><path d="M12 20.1l5.82 3.682c1.066.675 2.37-.322 2.09-1.584l-1.543-6.926 5.146-4.667c.94-.85.435-2.465-.799-2.567l-6.773-.602L13.29.89a1.38 1.38 0 0 0-2.581 0l-2.65 6.53-6.774.602C.052 8.126-.453 9.74.486 10.59l5.147 4.666-1.542 6.926c-.28 1.262 1.023 2.26 2.09 1.585L12 20.099z"></path></svg>' + movie.douban_score : ""}${movie.year > 0 ? " \xB7 " + movie.year : ""}</div><div class="db--title"><a href="${movie.link}" target="_blank">${movie.name}</a></div></div>`;
|
||||
}).join("");
|
||||
html += `</div></div>`;
|
||||
}
|
||||
document.querySelector(".db--list").innerHTML = html;
|
||||
}
|
||||
_randerListTemplate() {
|
||||
document.querySelector(".db--list").innerHTML = this.subjects.map((item) => {
|
||||
return `<div class="db--item">${item.is_top250 ? '<span class="top250">Top 250</span>' : ""}<img src="${item.poster}" referrerpolicy="no-referrer" class="db--image"><div class="ipc-signpost ">${item.create_time}</div><div class="db--score ">${item.douban_score > 0 ? '<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" ><path d="M12 20.1l5.82 3.682c1.066.675 2.37-.322 2.09-1.584l-1.543-6.926 5.146-4.667c.94-.85.435-2.465-.799-2.567l-6.773-.602L13.29.89a1.38 1.38 0 0 0-2.581 0l-2.65 6.53-6.774.602C.052 8.126-.453 9.74.486 10.59l5.147 4.666-1.542 6.926c-.28 1.262 1.023 2.26 2.09 1.585L12 20.099z"></path></svg>' + item.douban_score : ""}${item.year > 0 ? " \xB7 " + item.year : ""}</div><div class="db--title"><a href="${item.link}" target="_blank">${item.name}</a></div>
|
||||
</div>
|
||||
</div>`;
|
||||
}).join("");
|
||||
}
|
||||
_handleScroll() {
|
||||
window.addEventListener("scroll", () => {
|
||||
var t = window.scrollY || window.pageYOffset;
|
||||
const moreElement = document.querySelector(
|
||||
".block-more"
|
||||
);
|
||||
if (moreElement.offsetTop + -window.innerHeight < t && document.querySelector(".lds-ripple").classList.contains("u-hide") && !this.finished) {
|
||||
document.querySelector(".lds-ripple").classList.remove("u-hide");
|
||||
this.paged++;
|
||||
this._fetchData();
|
||||
}
|
||||
});
|
||||
}
|
||||
_handleNavClick() {
|
||||
this.on("click", ".db--navItem", (t) => {
|
||||
if (t.currentTarget.classList.contains("current"))
|
||||
return;
|
||||
this.genre = [];
|
||||
this.type = t.currentTarget.dataset.type;
|
||||
if (this.type != "book") {
|
||||
this._fetchGenres();
|
||||
document.querySelector(".db--genres")?.classList.remove("u-hide");
|
||||
} else {
|
||||
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");
|
||||
const self = t.target;
|
||||
self.classList.add("current");
|
||||
this.paged = 1;
|
||||
this.finished = false;
|
||||
this.subjects = [];
|
||||
this._fetchData();
|
||||
});
|
||||
}
|
||||
_create() {
|
||||
if (document.querySelector(".db--container")) {
|
||||
const container = document.querySelector(
|
||||
".db--container"
|
||||
);
|
||||
if (container.dataset.token) {
|
||||
this.token = container.dataset.token;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
const currentNavItem = document.querySelector(
|
||||
".db--navItem.current"
|
||||
);
|
||||
if (currentNavItem instanceof HTMLElement) {
|
||||
this.type = currentNavItem.dataset.type;
|
||||
}
|
||||
const currentType = document.querySelector(
|
||||
".db--list"
|
||||
);
|
||||
if (currentType.dataset.type)
|
||||
this.type = currentType.dataset.type;
|
||||
if (this.type == "movie") {
|
||||
document.querySelector(".db--genres").classList.remove("u-hide");
|
||||
}
|
||||
this._fetchGenres();
|
||||
this._fetchData();
|
||||
this._handleScroll();
|
||||
this._handleNavClick();
|
||||
}
|
||||
if (document.querySelector(".js-db")) {
|
||||
document.querySelectorAll(".js-db").forEach((item) => {
|
||||
const db = item;
|
||||
const id = db.dataset.id;
|
||||
const type = db.dataset.type;
|
||||
const nodeParent = db.parentNode;
|
||||
fetch(
|
||||
// @ts-ignore
|
||||
this.baseAPI + `${type}/${id}?token=${this.token}`
|
||||
).then((response) => {
|
||||
response.json().then((t) => {
|
||||
if (t.data) {
|
||||
const data = t.data;
|
||||
const node = document.createElement("div");
|
||||
node.classList.add("doulist-item");
|
||||
node.innerHTML = `<div class="doulist-subject">
|
||||
<div class="doulist-post"><img decoding="async" referrerpolicy="no-referrer" src="${data.poster}"></div>
|
||||
<div class="doulist-content">
|
||||
<div class="doulist-title"><a href="${data.link}" class="cute" target="_blank" rel="external nofollow">${data.name}</a></div>
|
||||
<div class="rating"><span class="allstardark"><span class="allstarlight" style="width:55%"></span></span><span class="rating_nums"> ${data.douban_score} </span></div>
|
||||
<div class="abstract">${data.card_subtitle}</div>
|
||||
</div>
|
||||
</div>`;
|
||||
nodeParent.replaceWith(node);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
if (document.querySelector(".db--collection")) {
|
||||
document.querySelectorAll(".db--collection").forEach((item) => {
|
||||
this._fetchCollection(item);
|
||||
});
|
||||
}
|
||||
}
|
||||
_fetchCollection(item) {
|
||||
const type = item.dataset.style ? item.dataset.style : "card";
|
||||
fetch(
|
||||
// @ts-ignore
|
||||
obvInit.api + "v1/movies?type=" + item.dataset.type + "&paged=1&genre=&start_time=" + item.dataset.start + "&end_time=" + item.dataset.end
|
||||
).then((response) => response.json()).then((t) => {
|
||||
if (t.length) {
|
||||
if (type == "card") {
|
||||
item.innerHTML += t.map((movie) => {
|
||||
return `<div class="doulist-item">
|
||||
<div class="doulist-subject">
|
||||
<div class="db--viewTime ">Marked ${movie.create_time}</div>
|
||||
<div class="doulist-post"><img referrerpolicy="no-referrer" src="${movie.poster}"></div><div class="doulist-content"><div class="doulist-title"><a href="${movie.link}" class="cute" target="_blank" rel="external nofollow">${movie.name}</a></div><div class="rating"><span class="allstardark"><span class="allstarlight" style="width:75%"></span></span><span class="rating_nums">${movie.douban_score}</span></div><div class="abstract">${movie.remark || movie.card_subtitle}</div></div></div></div>`;
|
||||
}).join("");
|
||||
} else {
|
||||
const result = t.reduce((result2, item2) => {
|
||||
if (Object.prototype.hasOwnProperty.call(
|
||||
result2,
|
||||
item2.create_time
|
||||
)) {
|
||||
result2[item2.create_time].push(item2);
|
||||
} else {
|
||||
result2[item2.create_time] = [item2];
|
||||
}
|
||||
return result2;
|
||||
}, {});
|
||||
let html = ``;
|
||||
for (let key in result) {
|
||||
html += `<div class="db--date">${key}</div><div class="db--dateList">`;
|
||||
html += result[key].map((movie) => {
|
||||
return `<div class="db--card__list"">
|
||||
<img referrerpolicy="no-referrer" src="${movie.poster}">
|
||||
<div>
|
||||
<div class="title"><a href="${movie.link}" class="cute" target="_blank" rel="external nofollow">${movie.name}</a></div>
|
||||
<div class="rating"><span class="allstardark"><span class="allstarlight" style="width:75%"></span></span><span class="rating_nums">${movie.douban_score}</span></div>
|
||||
${movie.remark || movie.card_subtitle}
|
||||
</div>
|
||||
</div>`;
|
||||
}).join("");
|
||||
html += `</div>`;
|
||||
}
|
||||
item.innerHTML = html;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
new FARALLON_DOUBAN({
|
||||
// @ts-ignore
|
||||
token: window.WPD_TOKEN
|
||||
});
|
||||
})();
|
||||
|
||||
;
|
||||
(() => {
|
||||
// ns-hugo:E:\OneDrive\桌面\suxiaoxiao\bigfa\bigfa.github.io\themes\farallon\assets\ts\utils.ts
|
||||
var farallonHelper = class {
|
||||
getCookie(t) {
|
||||
if (0 < document.cookie.length) {
|
||||
var e = document.cookie.indexOf(t + "=");
|
||||
if (-1 != e) {
|
||||
e = e + t.length + 1;
|
||||
var n = document.cookie.indexOf(";", e);
|
||||
return -1 == n && (n = document.cookie.length), document.cookie.substring(e, n);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
setCookie(t, e, n) {
|
||||
var o = /* @__PURE__ */ new Date();
|
||||
o.setTime(o.getTime() + 24 * n * 60 * 60 * 1e3);
|
||||
var i = "expires=" + o.toUTCString();
|
||||
document.cookie = t + "=" + e + ";" + i + ";path=/";
|
||||
}
|
||||
showNotice(message, type = "success") {
|
||||
const html = `<div class="notice--wrapper">${message}</div>`;
|
||||
document.querySelector("body").insertAdjacentHTML("beforeend", html);
|
||||
document.querySelector(".notice--wrapper").classList.add("is-active");
|
||||
setTimeout(() => {
|
||||
document.querySelector(".notice--wrapper").remove();
|
||||
}, 3e3);
|
||||
}
|
||||
};
|
||||
|
||||
// ns-hugo:E:\OneDrive\桌面\suxiaoxiao\bigfa\bigfa.github.io\themes\farallon\assets\ts\date.ts
|
||||
var farallonDate = 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 = [];
|
||||
constructor(config) {
|
||||
this.selector = config.selector;
|
||||
if (config.timeFormat) {
|
||||
this.timeFormat = config.timeFormat;
|
||||
}
|
||||
this.init();
|
||||
setTimeout(() => {
|
||||
this.refresh();
|
||||
}, 1e3 * 5);
|
||||
}
|
||||
init() {
|
||||
this.doms = Array.from(document.querySelectorAll(this.selector));
|
||||
this.doms.forEach((dom) => {
|
||||
dom.innerText = this.humanize_time_ago(
|
||||
dom.attributes["datetime"].value
|
||||
);
|
||||
});
|
||||
}
|
||||
humanize_time_ago(datetime) {
|
||||
const time = new Date(datetime);
|
||||
const between = Date.now() / 1e3 - Number(time.getTime() / 1e3);
|
||||
if (between < 3600) {
|
||||
return `${Math.ceil(between / 60)} ${Math.ceil(between / 60) == 1 ? this.timeFormat.second : this.timeFormat.seconds}`;
|
||||
} else if (between < 86400) {
|
||||
return `${Math.ceil(between / 3600)} ${Math.ceil(between / 3660) == 1 ? this.timeFormat.hour : this.timeFormat.hours}`;
|
||||
} else if (between < 86400 * 30) {
|
||||
return `${Math.ceil(between / 86400)} ${Math.ceil(between / 86400) == 1 ? this.timeFormat.day : this.timeFormat.days}`;
|
||||
} else if (between < 86400 * 30 * 12) {
|
||||
return `${Math.ceil(between / (86400 * 30))} ${Math.ceil(between / (86400 * 30)) == 1 ? this.timeFormat.month : this.timeFormat.months}`;
|
||||
} else {
|
||||
return time.getFullYear() + "-" + (time.getMonth() + 1) + "-" + time.getDate();
|
||||
}
|
||||
}
|
||||
refresh() {
|
||||
this.doms.forEach((dom) => {
|
||||
dom.innerText = this.humanize_time_ago(
|
||||
dom.attributes["datetime"].value
|
||||
);
|
||||
});
|
||||
}
|
||||
};
|
||||
var date_default = farallonDate;
|
||||
|
||||
// ns-hugo:E:\OneDrive\桌面\suxiaoxiao\bigfa\bigfa.github.io\themes\farallon\assets\ts\action.ts
|
||||
var farallonActions = class extends farallonHelper {
|
||||
singleSelector = ".post--single";
|
||||
likeButtonSelctor = ".like-btn";
|
||||
articleSelector = ".post--item";
|
||||
viewSelector = ".article--views";
|
||||
actionDomain;
|
||||
text = "";
|
||||
likeButton = null;
|
||||
post_id;
|
||||
is_single = false;
|
||||
constructor(config) {
|
||||
super();
|
||||
this.singleSelector = config.singleSelector ?? this.singleSelector;
|
||||
this.likeButtonSelctor = config.likeButtonSelctor ?? this.likeButtonSelctor;
|
||||
this.articleSelector = config.articleSelector ?? this.articleSelector;
|
||||
this.viewSelector = config.viewSelector ?? this.viewSelector;
|
||||
this.actionDomain = config.actionDomain;
|
||||
this.text = config.text ?? this.text;
|
||||
this.is_single = document.querySelector(this.singleSelector) ? true : false;
|
||||
if (this.is_single) {
|
||||
const postSingle = document.querySelector(
|
||||
this.singleSelector
|
||||
);
|
||||
this.post_id = postSingle.dataset.id ?? "";
|
||||
this.initArticleLike();
|
||||
}
|
||||
}
|
||||
initArticleLike() {
|
||||
this.likeButton = document.querySelector(this.likeButtonSelctor);
|
||||
if (this.likeButton) {
|
||||
fetch(this.actionDomain + "post/" + this.post_id + "/like").then(
|
||||
(res) => {
|
||||
res.json().then((data) => {
|
||||
this.likeButton.querySelector(
|
||||
".count"
|
||||
).innerText = data.likes;
|
||||
});
|
||||
}
|
||||
);
|
||||
this.likeButton.addEventListener("click", () => {
|
||||
this.handleLike();
|
||||
});
|
||||
if (this.getCookie("like_" + this.post_id)) {
|
||||
this.likeButton.classList.add("is-active");
|
||||
}
|
||||
}
|
||||
}
|
||||
handleLike() {
|
||||
if (this.getCookie("like_" + this.post_id)) {
|
||||
return this.showNotice("You have already liked this post");
|
||||
}
|
||||
if (this.likeButton) {
|
||||
const url = this.actionDomain + "post/" + this.post_id + "/like";
|
||||
fetch(url, {
|
||||
method: "post"
|
||||
}).then((response) => {
|
||||
return response.json();
|
||||
}).then((data) => {
|
||||
this.showNotice("Thanks for your like");
|
||||
const countElement = this.likeButton?.querySelector(
|
||||
".count"
|
||||
);
|
||||
if (countElement) {
|
||||
countElement.innerText = data.likes;
|
||||
}
|
||||
this.setCookie("like_" + this.post_id, "1", 1);
|
||||
});
|
||||
this.likeButton?.classList.add("is-active");
|
||||
}
|
||||
}
|
||||
};
|
||||
var action_default = farallonActions;
|
||||
|
||||
// <stdin>
|
||||
var farallonBase = class extends farallonHelper {
|
||||
is_single = false;
|
||||
post_id = 0;
|
||||
is_archive = false;
|
||||
VERSION = "0.4.1";
|
||||
like_btn;
|
||||
selctor = ".like-btn";
|
||||
// @ts-ignore
|
||||
actionDomain = window.actionDomain;
|
||||
constructor() {
|
||||
super();
|
||||
this.initCopyright();
|
||||
this.initThemeSwitch();
|
||||
this.initBack2Top();
|
||||
this.initSearch();
|
||||
}
|
||||
initSearch() {
|
||||
document.querySelector('[data-action="show-search"]').addEventListener("click", () => {
|
||||
document.querySelector(".site--header__center .inner").classList.toggle("search--active");
|
||||
});
|
||||
}
|
||||
initBack2Top() {
|
||||
if (document.querySelector(".backToTop")) {
|
||||
const backToTop = document.querySelector(
|
||||
".backToTop"
|
||||
);
|
||||
window.addEventListener("scroll", () => {
|
||||
const t = window.scrollY || window.pageYOffset;
|
||||
t > 200 ? backToTop.classList.add("is-active") : backToTop.classList.remove("is-active");
|
||||
});
|
||||
backToTop.addEventListener("click", () => {
|
||||
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||
});
|
||||
}
|
||||
}
|
||||
initCopyright() {
|
||||
const copyright = `<div class="site--footer__info">
|
||||
Theme <a href="https://fatesinger.com/101971" target="_blank">farallon</a> by bigfa / version ${this.VERSION}
|
||||
</div>`;
|
||||
document.querySelector(".site--footer__content").insertAdjacentHTML("afterend", copyright);
|
||||
document.querySelector(".icon--copryrights").addEventListener("click", () => {
|
||||
document.querySelector(".site--footer__info").classList.toggle("active");
|
||||
});
|
||||
}
|
||||
initThemeSwitch() {
|
||||
const theme = localStorage.getItem("theme") ? localStorage.getItem("theme") : "auto";
|
||||
const html = `<div class="fixed--theme">
|
||||
<span class="${theme == "dark" ? "is-active" : ""}" data-action-value="dark">
|
||||
<svg fill="none" height="24" shape-rendering="geometricPrecision" stroke="currentColor" stroke-linecap="round"
|
||||
stroke-linejoin="round" stroke-width="1.5" viewBox="0 0 24 24" width="24"
|
||||
style="color: currentcolor; width: 16px; height: 16px;">
|
||||
<path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
|
||||
</svg>
|
||||
</span>
|
||||
<span class="${theme == "light" ? "is-active" : ""}" data-action-value="light">
|
||||
<svg fill="none" height="24" shape-rendering="geometricPrecision" stroke="currentColor" stroke-linecap="round"
|
||||
stroke-linejoin="round" stroke-width="1.5" viewBox="0 0 24 24" width="24"
|
||||
style="color: currentcolor; width: 16px; height: 16px;">
|
||||
<circle cx="12" cy="12" r="5"></circle>
|
||||
<path d="M12 1v2"></path>
|
||||
<path d="M12 21v2"></path>
|
||||
<path d="M4.22 4.22l1.42 1.42"></path>
|
||||
<path d="M18.36 18.36l1.42 1.42"></path>
|
||||
<path d="M1 12h2"></path>
|
||||
<path d="M21 12h2"></path>
|
||||
<path d="M4.22 19.78l1.42-1.42"></path>
|
||||
<path d="M18.36 5.64l1.42-1.42"></path>
|
||||
</svg>
|
||||
</span>
|
||||
<span class="${theme == "auto" ? "is-active" : ""}" data-action-value="auto">
|
||||
<svg fill="none" height="24" shape-rendering="geometricPrecision" stroke="currentColor" stroke-linecap="round"
|
||||
stroke-linejoin="round" stroke-width="1.5" viewBox="0 0 24 24" width="24"
|
||||
style="color: currentcolor; width: 16px; height: 16px;">
|
||||
<rect x="2" y="3" width="20" height="14" rx="2" ry="2"></rect>
|
||||
<path d="M8 21h8"></path>
|
||||
<path d="M12 17v4"></path>
|
||||
</svg>
|
||||
</span>
|
||||
</div>`;
|
||||
document.querySelector("body").insertAdjacentHTML("beforeend", html);
|
||||
document.querySelectorAll(".fixed--theme span").forEach((item) => {
|
||||
item.addEventListener("click", () => {
|
||||
if (item.classList.contains("is-active"))
|
||||
return;
|
||||
document.querySelectorAll(".fixed--theme span").forEach((item2) => {
|
||||
item2.classList.remove("is-active");
|
||||
});
|
||||
if (item.dataset.actionValue == "dark") {
|
||||
localStorage.setItem("theme", "dark");
|
||||
document.querySelector("body").classList.remove("auto");
|
||||
document.querySelector("body").classList.add("dark");
|
||||
item.classList.add("is-active");
|
||||
} else if (item.dataset.actionValue == "light") {
|
||||
localStorage.setItem("theme", "light");
|
||||
document.querySelector("body").classList.remove("auto");
|
||||
document.querySelector("body").classList.remove("dark");
|
||||
item.classList.add("is-active");
|
||||
} else if (item.dataset.actionValue == "auto") {
|
||||
localStorage.setItem("theme", "auto");
|
||||
document.querySelector("body").classList.remove("dark");
|
||||
document.querySelector("body").classList.add("auto");
|
||||
item.classList.add("is-active");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
new action_default({
|
||||
singleSelector: ".post--single",
|
||||
articleSelector: ".post--item",
|
||||
likeButtonSelctor: ".like-btn",
|
||||
// @ts-ignore
|
||||
actionDomain: window.actionDomain
|
||||
});
|
||||
new farallonBase();
|
||||
new date_default({
|
||||
selector: ".humane--time",
|
||||
//@ts-ignore
|
||||
timeFormat: window.timeFormat
|
||||
});
|
||||
})();
|
||||
Vendored
+11
File diff suppressed because one or more lines are too long
Vendored
+9
File diff suppressed because one or more lines are too long
Vendored
+28
File diff suppressed because one or more lines are too long
Vendored
+2
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
|
After Width: | Height: | Size: 437 B |
Reference in New Issue
Block a user