-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update(exampleSite): resources folder
- Loading branch information
Showing
8 changed files
with
263 additions
and
2 deletions.
There are no files selected for viewing
92 changes: 92 additions & 0 deletions
92
...pleSite/resources/_gen/assets/js/js/dark-mode.js_0202b11e540a19f0daeb3e64997a3995.content
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// Note: Original code from https://derekkedziora.com/blog/dark-mode | ||
|
||
|
||
|
||
|
||
const userPrefers = getComputedStyle(document.documentElement).getPropertyValue('content'); | ||
|
||
if (theme === "dark") { | ||
document.getElementById("theme-toggle").innerHTML = "🌙"; | ||
|
||
var els = [].slice.apply(document.getElementsByClassName("chroma")); | ||
for (var i = 0; i < els.length; i++) { | ||
els[i].className = els[i].className.replace(/ *\bchroma\b/g, "chroma-dark"); | ||
} | ||
} else if (theme === "light") { | ||
document.getElementById("theme-toggle").innerHTML = "🌞"; | ||
|
||
var els = [].slice.apply(document.getElementsByClassName("chroma-dark")); | ||
for (var i = 0; i < els.length; i++) { | ||
els[i].className = els[i].className.replace(/ *\bchroma-dark\b/g, "chroma"); | ||
} | ||
} else if (userPrefers === "dark") { | ||
document.documentElement.setAttribute('data-theme', 'dark'); | ||
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#000'); | ||
window.localStorage.setItem('theme', 'dark'); | ||
document.getElementById("theme-toggle").innerHTML = "🌙"; | ||
|
||
var els = [].slice.apply(document.getElementsByClassName("chroma")); | ||
for (var i = 0; i < els.length; i++) { | ||
els[i].className = els[i].className.replace(/ *\bchroma\b/g, "chroma-dark"); | ||
} | ||
} else if (userPrefers === "light") { | ||
document.documentElement.setAttribute('data-theme', 'light'); | ||
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#fff'); | ||
window.localStorage.setItem('theme', 'light'); | ||
document.getElementById("theme-toggle").innerHTML = "🌞"; | ||
|
||
var els = [].slice.apply(document.getElementsByClassName("chroma-dark")); | ||
for (var i = 0; i < els.length; i++) { | ||
els[i].className = els[i].className.replace(/ *\bchroma-dark\b/g, "chroma"); | ||
} | ||
} | ||
|
||
function modeSwitcher() { | ||
const currentMode = document.documentElement.getAttribute('data-theme'); | ||
if (currentMode === "dark") { | ||
document.documentElement.setAttribute('data-theme', 'light'); | ||
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#fff'); | ||
window.localStorage.setItem('theme', 'light'); | ||
document.getElementById("theme-toggle").innerHTML = "🌞"; | ||
|
||
var els = [].slice.apply(document.getElementsByClassName("chroma-dark")); | ||
for (var i = 0; i < els.length; i++) { | ||
els[i].className = els[i].className.replace(/ *\bchroma-dark\b/g, "chroma"); | ||
} | ||
} else { | ||
document.documentElement.setAttribute('data-theme', 'dark'); | ||
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#000'); | ||
window.localStorage.setItem('theme', 'dark'); | ||
document.getElementById("theme-toggle").innerHTML = "🌙"; | ||
|
||
var els = [].slice.apply(document.getElementsByClassName("chroma")); | ||
for (var i = 0; i < els.length; i++) { | ||
els[i].className = els[i].className.replace(/ *\bchroma\b/g, "chroma-dark"); | ||
} | ||
} | ||
} | ||
|
||
// Sync Across Tabs | ||
// https://codepen.io/tevko/pen/GgWYpg | ||
|
||
window.addEventListener('storage', function (event) { | ||
if (event.newValue === "dark") { | ||
document.documentElement.setAttribute('data-theme', 'dark'); | ||
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#000'); | ||
document.getElementById("theme-toggle").innerHTML = "🌙"; | ||
|
||
var els = [].slice.apply(document.getElementsByClassName("chroma")); | ||
for (var i = 0; i < els.length; i++) { | ||
els[i].className = els[i].className.replace(/ *\bchroma\b/g, "chroma-dark"); | ||
} | ||
} else { | ||
document.documentElement.setAttribute('data-theme', 'light'); | ||
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#fff'); | ||
document.getElementById("theme-toggle").innerHTML = "🌞"; | ||
|
||
var els = [].slice.apply(document.getElementsByClassName("chroma-dark")); | ||
for (var i = 0; i < els.length; i++) { | ||
els[i].className = els[i].className.replace(/ *\bchroma-dark\b/g, "chroma"); | ||
} | ||
} | ||
}); |
1 change: 1 addition & 0 deletions
1
exampleSite/resources/_gen/assets/js/js/dark-mode.js_0202b11e540a19f0daeb3e64997a3995.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"Target":"js/dark-mode-rendered.js","MediaType":"application/javascript","Data":{}} |
165 changes: 165 additions & 0 deletions
165
...leSite/resources/_gen/assets/js/zh-cn/js/meme.js_d11fe7b62c27961c87ecd0f2490357b9.content
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
;const userPrefers=getComputedStyle(document.documentElement).getPropertyValue('content');if(theme==="dark"){document.getElementById("theme-toggle").innerHTML="🌙";var els=[].slice.apply(document.getElementsByClassName("chroma"));for(var i=0;i<els.length;i++){els[i].className=els[i].className.replace(/ *\bchroma\b/g,"chroma-dark");}}else if(theme==="light"){document.getElementById("theme-toggle").innerHTML="🌞";var els=[].slice.apply(document.getElementsByClassName("chroma-dark"));for(var i=0;i<els.length;i++){els[i].className=els[i].className.replace(/ *\bchroma-dark\b/g,"chroma");}}else if(userPrefers==="dark"){document.documentElement.setAttribute('data-theme','dark');document.querySelector('meta[name="theme-color"]').setAttribute('content','#000');window.localStorage.setItem('theme','dark');document.getElementById("theme-toggle").innerHTML="🌙";var els=[].slice.apply(document.getElementsByClassName("chroma"));for(var i=0;i<els.length;i++){els[i].className=els[i].className.replace(/ *\bchroma\b/g,"chroma-dark");}}else if(userPrefers==="light"){document.documentElement.setAttribute('data-theme','light');document.querySelector('meta[name="theme-color"]').setAttribute('content','#fff');window.localStorage.setItem('theme','light');document.getElementById("theme-toggle").innerHTML="🌞";var els=[].slice.apply(document.getElementsByClassName("chroma-dark"));for(var i=0;i<els.length;i++){els[i].className=els[i].className.replace(/ *\bchroma-dark\b/g,"chroma");}} | ||
function modeSwitcher(){const currentMode=document.documentElement.getAttribute('data-theme');if(currentMode==="dark"){document.documentElement.setAttribute('data-theme','light');document.querySelector('meta[name="theme-color"]').setAttribute('content','#fff');window.localStorage.setItem('theme','light');document.getElementById("theme-toggle").innerHTML="🌞";var els=[].slice.apply(document.getElementsByClassName("chroma-dark"));for(var i=0;i<els.length;i++){els[i].className=els[i].className.replace(/ *\bchroma-dark\b/g,"chroma");}}else{document.documentElement.setAttribute('data-theme','dark');document.querySelector('meta[name="theme-color"]').setAttribute('content','#000');window.localStorage.setItem('theme','dark');document.getElementById("theme-toggle").innerHTML="🌙";var els=[].slice.apply(document.getElementsByClassName("chroma"));for(var i=0;i<els.length;i++){els[i].className=els[i].className.replace(/ *\bchroma\b/g,"chroma-dark");}}} | ||
window.addEventListener('storage',function(event){if(event.newValue==="dark"){document.documentElement.setAttribute('data-theme','dark');document.querySelector('meta[name="theme-color"]').setAttribute('content','#000');document.getElementById("theme-toggle").innerHTML="🌙";var els=[].slice.apply(document.getElementsByClassName("chroma"));for(var i=0;i<els.length;i++){els[i].className=els[i].className.replace(/ *\bchroma\b/g,"chroma-dark");}}else{document.documentElement.setAttribute('data-theme','light');document.querySelector('meta[name="theme-color"]').setAttribute('content','#fff');document.getElementById("theme-toggle").innerHTML="🌞";var els=[].slice.apply(document.getElementsByClassName("chroma-dark"));for(var i=0;i<els.length;i++){els[i].className=els[i].className.replace(/ *\bchroma-dark\b/g,"chroma");}}});;function langSwitcherOver(){document.getElementById("langs").setAttribute("style","display:block");} | ||
function langSwitcherOut(){document.getElementById("langs").setAttribute("style","display:none");};var InstantClick=function(document,location){var $ua=navigator.userAgent,$isChromeForIOS=$ua.indexOf(' CriOS/')>-1,$hasTouch='createTouch'in document,$currentLocationWithoutHash,$urlToPreload,$preloadTimer,$lastTouchTimestamp,$history={},$xhr,$url=false,$title=false,$mustRedirect=false,$body=false,$timing={},$isPreloading=false,$isWaitingForCompletion=false,$trackedAssets=[],$useWhitelist,$preloadOnMousedown,$delayBeforePreload,$eventsCallbacks={fetch:[],receive:[],wait:[],change:[]} | ||
function removeHash(url){var index=url.indexOf('#') | ||
if(index<0){return url} | ||
return url.substr(0,index)} | ||
function getLinkTarget(target){while(target&&target.nodeName!='A'){target=target.parentNode} | ||
return target} | ||
function isBlacklisted(elem){do{if(!elem.hasAttribute){break} | ||
if(elem.hasAttribute('data-instant')){return false} | ||
if(elem.hasAttribute('data-no-instant')){return true}} | ||
while(elem=elem.parentNode);return false} | ||
function isWhitelisted(elem){do{if(!elem.hasAttribute){break} | ||
if(elem.hasAttribute('data-no-instant')){return false} | ||
if(elem.hasAttribute('data-instant')){return true}} | ||
while(elem=elem.parentNode);return false} | ||
function isPreloadable(a){var domain=location.protocol+'//'+location.host | ||
if(a.target||a.hasAttribute('download')||a.href.indexOf(domain+'/')!=0||(a.href.indexOf('#')>-1&&removeHash(a.href)==$currentLocationWithoutHash)||($useWhitelist?!isWhitelisted(a):isBlacklisted(a))){return false} | ||
return true} | ||
function triggerPageEvent(eventType,arg1,arg2,arg3){var returnValue=false | ||
for(var i=0;i<$eventsCallbacks[eventType].length;i++){if(eventType=='receive'){var altered=$eventsCallbacks[eventType][i](arg1,arg2,arg3) | ||
if(altered){if('body'in altered){arg2=altered.body} | ||
if('title'in altered){arg3=altered.title} | ||
returnValue=altered}} | ||
else{$eventsCallbacks[eventType][i](arg1,arg2,arg3)}} | ||
return returnValue} | ||
function changePage(title,body,newUrl,scrollY){document.documentElement.replaceChild(body,document.body) | ||
if(newUrl){history.pushState(null,null,newUrl) | ||
var hashIndex=newUrl.indexOf('#'),hashElem=hashIndex>-1&&document.getElementById(newUrl.substr(hashIndex+1)),offset=0 | ||
if(hashElem){while(hashElem.offsetParent){offset+=hashElem.offsetTop | ||
hashElem=hashElem.offsetParent}} | ||
scrollTo(0,offset) | ||
$currentLocationWithoutHash=removeHash(newUrl)} | ||
else{scrollTo(0,scrollY)} | ||
if($isChromeForIOS&&document.title==title){document.title=title+String.fromCharCode(160)} | ||
else{document.title=title} | ||
instantanize() | ||
triggerPageEvent('change',false) | ||
var userscriptEvent=document.createEvent('HTMLEvents') | ||
userscriptEvent.initEvent('instantclick:newpage',true,true) | ||
dispatchEvent(userscriptEvent)} | ||
function setPreloadingAsHalted(){$isPreloading=false | ||
$isWaitingForCompletion=false} | ||
function removeNoscriptTags(html){return html.replace(/<noscript[\s\S]+<\/noscript>/gi,'')} | ||
function mousedown(e){if($lastTouchTimestamp>(+new Date-500)){return} | ||
var a=getLinkTarget(e.target) | ||
if(!a||!isPreloadable(a)){return} | ||
preload(a.href)} | ||
function mouseover(e){if($lastTouchTimestamp>(+new Date-500)){return} | ||
var a=getLinkTarget(e.target) | ||
if(!a||!isPreloadable(a)){return} | ||
a.addEventListener('mouseout',mouseout) | ||
if(!$delayBeforePreload){preload(a.href)} | ||
else{$urlToPreload=a.href | ||
$preloadTimer=setTimeout(preload,$delayBeforePreload)}} | ||
function touchstart(e){$lastTouchTimestamp=+new Date | ||
var a=getLinkTarget(e.target) | ||
if(!a||!isPreloadable(a)){return} | ||
if($preloadOnMousedown){a.removeEventListener('mousedown',mousedown)} | ||
else{a.removeEventListener('mouseover',mouseover)} | ||
preload(a.href)} | ||
function click(e){var a=getLinkTarget(e.target) | ||
if(!a||!isPreloadable(a)){return} | ||
if(e.which>1||e.metaKey||e.ctrlKey){return} | ||
e.preventDefault() | ||
display(a.href)} | ||
function mouseout(){if($preloadTimer){clearTimeout($preloadTimer) | ||
$preloadTimer=false | ||
return} | ||
if(!$isPreloading||$isWaitingForCompletion){return} | ||
$xhr.abort() | ||
setPreloadingAsHalted()} | ||
function readystatechange(){if($xhr.readyState<4){return} | ||
if($xhr.status==0){return} | ||
$timing.ready=+new Date-$timing.start | ||
if($xhr.getResponseHeader('Content-Type').match(/\/(x|ht|xht)ml/)){var doc=document.implementation.createHTMLDocument('') | ||
doc.documentElement.innerHTML=removeNoscriptTags($xhr.responseText) | ||
$title=doc.title | ||
$body=doc.body | ||
var alteredOnReceive=triggerPageEvent('receive',$url,$body,$title) | ||
if(alteredOnReceive){if('body'in alteredOnReceive){$body=alteredOnReceive.body} | ||
if('title'in alteredOnReceive){$title=alteredOnReceive.title}} | ||
var urlWithoutHash=removeHash($url) | ||
$history[urlWithoutHash]={body:$body,title:$title,scrollY:urlWithoutHash in $history?$history[urlWithoutHash].scrollY:0} | ||
var elems=doc.head.children,found=0,elem,data | ||
for(var i=elems.length-1;i>=0;i--){elem=elems[i] | ||
if(elem.hasAttribute('data-instant-track')){data=elem.getAttribute('href')||elem.getAttribute('src')||elem.innerHTML | ||
for(var j=$trackedAssets.length-1;j>=0;j--){if($trackedAssets[j]==data){found++}}}} | ||
if(found!=$trackedAssets.length){$mustRedirect=true}} | ||
else{$mustRedirect=true} | ||
if($isWaitingForCompletion){$isWaitingForCompletion=false | ||
display($url)}} | ||
function instantanize(isInitializing){document.body.addEventListener('touchstart',touchstart,true) | ||
if($preloadOnMousedown){document.body.addEventListener('mousedown',mousedown,true)} | ||
else{document.body.addEventListener('mouseover',mouseover,true)} | ||
document.body.addEventListener('click',click,true) | ||
if(!isInitializing){var scripts=document.body.getElementsByTagName('script'),script,copy,parentNode,nextSibling | ||
for(i=0,j=scripts.length;i<j;i++){script=scripts[i] | ||
if(script.hasAttribute('data-no-instant')){continue} | ||
copy=document.createElement('script') | ||
if(script.src){copy.src=script.src} | ||
if(script.innerHTML){copy.innerHTML=script.innerHTML} | ||
parentNode=script.parentNode | ||
nextSibling=script.nextSibling | ||
parentNode.removeChild(script) | ||
parentNode.insertBefore(copy,nextSibling)}}} | ||
function preload(url){if(!$preloadOnMousedown&&'display'in $timing&&+new Date-($timing.start+$timing.display)<100){return} | ||
if($preloadTimer){clearTimeout($preloadTimer) | ||
$preloadTimer=false} | ||
if(!url){url=$urlToPreload} | ||
if($isPreloading&&(url==$url||$isWaitingForCompletion)){return} | ||
$isPreloading=true | ||
$isWaitingForCompletion=false | ||
$url=url | ||
$body=false | ||
$mustRedirect=false | ||
$timing={start:+new Date} | ||
triggerPageEvent('fetch') | ||
$xhr.open('GET',url) | ||
$xhr.send()} | ||
function display(url){if(!('display'in $timing)){$timing.display=+new Date-$timing.start} | ||
if($preloadTimer||!$isPreloading){if($preloadTimer&&$url&&$url!=url){location.href=url | ||
return} | ||
preload(url) | ||
triggerPageEvent('wait') | ||
$isWaitingForCompletion=true | ||
return} | ||
if($isWaitingForCompletion){location.href=url | ||
return} | ||
if($mustRedirect){location.href=$url | ||
return} | ||
if(!$body){triggerPageEvent('wait') | ||
$isWaitingForCompletion=true | ||
return} | ||
$history[$currentLocationWithoutHash].scrollY=pageYOffset | ||
setPreloadingAsHalted() | ||
changePage($title,$body,$url)} | ||
var supported='pushState'in history&&(!$ua.match('Android')||$ua.match('Chrome/'))&&location.protocol!="file:" | ||
function init(){if($currentLocationWithoutHash){return} | ||
if(!supported){triggerPageEvent('change',true) | ||
return} | ||
for(var i=arguments.length-1;i>=0;i--){var arg=arguments[i] | ||
if(arg===true){$useWhitelist=true} | ||
else if(arg=='mousedown'){$preloadOnMousedown=true} | ||
else if(typeof arg=='number'){$delayBeforePreload=arg}} | ||
$currentLocationWithoutHash=removeHash(location.href) | ||
$history[$currentLocationWithoutHash]={body:document.body,title:document.title,scrollY:pageYOffset} | ||
var elems=document.head.children,elem,data | ||
for(var i=elems.length-1;i>=0;i--){elem=elems[i] | ||
if(elem.hasAttribute('data-instant-track')){data=elem.getAttribute('href')||elem.getAttribute('src')||elem.innerHTML | ||
$trackedAssets.push(data)}} | ||
$xhr=new XMLHttpRequest() | ||
$xhr.addEventListener('readystatechange',readystatechange) | ||
instantanize(true) | ||
triggerPageEvent('change',true) | ||
addEventListener('popstate',function(){var loc=removeHash(location.href) | ||
if(loc==$currentLocationWithoutHash){return} | ||
if(!(loc in $history)){location.href=location.href | ||
return} | ||
$history[$currentLocationWithoutHash].scrollY=pageYOffset | ||
$currentLocationWithoutHash=loc | ||
changePage($history[loc].title,$history[loc].body,false,$history[loc].scrollY)})} | ||
function on(eventType,callback){$eventsCallbacks[eventType].push(callback)} | ||
return{supported:supported,init:init,on:on}}(document,location);; |
1 change: 1 addition & 0 deletions
1
exampleSite/resources/_gen/assets/js/zh-cn/js/meme.js_d11fe7b62c27961c87ecd0f2490357b9.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"Target":"zh-cn/js/meme.min.eefa9a8e98d101fc20befb995da6164f8dd7692c4e2bdbe59ad1fb9b3c3b2e9c.js","MediaType":"application/javascript","Data":{"Integrity":"sha256-7vqajpjRAfwgvvuZXaYWT43XaSxOK9vlmtH7mzw7Lpw="}} |
2 changes: 1 addition & 1 deletion
2
...leSite/resources/_gen/assets/scss/scss/main.scss_51b7f6e4c11d97bc4393cbedf672f7fb.content
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
exampleSite/resources/_gen/assets/scss/scss/main.scss_51b7f6e4c11d97bc4393cbedf672f7fb.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"Target":"css/meme.560124716fe30a2e5ac32a481bfe04e147cc52f86a0f990dd9f408e13a7d11d6.css","MediaType":"text/css","Data":{"Integrity":"sha256-VgEkcW/jCi5awypIG/4E4UfMUvhqD5kN2fQI4Tp9EdY="}} | ||
{"Target":"css/meme.7a33e428bea8910767b090f712fc97486282e03eb12d13044a664749408fa6b3.css","MediaType":"text/css","Data":{"Integrity":"sha256-ejPkKL6okQdnsJD3EvyXSGKC4D6xLRMESmZHSUCPprM="}} |
1 change: 1 addition & 0 deletions
1
...leSite/resources/_gen/assets/scss/scss/main.scss_be96cf40b83da67686753f877d1da77a.content
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
exampleSite/resources/_gen/assets/scss/scss/main.scss_be96cf40b83da67686753f877d1da77a.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"Target":"zh-cn/css/meme.08154c23d7281cb0ceb980023898dfc313d1ae7256a28702d6d4760e27fdd221.css","MediaType":"text/css","Data":{"Integrity":"sha256-CBVMI9coHLDOuYACOJjfwxPRrnJWoocC1tR2Dif90iE="}} |