2019-11-28 07:20:36 +07:00
|
|
|
!function(){function e(e){if("light"==e)var t=r.button.on;else t=r.button.off;document.querySelector("html").setAttribute("data-theme",e),document.querySelector(r.selector).innerHTML=t,document.querySelector(r.selector).setAttribute("aria-label",t.replace(/<[^>]*>?/gm,"")),r.currentTheme=e}var t,r={button:{element:"BUTTON",class:"secondary switcher",on:"<i>Turn on dark mode</i>",off:"<i>Turn off dark mode</i>"},target:"main",selector:"button.switcher",currentTheme:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"};(t=document.createElement(r.button.element)).className=r.button.class,document.querySelector(r.target).after(t),e(r.currentTheme),document.querySelector(r.selector).addEventListener("click",function(){"light"==r.currentTheme?e("dark"):e("light")},!1)}(),function(){function r(e){event.preventDefault();var t,r,a=e.href.split("#");a=function(e){mobile=window.matchMedia("(max-width: 991.99px)"),mobile.matches||"docs"==e&&(e="start");return e}(a[1]),a=document.getElementById(a),r=a,t=Math.floor(r.getBoundingClientRect().top),window.scrollBy({top:t,left:0,behavior:"smooth"})}!function(e){for(var t=0;t<e.length;t++)-1!=e[t].href.indexOf("#")&&e[t].addEventListener("click",function(e){r(e.target)},!1)}(document.querySelectorAll('a:not([href^="https://picocss.com"])'))}(),function(){function e(e){for(var t="",r="",a=0;a<e;a++)t+="<div>"+(a+1)+"</div>",r+=" <<b>div</b>>"+(a+1)+"</<b>div</b>>\n";document.querySelector(f.targetGrid).innerHTML=t,document.querySelector(f.targetCode).innerHTML='<<b>section</b> <i>class</i>=<u>"grid"</u>>\n'+r+"</<b>section</b>>"}var t,f={columnsCurrent:4,columnsMin:1,columnsMax:12,targetButtons:"#grids article",targetGrid:"#grids .grid",targetCode:"#grids pre code",selectorAdd:"#grids button.add",selectorRemove:"#grids button.remove"};(t=document.createElement("P")).innerHTML='<button class="secondary add"><svg xmlns="http://www.w3.org/2000/svg" height="1rem" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg> Add column</button><button class="secondary remove"><svg xmlns="http://www.w3.org/2000/svg" height="1rem" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="12" x2="19" y2="12"></line></svg> Remove column</button>',document.querySelector(f.targetButtons).before(t),document.querySelector(f.selectorAdd).addEventListener("click",function(){f.columnsCurrent<f.columnsMax&&(f.columnsCurrent++,e(f.columnsCurrent))},!1),document.querySelector(f.selectorRemove).addEventListener("click",function(){f.columnsCurrent>f.columnsMin&&(f.columnsCurrent--,e(f.columnsCurrent))},!1)}(),function(){function d(e,t){!function(e,t){for(var r=document.querySelectorAll(m.selectorTheme+" .name"),a=0;a<r.length;++a)r[a].innerHTML=e.charAt(0).toUpperCase()+e.substring(1)+" ";for(var f=document.querySelectorAll(m.selectorTheme+" .c500"),a=0;a<f.length;++a)f[a].innerHTML=t[500];for(var o=document.querySelectorAll(m.selectorTheme+" .c600"),a=0;a<o.length;++a)o[a].innerHTML=t[600];for(var n=document.querySelectorAll(m.selectorTheme+" .c700"),a=0;a<n.length;++a)n[a].innerHTML=t[700];for(var c=document.querySelectorAll(m.selectorTheme+" .c600-outline-light"),a=0;a<c.length;++a)c[a].innerHTML=b(t[600],.125);for(var d=document.querySelectorAll(m.selectorTheme+" .c600-outline-dark"),a=0;a<d.length;++a)d[a].innerHTML=b(t[600],.25);for(var l=document.querySelectorAll(m.selectorTheme+" .inverse"),a=0;a<l.length;++a)l[a].innerHTML=t.inverse;var i='[data-theme="generated"] {--primary:'+t[600]+";--h4:"+t[700]+";--primary-hover:"+t[700]+";--primary-focus:"+b(t[600],.125)+";--primary-inverse:"+t.inverse+';}@media only screen and (prefers-color-scheme: dark) {:root:not([data-theme="light"]) [data-theme="generated"] {--primary:'+t[600]+";--h4:"+t[400]+";--primary-hover:"+t[500]+";--primary-focus:"+b(t[600],.25)+";--primary-inverse:"+t.inverse+';}
|