Skip to content

Commit

Permalink
Merge pull request #1328 from ivan-nginx/master
Browse files Browse the repository at this point in the history
Fixes and enhancements. [6]
  • Loading branch information
iissnan authored Jan 5, 2017
2 parents 849ecb7 + d1c6771 commit 66c5f24
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 15 deletions.
6 changes: 3 additions & 3 deletions layout/_macro/post.swig
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
{% if post.description and theme.excerpt_description %}
{{ post.description }}
<!--noindex-->
<div class="post-more-link text-center">
<div class="post-button text-center">
<a class="btn" href="{{ url_for(post.path) }}">
{{ __('post.read_more') }} &raquo;
</a>
Expand All @@ -243,7 +243,7 @@
{% elif post.excerpt %}
{{ post.excerpt }}
<!--noindex-->
<div class="post-more-link text-center">
<div class="post-button text-center">
<a class="btn" href="{{ url_for(post.path) }}{% if theme.scroll_to_more %}#more{% endif %}" rel="contents">
{{ __('post.read_more') }} &raquo;
</a>
Expand All @@ -254,7 +254,7 @@
{{ content.substring(0, theme.auto_excerpt.length) }}
{% if content.length > theme.auto_excerpt.length %}...{% endif %}
<!--noindex-->
<div class="post-more-link text-center">
<div class="post-button text-center">
<a class="btn" href="{{ url_for(post.path) }}{% if theme.scroll_to_more %}#more{% endif %}" rel="contents">
{{ __('post.read_more') }} &raquo;
</a>
Expand Down
31 changes: 31 additions & 0 deletions scripts/tags/button.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* global hexo */
// Usage: {% button /path/to/url/, text, icon [class], title %}
// Alias: {% btn /path/to/url/, text, icon [class], title %}

function postButton(args) {
args = args.join(' ').split(',');
var url = args[0];
var text = args[1] || '';
var icon = args[2] || '';
var title = args[3] || '';

if (!url) {
hexo.log.warn('URL can NOT be empty');
}

text = text.trim();
icon = icon.trim();
title = title.trim();

var result = ['<span class="post-button text-center"><a class="btn" href="' + url + '"'];
title.length > 0 && result.push(' title="' + title + '"');
result.push('>');
icon.length > 0 && result.push('<i class="fa fa-' + icon + '"></i>');
text.length > 0 && result.push(text);
result.push('</a></span>');

return result.join('');
}

hexo.extend.tag.register('button', postButton);
hexo.extend.tag.register('btn', postButton);
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
background: $read-more-bg-color;
border-radius: $read-more-border-radius;
line-height: 2;
margin: 0 4px 8px 4px;
}
.btn:hover {
@extend .btn:hover;
}
.fa-fw {
width: (18em / 14);
text-align: left;
}
}
2 changes: 1 addition & 1 deletion source/css/_common/components/post/post.styl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
@import "post-type";
@import "post-title";
@import "post-meta";
@import "post-more-link";
@import "post-button";
@import "post-tags";
@import "post-nav";
@import "post-eof";
Expand Down
4 changes: 2 additions & 2 deletions source/css/_common/components/tags/full-image.styl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
margin: 20px auto;
+desktop() {
max-width: none;
width: 126%;
margin: 0 -13%;
width: $full-image-width;
margin: $full-image-margin-vertical $full-image-margin-horizontal;
}
}
3 changes: 2 additions & 1 deletion source/css/_schemes/Mist/_posts-expanded.styl
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@
.post-nav { margin-top: 40px; }
}

.post-more-link {
.post-button {
margin-top: 20px;
text-align: left;

a {
margin: 0 8px 8px 0 !important;
padding: 0;
font-size: $font-size-base;
color: $grey-dim;
Expand Down
7 changes: 0 additions & 7 deletions source/css/_schemes/Pisces/_full-image.styl

This file was deleted.

1 change: 0 additions & 1 deletion source/css/_schemes/Pisces/index.styl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "_full-image";
@import "_layout";
@import "_brand";
@import "_menu";
Expand Down
4 changes: 4 additions & 0 deletions source/css/_variables/Pisces.styl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ $btn-default-border-color = $text-color
$btn-default-hover-color = white
$btn-default-hover-bg = $black-deep

// Full Image Tag
$full-image-width = 118%
$full-image-margin-horizontal = -9%
$full-image-margin-vertical = 0

// Back to top
$b2t-opacity = .6
Expand Down
4 changes: 4 additions & 0 deletions source/css/_variables/base.styl
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ $b2t-font-size = 12px
$b2t-color = white
$b2t-bg-color = $black-deep

// full-image
$full-image-width = 110%
$full-image-margin-horizontal = -5%
$full-image-margin-vertical = 25px

// .post-expand .post-eof
// In Muse scheme, margin above and below the post separator
Expand Down

0 comments on commit 66c5f24

Please sign in to comment.