This commit is contained in:
2025-04-23 10:45:21 +02:00
parent 8030ffb888
commit d17fb46943
716 changed files with 163468 additions and 0 deletions

View File

@@ -0,0 +1,160 @@
// variables
var $body = $('body'),
$html = $('html'),
$window = $(window),
$document = $(document),
$header_main = $('#header_main'),
header_main_height = $header_main.height(),
easing_swiftOut = [ 0.35,0,0.25,1 ];
bez_easing_swiftOut = $.bez(easing_swiftOut);
/* Detect hi-res devices */
function isHighDensity() {
return ((window.matchMedia && (window.matchMedia('only screen and (min-resolution: 124dpi), only screen and (min-resolution: 1.3dppx), only screen and (min-resolution: 48.8dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3)').matches)) || (window.devicePixelRatio && window.devicePixelRatio > 1.3));
}
/*
* Dynamically loading an external JavaScript or CSS file
* http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml
*/
function loadjscssfile(b,c){if("js"==c){var a=document.createElement("script");a.setAttribute("type","text/javascript");a.setAttribute("src",b)}else"css"==c&&(a=document.createElement("link"),a.setAttribute("rel","stylesheet"),a.setAttribute("type","text/css"),a.setAttribute("href",b));"undefined"!=typeof a&&document.getElementsByTagName("head")[0].appendChild(a)};
/* detect touch devices */
function isTouchDevice() {
return 'ontouchstart' in document.documentElement;
}
$(function() {
// header main
altair_header_main.init();
// inputs
altair_md.init();
});
$window.on('load',function () {
if(isHighDensity()) {
loadjscssfile("bower_components/dense/src/dense.js", "js");
// enable hires images
$('img').dense({
glue: "@"
});
}
});
altair_header_main = {
init: function () {
// sticky header
altair_header_main.sticky_header();
// main navigation
altair_header_main.main_navigation();
},
sticky_header: function () {
$body.addClass('header_sticky');
$(window).on("scroll touchmove", function () {
$body.toggleClass('header_shadow', $(document).scrollTop() > 0);
});
},
main_navigation: function() {
$('#main_navigation').onePageNav({
currentClass: 'current_active',
changeHash: false,
scrollSpeed: 840,
scrollThreshold: 0.4,
filter: '',
scrollOffset: -header_main_height,
easing: bez_easing_swiftOut,
begin: function() {
//Hack so you can click other menu items after the initial click (IOS)
//$('body').append('<div id="device-dummy" style="height: 1px;"></div>');
},
end: function() {
$('#device-dummy').remove();
},
scrollChange: function($currentListItem) {
//I get fired when you enter a section and I pass the list item of the section
}
});
}
};
altair_md = {
init: function () {
altair_md.inputs();
},
inputs: function(parent) {
var $mdInput = (typeof parent === 'undefined') ? $('.md-input') : $(parent).find('.md-input');
$mdInput.each(function() {
if(!$(this).closest('.md-input-wrapper').length) {
var $this = $(this),
extraClass = '';
if($this.is('[class*="uk-form-width-"]')) {
var elClasses = $this.attr('class').split (' ');
for(var i = 0; i < elClasses.length; i++){
var classPart = elClasses[i].substr(0,14);
if(classPart == "uk-form-width-"){
var extraClass = elClasses[i];
}
}
}
if( $this.prev('label').length ) {
$this.prev('label').addBack().wrapAll('<div class="md-input-wrapper"/>');
} else if($this.siblings('[data-uk-form-password]').length) {
$this.siblings('[data-uk-form-password]').addBack().wrapAll('<div class="md-input-wrapper"/>');
} else {
$this.wrap('<div class="md-input-wrapper"/>');
}
$this.closest('.md-input-wrapper').append('<span class="md-input-bar '+extraClass+'"/>');
altair_md.update_input($this);
}
$body
.on('focus', '.md-input', function() {
$(this).closest('.md-input-wrapper').addClass('md-input-focus')
})
.on('blur', '.md-input', function() {
$(this).closest('.md-input-wrapper').removeClass('md-input-focus');
if(!$(this).hasClass('label-fixed')) {
if($(this).val() != '') {
$(this).closest('.md-input-wrapper').addClass('md-input-filled')
} else {
$(this).closest('.md-input-wrapper').removeClass('md-input-filled')
}
}
})
.on('change', '.md-input', function() {
altair_md.update_input($(this));
});
})
},
update_input: function(object) {
// clear wrapper classes
object.closest('.uk-input-group').removeClass('uk-input-group-danger uk-input-group-success');
object.closest('.md-input-wrapper').removeClass('md-input-wrapper-danger md-input-wrapper-success md-input-wrapper-disabled');
if(object.hasClass('md-input-danger')) {
if(object.closest('.uk-input-group').length) {
object.closest('.uk-input-group').addClass('uk-input-group-danger')
}
object.closest('.md-input-wrapper').addClass('md-input-wrapper-danger')
}
if(object.hasClass('md-input-success')) {
if(object.closest('.uk-input-group').length) {
object.closest('.uk-input-group').addClass('uk-input-group-success')
}
object.closest('.md-input-wrapper').addClass('md-input-wrapper-success')
}
if(object.prop('disabled')) {
object.closest('.md-input-wrapper').addClass('md-input-wrapper-disabled')
}
if(object.hasClass('label-fixed')) {
object.closest('.md-input-wrapper').addClass('md-input-filled')
}
if(object.val() != '') {
object.closest('.md-input-wrapper').addClass('md-input-filled')
}
}
};

1
assets/js/altair_lp_common.min.js vendored Normal file
View File

@@ -0,0 +1 @@
var $body=$("body"),$html=$("html"),$window=$(window),$document=$(document),$header_main=$("#header_main"),header_main_height=$header_main.height(),easing_swiftOut=[.35,0,.25,1];function isHighDensity(){return window.matchMedia&&(window.matchMedia("only screen and (min-resolution: 124dpi), only screen and (min-resolution: 1.3dppx), only screen and (min-resolution: 48.8dpcm)").matches||window.matchMedia("only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3)").matches)||window.devicePixelRatio&&1.3<window.devicePixelRatio}function loadjscssfile(e,i){if("js"==i){var t=document.createElement("script");t.setAttribute("type","text/javascript"),t.setAttribute("src",e)}else"css"==i&&((t=document.createElement("link")).setAttribute("rel","stylesheet"),t.setAttribute("type","text/css"),t.setAttribute("href",e));void 0!==t&&document.getElementsByTagName("head")[0].appendChild(t)}function isTouchDevice(){return"ontouchstart"in document.documentElement}bez_easing_swiftOut=$.bez(easing_swiftOut),$(function(){altair_header_main.init(),altair_md.init()}),$window.on("load",function(){isHighDensity()&&(loadjscssfile("bower_components/dense/src/dense.js","js"),$("img").dense({glue:"@"}))}),altair_header_main={init:function(){altair_header_main.sticky_header(),altair_header_main.main_navigation()},sticky_header:function(){$body.addClass("header_sticky"),$(window).on("scroll touchmove",function(){$body.toggleClass("header_shadow",0<$(document).scrollTop())})},main_navigation:function(){$("#main_navigation").onePageNav({currentClass:"current_active",changeHash:!1,scrollSpeed:840,scrollThreshold:.4,filter:"",scrollOffset:-header_main_height,easing:bez_easing_swiftOut,begin:function(){},end:function(){$("#device-dummy").remove()},scrollChange:function(e){}})}},altair_md={init:function(){altair_md.inputs()},inputs:function(e){(void 0===e?$(".md-input"):$(e).find(".md-input")).each(function(){if(!$(this).closest(".md-input-wrapper").length){var e=$(this),i="";if(e.is('[class*="uk-form-width-"]'))for(var t=e.attr("class").split(" "),n=0;n<t.length;n++){if("uk-form-width-"==t[n].substr(0,14))i=t[n]}e.prev("label").length?e.prev("label").addBack().wrapAll('<div class="md-input-wrapper"/>'):e.siblings("[data-uk-form-password]").length?e.siblings("[data-uk-form-password]").addBack().wrapAll('<div class="md-input-wrapper"/>'):e.wrap('<div class="md-input-wrapper"/>'),e.closest(".md-input-wrapper").append('<span class="md-input-bar '+i+'"/>'),altair_md.update_input(e)}$body.on("focus",".md-input",function(){$(this).closest(".md-input-wrapper").addClass("md-input-focus")}).on("blur",".md-input",function(){$(this).closest(".md-input-wrapper").removeClass("md-input-focus"),$(this).hasClass("label-fixed")||(""!=$(this).val()?$(this).closest(".md-input-wrapper").addClass("md-input-filled"):$(this).closest(".md-input-wrapper").removeClass("md-input-filled"))}).on("change",".md-input",function(){altair_md.update_input($(this))})})},update_input:function(e){e.closest(".uk-input-group").removeClass("uk-input-group-danger uk-input-group-success"),e.closest(".md-input-wrapper").removeClass("md-input-wrapper-danger md-input-wrapper-success md-input-wrapper-disabled"),e.hasClass("md-input-danger")&&(e.closest(".uk-input-group").length&&e.closest(".uk-input-group").addClass("uk-input-group-danger"),e.closest(".md-input-wrapper").addClass("md-input-wrapper-danger")),e.hasClass("md-input-success")&&(e.closest(".uk-input-group").length&&e.closest(".uk-input-group").addClass("uk-input-group-success"),e.closest(".md-input-wrapper").addClass("md-input-wrapper-success")),e.prop("disabled")&&e.closest(".md-input-wrapper").addClass("md-input-wrapper-disabled"),e.hasClass("label-fixed")&&e.closest(".md-input-wrapper").addClass("md-input-filled"),""!=e.val()&&e.closest(".md-input-wrapper").addClass("md-input-filled")}};

10870
assets/js/common.js Normal file

File diff suppressed because it is too large Load Diff

1
assets/js/common.min.js vendored Normal file

File diff suppressed because one or more lines are too long

399
assets/js/custom/dense.js Normal file
View File

@@ -0,0 +1,399 @@
/**
* Dense - Device pixel ratio aware images
*
* @link http://dense.rah.pw
* @license MIT
*/
/*
* Copyright (C) 2013 Jukka Svahn
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* @name jQuery
* @class
*/
/**
* @name fn
* @class
* @memberOf jQuery
*/
(function (factory)
{
'use strict';
if (typeof define === 'function' && define.amd)
{
define(['jquery'], factory);
}
else
{
factory(window.jQuery || window.Zepto);
}
}(function ($)
{
'use strict';
/**
* An array of checked image URLs.
*/
var pathStack = [],
/**
* Methods.
*/
methods = {},
/**
* Regular expression to check whether the URL has a protocol.
*
* Is used to check whether the image URL is external.
*/
regexHasProtocol = /^([a-z]:)?\/\//i,
/**
* Regular expression that split extensions from the file.
*
* Is used to inject the DPR suffix to the name.
*/
regexSuffix = /\.\w+$/,
/**
* Device pixel ratio.
*/
devicePixelRatio;
/**
* Init is the default method responsible for rendering
* a pixel-ratio-aware images.
*
* This method is used to select the images that
* should display retina-size images on high pixel ratio
* devices. Dense defaults to the init method if no
* method is specified.
*
* When attached to an image, the correct image variation is
* selected based on the device's pixel ratio. If the image element
* defines <code>data-{ratio}x</code> attributes (e.g. data-1x, data-2x, data-3x),
* the most appropriate of those is selected.
*
* If no data-ratio attributes are defined, the retina image is
* constructed from the <code>src</code> attribute.
* The searched high pixel ratio images follows
* a <code>{imageName}_{ratio}x.{ext}</code> naming convention.
* For an image found in /path/to/images/image.jpg, the 2x retina
* image would be looked from /path/to/images/image_2x.jpg.
*
* When image is constructed from the src, the image existance is
* verified using HTTP HEAD request, if <code>ping</code> option is
* <code>true</code>. The check makes sure no HTTP error code is returned,
* and that the received content-type is of an image. Vector image formats,
* like svg, are skipped based on the file extension.
*
* This method can also be used to load image in semi-lazy fashion,
* and avoid larger extra HTTP requests due to retina replacements.
* The data-1x attribute can be used to supstitute the src, making
* sure the browser doesn't try to download the normal image variation
* before the JavaScript driven behaviour kicks in.
*
* Some classes are added to the selected elements while Dense is processing
* the document. These classes include <code>dense-image</code>, <code>dense-loading</code>
* and <code>dense-ready</code>. These classes can be used to style the images,
* or hide them while they are being loaded.
*
* @param {Object} [options={}] Options
* @param {Boolean} [options.ping=null] Check image existence. If the default <code>NULL</code> checks local images, <code>FALSE</code> disables checking and <code>TRUE</code> checks even external images cross-domain
* @param {String} [options.dimensions=preserve] What to do with the image's <code>width</code> and <code>height</code> attributes. Either <code>update</code>, <code>remove</code> or <code>preserve</code>
* @param {String} [options.glue=_] String that glues the retina "nx" suffix to the image. This option can be used to change the naming convention between the two commonly used practices, <code>image@2x.jpg</code> and <code>image_2x.jpg</code>
* @param {Array} [options.skipExtensions=['svg']] Skipped image file extensions. There might be situations where you might want to exclude vector image formats
* @return {Object} this
* @method init
* @memberof jQuery.fn.dense
* @fires jQuery.fn.dense#denseRetinaReady.dense
* @example
* $('img').dense({
* ping: false,
* dimension: 'update'
* });
*/
methods.init = function (options)
{
options = $.extend({
ping: null,
dimensions: 'preserve',
glue: '_',
skipExtensions: ['svg']
}, options);
this.each(function ()
{
var $this = $(this);
if (!$this.is('img') || $this.hasClass('dense-image'))
{
return;
}
$this.addClass('dense-image dense-loading');
var image = methods.getImageAttribute.call(this),
originalImage = $this.attr('src'),
ping = false,
updateImage;
if (!image)
{
if (!originalImage || devicePixelRatio === 1 || $.inArray(originalImage.split('.').pop().split(/[\?\#]/).shift(), options.skipExtensions) !== -1)
{
$this.removeClass('dense-image dense-loading');
return;
}
image = originalImage.replace(regexSuffix, function (extension)
{
var pixelRatio = $this.attr('data-dense-cap') ? $this.attr('data-dense-cap') : devicePixelRatio;
return options.glue + pixelRatio + 'x' + extension;
});
ping = options.ping !== false && $.inArray(image, pathStack) === -1 && (options.ping === true || !regexHasProtocol.test(image) || image.indexOf('//'+document.domain) === 0 || image.indexOf(document.location.protocol+'//'+document.domain) === 0);
}
updateImage = function ()
{
var readyImage = function ()
{
$this.removeClass('dense-loading').addClass('dense-ready').trigger('denseRetinaReady.dense');
};
$this.attr('src', image);
if (options.dimensions === 'update')
{
$this.dense('updateDimensions').one('denseDimensionChanged', readyImage);
}
else
{
if (options.dimensions === 'remove')
{
$this.removeAttr('width height');
}
readyImage();
}
};
if (ping)
{
$.ajax({
url : image,
type : 'HEAD'
})
.done(function (data, textStatus, jqXHR)
{
var type = jqXHR.getResponseHeader('Content-type');
if (!type || type.indexOf('image/') === 0)
{
pathStack.push(image);
updateImage();
}
});
}
else
{
updateImage();
}
});
return this;
};
/**
* Sets an image's width and height attributes to its native values.
*
* Updates an img element's dimensions to the source image's
* real values. This method is asynchronous, so you can not directly
* return its values. Instead, use the 'dense-dimensions-updated'
* event to detect when the action is done.
*
* @return {Object} this
* @method updateDimensions
* @memberof jQuery.fn.dense
* @fires jQuery.fn.dense#denseDimensionChanged.dense
* @example
* var image = $('img').dense('updateDimensions');
*/
methods.updateDimensions = function ()
{
return this.each(function ()
{
var img, $this = $(this), src = $this.attr('src');
if (src)
{
img = new Image();
img.src = src;
$(img).on('load.dense', function ()
{
$this.attr({
width: img.width,
height: img.height
}).trigger('denseDimensionChanged.dense');
});
}
});
};
/**
* Gets device pixel ratio rounded up to the closest integer.
*
* @return {Integer} The pixel ratio
* @method devicePixelRatio
* @memberof jQuery.fn.dense
* @example
* var ratio = $(window).dense('devicePixelRatio');
* alert(ratio);
*/
methods.devicePixelRatio = function ()
{
var pixelRatio = 1;
if ($.type(window.devicePixelRatio) !== 'undefined')
{
pixelRatio = window.devicePixelRatio;
}
else if ($.type(window.matchMedia) !== 'undefined')
{
$.each([1.3, 2, 3, 4, 5, 6], function (key, ratio)
{
var mediaQuery = [
'(-webkit-min-device-pixel-ratio: '+ratio+')',
'(min-resolution: '+Math.floor(ratio*96)+'dpi)',
'(min-resolution: '+ratio+'dppx)'
].join(',');
if (!window.matchMedia(mediaQuery).matches)
{
return false;
}
pixelRatio = ratio;
});
}
return Math.ceil(pixelRatio);
};
/**
* Gets an appropriate URL for the pixel ratio from the data attribute list.
*
* Selects the most appropriate <code>data-{ratio}x</code> attribute from
* the given element's attributes. If the devices pixel ratio is greater
* than the largest specified image, the largest one of the available is used.
*
* @return {String|Boolean} The attribute value
* @method getImageAttribute
* @memberof jQuery.fn.dense
* @example
* var image = $('<div data-1x="image.jpg" data-2x="image_2x.jpg" />').dense('getImageAttribute');
* $('body').css('background-image', 'url(' + image + ')');
*/
methods.getImageAttribute = function ()
{
var $this = $(this).eq(0), image = false, url;
for (var i = 1; i <= devicePixelRatio; i++)
{
url = $this.attr('data-' + i + 'x');
if (url)
{
image = url;
}
}
return image;
};
devicePixelRatio = methods.devicePixelRatio();
/**
* Dense offers few methods and options that can be used to both customize the
* plugin's functionality and return resulting values. All interaction is done through
* the <code>$.fn.dense()</code> method, that accepts a called method and its options
* object as its arguments. Both arguments are optional, and either one can be omitted.
*
* @param {String} [method=init] The called method
* @param {Object} [options={}] Options passed to the method
* @class dense
* @memberof jQuery.fn
*/
$.fn.dense = function (method, options)
{
if ($.type(method) !== 'string' || $.type(methods[method]) !== 'function')
{
options = method;
method = 'init';
}
return methods[method].call(this, options);
};
/**
* Initialize automatically when document is ready.
*
* Dense is initialized automatically if the body element
* has a <code>dense-retina</code> class.
*/
$(function ()
{
$('body.dense-retina img').dense();
});
/**
* This event is invoked when a retina image has finished loading.
*
* @event jQuery.fn.dense#denseRetinaReady.dense
* @type {Object}
*/
/**
* This event is invoked when an image's dimension values
* have been updated by the <code>updateDimensions</code>
* method.
*
* @event jQuery.fn.dense#denseDimensionChanged.dense
* @type {Object}
*/
}));

1
assets/js/custom/dense.min.js vendored Normal file
View File

@@ -0,0 +1 @@
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):e(window.jQuery||window.Zepto)}(function(e){"use strict";var n,i=[],t={},a=/^([a-z]:)?\/\//i;t.init=function(d){return d=e.extend({ping:null,dimensions:"preserve",glue:"_",skipExtensions:["svg"]},d),this.each(function(){var s=e(this);if(s.is("img")&&!s.hasClass("dense-image")){s.addClass("dense-image dense-loading");var o,r=t.getImageAttribute.call(this),u=s.attr("src"),c=!1;if(!r){if(!u||1===n||-1!==e.inArray(u.split(".").pop().split(/[\?\#]/).shift(),d.skipExtensions))return void s.removeClass("dense-image dense-loading");r=u.replace(/\.\w+$/,function(e){var i=s.attr("data-dense-cap")?s.attr("data-dense-cap"):n;return d.glue+i+"x"+e}),c=!1!==d.ping&&-1===e.inArray(r,i)&&(!0===d.ping||!a.test(r)||0===r.indexOf("//"+document.domain)||0===r.indexOf(document.location.protocol+"//"+document.domain))}o=function(){var e=function(){s.removeClass("dense-loading").addClass("dense-ready").trigger("denseRetinaReady.dense")};s.attr("src",r),"update"===d.dimensions?s.dense("updateDimensions").one("denseDimensionChanged",e):("remove"===d.dimensions&&s.removeAttr("width height"),e())},c?e.ajax({url:r,type:"HEAD"}).done(function(e,n,t){var a=t.getResponseHeader("Content-type");a&&0!==a.indexOf("image/")||(i.push(r),o())}):o()}}),this},t.updateDimensions=function(){return this.each(function(){var n,i=e(this),t=i.attr("src");t&&(n=new Image,n.src=t,e(n).on("load.dense",function(){i.attr({width:n.width,height:n.height}).trigger("denseDimensionChanged.dense")}))})},t.devicePixelRatio=function(){var n=1;return"undefined"!==e.type(window.devicePixelRatio)?n=window.devicePixelRatio:"undefined"!==e.type(window.matchMedia)&&e.each([1.3,2,3,4,5,6],function(e,i){var t=["(-webkit-min-device-pixel-ratio: "+i+")","(min-resolution: "+Math.floor(96*i)+"dpi)","(min-resolution: "+i+"dppx)"].join(",");if(!window.matchMedia(t).matches)return!1;n=i}),Math.ceil(n)},t.getImageAttribute=function(){for(var i,t=e(this).eq(0),a=!1,d=1;d<=n;d++)(i=t.attr("data-"+d+"x"))&&(a=i);return a},n=t.devicePixelRatio(),e.fn.dense=function(n,i){return"string"===e.type(n)&&"function"===e.type(t[n])||(i=n,n="init"),t[n].call(this,i)},e(function(){e("body.dense-retina img").dense()})});

View File

@@ -0,0 +1,258 @@
/*
* 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: '',
scrollOffset: 0,
scrollSpeed: 750,
scrollThreshold: 0.5,
begin: false,
end: false,
scrollChange: false
},
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);
// Sort Sections by Position
this.sections = this.sortSectionsByPosition(this.sections);
for(var section in this.sections) {
if((this.sections[section] - windowHeight) < windowPos) {
returnValue = section;
}
}
return returnValue;
},
/**
* Sort Sections by its position value
* based on http://am.aurlien.net/post/1221493460/sorting-javascript-objects
* @param {Object} obj Object to sort
* @return {Object} sorted Object
*/
sortSectionsByPosition: function (obj) {
var tempArray = [];
var tempObj = {};
// Transform Object in Array
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
tempArray.push(key);
}
}
tempArray.sort(function(a,b) {
var x = obj[a];
var y = obj[b];
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
});
// Transform sorted tempArray back into Object
for (var i=0; i<tempArray.length; i++) {
tempObj[tempArray[i]] = obj[tempArray[i]];
}
return tempObj;
},
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;
$('html, body').animate({
scrollTop: offset + this.config.scrollOffset
}, 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 );

1
assets/js/custom/jquery.nav.min.js vendored Normal file
View File

@@ -0,0 +1 @@
!function(t,n,i,s){var e=function(s,e){this.elem=s,this.$elem=t(s),this.options=e,this.metadata=this.$elem.data("plugin-options"),this.$win=t(n),this.sections={},this.didScroll=!1,this.$doc=t(i),this.docHeight=this.$doc.height()};e.prototype={defaults:{navItems:"a",currentClass:"current",changeHash:!1,easing:"swing",filter:"",scrollOffset:0,scrollSpeed:750,scrollThreshold:.5,begin:!1,end:!1,scrollChange:!1},init:function(){return this.config=t.extend({},this.defaults,this.options,this.metadata),this.$nav=this.$elem.find(this.config.navItems),""!==this.config.filter&&(this.$nav=this.$nav.filter(this.config.filter)),this.$nav.on("click.onePageNav",t.proxy(this.handleClick,this)),this.getPositions(),this.bindInterval(),this.$win.on("resize.onePageNav",t.proxy(this.getPositions,this)),this},adjustNav:function(t,n){t.$elem.find("."+t.config.currentClass).removeClass(t.config.currentClass),n.addClass(t.config.currentClass)},bindInterval:function(){var t,n=this;n.$win.on("scroll.onePageNav",function(){n.didScroll=!0}),n.t=setInterval(function(){t=n.$doc.height(),n.didScroll&&(n.didScroll=!1,n.scrollChange()),t!==n.docHeight&&(n.docHeight=t,n.getPositions())},250)},getHash:function(t){return t.attr("href").split("#")[1]},getPositions:function(){var n,i,s,e=this;e.$nav.each(function(){n=e.getHash(t(this)),s=t("#"+n),s.length&&(i=s.offset().top,e.sections[n]=Math.round(i))})},getSection:function(t){var n=null,i=Math.round(this.$win.height()*this.config.scrollThreshold);this.sections=this.sortSectionsByPosition(this.sections);for(var s in this.sections)this.sections[s]-i<t&&(n=s);return n},sortSectionsByPosition:function(t){var n=[],i={};for(var s in t)t.hasOwnProperty(s)&&n.push(s);n.sort(function(n,i){var s=t[n],e=t[i];return e>s?-1:s>e?1:0});for(var e=0;e<n.length;e++)i[n[e]]=t[n[e]];return i},handleClick:function(i){var s=this,e=t(i.currentTarget),o=e.parent(),a="#"+s.getHash(e);o.hasClass(s.config.currentClass)||(s.config.begin&&s.config.begin(),s.adjustNav(s,o),s.unbindInterval(),s.scrollTo(a,function(){s.config.changeHash&&(n.location.hash=a),s.bindInterval(),s.config.end&&s.config.end()})),i.preventDefault()},scrollChange:function(){var t,n=this.$win.scrollTop(),i=this.getSection(n);null!==i&&(t=this.$elem.find('a[href$="#'+i+'"]').parent(),t.hasClass(this.config.currentClass)||(this.adjustNav(this,t),this.config.scrollChange&&this.config.scrollChange(t)))},scrollTo:function(n,i){var s=t(n).offset().top;t("html, body").animate({scrollTop:s+this.config.scrollOffset},this.config.scrollSpeed,this.config.easing,i)},unbindInterval:function(){clearInterval(this.t),this.$win.unbind("scroll.onePageNav")}},e.defaults=e.prototype.defaults,t.fn.onePageNav=function(t){return this.each(function(){new e(this,t).init()})}}(jQuery,window,document);

View File

@@ -0,0 +1,101 @@
// http://getuikit.com/docs/documentation_javascript.html#js-override
if (typeof UIkit !== 'undefined') {
UIkit.on('beforeready.uk.dom', function () {
// accrodion
if (typeof UIkit.components.accordion !== "undefined") { // check if accordion component is defined
$.extend(UIkit.components.accordion.prototype.defaults, {
easing: $.bez(easing_swiftOut),
duration: 200
});
}
// dropdown
if (typeof UIkit.components.dropdown.prototype !== "undefined") { // check if dropdown component is defined
$.extend(UIkit.components.dropdown.prototype.defaults, {
remaintime: 150,
delay: 50
});
(function() {
var old_show_function = UIkit.components.dropdown.prototype.show;
UIkit.components.dropdown.prototype.show = function() {
this.dropdown
.css({
'min-width': this.dropdown.outerWidth()
})
.addClass('uk-dropdown-active uk-dropdown-shown');
return old_show_function.apply(this, arguments);
}
})();
(function() {
var old_hide_function = UIkit.components.dropdown.prototype.hide;
UIkit.components.dropdown.prototype.hide = function() {
var this_dropdown = this.dropdown;
this_dropdown.removeClass('uk-dropdown-shown');
var dropdown_timeout = setTimeout(function() {
this_dropdown.removeClass('uk-dropdown-active')
},280);
return old_hide_function.apply(this, arguments);
}
})();
}
// modal
if (typeof UIkit.components.modal !== "undefined") { // check if modal component is defined
$.extend(UIkit.components.modal.prototype.defaults, {
center: true
});
UIkit.modal.dialog.template = '<div class="uk-modal uk-modal-dialog-replace"><div class="uk-modal-dialog" style="min-height:0;"></div></div>';
$body
.on('show.uk.modal', '.uk-modal-dialog-replace', function () {
// customize uikit dialog
setTimeout(function () {
var dialogReplace = $('.uk-modal-dialog-replace');
if (dialogReplace.find('.uk-button-primary').length) {
var actionBtn = dialogReplace.find('.uk-button-primary').toggleClass('uk-button-primary md-btn-flat-primary');
if (actionBtn.next('button')) {
actionBtn.next('button').after(actionBtn);
}
}
if (dialogReplace.find('.uk-button').length) {
dialogReplace.find('.uk-button').toggleClass('uk-button md-btn md-btn-flat');
}
if (dialogReplace.find('.uk-margin-small-top').length) {
dialogReplace.find('.uk-margin-small-top').toggleClass('uk-margin-small-top uk-margin-top');
}
if (dialogReplace.find('input.uk-width-1-1').length) {
dialogReplace.find('input.uk-width-1-1').toggleClass('uk-width-1-1 md-input');
// reinitialize md inputs
altair_md.inputs();
}
if (dialogReplace.find('.uk-form').length) {
dialogReplace.find('.uk-form').removeClass('uk-form');
}
}, 50)
});
}
// tooltip
if (typeof UIkit.components.tooltip !== "undefined") { // check if tooltip component is defined
$.extend(UIkit.components.tooltip.prototype.defaults, {
animation: 280,
offset: 8
});
}
});
}

View File

@@ -0,0 +1 @@
"undefined"!=typeof UIkit&&UIkit.on("beforeready.uk.dom",function(){"undefined"!=typeof UIkit.components.accordion&&$.extend(UIkit.components.accordion.prototype.defaults,{easing:$.bez(easing_swiftOut),duration:200}),"undefined"!=typeof UIkit.components.dropdown.prototype&&($.extend(UIkit.components.dropdown.prototype.defaults,{remaintime:150,delay:50}),function(){var t=UIkit.components.dropdown.prototype.show;UIkit.components.dropdown.prototype.show=function(){return this.dropdown.css({"min-width":this.dropdown.outerWidth()}).addClass("uk-dropdown-active uk-dropdown-shown"),t.apply(this,arguments)}}(),function(){var t=UIkit.components.dropdown.prototype.hide;UIkit.components.dropdown.prototype.hide=function(){var o=this.dropdown;o.removeClass("uk-dropdown-shown");setTimeout(function(){o.removeClass("uk-dropdown-active")},280);return t.apply(this,arguments)}}()),"undefined"!=typeof UIkit.components.modal&&($.extend(UIkit.components.modal.prototype.defaults,{center:!0}),UIkit.modal.dialog.template='<div class="uk-modal uk-modal-dialog-replace"><div class="uk-modal-dialog" style="min-height:0;"></div></div>',$body.on("show.uk.modal",".uk-modal-dialog-replace",function(){setTimeout(function(){var t=$(".uk-modal-dialog-replace");if(t.find(".uk-button-primary").length){var o=t.find(".uk-button-primary").toggleClass("uk-button-primary md-btn-flat-primary");o.next("button")&&o.next("button").after(o)}t.find(".uk-button").length&&t.find(".uk-button").toggleClass("uk-button md-btn md-btn-flat"),t.find(".uk-margin-small-top").length&&t.find(".uk-margin-small-top").toggleClass("uk-margin-small-top uk-margin-top"),t.find("input.uk-width-1-1").length&&(t.find("input.uk-width-1-1").toggleClass("uk-width-1-1 md-input"),altair_md.inputs()),t.find(".uk-form").length&&t.find(".uk-form").removeClass("uk-form")},50)})),"undefined"!=typeof UIkit.components.tooltip&&$.extend(UIkit.components.tooltip.prototype.defaults,{animation:280,offset:8})});

6955
assets/js/uikit_custom.js Normal file

File diff suppressed because it is too large Load Diff

1
assets/js/uikit_custom.min.js vendored Normal file

File diff suppressed because one or more lines are too long