diff --git a/package.json b/package.json index a81c7ca..1cf56df 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,6 @@ "bootstrap-sass": "=3.3.7", "font-awesome": "=4.7.0", "jquery": "=3.1.1", - "jquery.easing": "=1.4.1", "tstatic": "RealOrangeOne/tstatic", "underscore": "=1.8.3", "wow.js": "=1.2.2" diff --git a/theme/static/src/js/app.js b/theme/static/src/js/app.js index 9347cf1..df81682 100644 --- a/theme/static/src/js/app.js +++ b/theme/static/src/js/app.js @@ -2,6 +2,7 @@ require('./creative'); var ansi_up = require('ansi_up'); +var consts = require('./consts'); $('.image').each(function () { // setup div-image hybrids @@ -17,3 +18,15 @@ $('.ansi-up').each(function () { var ele = $(this); ele.html(ansi_up.ansi_to_html(ele.html())); }); + + +$('.navbar-brand').bind('click', function (event) { + if ($('html').scrollTop() > consts.NAVBAR_HEIGHT) { + $('html, body').stop().animate({ + scrollTop: 0 + }, consts.SCROLL_SPEED); + } else { + window.location = '/'; + } + event.preventDefault(); +}); diff --git a/theme/static/src/js/consts.js b/theme/static/src/js/consts.js new file mode 100644 index 0000000..0bb5a59 --- /dev/null +++ b/theme/static/src/js/consts.js @@ -0,0 +1,4 @@ +module.exports = { + NAVBAR_HEIGHT: $('#main-nav').height(), + SCROLL_SPEED: 750 +}; diff --git a/theme/static/src/js/creative/creative.js b/theme/static/src/js/creative/creative.js deleted file mode 100644 index 9cddbf2..0000000 --- a/theme/static/src/js/creative/creative.js +++ /dev/null @@ -1,38 +0,0 @@ -/*! - * Start Bootstrap - Creative Bootstrap Theme (http://startbootstrap.com) - * Code licensed under the Apache License v2.0. - * For details, see http://www.apache.org/licenses/LICENSE-2.0. - */ -'use strict'; - -// jQuery for page scrolling feature - requires jQuery Easing plugin -$('a.page-scroll').bind('click', function(event) { - var anchor = $(this); - $('html, body').stop().animate( - { - scrollTop: ($(anchor.attr('href')).offset().top - 50) - }, - 1250, - 'easeInOutExpo' - ); - event.preventDefault(); -}); - -// Highlight the top nav as scrolling occurs -$('body').scrollspy({ - target: '.navbar-fixed-top', - offset: 51 -}); - -// Closes the Responsive Menu on Menu Item Click -$('.navbar-collapse ul li a').click(function() { - $('.navbar-toggle:visible').click(); -}); - - -// Offset for Main Navigation -$('#main-nav').affix({ - offset: { - top: 50 - } -}); diff --git a/theme/static/src/js/creative/index.js b/theme/static/src/js/creative/index.js index 82e60fa..41329c1 100644 --- a/theme/static/src/js/creative/index.js +++ b/theme/static/src/js/creative/index.js @@ -1,8 +1,41 @@ 'use strict'; -require('jquery.easing'); -require('./creative'); - var WOW = require('wow.js'); +var consts = require('../consts'); new WOW().init(); + +/*! + * Start Bootstrap - Creative Bootstrap Theme (http://startbootstrap.com) + * Code licensed under the Apache License v2.0. + * For details, see http://www.apache.org/licenses/LICENSE-2.0. + * (Edited for theorangeone.net) + */ + +// jQuery for page scrolling feature +$('a.page-scroll').bind('click', function(event) { + $('html, body').stop().animate( + { scrollTop: $($(this).attr('href')).offset().top - consts.NAVBAR_HEIGHT }, + consts.SCROLL_SPEED + ); + event.preventDefault(); +}); + +// Highlight the top nav as scrolling occurs +$('body').scrollspy({ + target: '.navbar-fixed-top', + offset: consts.NAVBAR_HEIGHT + 1 +}); + +// Closes the Responsive Menu on Menu Item Click +$('.navbar-collapse ul li a').click(function() { + $('.navbar-toggle:visible').click(); +}); + + +// Offset for Main Navigation +$('#main-nav').affix({ + offset: { + top: consts.NAVBAR_HEIGHT * 1.5 + } +}); diff --git a/theme/templates/projects.html b/theme/templates/projects.html index 0d3407d..3d35ed5 100644 --- a/theme/templates/projects.html +++ b/theme/templates/projects.html @@ -18,7 +18,7 @@ {{ article.content }} - {% if article.download_link or aricle.repo %} + {% if article.download_link or article.repo %}