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

29 lines
108 KiB
JavaScript
Raw Normal View History

!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=function(e,t){e=this._events&&this._events[e];if(e&&e.length)return-1!=(t=e.indexOf(t))&&e.splice(t,1),this},t.emitEvent=function(e,t){var n=this._events&&this._events[e];if(n&&n.length){n=n.slice(0),t=t||[];for(var i=this._onceEvents&&this._onceEvents[e],o=0;o<n.length;o++){var r=n[o];i&&i[r]&&(this.off(e,r),delete i[r]),r.apply(this,t)}return this}},t.allOff=function(){delete this._events,delete this._onceEvents},e}),function(t,n){"use strict";"function"==typeof define&&define.amd?define(["ev-emitter/ev-emitter"],function(e){return n(t,e)}):"object"==typeof module&&module.exports?module.exports=n(t,require("ev-emitter")):t.imagesLoaded=n(t,t.EvEmitter)}("undefined"!=typeof window?window:this,function(t,e){function r(e,t){for(var n in t)e[n]=t[n];return e}function a(e,t,n){var i,o;return this instanceof a?(i="string"==typeof(i=e)?document.querySelectorAll(e):i)?(this.elements=(o=i,Array.isArray(o)?o:"object"==typeof o&&"number"==typeof o.length?c.call(o):[o]),this.options=r({},this.options),"function"==typeof t?n=t:r(this.options,t),n&&this.on("always",n),this.getImages(),s&&(this.jqDeferred=new s.Deferred),void setTimeout(this.check.bind(this))):void l.error("Bad element for imagesLoaded "+(i||e)):new a(e,t,n)}function n(e){this.img=e}function i(e,t){this.url=e,this.element=t,this.img=new Image}var s=t.jQuery,l=t.console,c=Array.prototype.slice,u=((a.prototype=Object.create(e.prototype)).options={},a.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},a.prototype.addElementImages=function(e){"IMG"==e.nodeName&&this.addImage(e),!0===this.options.background&&this.addElementBackgroundImages(e);var t=e.nodeType;if(t&&u[t]){for(var n=e.querySelectorAll("img"),i=0;i<n.length;i++){var o=n[i];this.addImage(o)}if("string"==typeof this.options.background)for(var r=e.querySelectorAll(this.options.background),i=0;i<r.length;i++){var a=r[i];this.addElementBackgroundImages(a)}}},{1:!0,9:!0,11:!0});return a.prototype.addElementBackgroundImages=function(e){var t=getComputedStyle(e);if(t)for(var n=/url\((['"])?(.*?)\1\)/gi,i=n.exec(t.backgroundImage);null!==i;){var o=i&&i[2];o&&this.addBackground(o,e),i=n.exec(t.backgroundImage)}},a.prototype.addImage=function(e){e=new n(e);this.images.push(e)},a.prototype.addBackground=function(e,t){e=new i(e,t);this.images.push(e)},a.prototype.check=function(){function t(e,t,n){setTimeout(function(){i.progress(e,t,n)})}var i=this;return this.progressedCount=0,this.hasAnyBroken=!1,this.images.length?void this.images.forEach(function(e){e.once("progress",t),e.check()}):void this.complete()},a.prototype.progress=function(e,t,n){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded,this.emitEvent("progress",[this,e,t]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,e),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&l&&l.log("progress: "+n,e,t)},a.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0,this.emitEvent(e,[this]),this.emitEvent("always",[this]),this.jqDeferred&&(e=this.hasAnyBroken?"reject":"resolve",this.jqDeferred[e](this))},(n.prototype=Object.create(e.prototype)).check=function(){return this.getIsImageComplete()?void this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),void(this.proxyImage.src=this.img.src))},n.prototype.getIsImageComplete=function(){ret
2023-10-17 10:17:37 +01:00
<div class="mastodon-avatar">
<img src="${escapeHtml(o.account.avatar_static)}" height=60 width=60 alt="${escapeHtml(o.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">
<a href="${o.account.url}" target="_blank" rel="nofollow">
<span>${o.account.display_name}</span>
2023-10-17 10:17:37 +01:00
</a>
<br/>
<span class="mastodon-author-uid">(@${escapeHtml("s"===o.account.acct?"s@sd.ai":o.account.acct)})</span>
2023-10-17 10:17:37 +01:00
</div>
</div>
<div class="toot-link">
<a class="date" href="${o.uri}" rel="nofollow" target="_blank">
${o.created_at.substring(0,10)}
2023-10-17 10:17:37 +01:00
</a>
<br/>
</div>
</div>
<div class="mastodon-comment-content">
${o.content}
<span class="tootlink" ${n?"":'style="display: none;"'}>${o.uri}</span>
2023-10-17 10:17:37 +01:00
</div>
</div>
</div>`,i=DOMPurify.sanitize(i,{RETURN_DOM_FRAGMENT:!0});for(const r of i.querySelectorAll(".tootlink"))r.onclick=function(){return copyElementTextToClipboard(this)};t.appendChild(i)}}else document.getElementById("mastodon-comments-list").innerHTML="<div class='mastodon-comment'>No comments (yet)!</div>"}let MASTODON_POST_ID;function pagination(e=!0,s,l=!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"),i=n.querySelectorAll(".gh-feed:not(.gh-featured):not(.gh-related) > *");const r=document.createDocumentFragment(),a=[];i.forEach(function(e){e=document.importNode(e,!0);l&&(e.style.visibility="hidden"),r.appendChild(e),a.push(e)}),c.appendChild(r),s&&s(a,d);var o=n.querySelector("link[rel=next]");o&&o.href?t.href=o.href:(t.remove(),u&&u.remove())}catch(e){throw t.remove(),e}}const i=c.nextElementSibling||document.querySelector(".gh-footer"),u=document.querySelector(".gh-loadmore"),d=(!document.querySelector("link[rel=next]")&&u&&u.remove(),async function(){i.getBoundingClientRect().top<=window.innerHeight&&document.querySelector("link[rel=next]")&&await n()});const o=new IntersectionObserver(async function(e){if(!t){if(t=!0,e[0].isIntersecting)if(l)await n();else for(;i.getBoundingClientRect().top<=window.innerHeight&&document.querySelector("link[rel=next]");)await n();t=!1,document.querySelector("link[rel=next]")||o.disconnect()}});e?o.observe(i):u.addEventListener("click",n)}document.addEventListener("DOMContentLoaded",async e=>{let t,n;var i=/bot|google|baidu|bing|msn|teoma|slurp|yandex/i.test(navigator.userAgent),i=(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&&!i&&(t=`https://${MASTODON_HOST}/api/v1/statuses/${MASTODON_POST_ID}/context`,n=!0),document.getElementById("mastodon-comments-list"));if(t&&i){var o=document.getElementById("toot-link-top"),r=document.getElementById("toot-link-clip"),a=`https://${MASTODON_HOST}/@s/`+MASTODON_POST_ID;o&&(o.href=a),r&&(r.innerText=a);let e=await(await fetch(t)).json();n&&(e=e.descendants);o=document.getElementById("mastodon-comments-header");return o&&(o.style.display=""),renderMastodonContent(e,i,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