-
Notifications
You must be signed in to change notification settings - Fork 199
/
post.html
145 lines (126 loc) · 4.62 KB
/
post.html
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
---
layout: default
---
<section class="tutorial">
<section class="sidebar sticky">
<ul>
{% assign sub_navigation = content | extract_element: 'h2' %}
{% for item in sub_navigation %}
<li><a href="#{{ item.id }}">{{ item.text }}</a></li>
{% endfor %}
</ul>
</section>
<section class="tutorial-content">
<h1>{{ page.title }}</h1>
{% if page.type == "Video" %}
{% include youtube.html video_id=page.video_id %}
{% if page.resources %}
<div class="resources">
<ul>
{% for resource in page.resources %}
<li><a href="{{ resource.link }}">{{ resource.name }}</a></li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endif %}
<div class="tutorial-main">
{{ content }}
</div>
<div class="tutorial-share">
<a class="modalOpen no-smooth" href="#subscribe">{% include social-icon.html icon="Email" %} Subscribe</a>
<a class="modalOpen no-smooth" href="#share">{% include social-icon.html icon="Share" %} Share</a>
</div>
</section>
</section>
{% if page.set %}
{% assign set_file_name = "_sets/" | append: page.set | append: ".md" %}
{% assign set = site.sets | where: "path", set_file_name | first %}
{% assign series_posts = site.posts | where: "set", page.set | sort: "order_number" %}
<div class="tutorial-series">
<h3>{{ set.title }} - Series</h3>
<p>{{ set.description }}</p>
{% include listings.html listings=series_posts numbered=true%}
</div>
{% endif %}
{% assign related_posts = site.related_posts %}
{% assign related_posts_size = related_posts | size %}
{% if related_posts_size > 0 %}
<div class="related">
<h3>Related tutorials</h3>
{% include listings.html listings=site.related_posts %}
</div>
{% endif %}
{% if site.disqus_shortname and page.comments %}
<div id="disqus_thread"></div>
<script>
var disqus_shortname = '{{ site.disqus_shortname }}';
var disqus_config = function () {
this.page.url = "{{ page.url | prepend: site.url }}";
this.page.identifier = "{{ page.id }}";
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = '//' + disqus_shortname + '.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
{% endif %}
<div id="subscribe" class="modalDialog">
<div>
<a title="Close" class="close">×</a>
<form action="{{ site.newsletter_action }}" method="post">
<h2>Subscribe</h2>
<p>The latest tutorials sent straight to your inbox.</p>
<input type="email" name="EMAIL" placeholder="Email">
<input type="submit" value="Sign up">
</form>
</div>
</div>
<div id="share" class="modalDialog sharing">
<div>
<a title="Close" class="close">×</a>
<h2>Share</h2>
<p>Share this tutorial with your community.</p>
<ul>
<li><a class="twitter" target="_blank" href="https://twitter.com/intent/tweet?url={{ page.url | prepend: site.url | cgi_escape }}">{% include social-icon.html icon="Twitter" %} Twitter</a></li>
<li><a class="facebook" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u={{ page.url | prepend: site.url | cgi_escape }}">{% include social-icon.html icon="Facebook2" %} Facebook</a></li>
<li><a class="google-plus" target="_blank" href="https://plus.google.com/share?url={{ page.url | prepend: site.url | cgi_escape }}">{% include social-icon.html icon="Google Plus" %} Google+</a></li>
<li><a class="hacker-news" target="_blank" href="http://news.ycombinator.com/submitlink?u={{ page.url | prepend: site.url | cgi_escape }}&t={{ page.title | cgi_escape | replace: "+", "%20" }}">{% include social-icon.html icon="Hacker News" %} Hacker News</a></li>
</ul>
</div>
</div>
<script src="{{ site.baseurl }}/js/main.js"></script>
<script>
var headings = document.querySelectorAll("h2[id]");
console.log(headings);
for (var i = 0; i < headings.length; i++) {
var anchorLink = document.createElement("a");
anchorLink.innerText = "#";
anchorLink.href = "#" + headings[i].id;
anchorLink.classList.add("header-link");
headings[i].appendChild(anchorLink);
}
$(".modalOpen").click(function() {
var id = $(this).attr("href");
$(id).addClass("show");
$(window).click(function() {
$(".show").removeClass("show");
});
$(id + " > div").click(function(event){
event.stopPropagation();
});
return false;
});
$(".close").click(function() {
$(".show").removeClass("show");
return false;
});
$(document).keyup(function(e) {
if (e.keyCode == 27) {
$(".show").removeClass("show");
}
});
</script>