cleanup js
This commit is contained in:
parent
df987c1181
commit
f0bb73e1e1
6 changed files with 54 additions and 43 deletions
|
@ -17,7 +17,6 @@
|
||||||
"bootstrap-sass": "=3.3.7",
|
"bootstrap-sass": "=3.3.7",
|
||||||
"font-awesome": "=4.7.0",
|
"font-awesome": "=4.7.0",
|
||||||
"jquery": "=3.1.1",
|
"jquery": "=3.1.1",
|
||||||
"jquery.easing": "=1.4.1",
|
|
||||||
"tstatic": "RealOrangeOne/tstatic",
|
"tstatic": "RealOrangeOne/tstatic",
|
||||||
"underscore": "=1.8.3",
|
"underscore": "=1.8.3",
|
||||||
"wow.js": "=1.2.2"
|
"wow.js": "=1.2.2"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
require('./creative');
|
require('./creative');
|
||||||
var ansi_up = require('ansi_up');
|
var ansi_up = require('ansi_up');
|
||||||
|
var consts = require('./consts');
|
||||||
|
|
||||||
|
|
||||||
$('.image').each(function () { // setup div-image hybrids
|
$('.image').each(function () { // setup div-image hybrids
|
||||||
|
@ -17,3 +18,15 @@ $('.ansi-up').each(function () {
|
||||||
var ele = $(this);
|
var ele = $(this);
|
||||||
ele.html(ansi_up.ansi_to_html(ele.html()));
|
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();
|
||||||
|
});
|
||||||
|
|
4
theme/static/src/js/consts.js
Normal file
4
theme/static/src/js/consts.js
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
module.exports = {
|
||||||
|
NAVBAR_HEIGHT: $('#main-nav').height(),
|
||||||
|
SCROLL_SPEED: 750
|
||||||
|
};
|
|
@ -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
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,8 +1,41 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
require('jquery.easing');
|
|
||||||
require('./creative');
|
|
||||||
|
|
||||||
var WOW = require('wow.js');
|
var WOW = require('wow.js');
|
||||||
|
var consts = require('../consts');
|
||||||
|
|
||||||
new WOW().init();
|
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
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
{{ article.content }}
|
{{ article.content }}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
{% if article.download_link or aricle.repo %}
|
{% if article.download_link or article.repo %}
|
||||||
<section class="text-center">
|
<section class="text-center">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
|
|
Reference in a new issue