Skip to content

Commit 1d6ac8d

Browse files
committed
Corrected reloadSocial to do intitial load if coming from other page. Standardized head/foot areas to clarify what needs to be repeated in all pages. Moved duplicate declaration of refreshNews to main.js
1 parent 18e555a commit 1d6ac8d

File tree

5 files changed

+134
-122
lines changed

5 files changed

+134
-122
lines changed

war/css/main.css

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#head-nav {
2+
background-color: black;
3+
}
4+
15
.videoWrapper {
26
position: relative;
37
padding-bottom: 56.25%; /* 16:9 */
@@ -738,11 +742,8 @@ dd {
738742
margin-top: 20px;
739743
margin-bottom: 15px;
740744
}
741-
/*CAROUSEL*/
742-
743-
/* CUSTOMIZE THE NAVBAR
744-
-------------------------------------------------- */
745745

746+
/*CAROUSEL*/
746747
/* Carousel base class */
747748
.carousel {
748749
margin-bottom: 0;

war/getting_started.html

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
<meta charset="utf-8">
55
<title>Getting Started</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<meta name="description" content="">
8-
<meta name="author" content="">
7+
<meta name="description" content="What the OpenWorm project is about.">
98

109
<!-- Le styles -->
1110
<link href="css/bootstrap.css" rel="stylesheet">
@@ -20,26 +19,26 @@
2019
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
2120
<![endif]-->
2221

23-
<!-- Fav and touch icons -->
22+
<!-- Fav and touch icons - code is out of date and may be superfluous -->
2423
<link rel="shortcut icon" href="favicon.ico">
2524
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
2625
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
2726
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
2827
<link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
2928

30-
<!-- see: https://github.com/thybag/PJAX-Standalone -->
31-
<script src="js/jquery-1.8.3.min.js"></script>
32-
<script src="js/jquery.pjax.js"></script>
29+
30+
<!-- pull in nav header with jquery;
31+
REPLICATE THIS IN ALL PAGES -->
32+
<div class="navbar navbar-inverse navbar-fixed-top" id="head-nav"></div>
33+
<script src="js/jquery-3.2.1.js"></script>
3334
<script>
34-
// set all links inside pj-content to try pjax
35-
$(document).pjax('a', '#pj-content', {fragment: '#pj-content'});
36-
// set explicit links in nav bar to use pjax
37-
$(document).pjax('a[data-pjax]', '#pj-content', {fragment: '#pj-content'});
35+
$.get('header-content.html', function(data) {
36+
$('#head-nav').html(data);
37+
})
38+
$.get('footer-content.html', function(data) {
39+
$('#foot-nav').html(data);
40+
})
3841
</script>
39-
40-
<!-- pull in nav header with jquery in footer -->
41-
<div id="head-nav"></div>
42-
4342
</head>
4443

4544
<body>
@@ -227,53 +226,50 @@ <h1>Contribute</h1>
227226
</div>
228227
</div><!-- end pjax content -->
229228

230-
<!-- Footer navigation
229+
<!-- FOOT: DUPLICATE ALL CONTENT THAT FOLLOWS
230+
231+
footer
231232
================================================== -->
232233
<div id="foot-nav"></div>
233234

234235
<!-- Le javascript
235236
================================================== -->
236-
<!-- Placed at the end of the document so the pages load faster -->
237+
<!-- end of the document so the pages load faster -->
237238

238-
<!-- pull in header/footer w/ jquery -->
239+
<!-- load pjax (jQuery loaded in head)-->
240+
<script src="js/jquery.pjax.js"></script>
239241
<script>
240-
$.get('header-content.html', function(data) {
241-
$('#head-nav').html(data);
242-
})
243-
$.get('footer-content.html', function(data) {
244-
$('#foot-nav').html(data);
245-
})
242+
// set links inside pj-content to try pjax
243+
$(document).pjax('a', '#pj-content', {fragment: '#pj-content'});
244+
// set explicit links in nav bar to use pjax
245+
$(document).pjax('a[data-pjax]', '#pj-content', {fragment: '#pj-content'});
246+
//pull in header/footer w/ jquery -->
246247
</script>
247248

248-
<!-- jquery was loaded in head. load other resources: -->
249+
<!-- load other resources: -->
249250
<script src="js/bootstrap.js"></script>
250251
<script src="js/jquery.parss.uncompressed.js"></script>
251252
<script src="js/main.js"></script>
252253
<script src="http://platform.twitter.com/widgets.js"></script>
253-
254+
254255
<script>
255256
$(document).on('pjax:complete', function() {
256257
// things to do on page change back to index.html
257258
if (window.location.pathname === '/index.html') {
258-
reloadSocial();
259-
$("#news-feed").PaRSS("http://openworm.tumblr.com/rss", // url to the feed
260-
6, // number of items to retrieve
261-
"M jS Y, g:i a", // date format
262-
false, // include descriptions
263-
function() {
264-
// optional callback not used
265-
})
259+
reloadSocial();
266260
}
267261
setNavigation();
268262
})
269263

270-
$(window).load(function() {
264+
$(window).on('load', function() {
271265
// things to do on initial page load (defined in main.js)
272266
setNavigation();
273-
loadGooglePlus();
274267
loadGoogleAnalytics();
275-
loadFacebook();
276-
loadTwitterWidget();
268+
if (window.location.pathname === '/index.html') {
269+
loadGooglePlus();
270+
loadFacebook();
271+
loadTwitterWidget();
272+
}
277273
})
278274
</script>
279275
</body>

war/header-content.html

Lines changed: 43 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,46 @@
1-
<div class="navbar navbar-inverse navbar-fixed-top">
2-
<div class="navbar-inner">
3-
<div class="container">
4-
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
5-
<span class="fa fa-bar"></span>
6-
<span class="fa fa-bar"></span>
7-
<span class="fa fa-bar"></span>
8-
</button>
1+
<div class="navbar-inner">
2+
<div class="container">
3+
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
4+
<span class="fa fa-bar"></span>
5+
<span class="fa fa-bar"></span>
6+
<span class="fa fa-bar"></span>
7+
</button>
98

10-
<div class="nav-collapse collapse">
11-
<ul class="nav">
12-
<li id="home">
13-
<a href="./index.html" data-pjax>Home</a>
14-
</li>
15-
<li id="started">
16-
<a data-pjax href="./getting_started.html">Get Started</a>
17-
</li>
18-
<li id="involved">
19-
<a data-pjax href="./get_involved.html">Get Involved</a>
20-
</li>
21-
<li id="downloads">
22-
<a data-pjax href="./downloads.html">Downloads</a>
23-
</li>
24-
<li id="supporters">
25-
<a data-pjax href="./supporters.html">Supporters</a>
26-
</li>
27-
<li id="media">
28-
<a data-pjax href="./media.html">Media</a>
29-
</li>
30-
<li id="science">
31-
<a data-pjax href="./science.html">Science</a>
32-
</li>
33-
<li id="donate">
34-
<a data-pjax class="donatecolor" href="./donate.html">Donate</a>
35-
</li>
36-
</ul>
37-
<ul class="nav pull-right">
38-
<li><a class="fa fa-github fa-15x" href="http://docs.openworm.org/en/latest/Community/github/"
39-
target="_blank"></a></li>
40-
<li><a class="minilogo" rel="tooltip" data-placement="right"
41-
data-original-title='"What I cannot create, I do not understand" - R. Feynman'></a>
42-
</li>
43-
<li><a href="http://browser.openworm.org" target="wormbrowser"> Explore the Worm</a></li>
44-
</ul>
45-
</div><!--/.nav-collapse -->
46-
</div>
9+
<div class="nav-collapse collapse">
10+
<ul class="nav">
11+
<li id="home">
12+
<a href="./index.html" data-pjax>Home</a>
13+
</li>
14+
<li id="started">
15+
<a data-pjax href="./getting_started.html">Get Started</a>
16+
</li>
17+
<li id="involved">
18+
<a data-pjax href="./get_involved.html">Get Involved</a>
19+
</li>
20+
<li id="downloads">
21+
<a data-pjax href="./downloads.html">Downloads</a>
22+
</li>
23+
<li id="supporters">
24+
<a data-pjax href="./supporters.html">Supporters</a>
25+
</li>
26+
<li id="media">
27+
<a data-pjax href="./media.html">Media</a>
28+
</li>
29+
<li id="science">
30+
<a data-pjax href="./science.html">Science</a>
31+
</li>
32+
<li id="donate">
33+
<a data-pjax class="donatecolor" href="./donate.html">Donate</a>
34+
</li>
35+
</ul>
36+
<ul class="nav pull-right">
37+
<li><a class="fa fa-github fa-15x" href="http://docs.openworm.org/en/latest/Community/github/"
38+
target="_blank"></a></li>
39+
<li><a class="minilogo" rel="tooltip" data-placement="right"
40+
data-original-title='"What I cannot create, I do not understand" - R. Feynman'></a>
41+
</li>
42+
<li><a href="http://browser.openworm.org" target="wormbrowser"> Explore the Worm</a></li>
43+
</ul>
44+
</div><!--/.nav-collapse -->
4745
</div>
4846
</div>

war/index.html

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,27 @@
1919
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
2020
<![endif]-->
2121

22-
<!-- Fav and touch icons -->
22+
<!-- Fav and touch icons - this code appears to be outdated -->
2323
<link rel="shortcut icon" href="favicon.ico">
2424
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
2525
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
2626
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
2727
<link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">
28-
29-
28+
29+
<!-- pull in nav header with jquery;
30+
REPLICATE THIS IN ALL PAGES -->
31+
<div class="navbar navbar-inverse navbar-fixed-top" id="head-nav"></div>
3032
<script src="js/jquery-3.2.1.js"></script>
31-
<script src="js/jquery.pjax.js"></script>
3233
<script>
33-
// set all links inside pj-content to try pjax
34-
$(document).pjax('a', '#pj-content', {fragment: '#pj-content'});
35-
// set explicit links in nav bar to use pjax
36-
$(document).pjax('a[data-pjax]', '#pj-content', {fragment: '#pj-content'});
34+
$.get('header-content.html', function(data) {
35+
$('#head-nav').html(data);
36+
})
37+
$.get('footer-content.html', function(data) {
38+
$('#foot-nav').html(data);
39+
})
3740
</script>
38-
39-
<!-- pull in nav header with jquery script in footer -->
40-
<div id="head-nav"></div>
41-
4241
</head>
42+
4343
<body>
4444
<div id="pj-content">
4545
<div id="fb-root"></div>
@@ -391,17 +391,25 @@ <h1>Meet with us</h1> <br>
391391
</div>
392392
</div><!-- end pjax content -->
393393

394-
395-
<!-- Footer navigation
394+
<!-- FOOT: DUPLICATE ALL CONTENT THAT FOLLOWS
395+
396+
footer
396397
================================================== -->
397398
<div id="foot-nav"></div>
398399

399400
<!-- Le javascript
400401
================================================== -->
401-
<!-- Placed at the end of the document so the pages load faster -->
402+
<!-- end of the document so the pages load faster -->
402403

403-
<!-- pull in header/footer w/ jquery -->
404+
<!-- load jQuery / pjax -->
405+
<script src="js/jquery-3.2.1.js"></script>
406+
<script src="js/jquery.pjax.js"></script>
404407
<script>
408+
// set all links inside pj-content to try pjax
409+
$(document).pjax('a', '#pj-content', {fragment: '#pj-content'});
410+
// set explicit links in nav bar to use pjax
411+
$(document).pjax('a[data-pjax]', '#pj-content', {fragment: '#pj-content'});
412+
//pull in header/footer w/ jquery -->
405413
$.get('header-content.html', function(data) {
406414
$('#head-nav').html(data);
407415
})
@@ -410,36 +418,30 @@ <h1>Meet with us</h1> <br>
410418
})
411419
</script>
412420

413-
<!-- jquery was loaded in head. load other resources: -->
421+
<!-- load other resources: -->
414422
<script src="js/bootstrap.js"></script>
415423
<script src="js/jquery.parss.uncompressed.js"></script>
416424
<script src="js/main.js"></script>
417425
<script src="http://platform.twitter.com/widgets.js"></script>
418-
426+
419427
<script>
420-
$(document).on('pjax:success', function() {
428+
$(document).on('pjax:complete', function() {
421429
// things to do on page change back to index.html
422430
if (window.location.pathname === '/index.html') {
423-
reloadSocial();
424-
$("#news-feed").PaRSS("http://openworm.tumblr.com/rss", // url to the feed
425-
6, // number of items to retrieve
426-
"M jS Y, g:i a", // date format
427-
false, // include descriptions
428-
function() {
429-
// optional callback not used
430-
})
431+
reloadSocial();
431432
}
432433
setNavigation();
433434
})
434435

435436
$(window).on('load', function() {
436437
// things to do on initial page load (defined in main.js)
437-
// alert(window.location.pathname);
438438
setNavigation();
439-
loadGooglePlus();
440439
loadGoogleAnalytics();
441-
loadFacebook();
442-
loadTwitterWidget();
440+
if (window.location.pathname === '/index.html') {
441+
loadGooglePlus();
442+
loadFacebook();
443+
loadTwitterWidget();
444+
}
443445
})
444446
</script>
445447
</body>

0 commit comments

Comments
 (0)