Initial pages site
This commit is contained in:
2306
themes/spd/source/js/bootstrap.js
vendored
Normal file
2306
themes/spd/source/js/bootstrap.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7
themes/spd/source/js/bootstrap.min.js
vendored
Normal file
7
themes/spd/source/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
65
themes/spd/source/js/hux-blog.js
Normal file
65
themes/spd/source/js/hux-blog.js
Normal file
@@ -0,0 +1,65 @@
|
||||
/*!
|
||||
* Clean Blog v1.0.0 (http://startbootstrap.com)
|
||||
* Copyright 2015 Start Bootstrap
|
||||
* Licensed under Apache 2.0 (https://github.com/IronSummitMedia/startbootstrap/blob/gh-pages/LICENSE)
|
||||
*/
|
||||
|
||||
// Tooltip Init
|
||||
$(function() {
|
||||
$("[data-toggle='tooltip']").tooltip();
|
||||
});
|
||||
|
||||
|
||||
// make all images responsive
|
||||
/*
|
||||
* Unuse by Hux
|
||||
* actually only Portfolio-Pages can't use it and only post-img need it.
|
||||
* so I modify the _layout/post and CSS to make post-img responsive!
|
||||
*/
|
||||
// $(function() {
|
||||
// $("img").addClass("img-responsive");
|
||||
// });
|
||||
|
||||
// responsive tables
|
||||
$(document).ready(function() {
|
||||
$("table").wrap("<div class='table-responsive'></div>");
|
||||
$("table").addClass("table");
|
||||
});
|
||||
|
||||
// responsive embed videos
|
||||
$(document).ready(function () {
|
||||
$('iframe[src*="youtube.com"]').wrap('<div class="embed-responsive embed-responsive-16by9"></div>');
|
||||
$('iframe[src*="youtube.com"]').addClass('embed-responsive-item');
|
||||
$('iframe[src*="vimeo.com"]').wrap('<div class="embed-responsive embed-responsive-16by9"></div>');
|
||||
$('iframe[src*="vimeo.com"]').addClass('embed-responsive-item');
|
||||
});
|
||||
|
||||
// Navigation Scripts to Show Header on Scroll-Up
|
||||
jQuery(document).ready(function($) {
|
||||
var MQL = 1170;
|
||||
|
||||
//primary navigation slide-in effect
|
||||
if ($(window).width() > MQL) {
|
||||
var headerHeight = $('.navbar-custom').height();
|
||||
$(window).on('scroll', {
|
||||
previousTop: 0
|
||||
},
|
||||
function() {
|
||||
var currentTop = $(window).scrollTop();
|
||||
//check if user is scrolling up
|
||||
if (currentTop < this.previousTop) {
|
||||
//if scrolling up...
|
||||
if (currentTop > 0 && $('.navbar-custom').hasClass('is-fixed')) {
|
||||
$('.navbar-custom').addClass('is-visible');
|
||||
} else {
|
||||
$('.navbar-custom').removeClass('is-visible is-fixed');
|
||||
}
|
||||
} else {
|
||||
//if scrolling down...
|
||||
$('.navbar-custom').removeClass('is-visible');
|
||||
if (currentTop > headerHeight && !$('.navbar-custom').hasClass('is-fixed')) $('.navbar-custom').addClass('is-fixed');
|
||||
}
|
||||
this.previousTop = currentTop;
|
||||
});
|
||||
}
|
||||
});
|
6
themes/spd/source/js/hux-blog.min.js
vendored
Normal file
6
themes/spd/source/js/hux-blog.min.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* Hux Blog v1.0.0 (http://huxpro.github.io)
|
||||
* Copyright 2015 Hux
|
||||
*/
|
||||
|
||||
$(function(){$("[data-toggle='tooltip']").tooltip()}),$(document).ready(function(){$("table").wrap("<div class='table-responsive'></div>"),$("table").addClass("table")}),$(document).ready(function(){$('iframe[src*="youtube.com"]').wrap('<div class="embed-responsive embed-responsive-16by9"></div>'),$('iframe[src*="youtube.com"]').addClass("embed-responsive-item"),$('iframe[src*="vimeo.com"]').wrap('<div class="embed-responsive embed-responsive-16by9"></div>'),$('iframe[src*="vimeo.com"]').addClass("embed-responsive-item")}),jQuery(document).ready(function(a){var b=1170;if(a(window).width()>b){var c=a(".navbar-custom").height();a(window).on("scroll",{previousTop:0},function(){var b=a(window).scrollTop();b<this.previousTop?b>0&&a(".navbar-custom").hasClass("is-fixed")?a(".navbar-custom").addClass("is-visible"):a(".navbar-custom").removeClass("is-visible is-fixed"):(a(".navbar-custom").removeClass("is-visible"),b>c&&!a(".navbar-custom").hasClass("is-fixed")&&a(".navbar-custom").addClass("is-fixed")),this.previousTop=b})}});
|
9205
themes/spd/source/js/jquery.js
vendored
Normal file
9205
themes/spd/source/js/jquery.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4
themes/spd/source/js/jquery.min.js
vendored
Normal file
4
themes/spd/source/js/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
224
themes/spd/source/js/jquery.nav.js
Normal file
224
themes/spd/source/js/jquery.nav.js
Normal file
@@ -0,0 +1,224 @@
|
||||
/*
|
||||
* jQuery One Page Nav Plugin
|
||||
* http://github.com/davist11/jQuery-One-Page-Nav
|
||||
*
|
||||
* Copyright (c) 2010 Trevor Davis (http://trevordavis.net)
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* Uses the same license as jQuery, see:
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* @version 3.0.0
|
||||
*
|
||||
* Example usage:
|
||||
* $('#nav').onePageNav({
|
||||
* currentClass: 'current',
|
||||
* changeHash: false,
|
||||
* scrollSpeed: 750
|
||||
* });
|
||||
*/
|
||||
|
||||
;(function($, window, document, undefined){
|
||||
|
||||
// our plugin constructor
|
||||
var OnePageNav = function(elem, options){
|
||||
this.elem = elem;
|
||||
this.$elem = $(elem);
|
||||
this.options = options;
|
||||
this.metadata = this.$elem.data('plugin-options');
|
||||
this.$win = $(window);
|
||||
this.sections = {};
|
||||
this.didScroll = false;
|
||||
this.$doc = $(document);
|
||||
this.docHeight = this.$doc.height();
|
||||
};
|
||||
|
||||
// the plugin prototype
|
||||
OnePageNav.prototype = {
|
||||
defaults: {
|
||||
navItems: 'a',
|
||||
currentClass: 'current',
|
||||
changeHash: false,
|
||||
easing: 'swing',
|
||||
filter: '',
|
||||
scrollSpeed: 750,
|
||||
scrollThreshold: 0.5,
|
||||
begin: false,
|
||||
end: false,
|
||||
scrollChange: false,
|
||||
padding: 0
|
||||
},
|
||||
|
||||
init: function() {
|
||||
// Introduce defaults that can be extended either
|
||||
// globally or using an object literal.
|
||||
this.config = $.extend({}, this.defaults, this.options, this.metadata);
|
||||
|
||||
this.$nav = this.$elem.find(this.config.navItems);
|
||||
|
||||
//Filter any links out of the nav
|
||||
if(this.config.filter !== '') {
|
||||
this.$nav = this.$nav.filter(this.config.filter);
|
||||
}
|
||||
|
||||
//Handle clicks on the nav
|
||||
this.$nav.on('click.onePageNav', $.proxy(this.handleClick, this));
|
||||
|
||||
//Get the section positions
|
||||
this.getPositions();
|
||||
|
||||
//Handle scroll changes
|
||||
this.bindInterval();
|
||||
|
||||
//Update the positions on resize too
|
||||
this.$win.on('resize.onePageNav', $.proxy(this.getPositions, this));
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
adjustNav: function(self, $parent) {
|
||||
self.$elem.find('.' + self.config.currentClass).removeClass(self.config.currentClass);
|
||||
$parent.addClass(self.config.currentClass);
|
||||
},
|
||||
|
||||
bindInterval: function() {
|
||||
var self = this;
|
||||
var docHeight;
|
||||
|
||||
self.$win.on('scroll.onePageNav', function() {
|
||||
self.didScroll = true;
|
||||
});
|
||||
|
||||
self.t = setInterval(function() {
|
||||
docHeight = self.$doc.height();
|
||||
|
||||
//If it was scrolled
|
||||
if(self.didScroll) {
|
||||
self.didScroll = false;
|
||||
self.scrollChange();
|
||||
}
|
||||
|
||||
//If the document height changes
|
||||
if(docHeight !== self.docHeight) {
|
||||
self.docHeight = docHeight;
|
||||
self.getPositions();
|
||||
}
|
||||
}, 250);
|
||||
},
|
||||
|
||||
getHash: function($link) {
|
||||
return $link.attr('href').split('#')[1];
|
||||
},
|
||||
|
||||
getPositions: function() {
|
||||
var self = this;
|
||||
var linkHref;
|
||||
var topPos;
|
||||
var $target;
|
||||
|
||||
self.$nav.each(function() {
|
||||
linkHref = self.getHash($(this));
|
||||
$target = $('#' + linkHref);
|
||||
|
||||
if($target.length) {
|
||||
topPos = $target.offset().top;
|
||||
self.sections[linkHref] = Math.round(topPos);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getSection: function(windowPos) {
|
||||
var returnValue = null;
|
||||
var windowHeight = Math.round(this.$win.height() * this.config.scrollThreshold);
|
||||
|
||||
for(var section in this.sections) {
|
||||
if((this.sections[section] - windowHeight) < windowPos) {
|
||||
returnValue = section;
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
},
|
||||
|
||||
handleClick: function(e) {
|
||||
var self = this;
|
||||
var $link = $(e.currentTarget);
|
||||
var $parent = $link.parent();
|
||||
var newLoc = '#' + self.getHash($link);
|
||||
|
||||
if(!$parent.hasClass(self.config.currentClass)) {
|
||||
//Start callback
|
||||
if(self.config.begin) {
|
||||
self.config.begin();
|
||||
}
|
||||
|
||||
//Change the highlighted nav item
|
||||
self.adjustNav(self, $parent);
|
||||
|
||||
//Removing the auto-adjust on scroll
|
||||
self.unbindInterval();
|
||||
|
||||
//Scroll to the correct position
|
||||
self.scrollTo(newLoc, function() {
|
||||
//Do we need to change the hash?
|
||||
if(self.config.changeHash) {
|
||||
window.location.hash = newLoc;
|
||||
}
|
||||
|
||||
//Add the auto-adjust on scroll back in
|
||||
self.bindInterval();
|
||||
|
||||
//End callback
|
||||
if(self.config.end) {
|
||||
self.config.end();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
},
|
||||
|
||||
scrollChange: function() {
|
||||
var windowTop = this.$win.scrollTop();
|
||||
var position = this.getSection(windowTop);
|
||||
var $parent;
|
||||
|
||||
//If the position is set
|
||||
if(position !== null) {
|
||||
$parent = this.$elem.find('a[href$="#' + position + '"]').parent();
|
||||
|
||||
//If it's not already the current section
|
||||
if(!$parent.hasClass(this.config.currentClass)) {
|
||||
//Change the highlighted nav item
|
||||
this.adjustNav(this, $parent);
|
||||
|
||||
//If there is a scrollChange callback
|
||||
if(this.config.scrollChange) {
|
||||
this.config.scrollChange($parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
scrollTo: function(target, callback) {
|
||||
var offset = $(target).offset().top - this.config.padding;
|
||||
|
||||
$('html, body').animate({
|
||||
scrollTop: offset
|
||||
}, this.config.scrollSpeed, this.config.easing, callback);
|
||||
},
|
||||
|
||||
unbindInterval: function() {
|
||||
clearInterval(this.t);
|
||||
this.$win.unbind('scroll.onePageNav');
|
||||
}
|
||||
};
|
||||
|
||||
OnePageNav.defaults = OnePageNav.prototype.defaults;
|
||||
|
||||
$.fn.onePageNav = function(options) {
|
||||
return this.each(function() {
|
||||
new OnePageNav(this, options).init();
|
||||
});
|
||||
};
|
||||
|
||||
})( jQuery, window , document );
|
81
themes/spd/source/js/jquery.tagcloud.js
Normal file
81
themes/spd/source/js/jquery.tagcloud.js
Normal file
@@ -0,0 +1,81 @@
|
||||
(function($) {
|
||||
|
||||
$.fn.tagcloud = function(options) {
|
||||
var opts = $.extend({}, $.fn.tagcloud.defaults, options);
|
||||
tagWeights = this.map(function(){
|
||||
return $(this).attr("rel");
|
||||
});
|
||||
tagWeights = jQuery.makeArray(tagWeights).sort(compareWeights);
|
||||
lowest = tagWeights[0];
|
||||
highest = tagWeights.pop();
|
||||
range = highest - lowest;
|
||||
if(range === 0) {range = 1;}
|
||||
// Sizes
|
||||
if (opts.size) {
|
||||
fontIncr = (opts.size.end - opts.size.start)/range;
|
||||
}
|
||||
// Colors
|
||||
if (opts.color) {
|
||||
colorIncr = colorIncrement (opts.color, range);
|
||||
}
|
||||
return this.each(function() {
|
||||
weighting = $(this).attr("rel") - lowest;
|
||||
if (opts.size) {
|
||||
$(this).css({"font-size": opts.size.start + (weighting * fontIncr) + opts.size.unit});
|
||||
}
|
||||
if (opts.color) {
|
||||
// change color to background-color
|
||||
$(this).css({"backgroundColor": tagColor(opts.color, colorIncr, weighting)});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.tagcloud.defaults = {
|
||||
size: {start: 14, end: 18, unit: "pt"}
|
||||
};
|
||||
|
||||
// Converts hex to an RGB array
|
||||
function toRGB (code) {
|
||||
if (code.length == 4) {
|
||||
code = jQuery.map(/\w+/.exec(code), function(el) {return el + el; }).join("");
|
||||
}
|
||||
hex = /(\w{2})(\w{2})(\w{2})/.exec(code);
|
||||
return [parseInt(hex[1], 16), parseInt(hex[2], 16), parseInt(hex[3], 16)];
|
||||
}
|
||||
|
||||
// Converts an RGB array to hex
|
||||
function toHex (ary) {
|
||||
return "#" + jQuery.map(ary, function(i) {
|
||||
hex = i.toString(16);
|
||||
hex = (hex.length == 1) ? "0" + hex : hex;
|
||||
return hex;
|
||||
}).join("");
|
||||
}
|
||||
|
||||
function colorIncrement (color, range) {
|
||||
return jQuery.map(toRGB(color.end), function(n, i) {
|
||||
return (n - toRGB(color.start)[i])/range;
|
||||
});
|
||||
}
|
||||
|
||||
function tagColor (color, increment, weighting) {
|
||||
rgb = jQuery.map(toRGB(color.start), function(n, i) {
|
||||
ref = Math.round(n + (increment[i] * weighting));
|
||||
if (ref > 255) {
|
||||
ref = 255;
|
||||
} else {
|
||||
if (ref < 0) {
|
||||
ref = 0;
|
||||
}
|
||||
}
|
||||
return ref;
|
||||
});
|
||||
return toHex(rgb);
|
||||
}
|
||||
|
||||
function compareWeights(a, b)
|
||||
{
|
||||
return a - b;
|
||||
}
|
||||
|
||||
})(jQuery);
|
18
themes/spd/source/js/toc.js
Normal file
18
themes/spd/source/js/toc.js
Normal file
@@ -0,0 +1,18 @@
|
||||
var toc = document.getElementById('toc')
|
||||
|
||||
if (toc != null) {
|
||||
window.addEventListener("scroll", scrollcatelogHandler);
|
||||
var tocPosition = toc.offsetTop;
|
||||
var height_header = $("#signature").height();
|
||||
function scrollcatelogHandler(e) {
|
||||
var event = e || window.event,
|
||||
target = event.target || event.srcElement;
|
||||
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
||||
if (scrollTop > tocPosition -60) {
|
||||
toc.classList.add("toc-fixed");
|
||||
} else {
|
||||
toc.classList.remove("toc-fixed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
13
themes/spd/source/js/totop.js
Normal file
13
themes/spd/source/js/totop.js
Normal file
@@ -0,0 +1,13 @@
|
||||
$(window).scroll(function() {
|
||||
$(window).scrollTop() > $(window).height()*0.5 ? $("#backtotop").addClass("show") : $("#backtotop").removeClass("show");
|
||||
});
|
||||
|
||||
$("#backtotop").click(function() {
|
||||
$("#backtotop").addClass("launch");
|
||||
$("html, body").animate({
|
||||
scrollTop: 0
|
||||
}, 1000, function() {
|
||||
$("#backtotop").removeClass("show launch");
|
||||
});
|
||||
return false;
|
||||
});
|
Reference in New Issue
Block a user