forked from starburst1977/readium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
post.hbs
executable file
·179 lines (147 loc) · 7.65 KB
/
post.hbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
{{!< default}}
{{! The comment above "< default" means - insert everything in this file into
the {body} of the default.hbs template, which contains our header/footer. }}
<main class="content" role="main">
<article class="{{post_class}}">
{{! Everything inside the #post tags pulls data from the post }}
{{#post}}
{{#has tag="articleImage"}}
<div class="article-image">
<div class="post-image-image">
Article Image
</div>
<div class="post-meta">
<h1 class="post-title">{{{title}}}</h1>
<div class="cf post-meta-text">
<div class="author-image" style="background-image: url({{author.image}})">Blog Logo</div>
<!--<h4 class="author-name" itemprop="author"></h4> on-->
<time datetime="{{date format="YYYY-MM-DD"}}">{{date format='DD MMM YYYY'}}</time>, tagged on {{#foreach tags}}<span class="post-tag-{{slug}}">{{#if @first}}{{else}}, {{/if}}<a href="/tag/{{slug}}">{{name}}</a></span>{{/foreach}}
</div>
<center><a href="#topofpage" class="topofpage"><i class="fa fa-angle-down"></i></a></center>
</div>
</div>
<script>
(function ($) {
"use strict";
$(document).ready(function(){
$('.post-content').each(function() {
var $this = $(this),
img = $this.find('img:first'),
url = img.attr('src');
$(".post-image-image").css('background-image', 'url('+url+')');
img.remove();
});
var $window = $(window),
$image = $('.post-image-image');
$window.on('scroll', function() {
var top = $window.scrollTop();
if (top < 0 || top > 1500) { return; }
$image
.css('transform', 'translate3d(0px, '+top/3+'px, 0px)')
.css('opacity', 1-Math.max(top/700, 0));
});
$window.trigger('scroll');
var height = $('.article-image').height();
$('.post-content').css('padding-top', height + 'px');
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 500);
return false;
}
}
});
});
});
}(jQuery));
</script>
{{! Each post has the blog logo at the top, with a link back to the home page }}
{{else}}
<div class="noarticleimage">
<div class="post-meta">
<h1 class="post-title">{{{title}}}</h1>
<div class="cf post-meta-text">
<div class="author-image" style="background-image: url({{author.image}})">Blog Logo</div>
<!--<h4 class="author-name" itemprop="author" itemscope itemtype="http://schema.org/Person">{{author}}</h4> on-->
<time datetime="{{date format="YYYY-MM-DD"}}">{{date format='DD MMM YYYY'}}</time>, tagged on {{#foreach tags}}<span class="post-tag-{{slug}}">{{#if @first}}{{else}}, {{/if}}<a href="/tag/{{slug}}">{{name}}</a></span>{{/foreach}}
</div>
</div>
</div>
<br>
<br>
<br>
{{/has}}
<section class="post-content">
<div class="post-reading">
<span class="post-reading-time"></span> read
</div>
<a name="topofpage"></a>
{{content}}
</section>
<footer class="post-footer">
<section class="share">
<a class="icon-twitter" href="http://twitter.com/share?text={{encode title}}&url={{url absolute="true"}}"
onclick="window.open(this.href, 'twitter-share', 'width=550,height=235');return false;">
<span class="hidden">Twitter</span>
</a>
<a class="icon-facebook" href="https://www.facebook.com/sharer/sharer.php?u={{url absolute="true"}}"
onclick="window.open(this.href, 'facebook-share','width=580,height=296');return false;">
<span class="hidden">Facebook</span>
</a>
<a class="icon-google-plus" href="https://plus.google.com/share?url={{url absolute="true"}}"
onclick="window.open(this.href, 'google-plus-share', 'width=490,height=530');return false;">
<span class="hidden">Google+</span>
</a>
</section>
</footer>
<div class="bottom-teaser cf">
<div class="isLeft">
<h5 class="index-headline featured"><span>Written by</span></h5>
<section class="author">
<div class="author-image" style="background-image: url({{author.image}})">Blog Logo</div>
<h4>A Nember</h4>
<p class="bio">{{author.bio}}</p>
<hr>
<p class="published">Published <time datetime="{{date format="YYYY-MM-DD"}}">{{date format='DD MMM YYYY'}}</time></p>
</section>
</div>
{{/post}}
<div class="isRight">
<h5 class="index-headline featured"><span></span></h5>
<br>
<footer class="site-footer">
<a class="subscribe icon-feed" href="{{@blog.url}}/rss/"><span class="tooltip"> Subscribe!</span></a>
<div class="inner">
<section class="copyright">All content copyright <a href="{{@blog.url}}/">{{@blog.title}}</a> © {{date format="YYYY"}}</section>
</div>
</footer>
</div>
</div>
<!--{{> comment-list}}-->
<div id='discourse-comments'></div>
<script type="text/javascript">
DiscourseEmbed = { discourseUrl: 'https://forum.nem.io/',
discourseEmbedUrl: 'http://blog.nem.io{{url}}' };
(function() {
var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
})();
</script>
</article>
</main>
<div class="bottom-closer">
<div class="background-closer-image" {{#if @blog.cover}}style="background-image: url({{@blog.cover}})"{{/if}}>
Image
</div>
<div class="inner">
<h1 class="blog-title">{{@blog.title}}</h1>
<h2 class="blog-description">{{@blog.description}}</h2>
<a href="/" class="btn">Back to Overview</a>
</div>
</div>