css
This commit is contained in:
parent
71bdad70c7
commit
7e835a72d6
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
|||
const IssuesAPI={requestIssuesAPI(s,e,t){let i=10;!function n(){return new Promise(((a,o)=>{let r=0,l=setTimeout((()=>{0===r&&(r=2,l=null,o("请求超时"),0==i&&t())}),5e3);fetch(s).then((function(s){if(2!==r&&(clearTimeout(l),a(s),l=null,r=1),s.ok)return s.json();throw new Error("Network response was not ok.")})).then((function(s){i=0,e(s)})).catch((function(s){i>0?(i-=1,setTimeout((()=>{n()}),5e3)):t()}))}))}()},parseIssueStrToJson(s){let e=s.match(/```json[\s|\S]*```/);if(e&&e.length>0&&(e=e[0]),e&&(e=e.split("```json")[1].split("```")[0],e))return JSON.parse(e)},groupIssuesData(s,e){var t=new Object;if(e.length>0)if(null!=s.group){const a=s.group.split("=");if(a.length>1){const o=a[0];let r=a[1];for(o&&r&&(r=r.split(",")),s.group=r,i=0;i<e.length;i++){const s=this.parseIssueStrToJson(e[i].body);if(s&&o in s){let e=s[o];e=e.replace(", ",",").split(",");for(var n=0;n<e.length;n++)if(r.includes(e[n])){let i=t[e[n]];null==i&&(i=new Array),i.push(s),t[e[n]]=i}}}}}else for(s.group=[""],i=0;i<e.length;i++){const s=this.parseIssueStrToJson(e[i].body);if(s){let e=t[""];null==e&&(e=new Array),e.push(s),t[""]=e}}return t},getIssuesAPIForSites(s){const e=$(s.el)[0];$(e).append('<div class="loading"><i class="fa fa-cog fa-2x fa-spin"></i><p>正在加载</p></div>'),this.requestIssuesAPI(s.api,(function(t){$(e).find(".loading").remove();const i=IssuesAPI.groupIssuesData(s,t),n=Object.keys(i);s.group.forEach(((s,t)=>{const a=i[s];if(a&&a.length>0)for(s.length>0?$(e).append("<h2>"+s+"</h2>"):""==name&&n.length>1&&$(e).append("<h2>未分组</h2>"),$(e).append('<div class="site-card-group '+t+'"></div>'),j=0;j<a.length;j++){const s=a[j];let i="";i=s.screenshot&&s.screenshot.length>0?'<div class="img"><img src="'+s.screenshot+'" onerror="javascript:this.src=\'https://image.thum.io/get/width/1024/crop/768/'+s.url+"';\"/></div>":'<div class="img"></div>';let n='<div class="info">';s.avatar&&s.avatar.length>0&&(n+='<img src="'+s.avatar+'" onerror="javascript:this.src=\'https://image.thum.io/get/width/1024/crop/768/'+s.url+"';\"/>"),n+='<span class="title">'+s.title+'</span><span class="desc">'+s.description+"</span></div>";const o="<div><a class='site-card' target='_blank' href='"+s.url+"'>"+i+n+"</a></div>";$(e).find(".site-card-group."+t).append(o)}}))}),(function(){$(e).find(".loading i").remove(),$(e).find(".loading p").text("加载失败,请稍后重试。")}))},getIssuesAPIForTimeline(s){const e=$(s.el)[0];$(e).append('<div class="loading"><i class="fa fa-cog fa-2x fa-spin"></i><p>正在加载</p></div>'),this.requestIssuesAPI(s.api,(function(s){if($(e).find(".loading").remove(),s.length>0)for(i=0;i<s.length;i++){const t=' <a class="comments" target="_blank" href="'+s[i].html_url+'"><i class="fa fa-comment-dots fa-fw"></i>'+s[i].comments+"</a>",n='<div class="timenode">'+('<div class="header"><p></p><p>'+s[i].title+t+"</p><p></p></div>")+('<div class="body"><p>'+s[i].body+"</p></div>")+"</div>";$(e).append(n)}}),(function(){$(e).find(".loading i").remove(),$(e).find(".loading p").text("加载失败,请稍后重试。")}))},request(){const s=document.getElementsByClassName("issues-wrap");for(var e=0;e<s.length;e++){const i=s[e],n=i.getAttribute("api"),a=i.getAttribute("group");var t=new Object;t.class=i.getAttribute("class"),t.el=i,t.api=n,t.group=a,t.class.split(" ").includes("sites")?this.getIssuesAPIForSites(t):t.class.split(" ").includes("timeline")&&this.getIssuesAPIForTimeline(t)}}};$((function(){IssuesAPI.request()}));
|
|
@ -1 +0,0 @@
|
|||
const util={diffDate:(e,t=!1)=>{const l=new Date,a=new Date(e),i=l.getTime()-a.getTime(),n=36e5,s=24*n;let r;if(t){const e=i/2592e6,t=i/s,l=i/n,a=i/6e4;r=e>12?null:e>=1?parseInt(e)+" "+stellar.config.date_suffix.month:t>=1?parseInt(t)+" "+stellar.config.date_suffix.day:l>=1?parseInt(l)+" "+stellar.config.date_suffix.hour:a>=1?parseInt(a)+" "+stellar.config.date_suffix.min:stellar.config.date_suffix.just}else r=parseInt(i/s);return r},loadCSS:(e,t,l,a)=>{var i,n=window.document,s=n.createElement("link");if(t)i=t;else{var r=(n.body||n.getElementsByTagName("head")[0]).childNodes;i=r[r.length-1]}var o=n.styleSheets;if(a)for(var d in a)a.hasOwnProperty(d)&&s.setAttribute(d,a[d]);s.rel="stylesheet",s.href=e,s.media="only x",function e(t){if(n.body)return t();setTimeout((function(){e(t)}))}((function(){i.parentNode.insertBefore(s,t?i:i.nextSibling)}));var c=function(e){for(var t=s.href,l=o.length;l--;)if(o[l].href===t)return e();setTimeout((function(){c(e)}))};function u(){s.addEventListener&&s.removeEventListener("load",u),s.media=l||"all"}return s.addEventListener&&s.addEventListener("load",u),s.onloadcssdefined=c,c(u),s},loadScript:(e,t)=>new Promise(((l,a)=>{var i=document.createElement("script");if(i.src=e,t)for(let e of Object.keys(t))i[e]=t[e];else i.async=!0;i.onerror=a,i.onload=i.onreadystatechange=function(){const e=this.readyState;e&&"loaded"!==e&&"complete"!==e||(i.onload=i.onreadystatechange=null,l())},document.head.appendChild(i)})),jQuery:e=>{"undefined"==typeof jQuery?util.loadScript(stellar.plugins.jQuery).then(e):e()}},l_body=document.querySelector(".l_body"),sidebar={toggle:()=>{l_body&&(l_body.classList.add("mobile"),l_body.classList.toggle("sidebar"))}},init={toc:()=>{util.jQuery((()=>{var e=[];$("article.md :header").each((function(t,l){e.push(l)})),$(document,window).scroll((function(t){var l=$(this).scrollTop(),a=null;for(var i in e){var n=$(e[i]);n.offset().top>l+32||(a?n.offset().top>=a.offset().top&&(a=n):a=n)}if(a){$("#toc a.toc-link").removeClass("active");var s="#"+a.attr("id");"#undefined"!=s?$('#toc a.toc-link[href="'+encodeURI(s)+'"]').addClass("active"):$("#toc a.toc-link:first").addClass("active")}}))}))},sidebar:()=>{util.jQuery((()=>{$("#toc a.toc-link").click((function(e){l_body.classList.remove("sidebar")})),$("#toc a#s-top").click((function(e){l_body.classList.remove("sidebar")}))}))},relativeDate:e=>{e.forEach((e=>{const t=e,l=t.getAttribute("datetime");let a=util.diffDate(l,!0);a&&(t.innerText=a)}))}};if(init.toc(),init.sidebar(),init.relativeDate(document.querySelectorAll("#post-meta time")),stellar.plugins.scrollreveal&&util.loadScript(stellar.plugins.scrollreveal.js).then((function(){ScrollReveal().reveal("body .reveal",{distance:stellar.plugins.scrollreveal.distance,duration:stellar.plugins.scrollreveal.duration,interval:stellar.plugins.scrollreveal.interval,scale:stellar.plugins.scrollreveal.scale,easing:"ease-out"})})),stellar.plugins.lazyload&&(util.loadScript(stellar.plugins.lazyload.js,{defer:!0}),window.lazyLoadOptions={elements_selector:".lazyload",threshold:0},window.addEventListener("LazyLoad::Initialized",(function(e){window.lazyLoadInstance=e.detail.instance}),!1),document.addEventListener("DOMContentLoaded",(function(){lazyLoadInstance.update()}))),stellar.plugins.issuesjs){null!=document.getElementById("issues-api")&&util.jQuery((()=>{util.loadScript(stellar.plugins.issuesjs,{defer:!0})}))}if(stellar.plugins.swiper){null!=document.getElementById("swiper-api")&&(util.loadCSS(stellar.plugins.swiper.css),util.loadScript(stellar.plugins.swiper.js,{defer:!0}).then((function(){new Swiper(".swiper-container",{slidesPerView:"auto",spaceBetween:8,centeredSlides:!0,zoom:!0,pagination:{el:".swiper-pagination",clickable:!0},autoplay:{delay:5e3,disableOnInteraction:!1},navigation:{nextEl:".swiper-button-next",prevEl:".swiper-button-prev"}})})))}stellar.plugins.preload&&("instant_page"==stellar.plugins.preload.service?util.loadScript(stellar.plugins.preload.instant_page,{defer:!0,type:"module",integrity:"sha384-OeDn4XE77tdHo8pGtE1apMPmAipjoxUQ++eeJa6EtJCfHlvijigWiJpD7VDPWXV1"}):"flying_pages"==stellar.plugins.preload.service&&(window.FPConfig={delay:0,ignoreKeywords:[],maxRPS:5,hoverDelay:25},util.loadScript(stellar.plugins.preload.flying_pages,{defer:!0})));
|
|
@ -43,7 +43,7 @@ function og_args() {
|
|||
return args;
|
||||
}
|
||||
%>
|
||||
<head hexo-theme='<%- stellar_info("tree") %>'>
|
||||
<head>
|
||||
<%- meta_generator() %>
|
||||
<meta charset="utf-8">
|
||||
<%- generate_robots() %>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<script type="text/javascript">
|
||||
stellar = {};
|
||||
stellar.github = 'https://github.com/xaoxuu/hexo-theme-stellar/tree/<%- theme.stellar.version %>';
|
||||
stellar.config = {
|
||||
date_suffix: {
|
||||
just: '<%- __('meta.date_suffix.just') %>',
|
||||
|
|
|
@ -54,7 +54,7 @@ $fs-p = $fs-15
|
|||
$fs-code = $fs-13
|
||||
|
||||
$border-card = 12px
|
||||
$border-widget = 8px
|
||||
$border-widget = 4px
|
||||
$border-block = 4px
|
||||
|
||||
// 可以动态变化的属性
|
||||
|
|
|
@ -33,14 +33,8 @@
|
|||
border-top: 1px solid var(--block-border)
|
||||
|
||||
.md .article-footer .social-wrap
|
||||
grid-gap: 0.5rem 1.5rem
|
||||
grid-template-columns: repeat(auto-fill, 24px)
|
||||
grid-gap: 0.5rem 1rem
|
||||
margin: 1rem 0
|
||||
a.social
|
||||
padding: 0
|
||||
background: none
|
||||
&:hover
|
||||
box-shadow: none
|
||||
|
||||
.md .article-footer .qrcode
|
||||
margin: 2rem auto 1rem
|
||||
|
@ -48,6 +42,7 @@
|
|||
padding: 4px
|
||||
background: white
|
||||
border-radius: 4px
|
||||
box-shadow: 0 4px 8px 0px rgba(0, 0, 0, 0.1), 0 0 32px 0px rgba(0, 0, 0, 0.1)
|
||||
img
|
||||
object-fit: contain
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
.l_left .footer
|
||||
margin-top: 0
|
||||
margin-bottom: 1rem
|
||||
line-height: 0
|
||||
|
||||
|
||||
.social-wrap
|
||||
display: grid
|
||||
grid-gap: 0.25rem 0.25rem
|
||||
grid-template-columns: repeat(auto-fill, 32px)
|
||||
a.social
|
||||
line-height: 0
|
||||
display: inline-block
|
||||
padding: 6px
|
||||
border-radius: 4px
|
||||
filter: grayscale(100%)
|
||||
overflow: hidden
|
||||
background: transparent
|
||||
trans3: box-shadow background transform
|
||||
&:hover
|
||||
color: $color-hover
|
||||
z-index: 1
|
||||
filter: grayscale(0%)
|
||||
transform: translateY(-1px)
|
||||
background: linear-gradient(145deg, #ddd, #fff)
|
||||
box-shadow: 2px 4px 8px #ddd, -2px -4px 8px #fff
|
|
@ -110,29 +110,3 @@ nav.menu
|
|||
margin-bottom: 0.5em
|
||||
>a:hover
|
||||
text-decoration: underline
|
||||
|
||||
|
||||
|
||||
.l_left .footer
|
||||
margin-top: 0
|
||||
margin-bottom: 1rem
|
||||
line-height: 0
|
||||
|
||||
|
||||
.social-wrap
|
||||
display: grid
|
||||
grid-gap: 0.25rem 0.25rem
|
||||
grid-template-columns: repeat(auto-fill, 32px)
|
||||
a.social
|
||||
line-height: 0
|
||||
display: inline-block
|
||||
padding: 4px
|
||||
border-radius: 4px
|
||||
filter: grayscale(100%)
|
||||
overflow: hidden
|
||||
background: var(--card)
|
||||
trans1: box-shadow
|
||||
&:hover
|
||||
color: $color-hover
|
||||
filter: grayscale(0%)
|
||||
box-shadow: $boxshadow-float
|
||||
|
|
|
@ -18,10 +18,11 @@
|
|||
@media screen and (max-width: $device-mobile-375)
|
||||
width: 100%
|
||||
box-shadow: $boxshadow-card
|
||||
transition: box-shadow
|
||||
trans2 box-shadow transform
|
||||
border-radius: $border-widget
|
||||
&:hover
|
||||
box-shadow: $boxshadow-float, $boxshadow-card-float
|
||||
transform: translateY(-1px)
|
||||
box-shadow: $boxshadow-card-float
|
||||
|
||||
|
||||
.md .link-card
|
||||
|
|
|
@ -337,3 +337,5 @@ if (stellar.plugins.preload) {
|
|||
util.loadScript(stellar.plugins.preload.flying_pages, {defer:true})
|
||||
}
|
||||
}
|
||||
|
||||
console.log('hexo-theme-stellar:\n' + stellar.github);
|
||||
|
|
Loading…
Reference in New Issue