ghost-theme-sd.ai/assets/built/source.js

29 lines
76 KiB
JavaScript
Raw Normal View History

2023-10-17 14:18:00 +01:00
function dropdown(){const o=window.matchMedia("(max-width: 767px)"),i=document.querySelector(".gh-navigation"),r=i.querySelector(".gh-navigation-menu"),a=r?.querySelector(".nav");if(a){const e=document.querySelector(".gh-navigation-logo"),t=a.innerHTML;o.matches&&a.querySelectorAll("li").forEach(function(e,t){e.style.transitionDelay=.03*(t+1)+"s"});const n=function(){if(!o.matches){for(var e=[];a.offsetWidth+64>r.offsetWidth&&a.lastElementChild;)e.unshift(a.lastElementChild),a.lastElementChild.remove();if(e.length){const t=document.createElement("button"),n=(t.setAttribute("class","gh-more-toggle gh-icon-button"),t.setAttribute("aria-label","More"),t.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="currentColor"><path d="M21.333 16c0-1.473 1.194-2.667 2.667-2.667v0c1.473 0 2.667 1.194 2.667 2.667v0c0 1.473-1.194 2.667-2.667 2.667v0c-1.473 0-2.667-1.194-2.667-2.667v0zM13.333 16c0-1.473 1.194-2.667 2.667-2.667v0c1.473 0 2.667 1.194 2.667 2.667v0c0 1.473-1.194 2.667-2.667 2.667v0c-1.473 0-2.667-1.194-2.667-2.667v0zM5.333 16c0-1.473 1.194-2.667 2.667-2.667v0c1.473 0 2.667 1.194 2.667 2.667v0c0 1.473-1.194 2.667-2.667 2.667v0c-1.473 0-2.667-1.194-2.667-2.667v0z"></path></svg>',document.createElement("div"));n.setAttribute("class","gh-dropdown"),10<=e.length?(i.classList.add("is-dropdown-mega"),n.style.gridTemplateRows=`repeat(${Math.ceil(e.length/2)}, 1fr)`):i.classList.remove("is-dropdown-mega"),e.forEach(function(e){n.appendChild(e)}),t.appendChild(n),a.appendChild(t),i.classList.add("is-dropdown-loaded"),window.addEventListener("click",function(e){i.classList.contains("is-dropdown-open")?i.classList.remove("is-dropdown-open"):t.contains(e.target)&&i.classList.add("is-dropdown-open")})}else i.classList.add("is-dropdown-loaded")}};imagesLoaded(e,function(){n()}),window.addEventListener("load",function(){e||n()}),window.addEventListener("resize",function(){setTimeout(()=>{a.innerHTML=t,n()},1)})}}function lightbox(e){document.querySelectorAll(e).forEach(function(e){e.addEventListener("click",function(e){var t=e;t.preventDefault();for(var n,o=[],i=0,r=t.target.closest(".kg-card").previousElementSibling;r&&(r.classList.contains("kg-image-card")||r.classList.contains("kg-gallery-card"));){var a=[];r.querySelectorAll("img").forEach(function(e){a.push({src:e.getAttribute("src"),msrc:e.getAttribute("src"),w:e.getAttribute("width"),h:e.getAttribute("height"),el:e}),i+=1}),r=r.previousElementSibling,o=a.concat(o)}t.target.classList.contains("kg-image")?o.push({src:t.target.getAttribute("src"),msrc:t.target.getAttribute("src"),w:t.target.getAttribute("width"),h:t.target.getAttribute("height"),el:t.target}):(n=!1,t.target.closest(".kg-gallery-card").querySelectorAll("img").forEach(function(e){o.push({src:e.getAttribute("src"),msrc:e.getAttribute("src"),w:e.getAttribute("width"),h:e.getAttribute("height"),el:e}),n||e===t.target?n=!0:i+=1}));for(var l=t.target.closest(".kg-card").nextElementSibling;l&&(l.classList.contains("kg-image-card")||l.classList.contains("kg-gallery-card"));)l.querySelectorAll("img").forEach(function(e){o.push({src:e.getAttribute("src"),msrc:e.getAttribute("src"),w:e.getAttribute("width"),h:e.getAttribute("height"),el:e})}),l=l.nextElementSibling;e=document.querySelectorAll(".pswp")[0];new PhotoSwipe(e,PhotoSwipeUI_Default,o,{bgOpacity:.9,closeOnScroll:!0,fullscreenEl:!1,history:!1,index:i,shareEl:!1,zoomEl:!1,getThumbBoundsFn:function(e){var e=o[e].el,t=window.pageYOffset||document.documentElement.scrollTop,e=e.getBoundingClientRect();return{x:e.left,y:e.top+t,w:e.width}}}).init()})})}!function(e,t){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",t):"object"==typeof module&&module.exports?module.exports=t():e.EvEmitter=t()}("undefined"!=typeof window?window:this,function(){function e(){}var t=e.prototype;return t.on=function(e,t){var n;if(e&&t)return-1==(n=(n=this._events=this._events||{})[e]=n[e]||[]).indexOf(t)&&n.push(t),this},t.once=function(e,t){var n;if(e&&t)return this.on(e,t),((n=this._onceEvents=this._onceEvents||{})[e]=n[e]||{})[t]=!0,this},t.off=functio
2023-10-17 10:17:37 +01:00
<div class="mastodon-avatar">
2023-10-17 14:18:00 +01:00
<img src="${escapeHtml(i.account.avatar_static)}" height=60 width=60 alt="${escapeHtml(i.account.display_name)}'s avatar">
2023-10-17 10:17:37 +01:00
</div>
<div class="mastodon-body">
<div class="mastodon-meta">
<div class="mastodon-author">
<div class="mastodon-author-link">
2023-10-17 17:04:52 +01:00
<a href="${i.account.url}" target="_blank" rel="nofollow">
2023-10-17 14:18:00 +01:00
<span>${i.account.display_name}</span>
2023-10-17 10:17:37 +01:00
</a>
<br/>
2023-10-17 14:18:00 +01:00
<span class="mastodon-author-uid">(@${escapeHtml("s"===i.account.acct?"s@sd.ai":i.account.acct)})</span>
2023-10-17 10:17:37 +01:00
</div>
</div>
<div class="toot-link">
2023-10-17 14:18:00 +01:00
<a class="date" href="${i.uri}" rel="nofollow" target="_blank">
${i.created_at.substring(0,10)}
2023-10-17 10:17:37 +01:00
</a>
<br/>
</div>
</div>
<div class="mastodon-comment-content">
2023-10-17 14:18:00 +01:00
${i.content}
<span class="tootlink" ${n?"":'style="display: none;"'}>${i.uri}</span>
2023-10-17 10:17:37 +01:00
</div>
</div>
2023-10-17 14:59:28 +01:00
</div>`,o=DOMPurify.sanitize(o,{RETURN_DOM_FRAGMENT:!0});for(const r of o.querySelectorAll(".tootlink"))r.onclick=function(){return copyElementTextToClipboard(this)};t.appendChild(o)}}else document.getElementById("mastodon-comments-list").innerHTML="<div class='mastodon-comment'>No comments (yet)!</div>"}let MASTODON_POST_ID;function pagination(e=!0,l,s=!1){const c=document.querySelector(".gh-feed");if(!c)return;let t=!1;async function n(){var t=document.querySelector("link[rel=next]");if(t)try{var e=await(await fetch(t.href)).text(),n=(new DOMParser).parseFromString(e,"text/html"),o=n.querySelectorAll(".gh-feed:not(.gh-featured):not(.gh-related) > *");const r=document.createDocumentFragment(),a=[];o.forEach(function(e){e=document.importNode(e,!0);s&&(e.style.visibility="hidden"),r.appendChild(e),a.push(e)}),c.appendChild(r),l&&l(a,d);var i=n.querySelector("link[rel=next]");i&&i.href?t.href=i.href:(t.remove(),u&&u.remove())}catch(e){throw t.remove(),e}}const o=c.nextElementSibling||document.querySelector(".gh-footer"),u=document.querySelector(".gh-loadmore"),d=(!document.querySelector("link[rel=next]")&&u&&u.remove(),async function(){o.getBoundingClientRect().top<=window.innerHeight&&document.querySelector("link[rel=next]")&&await n()});const i=new IntersectionObserver(async function(e){if(!t){if(t=!0,e[0].isIntersecting)if(s)await n();else for(;o.getBoundingClientRect().top<=window.innerHeight&&document.querySelector("link[rel=next]");)await n();t=!1,document.querySelector("link[rel=next]")||i.disconnect()}});e?i.observe(o):u.addEventListener("click",n)}document.addEventListener("DOMContentLoaded",async e=>{let t,n;var o=/bot|google|baidu|bing|msn|teoma|slurp|yandex/i.test(navigator.userAgent),o=(0<document.getElementsByClassName("gh-sidebar").length&&(t=`https://${MASTODON_HOST}/api/v1/accounts/${MASTODON_ACCOUNT_ID}/statuses?exclude_replies=true&exclude_reblogs=true`),MASTODON_POST_ID&&!o&&(t=`https://${MASTODON_HOST}/api/v1/statuses/${MASTODON_POST_ID}/context`,n=!0),document.getElementById("mastodon-comments-list"));if(t&&o){var i=document.getElementById("toot-link-top"),r=document.getElementById("toot-link-clip"),a=`https://${MASTODON_HOST}/@s/`+MASTODON_POST_ID;i&&(i.href=a),r&&(r.innerText=a);let e=await(await fetch(t)).json();n&&(e=e.descendants);i=document.getElementById("mastodon-comments-header");return i&&(i.style.display=""),renderMastodonContent(e,o,n)}});const isOSLight=window.matchMedia("(prefers-color-scheme: light)").matches,localTheme=window.localStorage&&window.localStorage.getItem("lightTheme"),themeToggle=document.querySelector(".theme-toggle");function changeFavicon(){var e=document.documentElement.classList.contains("dark-theme")?"/assets/images/favicon-dark.png":"/assets/images/favicon.png",t=document.createElement("link"),n=document.getElementById("dynamic-favicon");t.id="dynamic-favicon",t.rel="shortcut icon",t.href=e,n&&document.head.removeChild(n),document.head.appendChild(t)}function changeTheme(e){document.documentElement.classList.remove("light-theme","dark-theme","has-light-text","has-dark-text"),e?document.documentElement.classList.add("light-theme","has-dark-text"):document.documentElement.classList.add("dark-theme","has-light-text"),window.localStorage&&window.localStorage.setItem("lightTheme",e?"light":"dark"),changeFavicon()}themeToggle.addEventListener("click",()=>{changeTheme(document.documentElement.classList.contains("dark-theme"))}),"light"===localTheme?changeTheme(!0):changeTheme(isOSLight);
2023-09-15 10:47:56 +01:00
//# sourceMappingURL=source.js.map