release: 1.0.0-rc.2

This commit is contained in:
xaoxuu 2021-02-21 21:31:43 +08:00
parent 90adcf0c5b
commit b92efdfc58
6 changed files with 16 additions and 17 deletions

View File

@ -1,11 +1,10 @@
######## Stellar info ########
stellar:
version: '1.0.0-rc.1'
version: '1.0.0-rc.2'
homepage: 'https://xaoxuu.com/wiki/stellar/'
repo: 'https://github.com/xaoxuu/hexo-theme-stellar'
# The cdn version needs to be consistent with the stellar version
cdn_css: # 'https://cdn.jsdelivr.net/npm/hexo-theme-stellar@1.0/source/css/main.min.css'
cdn_js: # 'https://cdn.jsdelivr.net/npm/hexo-theme-stellar@1.0/source/js/main.min.js'
cdn_css: # Use cdn links instead of /css/main.css
cdn_js: # Use cdn links instead of /js/main.js
######## head tags ########
@ -66,13 +65,7 @@ article:
enable: false
max_count: 5
placeholder_img: https://7.dusays.com/2021/02/20/76b86c0226ffd.svg
# 分享文章
share:
qq: https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/qq.png
qzone: https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/qzone.png
weibo: https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/weibo.png
# 需要安装插件 npm i hexo-helper-qrcode
wechat: https://cdn.jsdelivr.net/gh/volantis-x/cdn-org/logo/128/wechat.png
######## Comments ########
@ -110,11 +103,11 @@ footer:
tag_plugins:
# {% note text %}
note:
default_color: ''
default_color: '' # white, dark, red, orange, yellow, green, cyan, blue, purple
# {% checkbox %}
checkbox:
interactive: false # enable interactive for user
# {% link title, url, img %}
# {% link url title [img:src] [description] %}
link:
default_img: https://7.dusays.com/2021/02/20/8f277b4ee0ecd.svg

1
dist/css/main.css vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/js/issues.js vendored Normal file
View File

@ -0,0 +1 @@
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='&nbsp;&nbsp;<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
dist/js/main.js vendored Normal file
View File

@ -0,0 +1 @@
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})));

View File

@ -37,10 +37,13 @@ function commit() {
printf "\n"
git commit -m "${msg}"
git checkout npm
git rebase main
printf "\n\n> \033[32m%s\033[0m" 'git push origin'
printf "\n"
git push origin
git push origin main
git push origin npm
# done
printf "\n\n> \033[32m%s\033[0m\n" 'Congratulations!'
}
@ -58,4 +61,4 @@ do
esac
done
prepare #&& commit
prepare && commit

View File

@ -1,6 +1,6 @@
{
"name": "hexo-theme-stellar",
"version": "1.0.0-rc.1",
"version": "1.0.0-rc.2",
"description": "Elegant and powerful theme for Hexo.",
"main": "package.json",
"scripts": {