Skip to content

Commit

Permalink
modified for benzblog
Browse files Browse the repository at this point in the history
  • Loading branch information
BenZstory committed Jul 10, 2019
1 parent 884155a commit 784beb7
Show file tree
Hide file tree
Showing 11 changed files with 228 additions and 174 deletions.
1 change: 1 addition & 0 deletions .gitattributes
@@ -1,2 +1,3 @@
* text=auto eol=lf
source/lib/* linguist-vendored
scripts/merge.js linguist-vendored
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
.vs
.DS_Store
.idea/
*.log
Expand Down
343 changes: 179 additions & 164 deletions _config.yml

Large diffs are not rendered by default.

16 changes: 15 additions & 1 deletion layout/_macro/post.swig
Expand Up @@ -236,8 +236,21 @@
</span>
{% endif %}

{% if post.tags and post.tags.length and not is_index %}
{% if theme.tag_icon %}
{% set tag_indicate = '<i class="fa fa-tag"></i>' %}
{% else %}
{% set tag_indicate = '#' %}
{% endif %}
<div class="post-tags">
{% for tag in post.tags %}
<a href="{{ url_for(tag.path) }}" rel="tag">{{ tag_indicate }} {{ tag.name }}</a>
{% endfor %}
</div>
{% endif %}

{% if post.description and (not theme.excerpt_description or not is_index) %}
<div class="post-description">{#
<div class="post-description" hidden>{#
#}{{ post.description }}{#
#}</div>
{% endif %}
Expand Down Expand Up @@ -352,6 +365,7 @@
{% endif %}

<footer class="post-footer">

{% if post.tags and post.tags.length and not is_index %}
{% if theme.tag_icon %}
{% set tag_indicate = '<i class="fa fa-tag"></i>' %}
Expand Down
9 changes: 7 additions & 2 deletions layout/_partials/head/head.swig
Expand Up @@ -45,7 +45,7 @@
<meta name="baidu-site-verification" content="{{ theme.baidu_site_verification }}"/>
{% endif %}

{% if theme.fancybox %}
{% if theme.fancybox.enable %}
{% set fancybox_css_uri = url_for(theme.vendors._internal + '/fancybox/source/jquery.fancybox.css') %}
{% if theme.vendors.fancybox_css %}
{% set fancybox_css_uri = theme.vendors.fancybox_css %}
Expand Down Expand Up @@ -97,7 +97,12 @@
sidebar: {{ theme.sidebar | json_encode }},
back2top: {{ theme.back2top.enable }},
back2top_sidebar: {{ theme.back2top.sidebar }},
fancybox: {{ theme.fancybox }},
fancybox: {
enable: {{theme.fancybox.enable}},
replace_from: {{theme.fancybox.replace_from}},
replace_to: '{{theme.fancybox.replace_to}}',
with_caption: {{theme.fancybox.with_caption}},
},
fastclick: {{ theme.fastclick }},
lazyload: {{ theme.lazyload }},
tabs: {{ theme.tabs.enable }},
Expand Down
2 changes: 1 addition & 1 deletion layout/_scripts/vendors.swig
Expand Up @@ -21,7 +21,7 @@
{% set js_vendors.velocity = 'velocity/velocity.min.js?v=1.2.1' %}
{% set js_vendors.velocity_ui = 'velocity/velocity.ui.min.js?v=1.2.1' %}

{% if theme.fancybox %}
{% if theme.fancybox.enable %}
{% set js_vendors.fancybox = 'fancybox/source/jquery.fancybox.pack.js' %}
{% endif %}

Expand Down
12 changes: 12 additions & 0 deletions source/css/_custom/custom.styl
@@ -0,0 +1,12 @@
// Custom styles.
.posts-expand .post-body img {
box-sizing: border-box;
margin: 0 auto 0px;
padding: 3px;
border: 1px solid #ddd;
}

.posts-expand .post-meta .post-tags {
margin-top: 10px;
text-align: center;
}
Binary file added source/images/favicon.ico
Binary file not shown.
Binary file added source/images/favicon_16x16.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion source/js/next-boot.js
Expand Up @@ -32,7 +32,7 @@ $(document).ready(function() {
* Register JS handlers by condition option.
* Need to add config option in Front-End at 'layout/_partials/head.swig' file.
*/
CONFIG.fancybox && NexT.utils.wrapImageWithFancyBox();
CONFIG.fancybox.enable && NexT.utils.wrapImageWithFancyBox(CONFIG.fancybox.replace_from, CONFIG.fancybox.replace_to, CONFIG.fancybox.with_caption);
CONFIG.tabs && NexT.utils.registerTabsTag();

NexT.utils.embeddedVideoTransformer();
Expand Down
16 changes: 11 additions & 5 deletions source/js/utils.js
Expand Up @@ -5,16 +5,18 @@ NexT.utils = NexT.$u = {
/**
* Wrap images with fancybox support.
*/
wrapImageWithFancyBox: function() {
wrapImageWithFancyBox: function(replace_from, replace_to, with_caption) {
$('.content img')
.not('#qr img')
.not(':hidden')
.each(function() {
var $image = $(this);
var imageTitle = $image.attr('title') || $image.attr('alt');
var $imageWrapLink = $image.parent('a');

if ($imageWrapLink.length < 1) {
var imageLink = $image.attr('data-src') || $image.attr('src');
var imageLink = $image.attr('data-original') || $image.attr('src');
imageLink = imageLink.replace(replace_from, replace_to)

$imageWrapLink = $image.wrap('<a class="fancybox fancybox.image" href="' + imageLink + '" itemscope itemtype="http://schema.org/ImageObject" itemprop="url"></a>').parent('a');
if ($image.is('.post-gallery img')) {
$imageWrapLink.addClass('post-gallery-img');
Expand All @@ -28,7 +30,7 @@ NexT.utils = NexT.$u = {
}
}

if (imageTitle) {
if (with_caption && imageTitle) {
$imageWrapLink.append('<p class="image-caption">' + imageTitle + '</p>');
// Make sure img title tag will show correctly in fancybox
$imageWrapLink.attr('title', imageTitle).attr('data-caption', imageTitle);
Expand All @@ -46,7 +48,11 @@ NexT.utils = NexT.$u = {
},

lazyLoadPostsImages: function() {
lozad('.content img').observe();
$('#posts').find('img').lazyload({
//placeholder: '/images/loading.gif',
effect : 'fadeIn',
threshold: 0
});
},

/**
Expand Down

0 comments on commit 784beb7

Please sign in to comment.