Site Skeleton

This commit is contained in:
2019-09-05 14:38:10 +02:00
parent 62f9eaf019
commit 9185f3cf63
136 changed files with 91634 additions and 0 deletions

View File

@ -0,0 +1,173 @@
/*!
* bsCustomFileInput v1.3.2 (https://github.com/Johann-S/bs-custom-file-input)
* Copyright 2018 - 2019 Johann-S <johann.servoire@gmail.com>
* Licensed under MIT (https://github.com/Johann-S/bs-custom-file-input/blob/master/LICENSE)
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.bsCustomFileInput = factory());
}(this, function () {
'use strict';
var Selector = {
CUSTOMFILE: '.custom-file input[type="file"]',
CUSTOMFILELABEL: '.custom-file-label',
FORM: 'form',
INPUT: 'input'
};
var textNodeType = 3;
var getDefaultText = function getDefaultText(input) {
var defaultText = '';
var label = input.parentNode.querySelector(Selector.CUSTOMFILELABEL);
if (label) {
defaultText = label.innerHTML;
}
return defaultText;
};
var findFirstChildNode = function findFirstChildNode(element) {
if (element.childNodes.length > 0) {
var childNodes = [].slice.call(element.childNodes);
for (var i = 0; i < childNodes.length; i++) {
var node = childNodes[i];
if (node.nodeType !== textNodeType) {
return node;
}
}
}
return element;
};
var restoreDefaultText = function restoreDefaultText(input) {
var defaultText = input.bsCustomFileInput.defaultText;
var label = input.parentNode.querySelector(Selector.CUSTOMFILELABEL);
if (label) {
var element = findFirstChildNode(label);
element.innerHTML = defaultText;
}
};
var fileApi = !!window.File;
var FAKE_PATH = 'fakepath';
var FAKE_PATH_SEPARATOR = '\\';
var getSelectedFiles = function getSelectedFiles(input) {
if (input.hasAttribute('multiple') && fileApi) {
return [].slice.call(input.files).map(function (file) {
return file.name;
}).join(', ');
}
if (input.value.indexOf(FAKE_PATH) !== -1) {
var splittedValue = input.value.split(FAKE_PATH_SEPARATOR);
return splittedValue[splittedValue.length - 1];
}
return input.value;
};
function handleInputChange() {
var label = this.parentNode.querySelector(Selector.CUSTOMFILELABEL);
if (label) {
var element = findFirstChildNode(label);
var inputValue = getSelectedFiles(this);
if (inputValue.length) {
element.innerHTML = inputValue;
} else {
restoreDefaultText(this);
}
}
}
function handleFormReset() {
var customFileList = [].slice.call(this.querySelectorAll(Selector.INPUT)).filter(function (input) {
return !!input.bsCustomFileInput;
});
for (var i = 0, len = customFileList.length; i < len; i++) {
restoreDefaultText(customFileList[i]);
}
}
var customProperty = 'bsCustomFileInput';
var Event = {
FORMRESET: 'reset',
INPUTCHANGE: 'change'
};
var bsCustomFileInput = {
init: function init(inputSelector, formSelector) {
if (inputSelector === void 0) {
inputSelector = Selector.CUSTOMFILE;
}
if (formSelector === void 0) {
formSelector = Selector.FORM;
}
var customFileInputList = [].slice.call(document.querySelectorAll(inputSelector));
var formList = [].slice.call(document.querySelectorAll(formSelector));
for (var i = 0, len = customFileInputList.length; i < len; i++) {
var input = customFileInputList[i];
Object.defineProperty(input, customProperty, {
value: {
defaultText: getDefaultText(input)
},
writable: true
});
handleInputChange.call(input);
input.addEventListener(Event.INPUTCHANGE, handleInputChange);
}
for (var _i = 0, _len = formList.length; _i < _len; _i++) {
formList[_i].addEventListener(Event.FORMRESET, handleFormReset);
Object.defineProperty(formList[_i], customProperty, {
value: true,
writable: true
});
}
},
destroy: function destroy() {
var formList = [].slice.call(document.querySelectorAll(Selector.FORM)).filter(function (form) {
return !!form.bsCustomFileInput;
});
var customFileInputList = [].slice.call(document.querySelectorAll(Selector.INPUT)).filter(function (input) {
return !!input.bsCustomFileInput;
});
for (var i = 0, len = customFileInputList.length; i < len; i++) {
var input = customFileInputList[i];
restoreDefaultText(input);
input[customProperty] = undefined;
input.removeEventListener(Event.INPUTCHANGE, handleInputChange);
}
for (var _i2 = 0, _len2 = formList.length; _i2 < _len2; _i2++) {
formList[_i2].removeEventListener(Event.FORMRESET, handleFormReset);
formList[_i2][customProperty] = undefined;
}
}
};
return bsCustomFileInput;
}));
//# sourceMappingURL=bs-custom-file-input.js.map
document.addEventListener("DOMContentLoaded", function () {
bsCustomFileInput.init()
});

14456
mdb/js/modules/chart.js Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,27 @@
/*
Enhanced Bootstrap Modals
https://mdbootstrap.com
office@mdbootstrap.com
*/
(function($){
$('body').on('shown.bs.modal', '.modal', function() {
if(!$('.modal-backdrop').length) {
$modal_dialog = $(this).children('.modal-dialog')
if($modal_dialog.hasClass('modal-side')) {
$(this).addClass('modal-scrolling');
$('body').addClass('scrollable');
}
if($modal_dialog.hasClass('modal-frame')) {
$(this).addClass('modal-content-clickable');
$('body').addClass('scrollable');
}
}
});
$('body').on('hidden.bs.modal', '.modal', function() {
$('body').removeClass('scrollable');
});
})(jQuery);

173
mdb/js/modules/forms-free.js Executable file
View File

@ -0,0 +1,173 @@
"use strict";
var _this = void 0;
(function ($) {
var inputSelector = "".concat(['text', 'password', 'email', 'url', 'tel', 'number', 'search', 'search-md'].map(function (selector) {
return "input[type=".concat(selector, "]");
}).join(', '), ", textarea");
var textAreaSelector = '.materialize-textarea';
var updateTextFields = function updateTextFields($input) {
var $labelAndIcon = $input.siblings('label, i');
var hasValue = $input.val().length;
var hasPlaceholder = $input.attr('placeholder');
var addOrRemove = "".concat(hasValue || hasPlaceholder ? 'add' : 'remove', "Class");
$labelAndIcon[addOrRemove]('active');
};
var validateField = function validateField($input) {
if ($input.hasClass('validate')) {
var value = $input.val();
var noValue = !value.length;
var isValid = !$input[0].validity.badInput;
if (noValue && isValid) {
$input.removeClass('valid').removeClass('invalid');
} else {
var valid = $input.is(':valid');
var length = Number($input.attr('length')) || 0;
if (valid && (!length || length > value.length)) {
$input.removeClass('invalid').addClass('valid');
} else {
$input.removeClass('valid').addClass('invalid');
}
}
}
};
var textAreaAutoResize = function textAreaAutoResize() {
var $textarea = $(_this);
if ($textarea.val().length) {
var $hiddenDiv = $('.hiddendiv');
var fontFamily = $textarea.css('font-family');
var fontSize = $textarea.css('font-size');
if (fontSize) {
$hiddenDiv.css('font-size', fontSize);
}
if (fontFamily) {
$hiddenDiv.css('font-family', fontFamily);
}
if ($textarea.attr('wrap') === 'off') {
$hiddenDiv.css('overflow-wrap', 'normal').css('white-space', 'pre');
}
$hiddenDiv.text("".concat($textarea.val(), "\n"));
var content = $hiddenDiv.html().replace(/\n/g, '<br>');
$hiddenDiv.html(content); // When textarea is hidden, width goes crazy.
// Approximate with half of window size
$hiddenDiv.css('width', $textarea.is(':visible') ? $textarea.width() : $(window).width() / 2);
$textarea.css('height', $hiddenDiv.height());
}
};
$(inputSelector).each(function (index, input) {
var $this = $(input);
var $labelAndIcon = $this.siblings('label, i');
updateTextFields($this);
var isValid = input.validity.badInput;
if (isValid) {
$labelAndIcon.addClass('active');
}
});
$(document).on('focus', inputSelector, function (e) {
$(e.target).siblings('label, i').addClass('active');
});
$(document).on('blur', inputSelector, function (e) {
var $this = $(e.target);
var noValue = !$this.val();
var invalid = !e.target.validity.badInput;
var noPlaceholder = $this.attr('placeholder') === undefined;
if (noValue && invalid && noPlaceholder) {
$this.siblings('label, i').removeClass('active');
}
validateField($this);
});
$(document).on('change', inputSelector, function (e) {
var $this = $(e.target);
updateTextFields($this);
validateField($this);
});
$('input[autofocus]').siblings('label, i').addClass('active');
$(document).on('reset', function (e) {
var $formReset = $(e.target);
if ($formReset.is('form')) {
var $formInputs = $formReset.find(inputSelector);
$formInputs.removeClass('valid').removeClass('invalid').each(function (index, input) {
var $this = $(input);
var noDefaultValue = !$this.val();
var noPlaceholder = !$this.attr('placeholder');
if (noDefaultValue && noPlaceholder) {
$this.siblings('label, i').removeClass('active');
}
});
$formReset.find('select.initialized').each(function (index, select) {
var $select = $(select);
var $visibleInput = $select.siblings('input.select-dropdown');
var defaultValue = $select.children('[selected]').val();
$select.val(defaultValue);
$visibleInput.val(defaultValue);
});
}
});
function init() {
var $text = $('.md-textarea-auto');
if ($text.length) {
var observe;
if (window.attachEvent) {
observe = function observe(element, event, handler) {
element.attachEvent("on".concat(event), handler);
};
} else {
observe = function observe(element, event, handler) {
element.addEventListener(event, handler, false);
};
}
$text.each(function () {
var self = this;
function resize() {
self.style.height = 'auto';
self.style.height = "".concat(self.scrollHeight, "px");
}
function delayedResize() {
window.setTimeout(resize, 0);
}
observe(self, 'change', resize);
observe(self, 'cut', delayedResize);
observe(self, 'paste', delayedResize);
observe(self, 'drop', delayedResize);
observe(self, 'keydown', delayedResize);
resize();
});
}
}
init();
var $body = $('body');
if (!$('.hiddendiv').first().length) {
var $hiddenDiv = $('<div class="hiddendiv common"></div>');
$body.append($hiddenDiv);
}
$(textAreaSelector).each(textAreaAutoResize);
$body.on('keyup keydown', textAreaSelector, textAreaAutoResize);
})(jQuery);

205
mdb/js/modules/jquery.easing.js Executable file
View File

@ -0,0 +1,205 @@
/*
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*
* Uses the built in easing capabilities added In jQuery 1.1
* to offer multiple easing options
*
* TERMS OF USE - jQuery Easing
*
* Open source under the BSD License.
*
* Copyright © 2008 George McGinley Smith
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];
jQuery.extend( jQuery.easing,
{
def: 'easeOutQuad',
swing: function (x, t, b, c, d) {
//alert(jQuery.easing.default);
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
},
easeInQuad: function (x, t, b, c, d) {
return c*(t/=d)*t + b;
},
easeOutQuad: function (x, t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
},
easeInOutQuad: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2) - 1) + b;
},
easeInCubic: function (x, t, b, c, d) {
return c*(t/=d)*t*t + b;
},
easeOutCubic: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t + 1) + b;
},
easeInOutCubic: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
},
easeInQuart: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t + b;
},
easeOutQuart: function (x, t, b, c, d) {
return -c * ((t=t/d-1)*t*t*t - 1) + b;
},
easeInOutQuart: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
return -c/2 * ((t-=2)*t*t*t - 2) + b;
},
easeInQuint: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t*t + b;
},
easeOutQuint: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t*t*t + 1) + b;
},
easeInOutQuint: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
},
easeInSine: function (x, t, b, c, d) {
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
},
easeOutSine: function (x, t, b, c, d) {
return c * Math.sin(t/d * (Math.PI/2)) + b;
},
easeInOutSine: function (x, t, b, c, d) {
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
},
easeInExpo: function (x, t, b, c, d) {
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
},
easeOutExpo: function (x, t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
},
easeInOutExpo: function (x, t, b, c, d) {
if (t==0) return b;
if (t==d) return b+c;
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
},
easeInCirc: function (x, t, b, c, d) {
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
},
easeOutCirc: function (x, t, b, c, d) {
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
},
easeInOutCirc: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
},
easeInElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
},
easeOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
},
easeInOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
},
easeInBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
},
easeOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
},
easeInOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
},
easeInBounce: function (x, t, b, c, d) {
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
},
easeOutBounce: function (x, t, b, c, d) {
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
} else if (t < (2/2.75)) {
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
} else {
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}
},
easeInOutBounce: function (x, t, b, c, d) {
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
}
});
/*
*
* TERMS OF USE - EASING EQUATIONS
*
* Open source under the BSD License.
*
* Copyright © 2001 Robert Penner
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* Neither the name of the author nor the names of contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/

View File

@ -0,0 +1,16 @@
"use strict";
(function ($) {
var SCROLLING_NAVBAR_OFFSET_TOP = 50;
$(window).on('scroll', function () {
var $navbar = $('.navbar');
if ($navbar.length) {
if ($navbar.offset().top > SCROLLING_NAVBAR_OFFSET_TOP) {
$('.scrolling-navbar').addClass('top-nav-collapse');
} else {
$('.scrolling-navbar').removeClass('top-nav-collapse');
}
}
});
})(jQuery);

View File

@ -0,0 +1,67 @@
"use strict";
(function ($) {
$.fn.mdbTreeview = function () {
var $this = $(this);
if ($this.hasClass('treeview')) {
var $toggler = $this.find('.rotate');
$.each($toggler, function (e) {
$($toggler[e]).off('click');
$($toggler[e]).on('click', function () {
var $this = $(this);
$this.siblings('.nested').toggleClass('active');
$this.toggleClass('down');
});
});
}
if ($this.hasClass('treeview-animated')) {
var $elements = $this.find('.treeview-animated-element');
var $closed = $this.find('.closed');
$this.find('.nested').hide();
$closed.off('click');
$closed.on('click', function () {
var $this = $(this);
var $target = $this.siblings('.nested');
var $pointer = $this.children('.fa-angle-right');
$this.toggleClass('open');
$pointer.toggleClass('down');
!$target.hasClass('active') ? $target.addClass('active').slideDown() : $target.removeClass('active').slideUp();
return false;
});
$elements.off('click');
$elements.on('click', function () {
var $this = $(this);
$this.hasClass('opened') ? $this.removeClass('opened') : ($elements.removeClass('opened'), $this.addClass('opened'));
});
}
if ($this.hasClass('treeview-colorful')) {
var _$elements = $this.find('.treeview-colorful-element');
var $header = $this.find('.treeview-colorful-items-header');
$this.find('.nested').hide();
$header.off('click');
$header.on('click', function () {
var $this = $(this);
var $target = $this.siblings('.nested');
var $pointerPlus = $this.children('.fa-plus-circle');
var $pointerMinus = $this.children('.fa-minus-circle');
$this.toggleClass('open');
$pointerPlus.removeClass('fa-plus-circle');
$pointerPlus.addClass('fa-minus-circle');
$pointerMinus.removeClass('fa-minus-circle');
$pointerMinus.addClass('fa-plus-circle');
!$target.hasClass('active') ? $target.addClass('active').slideDown() : $target.removeClass('active').slideUp();
});
_$elements.off('click');
_$elements.on('click', function () {
var $this = $(this);
$this.hasClass('opened') ? _$elements.removeClass('opened') : (_$elements.removeClass('opened'), $this.addClass('opened'));
});
}
};
})(jQuery);

File diff suppressed because one or more lines are too long

5
mdb/js/modules/velocity.min.js vendored Executable file

File diff suppressed because one or more lines are too long

609
mdb/js/modules/waves.js Executable file
View File

@ -0,0 +1,609 @@
/*!
* Waves v0.7.6
* http://fian.my.id/Waves
*
* Copyright 2014-2018 Alfiana E. Sibuea and other contributors
* Released under the MIT license
* https://github.com/fians/Waves/blob/master/LICENSE
*/
(function (window, factory) {
'use strict';
// AMD. Register as an anonymous module. Wrap in function so we have access
// to root via `this`.
if (typeof define === 'function' && define.amd) {
define([], function () {
window.Waves = factory.call(window);
return window.Waves;
});
}
// Node. Does not work with strict CommonJS, but only CommonJS-like
// environments that support module.exports, like Node.
else if (typeof exports === 'object') {
module.exports = factory.call(window);
}
// Browser globals.
else {
window.Waves = factory.call(window);
}
})(typeof window === 'object' ? window : this, function () {
'use strict';
var Waves = Waves || {};
var $$ = document.querySelectorAll.bind(document);
var toString = Object.prototype.toString;
var isTouchAvailable = 'ontouchstart' in window;
// Find exact position of element
function isWindow(obj) {
return obj !== null && obj === obj.window;
}
function getWindow(elem) {
return isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView;
}
function isObject(value) {
var type = typeof value;
return type === 'function' || type === 'object' && !!value;
}
function isDOMNode(obj) {
return isObject(obj) && obj.nodeType > 0;
}
function getWavesElements(nodes) {
var stringRepr = toString.call(nodes);
if (stringRepr === '[object String]') {
return $$(nodes);
} else if (isObject(nodes) && /^\[object (Array|HTMLCollection|NodeList|Object)\]$/.test(stringRepr) && nodes.hasOwnProperty('length')) {
return nodes;
} else if (isDOMNode(nodes)) {
return [nodes];
}
return [];
}
function offset(elem) {
var docElem, win,
box = {
top: 0,
left: 0
},
doc = elem && elem.ownerDocument;
docElem = doc.documentElement;
if (typeof elem.getBoundingClientRect !== typeof undefined) {
box = elem.getBoundingClientRect();
}
win = getWindow(doc);
return {
top: box.top + win.pageYOffset - docElem.clientTop,
left: box.left + win.pageXOffset - docElem.clientLeft
};
}
function convertStyle(styleObj) {
var style = '';
for (var prop in styleObj) {
if (styleObj.hasOwnProperty(prop)) {
style += (prop + ':' + styleObj[prop] + ';');
}
}
return style;
}
var Effect = {
// Effect duration
duration: 750,
// Effect delay (check for scroll before showing effect)
delay: 200,
show: function (e, element, velocity) {
// Disable right click
if (e.button === 2) {
return false;
}
element = element || this;
// Create ripple
var ripple = document.createElement('div');
ripple.className = 'waves-ripple waves-rippling';
element.appendChild(ripple);
// Get click coordinate and element width
var pos = offset(element);
var relativeY = 0;
var relativeX = 0;
// Support for touch devices
if ('touches' in e && e.touches.length) {
relativeY = (e.touches[0].pageY - pos.top);
relativeX = (e.touches[0].pageX - pos.left);
}
//Normal case
else {
relativeY = (e.pageY - pos.top);
relativeX = (e.pageX - pos.left);
}
// Support for synthetic events
relativeX = relativeX >= 0 ? relativeX : 0;
relativeY = relativeY >= 0 ? relativeY : 0;
var scale = 'scale(' + ((element.clientWidth / 100) * 3) + ')';
var translate = 'translate(0,0)';
if (velocity) {
translate = 'translate(' + (velocity.x) + 'px, ' + (velocity.y) + 'px)';
}
// Attach data to element
ripple.setAttribute('data-hold', Date.now());
ripple.setAttribute('data-x', relativeX);
ripple.setAttribute('data-y', relativeY);
ripple.setAttribute('data-scale', scale);
ripple.setAttribute('data-translate', translate);
// Set ripple position
var rippleStyle = {
top: relativeY + 'px',
left: relativeX + 'px'
};
ripple.classList.add('waves-notransition');
ripple.setAttribute('style', convertStyle(rippleStyle));
ripple.classList.remove('waves-notransition');
// Scale the ripple
rippleStyle['-webkit-transform'] = scale + ' ' + translate;
rippleStyle['-moz-transform'] = scale + ' ' + translate;
rippleStyle['-ms-transform'] = scale + ' ' + translate;
rippleStyle['-o-transform'] = scale + ' ' + translate;
rippleStyle.transform = scale + ' ' + translate;
rippleStyle.opacity = '1';
var duration = e.type === 'mousemove' ? 2500 : Effect.duration;
rippleStyle['-webkit-transition-duration'] = duration + 'ms';
rippleStyle['-moz-transition-duration'] = duration + 'ms';
rippleStyle['-o-transition-duration'] = duration + 'ms';
rippleStyle['transition-duration'] = duration + 'ms';
ripple.setAttribute('style', convertStyle(rippleStyle));
},
hide: function (e, element) {
element = element || this;
var ripples = element.getElementsByClassName('waves-rippling');
for (var i = 0, len = ripples.length; i < len; i++) {
removeRipple(e, element, ripples[i]);
}
if (isTouchAvailable) {
element.removeEventListener('touchend', Effect.hide);
element.removeEventListener('touchcancel', Effect.hide);
}
element.removeEventListener('mouseup', Effect.hide);
element.removeEventListener('mouseleave', Effect.hide);
}
};
/**
* Collection of wrapper for HTML element that only have single tag
* like <input> and <img>
*/
var TagWrapper = {
// Wrap <input> tag so it can perform the effect
input: function (element) {
var parent = element.parentNode;
// If input already have parent just pass through
if (parent.tagName.toLowerCase() === 'span' && parent.classList.contains('waves-effect')) {
return;
}
// Put element class and style to the specified parent
var wrapper = document.createElement('span');
wrapper.className = 'waves-input-wrapper';
// element.className = 'waves-button-input';
// Put element as child
parent.replaceChild(wrapper, element);
wrapper.appendChild(element);
},
// Wrap <img> tag so it can perform the effect
img: function (element) {
var parent = element.parentNode;
// If input already have parent just pass through
if (parent.tagName.toLowerCase() === 'i' && parent.classList.contains('waves-effect')) {
return;
}
// Put element as child
var wrapper = document.createElement('i');
parent.replaceChild(wrapper, element);
wrapper.appendChild(element);
}
};
/**
* Hide the effect and remove the ripple. Must be
* a separate function to pass the JSLint...
*/
function removeRipple(e, el, ripple) {
// Check if the ripple still exist
if (!ripple) {
return;
}
ripple.classList.remove('waves-rippling');
var relativeX = ripple.getAttribute('data-x');
var relativeY = ripple.getAttribute('data-y');
var scale = ripple.getAttribute('data-scale');
var translate = ripple.getAttribute('data-translate');
// Get delay beetween mousedown and mouse leave
var diff = Date.now() - Number(ripple.getAttribute('data-hold'));
var delay = 350 - diff;
if (delay < 0) {
delay = 0;
}
if (e.type === 'mousemove') {
delay = 150;
}
// Fade out ripple after delay
var duration = e.type === 'mousemove' ? 2500 : Effect.duration;
setTimeout(function () {
var style = {
top: relativeY + 'px',
left: relativeX + 'px',
opacity: '0',
// Duration
'-webkit-transition-duration': duration + 'ms',
'-moz-transition-duration': duration + 'ms',
'-o-transition-duration': duration + 'ms',
'transition-duration': duration + 'ms',
'-webkit-transform': scale + ' ' + translate,
'-moz-transform': scale + ' ' + translate,
'-ms-transform': scale + ' ' + translate,
'-o-transform': scale + ' ' + translate,
'transform': scale + ' ' + translate
};
ripple.setAttribute('style', convertStyle(style));
setTimeout(function () {
try {
el.removeChild(ripple);
} catch (e) {
return false;
}
}, duration);
}, delay);
}
/**
* Disable mousedown event for 500ms during and after touch
*/
var TouchHandler = {
/* uses an integer rather than bool so there's no issues with
* needing to clear timeouts if another touch event occurred
* within the 500ms. Cannot mouseup between touchstart and
* touchend, nor in the 500ms after touchend. */
touches: 0,
allowEvent: function (e) {
var allow = true;
if (/^(mousedown|mousemove)$/.test(e.type) && TouchHandler.touches) {
allow = false;
}
return allow;
},
registerEvent: function (e) {
var eType = e.type;
if (eType === 'touchstart') {
TouchHandler.touches += 1; // push
} else if (/^(touchend|touchcancel)$/.test(eType)) {
setTimeout(function () {
if (TouchHandler.touches) {
TouchHandler.touches -= 1; // pop after 500ms
}
}, 500);
}
}
};
/**
* Delegated click handler for .waves-effect element.
* returns null when .waves-effect element not in "click tree"
*/
function getWavesEffectElement(e) {
if (TouchHandler.allowEvent(e) === false) {
return null;
}
var element = null;
var target = e.target || e.srcElement;
while (target.parentElement) {
if ((!(target instanceof SVGElement)) && target.classList.contains('waves-effect')) {
element = target;
break;
}
target = target.parentElement;
}
return element;
}
/**
* Bubble the click and show effect if .waves-effect elem was found
*/
function showEffect(e) {
// Disable effect if element has "disabled" property on it
// In some cases, the event is not triggered by the current element
// if (e.target.getAttribute('disabled') !== null) {
// return;
// }
var element = getWavesEffectElement(e);
if (element !== null) {
// Make it sure the element has either disabled property, disabled attribute or 'disabled' class
if (element.disabled || element.getAttribute('disabled') || element.classList.contains('disabled')) {
return;
}
TouchHandler.registerEvent(e);
if (e.type === 'touchstart' && Effect.delay) {
var hidden = false;
var timer = setTimeout(function () {
timer = null;
Effect.show(e, element);
}, Effect.delay);
var hideEffect = function (hideEvent) {
// if touch hasn't moved, and effect not yet started: start effect now
if (timer) {
clearTimeout(timer);
timer = null;
Effect.show(e, element);
}
if (!hidden) {
hidden = true;
Effect.hide(hideEvent, element);
}
removeListeners();
};
var touchMove = function (moveEvent) {
if (timer) {
clearTimeout(timer);
timer = null;
}
hideEffect(moveEvent);
removeListeners();
};
element.addEventListener('touchmove', touchMove, false);
element.addEventListener('touchend', hideEffect, false);
element.addEventListener('touchcancel', hideEffect, false);
var removeListeners = function () {
element.removeEventListener('touchmove', touchMove);
element.removeEventListener('touchend', hideEffect);
element.removeEventListener('touchcancel', hideEffect);
};
} else {
Effect.show(e, element);
if (isTouchAvailable) {
element.addEventListener('touchend', Effect.hide, false);
element.addEventListener('touchcancel', Effect.hide, false);
}
element.addEventListener('mouseup', Effect.hide, false);
element.addEventListener('mouseleave', Effect.hide, false);
}
}
}
Waves.init = function (options) {
var body = document.body;
options = options || {};
if ('duration' in options) {
Effect.duration = options.duration;
}
if ('delay' in options) {
Effect.delay = options.delay;
}
if (isTouchAvailable) {
body.addEventListener('touchstart', showEffect, false);
body.addEventListener('touchcancel', TouchHandler.registerEvent, false);
body.addEventListener('touchend', TouchHandler.registerEvent, false);
}
body.addEventListener('mousedown', showEffect, false);
};
/**
* Attach Waves to dynamically loaded inputs, or add .waves-effect and other
* waves classes to a set of elements. Set drag to true if the ripple mouseover
* or skimming effect should be applied to the elements.
*/
Waves.attach = function (elements, classes) {
elements = getWavesElements(elements);
if (toString.call(classes) === '[object Array]') {
classes = classes.join(' ');
}
classes = classes ? ' ' + classes : '';
var element, tagName;
for (var i = 0, len = elements.length; i < len; i++) {
element = elements[i];
tagName = element.tagName.toLowerCase();
if (['input', 'img'].indexOf(tagName) !== -1) {
TagWrapper[tagName](element);
element = element.parentElement;
}
if (element.className.indexOf('waves-effect') === -1) {
element.className += ' waves-effect' + classes;
}
}
};
/**
* Cause a ripple to appear in an element via code.
*/
Waves.ripple = function (elements, options) {
elements = getWavesElements(elements);
var elementsLen = elements.length;
options = options || {};
options.wait = options.wait || 0;
options.position = options.position || null; // default = centre of element
if (elementsLen) {
var element, pos, off, centre = {},
i = 0;
var mousedown = {
type: 'mousedown',
button: 1
};
var hideRipple = function (mouseup, element) {
return function () {
Effect.hide(mouseup, element);
};
};
for (; i < elementsLen; i++) {
element = elements[i];
pos = options.position || {
x: element.clientWidth / 2,
y: element.clientHeight / 2
};
off = offset(element);
centre.x = off.left + pos.x;
centre.y = off.top + pos.y;
mousedown.pageX = centre.x;
mousedown.pageY = centre.y;
Effect.show(mousedown, element);
if (options.wait >= 0 && options.wait !== null) {
var mouseup = {
type: 'mouseup',
button: 1
};
setTimeout(hideRipple(mouseup, element), options.wait);
}
}
}
};
/**
* Remove all ripples from an element.
*/
Waves.calm = function (elements) {
elements = getWavesElements(elements);
var mouseup = {
type: 'mouseup',
button: 1
};
for (var i = 0, len = elements.length; i < len; i++) {
Effect.hide(mouseup, elements[i]);
}
};
/**
* Deprecated API fallback
*/
Waves.displayEffect = function (options) {
console.error('Waves.displayEffect() has been deprecated and will be removed in future version. Please use Waves.init() to initialize Waves effect');
Waves.init(options);
};
return Waves;
});
$(document).ready(function () {
//Initialization
Waves.attach('.btn:not(.btn-flat), .btn-floating', ['waves-light']);
Waves.attach('.btn-flat', ['waves-effect']);
Waves.attach('.chip', ['waves-effect']);
Waves.attach('.view a .mask', ['waves-light']);
Waves.attach('.waves-light', ['waves-light']);
Waves.attach('.navbar-nav a:not(.navbar-brand), .nav-icons li a, .nav-tabs .nav-item:not(.dropdown)', ['waves-light']);
Waves.attach('.pager li a', ['waves-light']);
Waves.attach('.pagination .page-item .page-link', ['waves-effect']);
Waves.init();
});

208
mdb/js/modules/wow.js Executable file
View File

@ -0,0 +1,208 @@
'use strict';
var WOW;
(function ($) {
WOW = function WOW() {
return {
init: function init() {
var animationName = [];
var once = 1;
function mdbWow() {
var windowHeight = window.innerHeight;
var scroll = window.scrollY;
$('.wow').each(function () {
if ($(this).css('visibility') == 'visible') {
return;
}
if (windowHeight + scroll - 100 > getOffset(this) && scroll < getOffset(this) || windowHeight + scroll - 100 > getOffset(this) + $(this).height() && scroll < getOffset(this) + $(this).height() || windowHeight + scroll == $(document).height() && getOffset(this) + 100 > $(document).height()) {
var index = $(this).index('.wow');
var delay = $(this).attr('data-wow-delay');
if (delay) {
delay = $(this).attr('data-wow-delay').slice(0, -1
);
var self = this;
var timeout = parseFloat(delay) * 1000;
$(self).addClass('animated');
$(self).css({
'visibility': 'visible'
});
$(self).css({
'animation-delay': delay
});
$(self).css({
'animation-name': animationName[index]
});
var removeTime = $(this).css('animation-duration').slice(0, -1) * 1000;
if ($(this).attr('data-wow-delay')) {
removeTime += $(this).attr('data-wow-delay').slice(0, -1) * 1000;
}
var self = this;
setTimeout(function () {
$(self).removeClass('animated');
}, removeTime);
} else {
$(this).addClass('animated');
$(this).css({
'visibility': 'visible'
});
$(this).css({
'animation-name': animationName[index]
});
var removeTime = $(this).css('animation-duration').slice(0, -1) * 1000;
var self = this;
setTimeout(function () {
$(self).removeClass('animated');
}, removeTime);
}
}
});
}
function appear() {
$('.wow').each(function () {
var index = $(this).index('.wow');
var delay = $(this).attr('data-wow-delay');
if (delay) {
delay = $(this).attr('data-wow-delay').slice(0, -1);
var timeout = parseFloat(delay) * 1000;
$(this).addClass('animated');
$(this).css({
'visibility': 'visible'
});
$(this).css({
'animation-delay': delay + 's'
});
$(this).css({
'animation-name': animationName[index]
});
} else {
$(this).addClass('animated');
$(this).css({
'visibility': 'visible'
});
$(this).css({
'animation-name': animationName[index]
});
}
});
}
function hide() {
var windowHeight = window.innerHeight;
var scroll = window.scrollY;
$('.wow.animated').each(function () {
if (windowHeight + scroll - 100 > getOffset(this) && scroll > getOffset(this) + 100 || windowHeight + scroll - 100 < getOffset(this) && scroll < getOffset(this) + 100 || getOffset(this) + $(this).height > $(document).height() - 100) {
$(this).removeClass('animated');
$(this).css({
'animation-name': 'none'
});
$(this).css({
'visibility': 'hidden'
});
} else {
var removeTime = $(this).css('animation-duration').slice(0, -1) * 1000;
if ($(this).attr('data-wow-delay')) {
removeTime += $(this).attr('data-wow-delay').slice(0, -1) * 1000;
}
var self = this;
setTimeout(function () {
$(self).removeClass('animated');
}, removeTime);
}
});
mdbWow();
once--;
}
function getOffset(elem) {
var box = elem.getBoundingClientRect();
var body = document.body;
var docEl = document.documentElement;
var scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop;
var clientTop = docEl.clientTop || body.clientTop || 0;
var top = box.top + scrollTop - clientTop;
return Math.round(top);
}
$('.wow').each(function () {
$(this).css({
'visibility': 'hidden'
});
animationName[$(this).index('.wow')] = $(this).css('animation-name');
$(this).css({
'animation-name': 'none'
});
});
$(window).scroll(function () {
if (once) {
hide();
} else {
mdbWow();
}
});
appear();
}
};
};
})(jQuery);