Add favicon

This commit is contained in:
simon committed 2023-10-17 14:59:28 +01:00
1 parent 346f3de193
commit 74e9f9feaf
5 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -25,5 +25,5 @@ function dropdown(){const o=window.matchMedia("(max-width: 767px)"),i=document.q
<span class="tootlink" ${n?"":'style="display: none;"'}>${i.uri}</span> <span class="tootlink" ${n?"":'style="display: none;"'}>${i.uri}</span>
</div> </div>
</div> </div>
</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")?"/img/favicon-dark.png":"/img/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); </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);
//# sourceMappingURL=source.js.map //# sourceMappingURL=source.js.map
+1 -1
View File
@@ -1 +1 @@
{"version":3,"sources":["dropdown.js","lightbox.js","imagesloaded.pkgd.min.js","photoswipe-ui-default.min.js","photoswipe.min.js","purify.min.js","reframe.min.js","casper.js","mastodon.js","pagination.js","theme.js"],"names":["dropdown","mediaQuery","window","matchMedia","head","document","querySelector","menu","nav","logo","navHTML","innerHTML","matches","querySelectorAll","forEach","item","index","style","transitionDelay","makeDropdown","submenuItems","offsetWidth","lastElementChild","unshift","remove","length","toggle","createElement","wrapper","setAttribute","classList","add","gridTemplateRows","Math","ceil","child","appendChild","addEventListener","e","contains","target","imagesLoaded","setTimeout","lightbox","trigger","trig","onThumbnailsClick","preventDefault","reachedCurrentItem","items","prevSibling","closest","previousElementSibling","prevItems","push","src","getAttribute","msrc","w","h","el","concat","nextSibling","nextElementSibling","pswpElement","PhotoSwipe","PhotoSwipeUI_Default","bgOpacity","closeOnScroll","fullscreenEl","history","shareEl","zoomEl","getThumbBoundsFn","thumbnail","pageYScroll","pageYOffset","documentElement","scrollTop","rect","getBoundingClientRect","x","left","y","top","width","init","t","define","amd","module","exports","EvEmitter","this","prototype","on","n","i","_events","indexOf","once","_onceEvents","off","splice","emitEvent","slice","o","r","apply","allOff","require","s","elements","Array","isArray","d","call","options","getImages","jqDeferred","Deferred","check","bind","a","error","img","url","element","Image","jQuery","console","u","Object","create","images","addElementImages","nodeName","addImage","background","addElementBackgroundImages","nodeType","1","9","11","getComputedStyle","exec","backgroundImage","addBackground","progress","progressedCount","hasAnyBroken","complete","isLoaded","notify","debug","log","isComplete","getIsImageComplete","confirm","naturalWidth","proxyImage","handleEvent","type","onload","unbindEvents","onerror","removeEventListener","makeJQueryPlugin","fn","promise","b","A","event","q","timeToIdle","mouseUsed","k","K","c","f","srcElement","g","S","onTap","name","stopPropagation","features","isOldAndroid","D","getNumItemsFn","p","C","E","F","removeClass","addClass","H","shareButtons","getImageURLForShare","getPageURLForShare","getTextForShare","replace","encodeURIComponent","id","download","label","parseShareButtonOut","children","onclick","G","I","closeElClasses","hasClass","clearTimeout","J","v","setIdle","L","relatedTarget","toElement","timeToIdleOutside","O","m","P","vGap","likelyTouchDevice","screen","fitControlsWidth","barsSize","captionEl","bottom","createEl","insertBefore","addCaptionHTMLFn","clientHeight","parseInt","T","className","option","onInit","getChildByClass","j","l","z","loadingIndicatorDelay","title","closeEl","counterEl","arrowEl","preloaderEl","tapToClose","tapToToggleControls","clickToCloseNonZoomable","currItem","location","href","indexIndicatorSep","shout","hasAttribute","open","round","toggleDesktopZoom","close","prev","next","isFullscreen","exit","enter","extend","scrollWrap","listen","hideControls","showControls","update","initialZoomLevel","getZoomLevel","zoomTo","getDoubleTapZoom","test","tagName","prevent","onGlobalTap","onMouseOver","clearInterval","unbind","eventK","updateFullscreen","hideAnimationDuration","removeChild","showAnimationDuration","setInterval","getFullscreenAPI","template","loading","allowProgressiveImg","updateIndexIndicator","setScrollOffset","getScrollY","getCurrentIndex","detail","pointerType","fitRatio","releasePoint","supportsFullscreen","exitFullscreen","mozCancelFullScreen","webkitExitFullscreen","msExitFullscreen","requestFullscreen","enterK","exitK","elementK","mozRequestFullScreen","webkitRequestFullscreen","msRequestFullscreen","Element","ALLOW_KEYBOARD_INPUT","split","RegExp","firstChild","arraySearch","hasOwnProperty","easing","sine","out","sin","PI","inOut","cos","cubic","detectFeatures","oldIE","all","touch","requestAnimationFrame","raf","caf","cancelAnimationFrame","pointerEvent","PointerEvent","navigator","msPointerEnabled","userAgent","platform","appVersion","match","isOldIOSPhone","parseFloat","androidVersion","isMobileOpera","charAt","toUpperCase","toLowerCase","Date","getTime","max","svg","createElementNS","createSVGRect","allowPanToNext","spacing","loop","pinchToClose","closeOnVerticalDrag","verticalDragRange","showHideOpacity","focus","escKey","arrowKeys","mainScrollEndFriction","panEndFriction","isClickableElement","maxSpreadZoom","modal","scaleMode","ma","za","publicMethods","wa","Aa","ac","Ca","Ba","Va","initialPosition","La","min","Xa","keyCode","ctrlKey","altKey","shiftKey","metaKey","returnValue","Ya","Y","X","fa","Za","Ob","button","$b","U","Eb","Da","mb","pointerId","pageX","pageY","Mb","_","cb","V","ha","ka","ia","$","W","ga","Ma","oa","pa","na","kb","lb","nb","ta","ra","ob","Q","Ea","Sa","zb","Ab","aa","hb","ib","Gb","vb","ub","abs","ca","yb","Pb","tb","gb","Rb",Line truncated {"version":3,"sources":["dropdown.js","lightbox.js","imagesloaded.pkgd.min.js","photoswipe-ui-default.min.js","photoswipe.min.js","purify.min.js","reframe.min.js","casper.js","mastodon.js","pagination.js","theme.js"],"names":["dropdown","mediaQuery","window","matchMedia","head","document","querySelector","menu","nav","logo","navHTML","innerHTML","matches","querySelectorAll","forEach","item","index","style","transitionDelay","makeDropdown","submenuItems","offsetWidth","lastElementChild","unshift","remove","length","toggle","createElement","wrapper","setAttribute","classList","add","gridTemplateRows","Math","ceil","child","appendChild","addEventListener","e","contains","target","imagesLoaded","setTimeout","lightbox","trigger","trig","onThumbnailsClick","preventDefault","reachedCurrentItem","items","prevSibling","closest","previousElementSibling","prevItems","push","src","getAttribute","msrc","w","h","el","concat","nextSibling","nextElementSibling","pswpElement","PhotoSwipe","PhotoSwipeUI_Default","bgOpacity","closeOnScroll","fullscreenEl","history","shareEl","zoomEl","getThumbBoundsFn","thumbnail","pageYScroll","pageYOffset","documentElement","scrollTop","rect","getBoundingClientRect","x","left","y","top","width","init","t","define","amd","module","exports","EvEmitter","this","prototype","on","n","i","_events","indexOf","once","_onceEvents","off","splice","emitEvent","slice","o","r","apply","allOff","require","s","elements","Array","isArray","d","call","options","getImages","jqDeferred","Deferred","check","bind","a","error","img","url","element","Image","jQuery","console","u","Object","create","images","addElementImages","nodeName","addImage","background","addElementBackgroundImages","nodeType","1","9","11","getComputedStyle","exec","backgroundImage","addBackground","progress","progressedCount","hasAnyBroken","complete","isLoaded","notify","debug","log","isComplete","getIsImageComplete","confirm","naturalWidth","proxyImage","handleEvent","type","onload","unbindEvents","onerror","removeEventListener","makeJQueryPlugin","fn","promise","b","A","event","q","timeToIdle","mouseUsed","k","K","c","f","srcElement","g","S","onTap","name","stopPropagation","features","isOldAndroid","D","getNumItemsFn","p","C","E","F","removeClass","addClass","H","shareButtons","getImageURLForShare","getPageURLForShare","getTextForShare","replace","encodeURIComponent","id","download","label","parseShareButtonOut","children","onclick","G","I","closeElClasses","hasClass","clearTimeout","J","v","setIdle","L","relatedTarget","toElement","timeToIdleOutside","O","m","P","vGap","likelyTouchDevice","screen","fitControlsWidth","barsSize","captionEl","bottom","createEl","insertBefore","addCaptionHTMLFn","clientHeight","parseInt","T","className","option","onInit","getChildByClass","j","l","z","loadingIndicatorDelay","title","closeEl","counterEl","arrowEl","preloaderEl","tapToClose","tapToToggleControls","clickToCloseNonZoomable","currItem","location","href","indexIndicatorSep","shout","hasAttribute","open","round","toggleDesktopZoom","close","prev","next","isFullscreen","exit","enter","extend","scrollWrap","listen","hideControls","showControls","update","initialZoomLevel","getZoomLevel","zoomTo","getDoubleTapZoom","test","tagName","prevent","onGlobalTap","onMouseOver","clearInterval","unbind","eventK","updateFullscreen","hideAnimationDuration","removeChild","showAnimationDuration","setInterval","getFullscreenAPI","template","loading","allowProgressiveImg","updateIndexIndicator","setScrollOffset","getScrollY","getCurrentIndex","detail","pointerType","fitRatio","releasePoint","supportsFullscreen","exitFullscreen","mozCancelFullScreen","webkitExitFullscreen","msExitFullscreen","requestFullscreen","enterK","exitK","elementK","mozRequestFullScreen","webkitRequestFullscreen","msRequestFullscreen","Element","ALLOW_KEYBOARD_INPUT","split","RegExp","firstChild","arraySearch","hasOwnProperty","easing","sine","out","sin","PI","inOut","cos","cubic","detectFeatures","oldIE","all","touch","requestAnimationFrame","raf","caf","cancelAnimationFrame","pointerEvent","PointerEvent","navigator","msPointerEnabled","userAgent","platform","appVersion","match","isOldIOSPhone","parseFloat","androidVersion","isMobileOpera","charAt","toUpperCase","toLowerCase","Date","getTime","max","svg","createElementNS","createSVGRect","allowPanToNext","spacing","loop","pinchToClose","closeOnVerticalDrag","verticalDragRange","showHideOpacity","focus","escKey","arrowKeys","mainScrollEndFriction","panEndFriction","isClickableElement","maxSpreadZoom","modal","scaleMode","ma","za","publicMethods","wa","Aa","ac","Ca","Ba","Va","initialPosition","La","min","Xa","keyCode","ctrlKey","altKey","shiftKey","metaKey","returnValue","Ya","Y","X","fa","Za","Ob","button","$b","U","Eb","Da","mb","pointerId","pageX","pageY","Mb","_","cb","V","ha","ka","ia","$","W","ga","Ma","oa","pa","na","kb","lb","nb","ta","ra","ob","Q","Ea","Sa","zb","Ab","aa","hb","ib","Gb","vb","ub","abs","ca","yb","Pb","tb","gb","Rb",Line truncated
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

+1 -1
View File
@@ -5,7 +5,7 @@ const localTheme = window.localStorage && window.localStorage.getItem("lightThem
const themeToggle = document.querySelector(".theme-toggle") const themeToggle = document.querySelector(".theme-toggle")
function changeFavicon() { function changeFavicon() {
const src = document.documentElement.classList.contains("dark-theme") ? "/img/favicon-dark.png" : "/img/favicon.png"; const src = document.documentElement.classList.contains("dark-theme") ? "/assets/images/favicon-dark.png" : "/assets/images/favicon.png";
const link = document.createElement('link'), const link = document.createElement('link'),
oldLink = document.getElementById('dynamic-favicon'); oldLink = document.getElementById('dynamic-favicon');
link.id = 'dynamic-favicon'; link.id = 'dynamic-favicon';