Commit 2ba67f35 authored by jimakker's avatar jimakker

moar

parent 889ebdf7
fancybox: true ## If you want to use fancybox please set the value to true.
menu:
- page: archive
- page: Docs
directory: docs/
icon: fa-book
- page: blog
directory: archives/
icon: fa-archive
icon: fa-newspaper-o
- page: about
directory: about/
icon: fa-user
icon: fa-info
- page: rss
directory: atom.xml
icon: fa-rss
widgets: ## Six widgets in sidebar provided: search, category, tag, recent_posts, rencent_comments and links.
# - search
- recent_posts
- category
- tag
# - recent_posts
# - recent_comments
# - links
- links
links:
- title: hackmildegia
url: http://www.example1.com/
- title: site-name2
url: http://www.example2.com/
- title: site-name3
url: http://www.example3.com/
- title: HACKmildegia
url: http://hackmildegia.net
- title: BaibaLab
url: http://baibalab.net/
hero:
class: is-info
......
if theme.duoshuo
.ds-thread(data-thread-key=page.path, data-title=page.title, data-url=page.permalink, data-author-key='1')
if theme.disqus
#disqus_thread
script.
var disqus_shortname = '#{theme.disqus}';
var disqus_identifier = '#{page.path}';
var disqus_title = '#{page.title}';
var disqus_url = '#{config.url}/#{page.path}';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
script(id='dsq-count-scr', src='//#{theme.disqus}.disqus.com/count.js', async)
if page.tags
.tags
for tag in page.tags.toArray()
a(href=url_for(tag.path))= tag.name
a#rocket.show(href='#top')
script(type='text/javascript', src=url_for(theme.js) + '/totop.js' + '?v=' + theme.version, async)
.widget
.widget-title
i(class='fa fa-folder-o')= ' ' + __('categories')
!= list_categories({show_count: false})
aside.menu
p.menu-label= __('categories')
!= list_categories({show_count: false, class:'menu'})
.widget
.widget-title
i(class='fa fa-external-link')= ' ' + __('blogroll')
- for (var i in theme.links)
ul
a(href='#{theme.links[i].url}' title='#{theme.links[i].title}' target='_blank') #{theme.links[i].title}
aside.menu
p.menu-label= __('blogroll')
ul.menu-list
- for (var i in theme.links)
li
a(href='#{theme.links[i].url}' title='#{theme.links[i].title}' target='_blank') #{theme.links[i].title}
if theme.duoshuo
.widget
.comments-title
i(class='fa fa-comment-o')= ' ' + __('recent_comments')
.ds-recent-comments(data-num-items='5' data-show-avatars='0' data-show-time='1' data-show-admin='0' data-excerpt-length='32' data-show-title='1')
if theme.disqus
.widget
.widget-title
i(class='fa fa-comment-o')= ' ' + __('recent_comments')
script(type='text/javascript', src='//#{theme.disqus}.disqus.com/recent_comments_widget.js?num_items=5&hide_avatars=1&avatar_size=32&excerpt_length=20&hide_mods=1')
.widget
.widget-title
i(class='fa fa-file-o')= ' ' + __('recent')
!= list_posts({amount: 10})
aside.menu
p.menu-label= __('recent')
!= list_posts({amount: 5, class:'menu'})
if theme.google_search == true
.widget
form(action='//www.google.com/search' method='get' accept-charset='utf-8' class='search-form' target='_blank')
input(type='text' name='q' maxlength='20' placeholder='Search')
input(type='hidden' name='sitesearch' value='#{config.url}')
if theme.baidu_search == true
.widget
form(action='//www.baidu.com/baidu' method='get' accept-charset='utf-8' class='search-form' target='_blank')
input(type='search' name='word' maxlength='20' placeholder='Search')
input(type='hidden' name='si' value='#{config.url}')
input(name='tn' type='hidden' value='bds')
input(name='cl' type='hidden' value='3')
input(name='ct' type='hidden' value='2097152')
input(name='s' type='hidden' value='on')
if theme.swiftype
.widget
input.st-default-search-input(placeholder='Search' type='text')
if theme.tinysou
.widget
form
input#ts-search-input(class='ts-search-input' placeholder='Search' type='text')
if theme.self_search == true
.widget
.search-form
input(id='local-search-input' placeholder='Search' type='text' name='q' results='0')
div#local-search-result
.widget
.widget-title
i(class='fa fa-star-o')= ' ' + __('tags')
.tagcloud
!= tagcloud({min_font: 15, max_font: 15, amount: 100, orderby: 'count'})
aside.menu
p.menu-label= __('tags')
!= list_tags({show_count: false, class:'menu'})
......@@ -8,17 +8,18 @@ block title
if page.archive
title= __('archive') + ' | ' + config.title
block content
if page.category || page.tag
h1.label-title= __('reading_label', page.category || page.tag)
.post
.post-archive
//Use lodash to classify posts. See https://lodash.com/docs#groupBy
each posts, year in _.groupBy(page.posts.toArray(), function(p){return -p.date.format('YYYY')})
h2= -year
ul.listing
for post in posts
li
span.date= post.date.format('YYYY/MM/DD')
a(href=url_for(post.path), title=post.title)
+title(post)
include _partial/paginator.jade
.content
if page.category || page.tag
h1.label-title= __('reading_label', page.category || page.tag)
.post
.post-archive
//Use lodash to classify posts. See https://lodash.com/docs#groupBy
each posts, year in _.groupBy(page.posts.toArray(), function(p){return -p.date.format('YYYY')})
h2= -year
ul.listing
for post in posts
li
span.date= post.date.format('YYYY/MM/DD')
a(href=url_for(post.path), title=post.title)
+title(post)
include _partial/paginator.jade
......@@ -60,16 +60,15 @@ html(lang='#{config.language}')
//- h2.subtitle
//- | A simple container to divide your page into <strong>sections</strong>, like the one you're currently reading
//- hr
.content
.columns
if(!is_home())
.column.is-quarter
#sidebar
each item in theme.widgets
!= partial('_widget/' + item + '.jade')
.colum
block content
.columns
if(is_archive() || is_post())
.column.is-quarter
#sidebar
each item in theme.widgets
!= partial('_widget/' + item + '.jade')
.column
block content
include _partial/footer
//- include _partial/totop
include _partial/after_footer
//- include _partial/after_footer
......@@ -4,28 +4,29 @@ extends base
block title
title= config.title + ' | ' + config.subtitle
block content
for post in page.posts.toArray()
.post
h2.post-title
include _partial/helpers
a(href=url_for(post.path))
+title(post)
.post-meta= post.date.format(config.date_format)
if post.description
.post-content
!= post.description
else if post.excerpt
.post-content
!= post.excerpt
else if post.content
- var br = post.content.indexOf('\n')
if br < 0
.content
for post in page.posts.toArray()
.post
h2.post-title
include _partial/helpers
a(href=url_for(post.path))
+title(post)
.post-meta= post.date.format(config.date_format)
if post.description
.post-content
!= post.content
else
!= post.description
else if post.excerpt
.post-content
!= post.content.substring(0, br)
p(class='readmore')
a(href=url_for(post.path))= __('Readmore')
!= post.excerpt
else if post.content
- var br = post.content.indexOf('\n')
if br < 0
.post-content
!= post.content
else
.post-content
!= post.content.substring(0, br)
p(class='readmore')
a(href=url_for(post.path))= __('Readmore')
include _partial/paginator
include _partial/paginator
......@@ -2,10 +2,22 @@ extends base
block title
title= page.title + ' | ' + config.title
block content
.post
h1.post-title= page.title
.post-content
!= page.content
if page.comments
include _partial/comments
.columns
if(page.menu)
.column.is-quarter
aside.menu
p.menu-label Menu
ul.menu-list
- for (var i in page.menu)
li
a(href='#{page.menu[i].url}' title='#{page.menu[i].title}') #{page.menu[i].title}
if(page.menu[i].submenu)
ul
- for (var j in page.menu[i].submenu)
li
a(href='#{page.menu[i].submenu[j].url}' title='#{page.menu[i].submenu[j].title}') #{page.menu[i].submenu[j].title}
.column
.content
h1.post-title= page.title
!= page.content
......@@ -4,14 +4,21 @@ block title
title= page.title + ' | ' + config.title
block content
.post
.content
h1.post-title= page.title
.post-meta= page.date.format('ll')
.post-meta.notification= page.date.format('ll')
if page.categories.length > 0
span= ' | '
span.category
for category in page.categories.toArray()
a(href=url_for(category.path))= category.name
span= ' | Categories: '
for category, key in page.categories.toArray()
a(href=url_for(category.path))= category.name
if(key < page.categories.length-1 )
!= ' > '
if page.tags
span= ' | ' + __('tags') + ': '
for tag, key in page.tags.toArray()
a(href=url_for(tag.path))= tag.name
if(key < page.tags.length-1 )
| ,
if page.toc
div(class='clear')
div(id='toc' class='toc-article')
......@@ -19,6 +26,4 @@ block content
!= toc(page.content)
.post-content
!= page.content
include _partial/tag
include _partial/post_nav
include _partial/comments
var hexo = hexo || {};
function box(args, content){
content= hexo.render.renderSync({text: content, engine: 'markdown'});
var text = '<div class="box"><div class="content">' + content + '</div></div>';
return text;
}
hexo.extend.tag.register('box', box, {ends: true});
var hexo = hexo || {};
function button(args){
var buttonClasses = args[1] || '';
var text = '<a class="button '+ buttonClasses +'">' +
args[0] +
'</a>';
return text;
}
hexo.extend.tag.register('button', button);
function ibutton(args){
var icon = args[2];
var buttonClasses = args[3] || '';
var text = '<a href="'+args[1]+'" class="button '+ buttonClasses +'">' +
'<span class="icon"><i class="fa fa-'+icon+'"></i></span>' +
'<span>' + args[0] + '</span>'+
'</a>';
return text;
}
hexo.extend.tag.register('ibutton', ibutton);
var hexo = hexo || {};
function notification(args, content){
var text = '<div class="notification">' + content + '</div>';
var text = '<div class="notification ' + (args[0] || '') + '">' + content + '</div>';
text = hexo.render.renderSync({text: text, engine: 'markdown'});
return text;
......
.pagination li {
list-style:none
}
.menu {
margin-bottom: 20px
}
@import "../../node_modules/bulma/bulma"
+function($) {
'use strict';
// Resize code blocks to fit the screen width
var CodeBlockResizer = function(elem) {
this.$codeBlocks = $(elem);
};
CodeBlockResizer.prototype = {
/**
* Run main feature
*/
run: function() {
var self = this;
// resize all codeblocks
self.resize();
// resize codeblocks when window is resized
$(window).smartresize(function() {
self.resize();
});
},
/**
* Resize codeblocks
*/
resize: function() {
var self = this;
self.$codeBlocks.each(function() {
var $gutter = $(this).find('.gutter');
var $code = $(this).find('.code');
// get padding of code div
var codePaddings = $code.width() - $code.innerWidth();
// code block div width with padding - gutter div with padding + code div padding
var width = $(this).outerWidth() - $gutter.outerWidth() + codePaddings;
// apply new width
$code.css('width', width);
$code.children('pre').css('width', width);
});
}
};
$(document).ready(function() {
// register jQuery function to check if an element has an horizontal scroll bar
$.fn.hasHorizontalScrollBar = function() {
return this.get(0).scrollWidth > this.innerWidth();
};
var resizer = new CodeBlockResizer('figure.highlight');
resizer.run();
});
}(jQuery);
$(document).ready(function() {
$('img').each(function() {
if ($(this).parent().hasClass('fancybox')) return;
if ($(this).hasClass('nofancybox')) return;
var alt = this.alt;
if (alt) $(this).after('<span class="caption">' + alt + '</span>');
$(this).wrap('<a href="' + ($(this).attr('data-src') == null ? this.src : $(this).attr('data-src')) + '" title="' + alt + '" class="fancybox"></a>');
});
$(this).find('.fancybox').each(function(){
$(this).attr('rel', 'article');
});
});
$(document).ready(function() {
$("a[href$='.jpg'],a[href$='.png'],a[href$='.gif']").attr('rel', 'gallery').fancybox({
helpers : {
title: { type: 'inside'}
}
});
});
This diff is collapsed.
var searchFunc = function(path, search_id, content_id) {
'use strict';
$.ajax({
url: path,
dataType: "xml",
success: function( xmlResponse ) {
// get the contents from search data
var datas = $( "entry", xmlResponse ).map(function() {
return {
title: $( "title", this ).text(),
content: $("content",this).text(),
url: $( "url" , this).text()
};
}).get();
var $input = document.getElementById(search_id);
var $resultContent = document.getElementById(content_id);
$input.addEventListener('input', function(){
var str='<ul class=\"search-result-list\">';
var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
$resultContent.innerHTML = "";
if (this.value.trim().length <= 0) {
return;
}
// perform local searching
datas.forEach(function(data) {
var isMatch = true;
var content_index = [];
var data_title = data.title.trim().toLowerCase();
var data_content = data.content.trim().replace(/<[^>]+>/g,"").toLowerCase();
var data_url = data.url;
var index_title = -1;
var index_content = -1;
var first_occur = -1;
// only match artiles with not empty titles and contents
if(data_title != '' && data_content != '') {
keywords.forEach(function(keyword, i) {
index_title = data_title.indexOf(keyword);
index_content = data_content.indexOf(keyword);
if( index_title < 0 && index_content < 0 ){
isMatch = false;
} else {
if (index_content < 0) {
index_content = 0;
}
if (i == 0) {
first_occur = index_content;
}
}
});
}
// show search results
if (isMatch) {
str += "<li><a href='"+ data_url +"' class='search-result-title'>"+ data_title +"</a>";
var content = data.content.trim().replace(/<[^>]+>/g,"");
if (first_occur >= 0) {
// cut out 100 characters
var start = first_occur - 20;
var end = first_occur + 20;
if(start < 0){
start = 0;
}
if(start == 0){
end = 40;
}
if(end > content.length){
end = content.length;
}
var match_content = content.substr(start, end);
// highlight all keywords
keywords.forEach(function(keyword){
var regS = new RegExp(keyword, "gi");
match_content = match_content.replace(regS, "<em class=\"search-keyword\">"+keyword+"</em>");
});
str += "<p class=\"search-result\">" + match_content +"...</p>"
}
str += "</li>";
}
});
str += "</ul>";
$resultContent.innerHTML = str;
});
}
});
}
(function($){
// article-share
$('body').on('click', function(){
$('.article-share-box.on').removeClass('on');
}).on('click', '.article-share-link', function(e){
e.stopPropagation();
var $this = $(this),
url = $this.attr('data-url'),
encodedUrl = encodeURIComponent(url),
id = 'article-share-box-' + $this.attr('data-id'),
title = document.title,
offset = $this.offset();
if ($('#' + id).length){
var box = $('#' + id);
if (box.hasClass('on')){
box.removeClass('on');
return;
}
} else {
var html = [
'<div id="' + id + '" class="article-share-box">',
'<input class="article-share-input" value="' + url + '">',
'<div class="article-share-links">',
'<a href="https://twitter.com/intent/tweet?url=' + encodedUrl + '" class="article-share-twitter" target="_blank" title="Twitter"></a>',
'<a href="https://www.facebook.com/sharer.php?u=' + encodedUrl + '" class="article-share-facebook" target="_blank" title="Facebook"></a>',
'<a href="http://service.weibo.com/share/share.php?title=' + title + '&url=' + encodedUrl + '&searchPic=true&style=number' + '" class="article-share-weibo" target="_blank" title="Weibo"></a>',
'<a href="http://s.jiathis.com/qrcode.php?url=' + encodedUrl + '" class="article-share-wechat" target="_blank" title="Wechat"></a>',
'</div>',
'</div>'
].join('');
var box = $(html);
$('body').append(box);
}
$('.article-share-box.on').hide();
box.css({
top: offset.top + 25,
left: offset.left
}).addClass('on');
}).on('click', '.article-share-box', function(e){
e.stopPropagation();
}).on('click', '.article-share-box-input', function(){
$(this).select();
}).on('click', '.article-share-box-link', function(e){
e.preventDefault();
e.stopPropagation();
window.open(this.href, 'article-share-box-window-' + Date.now(), 'width=500,height=450');
});
})(jQuery);
+(function($, sr) {
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function(func, threshold, execAsap) {
var timeout;
return function debounced() {
var obj = this, args = arguments;
function delayed() {
if (!execAsap) {
func.apply(obj, args);
}
timeout = null;
};
if (timeout) {
clearTimeout(timeout);
}
else if (execAsap) {
func.apply(obj, args);
}
timeout = setTimeout(delayed, threshold || 100);
};
};
jQuery.fn[sr] = function(fn) {
return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr);
};
})(jQuery, 'smartresize');
$(window).scroll(function() {
$(window).scrollTop() > 500 ? $("#rocket").addClass("show") : $("#rocket").removeClass("show");
});
$("#rocket").click(function() {
$("#rocket").addClass("launch");
$("html, body").animate({
scrollTop: 0
}, 500, function() {
$("#rocket").removeClass("show launch");
});
return false;
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment