-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit def3466
Showing
40 changed files
with
2,673 additions
and
0 deletions.
There are no files selected for viewing
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,35 @@ | ||
'use strict'; | ||
|
||
function postBtns(args, content) { | ||
return `<div class="btns ${args.join(' ')}"> | ||
${content} | ||
</div>`; | ||
} | ||
|
||
function postCell(args, content) { | ||
args = args.join(' ').split(',') | ||
let text = args[0] || '' | ||
let url = args[1] || '' | ||
text = text.trim() | ||
url = url.trim() | ||
if (url.length > 0) { | ||
url = "href='" + url + "'" | ||
} | ||
let icon = '' | ||
let img = 'https://cdn.jsdelivr.net/gh/volantis-x/cdn-volantis@3/img/placeholder/d570170f4f12e1ee829ca0e85a7dffeb77343a.svg' | ||
if (args.length > 2) { | ||
if (args[2].indexOf(' fa-') > -1) { | ||
icon = args[2].trim() | ||
} else { | ||
img = args[2].trim() | ||
} | ||
} | ||
if (icon.length > 0) { | ||
return `<a class="button" ${url} title='${text}'><i class='${icon}'></i>${text}</a>` | ||
} else { | ||
return `<a class="button" ${url} title='${text}'><img src='${img}'>${text}</a>` | ||
} | ||
} | ||
|
||
hexo.extend.tag.register('btns', postBtns, {ends: true}); | ||
hexo.extend.tag.register('cell', postCell); |
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,28 @@ | ||
/** | ||
* Button | ||
* {% btn url text icon option %} | ||
* option: color outline center block larger | ||
* color : default/blue/pink/red/purple/orange/green | ||
*/ | ||
|
||
'use strict' | ||
|
||
const urlFor = require('hexo-util').url_for.bind(hexo) | ||
|
||
function btn (args) { | ||
args = args.join(' ').split(',') | ||
let url = args[0] || '' | ||
let text = args[1] || '' | ||
let icon = args[2] || '' | ||
let option = args[3] || '' | ||
|
||
url = url.trim() | ||
text = text.trim() | ||
icon = icon.trim() | ||
option = option.trim() | ||
|
||
return `<a class="btn-beautify button--animated ${option}" href="${urlFor(url)}" | ||
title="${text}">${icon.length > 0 ? `<i class="${icon} fa-fw"></i>` : ''}<span>${text}</span></a>` | ||
} | ||
|
||
hexo.extend.tag.register('btn', btn, { ends: false }) |
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,53 @@ | ||
'use strict'; | ||
|
||
function postCheckbox(args) { | ||
args = args.join(' ').split(',') | ||
var cls = '' | ||
var text = '' | ||
var checked = false | ||
if (args.length > 1) { | ||
cls = (args[0] || '').trim() | ||
if (cls.length > 0) { | ||
cls = ' ' + cls | ||
} | ||
if (cls.indexOf('checked') > -1) { | ||
checked = true | ||
} | ||
text = (args[1] || '').trim() | ||
} else if (args.length > 0) { | ||
text = (args[0] || '').trim() | ||
} | ||
if (text.length > 0) { | ||
return `<div class='checkbox${cls}'><input type="checkbox" ${ checked ? 'checked="checked"' : '' }/> | ||
${hexo.render.renderSync({text: text, engine: 'markdown'}).split('\n').join('')} | ||
</div>` | ||
} | ||
} | ||
function postRadio(args) { | ||
args = args.join(' ').split(',') | ||
var cls = '' | ||
var text = '' | ||
var checked = false | ||
if (args.length > 1) { | ||
cls = (args[0] || '').trim() | ||
if (cls.length > 0) { | ||
cls = ' ' + cls | ||
} | ||
if (cls.indexOf('checked') > -1) { | ||
checked = true | ||
} | ||
text = (args[1] || '').trim() | ||
} else if (args.length > 0) { | ||
text = (args[0] || '').trim() | ||
} | ||
if (text.length > 0) { | ||
return `<div class='checkbox${cls}'><input type="radio" ${ checked ? 'checked="checked"' : '' }/> | ||
${hexo.render.renderSync({text: text, engine: 'markdown'}).split('\n').join('')} | ||
</div>` | ||
} | ||
} | ||
// {% checkbox text %} | ||
// {% checkbox checked, text %} | ||
// {% checkbox color checked, text %} | ||
hexo.extend.tag.register('checkbox', postCheckbox); | ||
hexo.extend.tag.register('radio', postRadio); |
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,29 @@ | ||
'use strict'; | ||
|
||
function postFolding(args, content) { | ||
args = args.join(' ').split(','); | ||
let style = '' | ||
let title = '' | ||
if (args.length > 1) { | ||
style = args[0].trim() | ||
title = args[1].trim() | ||
} else if (args.length > 0) { | ||
title = args[0].trim() | ||
} | ||
if (style != undefined) { | ||
return `<details ${style}><summary> ${title} </summary> | ||
<div class='content'> | ||
${hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')} | ||
</div> | ||
</details>`; | ||
} else { | ||
return `<details><summary> ${title} </summary> | ||
<div class='content'> | ||
${hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')} | ||
</div> | ||
</details>`; | ||
} | ||
|
||
} | ||
|
||
hexo.extend.tag.register('folding', postFolding, {ends: true}); |
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,34 @@ | ||
/** | ||
* Butterfly | ||
* galleryGroup and allery | ||
*/ | ||
|
||
'use strict' | ||
|
||
const urlFor = require('hexo-util').url_for.bind(hexo) | ||
|
||
function gallery (args, content) { | ||
return `<div class="justified-gallery">${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')} | ||
</div>` | ||
} | ||
|
||
function galleryGroup (args) { | ||
const name = args[0] | ||
const desrc = args[1] | ||
const url = urlFor(args[2]) | ||
const img = urlFor(args[3]) | ||
|
||
return ` | ||
<figure class="gallery-group"> | ||
<img class="gallery-group-img" src='${img}'> | ||
<figcaption> | ||
<div class="gallery-group-name">${name}</div> | ||
<p>${desrc}</p> | ||
<a href='${url}'></a> | ||
</figcaption> | ||
</figure> | ||
` | ||
} | ||
|
||
hexo.extend.tag.register('gallery', gallery, { ends: true }) | ||
hexo.extend.tag.register('galleryGroup', galleryGroup) |
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,44 @@ | ||
/** | ||
* https://github.com/anuraghazra/github-readme-stats | ||
*/ | ||
|
||
'use strict'; | ||
|
||
// {% ghcard volantis-x %} | ||
// {% ghcard volantis-x/hexo-theme-volantis %} | ||
hexo.extend.tag.register('ghcard', function(args) { | ||
args = args.join(' ').split(', '); | ||
let path = args[0].trim(); | ||
let card = ''; | ||
card += '<a class="ghcard" rel="external nofollow noopener noreferrer" href="https://github.com/' + path + '">'; | ||
let url = ''; | ||
if (path.includes('/')) { | ||
// is repo | ||
let ps = path.split('/'); | ||
url += 'https://github-readme-stats.vercel.app/api/pin/?username=' + ps[0] + "&repo=" + ps[1]; | ||
} else { | ||
// is user | ||
url += 'https://github-readme-stats.vercel.app/api/?username=' + path; | ||
} | ||
if (args.length > 1) { | ||
for (let i = 1; i < args.length; i++) { | ||
let tmp = args[i].trim(); | ||
url += "&" + tmp; | ||
} | ||
} | ||
if (!url.includes('&show_owner=')) { | ||
url += '&show_owner=true'; | ||
} | ||
card += '<img src="' + url + '"/>'; | ||
card += '</a>'; | ||
return card; | ||
}); | ||
|
||
hexo.extend.tag.register('ghcardgroup', function(args, content) { | ||
let ret = ''; | ||
// wrap | ||
ret += '<div class="ghcard-group">'; | ||
ret += content; | ||
ret += '</div>'; | ||
return ret; | ||
}, {ends: true}); |
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,71 @@ | ||
/** | ||
* Butterfly | ||
* @example | ||
* hideInline | ||
* {% hideInline content,display,bg,color %} | ||
* content不能包含當引號,可用 ' | ||
* hideBlock | ||
* {% hideBlock display,bg,color %} | ||
* content | ||
* {% endhideBlock %} | ||
* hideToggle | ||
* {% hideToggle display,bg,color %} | ||
* content | ||
* {% endhideToggle %} | ||
*/ | ||
|
||
'use strict' | ||
|
||
function hideInline (args) { | ||
args = args.join(' ').split(',') | ||
const content = args[0] | ||
const display = args[1] || 'Click' | ||
const bg = args[2] || false | ||
const color = args[3] || false | ||
let group = 'style="' | ||
|
||
if (bg) group += `background-color: ${bg};` | ||
if (color) group += `color: ${color}` | ||
group += '"' | ||
|
||
return `<span class="hide-inline"><button type="button" class="hide-button button--animated" ${group}>${display} | ||
</button><span class="hide-content">${content}</span></span>` | ||
} | ||
|
||
function hideBlock (args, content) { | ||
args = args.join(' ').split(',') | ||
const display = args[0] || 'Click' | ||
const bg = args[1] || false | ||
const color = args[2] || false | ||
let group = 'style="' | ||
|
||
if (bg) group += `background-color: ${bg};` | ||
if (color) group += `color: ${color}` | ||
group += '"' | ||
|
||
return `<div class="hide-block"><button type="button" class="hide-button button--animated" ${group}>${display} | ||
</button><span class="hide-content">${hexo.render.renderSync({ text: content, engine: 'markdown' })}</span></div>` | ||
} | ||
|
||
function hideToggle (args, content) { | ||
args = args.join(' ').split(',') | ||
const display = args[0] | ||
const bg = args[1] || false | ||
const color = args[2] || false | ||
let group = 'style="' | ||
let border = '' | ||
|
||
if (bg) { | ||
border = `style="border: 1px solid ${bg}"` | ||
group += `background-color: ${bg};` | ||
} | ||
if (color) group += `color: ${color}` | ||
group += '"' | ||
|
||
return `<div class="hide-toggle" ${border}><div class="hide-button toggle-title" ${group}><i class="fas fa-caret-right fa-fw"></i><span>${display}</span></div> | ||
<div class="hide-content">${hexo.render.renderSync({ text: content, engine: 'markdown' })}</div></div>` | ||
} | ||
|
||
hexo.extend.tag.register('hideInline', hideInline) | ||
hexo.extend.tag.register('hideBlock', hideBlock, { ends: true }) | ||
hexo.extend.tag.register('hideToggle', hideToggle, { ends: true }) |
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,91 @@ | ||
/** | ||
* image.js v4 | https://volantis.js.org | ||
*/ | ||
|
||
'use strict'; | ||
|
||
// {% image url %} | ||
// {% image url, alt=haha %} | ||
// {% image url, width=50% %} | ||
// {% image url, height=32px %} | ||
// {% image url, bg=#eee %} | ||
// {% image url, alt=haha, width=400px %} | ||
// {% image url, alt=haha, width=400px, bg=#eee %} | ||
hexo.extend.tag.register('image', function(args) { | ||
args = args.join(' ').split(', '); | ||
let url = args[0].trim(); | ||
let alt = ''; | ||
let bg = ''; | ||
let style = ''; | ||
if (args.length > 1) { | ||
for (let i = 1; i < args.length; i++) { | ||
let tmp = args[i].trim(); | ||
if (tmp.includes('alt=')) { | ||
alt = tmp.substring(4, tmp.length); | ||
} else if (tmp.includes('width=')) { | ||
style += 'width:' + tmp.substring(6, tmp.length) + ';'; | ||
} else if (tmp.includes('height=')) { | ||
style += 'height:' + tmp.substring(7, tmp.length) + ';'; | ||
} else if (tmp.includes('bg=')) { | ||
bg = tmp.substring(3, tmp.length); | ||
} | ||
} | ||
} | ||
function img(url, alt, style) { | ||
let img = ''; | ||
img += '<img class="img" src="' + url + '"'; | ||
if (alt.length > 0) { | ||
img += ' alt="' + alt + '"'; | ||
} | ||
if (style.length > 0) { | ||
img += ' style="' + style + '"'; | ||
} | ||
img += '/>'; | ||
return img; | ||
} | ||
|
||
let ret = ''; | ||
// wrap | ||
ret += '<div class="img-wrap">'; | ||
// bg | ||
ret += '<div class="img-bg"'; | ||
if (bg.length > 0) { | ||
ret += ' style="background:' + bg + '"'; | ||
} | ||
ret += '>'; | ||
ret += img(url, alt, style); | ||
ret += '</div>'; | ||
|
||
if (alt.length > 0) { | ||
ret += '<span class="image-caption">' + alt + '</span>'; | ||
} | ||
|
||
ret += '</div>'; | ||
return ret; | ||
}); | ||
|
||
|
||
// {% inlineimage url %} | ||
// {% inlineimage url, height=22px %} | ||
hexo.extend.tag.register('inlineimage', function(args) { | ||
args = args.join(' ').split(', '); | ||
let url = args[0].trim(); | ||
let ret = ''; | ||
ret += '<img no-lazy class="inline" src="' + url + '"'; | ||
let style = ''; | ||
if (args.length > 1) { | ||
for (let i = 1; i < args.length; i++) { | ||
let tmp = args[i].trim(); | ||
if (tmp.includes('height=')) { | ||
style += 'height:' + tmp.substring(7, tmp.length) + ';'; | ||
} | ||
} | ||
} | ||
if (style.length > 0) { | ||
ret += ' style="' + style + '"'; | ||
} else { | ||
ret += ' style="height:1.5em"'; | ||
} | ||
ret += '/>'; | ||
return ret; | ||
}); |
Oops, something went wrong.