-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdefault.hbs
265 lines (223 loc) · 9.76 KB
/
default.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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<!DOCTYPE html>
<html lang="en">
<head>
{{!-- Document Settings --}}
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
{{!-- Base Meta --}}
<title>{{meta_title}}</title>
<meta name="HandheldFriendly" content="True" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
{{!-- Styles'n'Scripts --}}
<link rel="stylesheet" type="text/css" href="{{asset "built/screen.css"}}" />
<link rel="stylesheet" type="text/css" href="{{asset "css/screen.css"}}" />
<link rel="stylesheet" type="text/css" href="{{asset "css/tab.css"}}" />
<link rel="stylesheet" type="text/css" href="{{asset "css/prism.css"}}" />
<link rel="stylesheet" type="text/css" href="{{asset "css/head_tab.css"}}" />
<link rel="stylesheet" type="text/css" href="{{asset "css/complexity.css"}}" />
<link rel="stylesheet" type="text/css" href="{{asset "css/post_page.css"}}" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="{{asset "built/lightbox.css"}}" />
<link rel="stylesheet" type="text/css" href="{{asset "css/course_page.css"}}" />
<link rel="stylesheet" type="text/css" href="{{asset "css/search_page.css"}}" />
<link rel="stylesheet" type="text/css" href="{{asset "css/navbar.css"}}" />
<style>
a {
text-decoration: none !important;
}
#time {
text-align: center;
font-weight: bold;
}
#scrollBtn {
display: none;
position: fixed;
bottom: 90px;
right: 36px;
z-index: 999;
border: none;
outline: none;
background-color: #351ed478;
color: white;
cursor: pointer;
padding: 15px;
border-radius: 50px;
width: 45px;
}
#scrollBtn:hover {
background-color: #351ed4;
}
@media (max-width: 480px) {
#scrollBtn {
right: 18px;
bottom: 80px;
transform: scale(0.9);
}
}
</style>
{{!-- This tag outputs SEO meta+structured data and other important settings --}}
{{ghost_head}}
</head>
<div id="nav_toggle" class="navbar_collapse navigation_page">
<div id="navbar_close">×</div>
<a href="http://iq.opengenus.org">Home</a>
<a href="http://discourse.opengenus.org">Discussions</a>
<a href="http://iq.opengenus.org/guide-to-writing-a-note-at-opengenus-iq/">Write at Opengenus IQ</a>
</div>
<body class="{{body_class}}">
<div id="search_page" class="search_page search_page_hide">
<div class="search_page_close search_toggle">×</div>
<div class="search_page_body">
<div id="site-search" style="display:none;" class="search_form">
<input class="typeahead search_form_input" type="text" placeholder="Search" />
</div>
</div>
</div>
<div class="site-wrapper">
{{!-- All the main content gets inserted here, index.hbs, post.hbs, etc --}}
{{{body}}}
{{!-- Chat button--}}
<div id="Forum_Button">
<button id="Discourse_button" class="Discourse_button">
<i class="fa fa-comments fa-3x"></i>
</button>
</div>
<div id="Discourse_Forum" class="Discourse_Forum">
<!--promote the user to discourse forum -->
<div class="Discourse_Popup_Container">
<span id="Discourse_close" class="Discourse_close">×</span>
<div id="Discourse_Popup_icon" class="Discourse_Popup_icon">
<img src="{{asset "images/Join_community.png"}}" class="community_icon">
</div>
<div class="Discourse_Popup_Content">
<p>Visit our discussion forum to ask any question and join our community</p>
<a target="_blank" class="discourse_link" href="https://discourse.opengenus.org/">View Forum</a>
</div>
</div>
</div>
{{!-- Chat button--}}
{{!-- The footer at the very bottom of the screen --}}
<footer class="site-footer outer">
<div class="site-footer-content inner">
<section class="copyright"><a href="{{@blog.url}}">{{@blog.title}}</a> © {{date format="YYYY"}} All rights
reserved ™ </section>
<nav class="site-footer-nav">
<a href="{{@blog.url}}">Top Posts</a>
{{#if @blog.facebook}}<a href="{{facebook_url @blog.facebook}}" target="_blank"
rel="noopener">Facebook</a>{{/if}}
{{#if @blog.twitter}}<a href="{{twitter_url @blog.twitter}}" target="_blank" rel="noopener">Twitter</a>{{/if}}
</nav>
</div>
</footer>
</div>
{{!-- The big email subscribe modal content --}}
{{#if @labs.subscribers}}
<div id="subscribe" class="subscribe-overlay">
<a class="subscribe-overlay-close" href="#"></a>
<div class="subscribe-overlay-content">
{{#if @blog.logo}}
<img class="subscribe-overlay-logo" src="{{@blog.logo}}" alt="{{@blog.title}}" />
{{/if}}
<h1 class="subscribe-overlay-title">Join the mailbox of Knowledge <br> OpenGenus IQ</h1>
<p class="subscribe-overlay-description">Get your daily dose of knowledge delivered straight to your inbox</p>
{{subscribe_form placeholder="[email protected]"}}
</div>
</div>
{{/if}}
{{!-- jQuery + Fitvids, which makes all video embeds responsive --}}
<script src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous">
</script>
<script type="text/javascript" src="{{asset "js/chatbox.js"}}"></script>
<script type="text/javascript" src="{{asset "js/jquery.fitvids.js"}}"></script>
<script type="text/javascript" src="{{asset "js/tab.js"}}"></script>
<script type="text/javascript" src="{{asset "js/prism.js"}}"></script>
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.11.1/typeahead.bundle.min.js"></script>
<script>
// ===== Scroll to Top ====
$(window).scroll(function() {
if ($(this).scrollTop() >= 50) { // If page is scrolled more than 50px
$('#scrollBtn').fadeIn(500); // Fade in the arrow
} else {
$('#scrollBtn').fadeOut(500); // Else fade out the arrow
}
});
$('#scrollBtn').click(function() { // When arrow is clicked
$('body,html').animate({
scrollTop : 0 // Scroll to top of body
}, 500);
});
</script>
{{#if pagination.pages}}
<script>
var maxPages = parseInt('{{pagination.pages}}');
</script>
<script src="{{asset "js/infinitescroll.js"}}"></script>
{{/if}}
{{!-- The #block helper will pull in data from the #contentFor other template files. In this case, there's some JavaScript which we only want to use in post.hbs, but it needs to be included down here, after jQuery has already loaded. --}}
{{{block "scripts"}}}
<script>
//Wait for other things to be loaded so the site doesn't wait on the search
$(document).ready(function () {
//Go grab all the posts on the blog, but only the slug and title fields
//That helps limit the amount of data sent and stored locally
$.get(ghost.url.api('posts', { limit: "all", fields: "slug,title,feature_image,meta_description" })).done(function (data) {
//add all the data returned to a variable
var searchData = data.posts;
//New bloodhound to make it searchable
var search = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('title'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
local: searchData
});
$(document).click(function () {
$("#toggle").toggle("slide");
});
//Build the typeahead
$('#site-search .typeahead').typeahead(null, {
name: 'search',
display: 'title',
//source is the bloodhound variable
source: search,
templates: {
//display no result image if no result is found
empty: [
'<div class="search_noresult_image"><img src="{{asset "images/search-empty.svg"}}"><p>No results found</p></div>'
].join('\n'),
suggestion: function (data) {
if (data.meta_description == null) {
data.meta_description = "No description provided";
}
if (data.feature_image == null) {
data.feature_image = "{{asset "images / search - image.jpg"}}";
}
var post_url = window.location.protocol + '%2F%2F' + window.location.host + "%2F" + data.slug;
var parsed_post_url = decodeURIComponent(post_url);
//check is description and image are avaialable
return '<div class="search_page_results"><a href="' + parsed_post_url + '" class="search_item_image"><img src="' + data.feature_image + '"></a><div class="search_item_text"><a href="' + parsed_post_url + '"class="search_item_title">' + data.title + '</a><div class="search_item_description">' + data.meta_description + '</div></div> </div>';
}
}
});
//display and close navbar window and search window
$('#navbar_close').bind('click', function () {
$('#nav_toggle').toggleClass('navigation_page_open');
});
$('#burgertoggle').bind('click', function () {
$('#nav_toggle').toggleClass('navigation_page_open');
});
$('.search_toggle').bind('click', function () {
$('#search_page').toggleClass('search_page_hide');
});
//Now show the search bar since getting data was successful
$('#site-search').show();
}).fail(function () {
//If the get request errors out, put an error in the console
console.log("Error getting Ghost API Data");
});
});
</script>
{{!-- Ghost outputs important scripts and data with this tag - it should always be the very last thing before the closing body tag --}}
{{ghost_foot}}
</body>
</html>