initial commit
This commit is contained in:
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* jQuery.appear
|
||||
* https://github.com/bas2k/jquery.appear/
|
||||
* http://code.google.com/p/jquery-appear/
|
||||
* http://bas2k.ru/
|
||||
*
|
||||
* Copyright (c) 2009 Michael Hixson
|
||||
* Copyright (c) 2012-2014 Alexander Brovikov
|
||||
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
(function($) {
|
||||
$.fn.appear = function(fn, options) {
|
||||
|
||||
var settings = $.extend({
|
||||
|
||||
//arbitrary data to pass to fn
|
||||
data: undefined,
|
||||
|
||||
//call fn only on the first appear?
|
||||
one: true,
|
||||
|
||||
// X & Y accuracy
|
||||
accX: 0,
|
||||
accY: 0
|
||||
|
||||
}, options);
|
||||
|
||||
return this.each(function() {
|
||||
|
||||
var t = $(this);
|
||||
|
||||
//whether the element is currently visible
|
||||
t.appeared = false;
|
||||
|
||||
if (!fn) {
|
||||
|
||||
//trigger the custom event
|
||||
t.trigger('appear', settings.data);
|
||||
return;
|
||||
}
|
||||
|
||||
var w = $(window);
|
||||
|
||||
//fires the appear event when appropriate
|
||||
var check = function() {
|
||||
|
||||
//is the element hidden?
|
||||
if (!t.is(':visible')) {
|
||||
|
||||
//it became hidden
|
||||
t.appeared = false;
|
||||
return;
|
||||
}
|
||||
|
||||
//is the element inside the visible window?
|
||||
var a = w.scrollLeft();
|
||||
var b = w.scrollTop();
|
||||
var o = t.offset();
|
||||
var x = o.left;
|
||||
var y = o.top;
|
||||
|
||||
var ax = settings.accX;
|
||||
var ay = settings.accY;
|
||||
var th = t.height();
|
||||
var wh = w.height();
|
||||
var tw = t.width();
|
||||
var ww = w.width();
|
||||
|
||||
if (y + th + ay >= b &&
|
||||
y <= b + wh + ay &&
|
||||
x + tw + ax >= a &&
|
||||
x <= a + ww + ax) {
|
||||
|
||||
//trigger the custom event
|
||||
if (!t.appeared) t.trigger('appear', settings.data);
|
||||
|
||||
} else {
|
||||
|
||||
//it scrolled out of view
|
||||
t.appeared = false;
|
||||
}
|
||||
};
|
||||
|
||||
//create a modified fn with some additional logic
|
||||
var modifiedFn = function() {
|
||||
|
||||
//mark the element as visible
|
||||
t.appeared = true;
|
||||
|
||||
//is this supposed to happen only once?
|
||||
if (settings.one) {
|
||||
|
||||
//remove the check
|
||||
w.unbind('scroll', check);
|
||||
var i = $.inArray(check, $.fn.appear.checks);
|
||||
if (i >= 0) $.fn.appear.checks.splice(i, 1);
|
||||
}
|
||||
|
||||
//trigger the original fn
|
||||
fn.apply(this, arguments);
|
||||
};
|
||||
|
||||
//bind the modified fn to the element
|
||||
if (settings.one) t.one('appear', settings.data, modifiedFn);
|
||||
else t.bind('appear', settings.data, modifiedFn);
|
||||
|
||||
//check whenever the window scrolls
|
||||
w.scroll(check);
|
||||
|
||||
//check whenever the dom changes
|
||||
$.fn.appear.checks.push(check);
|
||||
|
||||
//check now
|
||||
(check)();
|
||||
});
|
||||
};
|
||||
|
||||
//keep a queue of appearance checks
|
||||
$.extend($.fn.appear, {
|
||||
|
||||
checks: [],
|
||||
timeout: null,
|
||||
|
||||
//process the queue
|
||||
checkAll: function() {
|
||||
var length = $.fn.appear.checks.length;
|
||||
if (length > 0) while (length--) ($.fn.appear.checks[length])();
|
||||
},
|
||||
|
||||
//check the queue asynchronously
|
||||
run: function() {
|
||||
if ($.fn.appear.timeout) clearTimeout($.fn.appear.timeout);
|
||||
$.fn.appear.timeout = setTimeout($.fn.appear.checkAll, 20);
|
||||
}
|
||||
});
|
||||
|
||||
//run checks when these methods are called
|
||||
$.each(['append', 'prepend', 'after', 'before', 'attr',
|
||||
'removeAttr', 'addClass', 'removeClass', 'toggleClass',
|
||||
'remove', 'css', 'show', 'hide'], function(i, n) {
|
||||
var old = $.fn[n];
|
||||
if (old) {
|
||||
$.fn[n] = function() {
|
||||
var r = old.apply(this, arguments);
|
||||
$.fn.appear.run();
|
||||
return r;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
7
hamrokhaanpaan/wp-content/themes/stnews-theme/assets/js/bootstrap.min.js
vendored
Normal file
7
hamrokhaanpaan/wp-content/themes/stnews-theme/assets/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,17 @@
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
$('.color-trigger').on('click', function () {
|
||||
$(this).parent().toggleClass('visible-palate');
|
||||
});
|
||||
|
||||
$('.color-palate .colors-list .palate').on('click', function() {
|
||||
var newThemeColor = $(this).attr('data-theme-file');
|
||||
var targetCSSFile = $('link[id="theme-color-file"]');
|
||||
$(targetCSSFile).attr('href',newThemeColor);
|
||||
$('.color-palate .colors-list .palate').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
});
|
||||
|
||||
|
||||
}(jQuery));
|
326
hamrokhaanpaan/wp-content/themes/stnews-theme/assets/js/html5.js
Normal file
326
hamrokhaanpaan/wp-content/themes/stnews-theme/assets/js/html5.js
Normal file
@@ -0,0 +1,326 @@
|
||||
/**
|
||||
* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||
*/
|
||||
;(function(window, document) {
|
||||
/*jshint evil:true */
|
||||
/** version */
|
||||
var version = '3.7.3';
|
||||
|
||||
/** Preset options */
|
||||
var options = window.html5 || {};
|
||||
|
||||
/** Used to skip problem elements */
|
||||
var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
|
||||
|
||||
/** Not all elements can be cloned in IE **/
|
||||
var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;
|
||||
|
||||
/** Detect whether the browser supports default html5 styles */
|
||||
var supportsHtml5Styles;
|
||||
|
||||
/** Name of the expando, to work with multiple documents or to re-shiv one document */
|
||||
var expando = '_html5shiv';
|
||||
|
||||
/** The id for the the documents expando */
|
||||
var expanID = 0;
|
||||
|
||||
/** Cached data for each document */
|
||||
var expandoData = {};
|
||||
|
||||
/** Detect whether the browser supports unknown elements */
|
||||
var supportsUnknownElements;
|
||||
|
||||
(function() {
|
||||
try {
|
||||
var a = document.createElement('a');
|
||||
a.innerHTML = '<xyz></xyz>';
|
||||
//if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles
|
||||
supportsHtml5Styles = ('hidden' in a);
|
||||
|
||||
supportsUnknownElements = a.childNodes.length == 1 || (function() {
|
||||
// assign a false positive if unable to shiv
|
||||
(document.createElement)('a');
|
||||
var frag = document.createDocumentFragment();
|
||||
return (
|
||||
typeof frag.cloneNode == 'undefined' ||
|
||||
typeof frag.createDocumentFragment == 'undefined' ||
|
||||
typeof frag.createElement == 'undefined'
|
||||
);
|
||||
}());
|
||||
} catch(e) {
|
||||
// assign a false positive if detection fails => unable to shiv
|
||||
supportsHtml5Styles = true;
|
||||
supportsUnknownElements = true;
|
||||
}
|
||||
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Creates a style sheet with the given CSS text and adds it to the document.
|
||||
* @private
|
||||
* @param {Document} ownerDocument The document.
|
||||
* @param {String} cssText The CSS text.
|
||||
* @returns {StyleSheet} The style element.
|
||||
*/
|
||||
function addStyleSheet(ownerDocument, cssText) {
|
||||
var p = ownerDocument.createElement('p'),
|
||||
parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
|
||||
|
||||
p.innerHTML = 'x<style>' + cssText + '</style>';
|
||||
return parent.insertBefore(p.lastChild, parent.firstChild);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of `html5.elements` as an array.
|
||||
* @private
|
||||
* @returns {Array} An array of shived element node names.
|
||||
*/
|
||||
function getElements() {
|
||||
var elements = html5.elements;
|
||||
return typeof elements == 'string' ? elements.split(' ') : elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extends the built-in list of html5 elements
|
||||
* @memberOf html5
|
||||
* @param {String|Array} newElements whitespace separated list or array of new element names to shiv
|
||||
* @param {Document} ownerDocument The context document.
|
||||
*/
|
||||
function addElements(newElements, ownerDocument) {
|
||||
var elements = html5.elements;
|
||||
if(typeof elements != 'string'){
|
||||
elements = elements.join(' ');
|
||||
}
|
||||
if(typeof newElements != 'string'){
|
||||
newElements = newElements.join(' ');
|
||||
}
|
||||
html5.elements = elements +' '+ newElements;
|
||||
shivDocument(ownerDocument);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the data associated to the given document
|
||||
* @private
|
||||
* @param {Document} ownerDocument The document.
|
||||
* @returns {Object} An object of data.
|
||||
*/
|
||||
function getExpandoData(ownerDocument) {
|
||||
var data = expandoData[ownerDocument[expando]];
|
||||
if (!data) {
|
||||
data = {};
|
||||
expanID++;
|
||||
ownerDocument[expando] = expanID;
|
||||
expandoData[expanID] = data;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a shived element for the given nodeName and document
|
||||
* @memberOf html5
|
||||
* @param {String} nodeName name of the element
|
||||
* @param {Document|DocumentFragment} ownerDocument The context document.
|
||||
* @returns {Object} The shived element.
|
||||
*/
|
||||
function createElement(nodeName, ownerDocument, data){
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
if(supportsUnknownElements){
|
||||
return ownerDocument.createElement(nodeName);
|
||||
}
|
||||
if (!data) {
|
||||
data = getExpandoData(ownerDocument);
|
||||
}
|
||||
var node;
|
||||
|
||||
if (data.cache[nodeName]) {
|
||||
node = data.cache[nodeName].cloneNode();
|
||||
} else if (saveClones.test(nodeName)) {
|
||||
node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
|
||||
} else {
|
||||
node = data.createElem(nodeName);
|
||||
}
|
||||
|
||||
// Avoid adding some elements to fragments in IE < 9 because
|
||||
// * Attributes like `name` or `type` cannot be set/changed once an element
|
||||
// is inserted into a document/fragment
|
||||
// * Link elements with `src` attributes that are inaccessible, as with
|
||||
// a 403 response, will cause the tab/window to crash
|
||||
// * Script elements appended to fragments will execute when their `src`
|
||||
// or `text` property is set
|
||||
return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a shived DocumentFragment for the given document
|
||||
* @memberOf html5
|
||||
* @param {Document} ownerDocument The context document.
|
||||
* @returns {Object} The shived DocumentFragment.
|
||||
*/
|
||||
function createDocumentFragment(ownerDocument, data){
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
if(supportsUnknownElements){
|
||||
return ownerDocument.createDocumentFragment();
|
||||
}
|
||||
data = data || getExpandoData(ownerDocument);
|
||||
var clone = data.frag.cloneNode(),
|
||||
i = 0,
|
||||
elems = getElements(),
|
||||
l = elems.length;
|
||||
for(;i<l;i++){
|
||||
clone.createElement(elems[i]);
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shivs the `createElement` and `createDocumentFragment` methods of the document.
|
||||
* @private
|
||||
* @param {Document|DocumentFragment} ownerDocument The document.
|
||||
* @param {Object} data of the document.
|
||||
*/
|
||||
function shivMethods(ownerDocument, data) {
|
||||
if (!data.cache) {
|
||||
data.cache = {};
|
||||
data.createElem = ownerDocument.createElement;
|
||||
data.createFrag = ownerDocument.createDocumentFragment;
|
||||
data.frag = data.createFrag();
|
||||
}
|
||||
|
||||
|
||||
ownerDocument.createElement = function(nodeName) {
|
||||
//abort shiv
|
||||
if (!html5.shivMethods) {
|
||||
return data.createElem(nodeName);
|
||||
}
|
||||
return createElement(nodeName, ownerDocument, data);
|
||||
};
|
||||
|
||||
ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
|
||||
'var n=f.cloneNode(),c=n.createElement;' +
|
||||
'h.shivMethods&&(' +
|
||||
// unroll the `createElement` calls
|
||||
getElements().join().replace(/[\w\-:]+/g, function(nodeName) {
|
||||
data.createElem(nodeName);
|
||||
data.frag.createElement(nodeName);
|
||||
return 'c("' + nodeName + '")';
|
||||
}) +
|
||||
');return n}'
|
||||
)(html5, data.frag);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Shivs the given document.
|
||||
* @memberOf html5
|
||||
* @param {Document} ownerDocument The document to shiv.
|
||||
* @returns {Document} The shived document.
|
||||
*/
|
||||
function shivDocument(ownerDocument) {
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
var data = getExpandoData(ownerDocument);
|
||||
|
||||
if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
|
||||
data.hasCSS = !!addStyleSheet(ownerDocument,
|
||||
// corrects block display not defined in IE6/7/8/9
|
||||
'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +
|
||||
// adds styling not present in IE6/7/8/9
|
||||
'mark{background:#FF0;color:#000}' +
|
||||
// hides non-rendered elements
|
||||
'template{display:none}'
|
||||
);
|
||||
}
|
||||
if (!supportsUnknownElements) {
|
||||
shivMethods(ownerDocument, data);
|
||||
}
|
||||
return ownerDocument;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The `html5` object is exposed so that more elements can be shived and
|
||||
* existing shiving can be detected on iframes.
|
||||
* @type Object
|
||||
* @example
|
||||
*
|
||||
* // options can be changed before the script is included
|
||||
* html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false };
|
||||
*/
|
||||
var html5 = {
|
||||
|
||||
/**
|
||||
* An array or space separated string of node names of the elements to shiv.
|
||||
* @memberOf html5
|
||||
* @type Array|String
|
||||
*/
|
||||
'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video',
|
||||
|
||||
/**
|
||||
* current version of html5shiv
|
||||
*/
|
||||
'version': version,
|
||||
|
||||
/**
|
||||
* A flag to indicate that the HTML5 style sheet should be inserted.
|
||||
* @memberOf html5
|
||||
* @type Boolean
|
||||
*/
|
||||
'shivCSS': (options.shivCSS !== false),
|
||||
|
||||
/**
|
||||
* Is equal to true if a browser supports creating unknown/HTML5 elements
|
||||
* @memberOf html5
|
||||
* @type boolean
|
||||
*/
|
||||
'supportsUnknownElements': supportsUnknownElements,
|
||||
|
||||
/**
|
||||
* A flag to indicate that the document's `createElement` and `createDocumentFragment`
|
||||
* methods should be overwritten.
|
||||
* @memberOf html5
|
||||
* @type Boolean
|
||||
*/
|
||||
'shivMethods': (options.shivMethods !== false),
|
||||
|
||||
/**
|
||||
* A string to describe the type of `html5` object ("default" or "default print").
|
||||
* @memberOf html5
|
||||
* @type String
|
||||
*/
|
||||
'type': 'default',
|
||||
|
||||
// shivs the document according to the specified `html5` object options
|
||||
'shivDocument': shivDocument,
|
||||
|
||||
//creates a shived element
|
||||
createElement: createElement,
|
||||
|
||||
//creates a shived documentFragment
|
||||
createDocumentFragment: createDocumentFragment,
|
||||
|
||||
//extends list of elements
|
||||
addElements: addElements
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
// expose html5
|
||||
window.html5 = html5;
|
||||
|
||||
// shiv the document
|
||||
shivDocument(document);
|
||||
|
||||
if(typeof module == 'object' && module.exports){
|
||||
module.exports = html5;
|
||||
}
|
||||
|
||||
}(typeof window !== "undefined" ? window : this, document));
|
File diff suppressed because one or more lines are too long
@@ -0,0 +1,689 @@
|
||||
(function($) {
|
||||
'use strict';
|
||||
|
||||
var _currentSpinnerId = 0;
|
||||
|
||||
function _scopedEventName(name, id) {
|
||||
return name + '.touchspin_' + id;
|
||||
}
|
||||
|
||||
function _scopeEventNames(names, id) {
|
||||
return $.map(names, function(name) {
|
||||
return _scopedEventName(name, id);
|
||||
});
|
||||
}
|
||||
|
||||
$.fn.TouchSpin = function(options) {
|
||||
|
||||
if (options === 'destroy') {
|
||||
this.each(function() {
|
||||
var originalinput = $(this),
|
||||
originalinput_data = originalinput.data();
|
||||
$(document).off(_scopeEventNames([
|
||||
'mouseup',
|
||||
'touchend',
|
||||
'touchcancel',
|
||||
'mousemove',
|
||||
'touchmove',
|
||||
'scroll',
|
||||
'scrollstart'], originalinput_data.spinnerid).join(' '));
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
var defaults = {
|
||||
min: 0,
|
||||
max: 100,
|
||||
initval: '',
|
||||
replacementval: '',
|
||||
step: 1,
|
||||
decimals: 0,
|
||||
stepinterval: 100,
|
||||
forcestepdivisibility: 'round', // none | floor | round | ceil
|
||||
stepintervaldelay: 500,
|
||||
verticalbuttons: false,
|
||||
verticalupclass: 'glyphicon glyphicon-chevron-up',
|
||||
verticaldownclass: 'glyphicon glyphicon-chevron-down',
|
||||
prefix: '',
|
||||
postfix: '',
|
||||
prefix_extraclass: '',
|
||||
postfix_extraclass: '',
|
||||
booster: true,
|
||||
boostat: 10,
|
||||
maxboostedstep: false,
|
||||
mousewheel: true,
|
||||
buttondown_class: 'btn btn-default',
|
||||
buttonup_class: 'btn btn-default',
|
||||
buttondown_txt: '-',
|
||||
buttonup_txt: '+'
|
||||
};
|
||||
|
||||
var attributeMap = {
|
||||
min: 'min',
|
||||
max: 'max',
|
||||
initval: 'init-val',
|
||||
replacementval: 'replacement-val',
|
||||
step: 'step',
|
||||
decimals: 'decimals',
|
||||
stepinterval: 'step-interval',
|
||||
verticalbuttons: 'vertical-buttons',
|
||||
verticalupclass: 'vertical-up-class',
|
||||
verticaldownclass: 'vertical-down-class',
|
||||
forcestepdivisibility: 'force-step-divisibility',
|
||||
stepintervaldelay: 'step-interval-delay',
|
||||
prefix: 'prefix',
|
||||
postfix: 'postfix',
|
||||
prefix_extraclass: 'prefix-extra-class',
|
||||
postfix_extraclass: 'postfix-extra-class',
|
||||
booster: 'booster',
|
||||
boostat: 'boostat',
|
||||
maxboostedstep: 'max-boosted-step',
|
||||
mousewheel: 'mouse-wheel',
|
||||
buttondown_class: 'button-down-class',
|
||||
buttonup_class: 'button-up-class',
|
||||
buttondown_txt: 'button-down-txt',
|
||||
buttonup_txt: 'button-up-txt'
|
||||
};
|
||||
|
||||
return this.each(function() {
|
||||
|
||||
var settings,
|
||||
originalinput = $(this),
|
||||
originalinput_data = originalinput.data(),
|
||||
container,
|
||||
elements,
|
||||
value,
|
||||
downSpinTimer,
|
||||
upSpinTimer,
|
||||
downDelayTimeout,
|
||||
upDelayTimeout,
|
||||
spincount = 0,
|
||||
spinning = false;
|
||||
|
||||
init();
|
||||
|
||||
|
||||
function init() {
|
||||
if (originalinput.data('alreadyinitialized')) {
|
||||
return;
|
||||
}
|
||||
|
||||
originalinput.data('alreadyinitialized', true);
|
||||
_currentSpinnerId += 1;
|
||||
originalinput.data('spinnerid', _currentSpinnerId);
|
||||
|
||||
|
||||
if (!originalinput.is('input')) {
|
||||
console.log('Must be an input.');
|
||||
return;
|
||||
}
|
||||
|
||||
_initSettings();
|
||||
_setInitval();
|
||||
_checkValue();
|
||||
_buildHtml();
|
||||
_initElements();
|
||||
_hideEmptyPrefixPostfix();
|
||||
_bindEvents();
|
||||
_bindEventsInterface();
|
||||
elements.input.css('display', 'block');
|
||||
}
|
||||
|
||||
function _setInitval() {
|
||||
if (settings.initval !== '' && originalinput.val() === '') {
|
||||
originalinput.val(settings.initval);
|
||||
}
|
||||
}
|
||||
|
||||
function changeSettings(newsettings) {
|
||||
_updateSettings(newsettings);
|
||||
_checkValue();
|
||||
|
||||
var value = elements.input.val();
|
||||
|
||||
if (value !== '') {
|
||||
value = Number(elements.input.val());
|
||||
elements.input.val(value.toFixed(settings.decimals));
|
||||
}
|
||||
}
|
||||
|
||||
function _initSettings() {
|
||||
settings = $.extend({}, defaults, originalinput_data, _parseAttributes(), options);
|
||||
}
|
||||
|
||||
function _parseAttributes() {
|
||||
var data = {};
|
||||
$.each(attributeMap, function(key, value) {
|
||||
var attrName = 'bts-' + value + '';
|
||||
if (originalinput.is('[data-' + attrName + ']')) {
|
||||
data[key] = originalinput.data(attrName);
|
||||
}
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
function _updateSettings(newsettings) {
|
||||
settings = $.extend({}, settings, newsettings);
|
||||
}
|
||||
|
||||
function _buildHtml() {
|
||||
var initval = originalinput.val(),
|
||||
parentelement = originalinput.parent();
|
||||
|
||||
if (initval !== '') {
|
||||
initval = Number(initval).toFixed(settings.decimals);
|
||||
}
|
||||
|
||||
originalinput.data('initvalue', initval).val(initval);
|
||||
originalinput.addClass('form-control');
|
||||
|
||||
if (parentelement.hasClass('input-group')) {
|
||||
_advanceInputGroup(parentelement);
|
||||
}
|
||||
else {
|
||||
_buildInputGroup();
|
||||
}
|
||||
}
|
||||
|
||||
function _advanceInputGroup(parentelement) {
|
||||
parentelement.addClass('bootstrap-touchspin');
|
||||
|
||||
var prev = originalinput.prev(),
|
||||
next = originalinput.next();
|
||||
|
||||
var downhtml,
|
||||
uphtml,
|
||||
prefixhtml = '<span class="input-group-addon bootstrap-touchspin-prefix">' + settings.prefix + '</span>',
|
||||
postfixhtml = '<span class="input-group-addon bootstrap-touchspin-postfix">' + settings.postfix + '</span>';
|
||||
|
||||
if (prev.hasClass('input-group-btn')) {
|
||||
downhtml = '<button class="' + settings.buttondown_class + ' bootstrap-touchspin-down" type="button">' + settings.buttondown_txt + '</button>';
|
||||
prev.append(downhtml);
|
||||
}
|
||||
else {
|
||||
downhtml = '<span class="input-group-btn"><button class="' + settings.buttondown_class + ' bootstrap-touchspin-down" type="button">' + settings.buttondown_txt + '</button></span>';
|
||||
$(downhtml).insertBefore(originalinput);
|
||||
}
|
||||
|
||||
if (next.hasClass('input-group-btn')) {
|
||||
uphtml = '<button class="' + settings.buttonup_class + ' bootstrap-touchspin-up" type="button">' + settings.buttonup_txt + '</button>';
|
||||
next.prepend(uphtml);
|
||||
}
|
||||
else {
|
||||
uphtml = '<span class="input-group-btn"><button class="' + settings.buttonup_class + ' bootstrap-touchspin-up" type="button">' + settings.buttonup_txt + '</button></span>';
|
||||
$(uphtml).insertAfter(originalinput);
|
||||
}
|
||||
|
||||
$(prefixhtml).insertBefore(originalinput);
|
||||
$(postfixhtml).insertAfter(originalinput);
|
||||
|
||||
container = parentelement;
|
||||
}
|
||||
|
||||
function _buildInputGroup() {
|
||||
var html;
|
||||
|
||||
if (settings.verticalbuttons) {
|
||||
html = '<div class="input-group bootstrap-touchspin"><span class="input-group-addon bootstrap-touchspin-prefix">' + settings.prefix + '</span><span class="input-group-addon bootstrap-touchspin-postfix">' + settings.postfix + '</span><span class="input-group-btn-vertical"><button class="' + settings.buttondown_class + ' bootstrap-touchspin-up" type="button"><i class="' + settings.verticalupclass + '"></i></button><button class="' + settings.buttonup_class + ' bootstrap-touchspin-down" type="button"><i class="' + settings.verticaldownclass + '"></i></button></span></div>';
|
||||
}
|
||||
else {
|
||||
html = '<div class="input-group bootstrap-touchspin"><span class="input-group-btn"><button class="' + settings.buttondown_class + ' bootstrap-touchspin-down" type="button">' + settings.buttondown_txt + '</button></span><span class="input-group-addon bootstrap-touchspin-prefix">' + settings.prefix + '</span><span class="input-group-addon bootstrap-touchspin-postfix">' + settings.postfix + '</span><span class="input-group-btn"><button class="' + settings.buttonup_class + ' bootstrap-touchspin-up" type="button">' + settings.buttonup_txt + '</button></span></div>';
|
||||
}
|
||||
|
||||
container = $(html).insertBefore(originalinput);
|
||||
|
||||
$('.bootstrap-touchspin-prefix', container).after(originalinput);
|
||||
|
||||
if (originalinput.hasClass('input-sm')) {
|
||||
container.addClass('input-group-sm');
|
||||
}
|
||||
else if (originalinput.hasClass('input-lg')) {
|
||||
container.addClass('input-group-lg');
|
||||
}
|
||||
}
|
||||
|
||||
function _initElements() {
|
||||
elements = {
|
||||
down: $('.bootstrap-touchspin-down', container),
|
||||
up: $('.bootstrap-touchspin-up', container),
|
||||
input: $('input', container),
|
||||
prefix: $('.bootstrap-touchspin-prefix', container).addClass(settings.prefix_extraclass),
|
||||
postfix: $('.bootstrap-touchspin-postfix', container).addClass(settings.postfix_extraclass)
|
||||
};
|
||||
}
|
||||
|
||||
function _hideEmptyPrefixPostfix() {
|
||||
if (settings.prefix === '') {
|
||||
elements.prefix.hide();
|
||||
}
|
||||
|
||||
if (settings.postfix === '') {
|
||||
elements.postfix.hide();
|
||||
}
|
||||
}
|
||||
|
||||
function _bindEvents() {
|
||||
originalinput.on('keydown', function(ev) {
|
||||
var code = ev.keyCode || ev.which;
|
||||
|
||||
if (code === 38) {
|
||||
if (spinning !== 'up') {
|
||||
upOnce();
|
||||
startUpSpin();
|
||||
}
|
||||
ev.preventDefault();
|
||||
}
|
||||
else if (code === 40) {
|
||||
if (spinning !== 'down') {
|
||||
downOnce();
|
||||
startDownSpin();
|
||||
}
|
||||
ev.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
originalinput.on('keyup', function(ev) {
|
||||
var code = ev.keyCode || ev.which;
|
||||
|
||||
if (code === 38) {
|
||||
stopSpin();
|
||||
}
|
||||
else if (code === 40) {
|
||||
stopSpin();
|
||||
}
|
||||
});
|
||||
|
||||
originalinput.on('blur', function() {
|
||||
_checkValue();
|
||||
});
|
||||
|
||||
elements.down.on('keydown', function(ev) {
|
||||
var code = ev.keyCode || ev.which;
|
||||
|
||||
if (code === 32 || code === 13) {
|
||||
if (spinning !== 'down') {
|
||||
downOnce();
|
||||
startDownSpin();
|
||||
}
|
||||
ev.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
elements.down.on('keyup', function(ev) {
|
||||
var code = ev.keyCode || ev.which;
|
||||
|
||||
if (code === 32 || code === 13) {
|
||||
stopSpin();
|
||||
}
|
||||
});
|
||||
|
||||
elements.up.on('keydown', function(ev) {
|
||||
var code = ev.keyCode || ev.which;
|
||||
|
||||
if (code === 32 || code === 13) {
|
||||
if (spinning !== 'up') {
|
||||
upOnce();
|
||||
startUpSpin();
|
||||
}
|
||||
ev.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
elements.up.on('keyup', function(ev) {
|
||||
var code = ev.keyCode || ev.which;
|
||||
|
||||
if (code === 32 || code === 13) {
|
||||
stopSpin();
|
||||
}
|
||||
});
|
||||
|
||||
elements.down.on('mousedown.touchspin', function(ev) {
|
||||
elements.down.off('touchstart.touchspin'); // android 4 workaround
|
||||
|
||||
if (originalinput.is(':disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
downOnce();
|
||||
startDownSpin();
|
||||
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
});
|
||||
|
||||
elements.down.on('touchstart.touchspin', function(ev) {
|
||||
elements.down.off('mousedown.touchspin'); // android 4 workaround
|
||||
|
||||
if (originalinput.is(':disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
downOnce();
|
||||
startDownSpin();
|
||||
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
});
|
||||
|
||||
elements.up.on('mousedown.touchspin', function(ev) {
|
||||
elements.up.off('touchstart.touchspin'); // android 4 workaround
|
||||
|
||||
if (originalinput.is(':disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
upOnce();
|
||||
startUpSpin();
|
||||
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
});
|
||||
|
||||
elements.up.on('touchstart.touchspin', function(ev) {
|
||||
elements.up.off('mousedown.touchspin'); // android 4 workaround
|
||||
|
||||
if (originalinput.is(':disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
upOnce();
|
||||
startUpSpin();
|
||||
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
});
|
||||
|
||||
elements.up.on('mouseout touchleave touchend touchcancel', function(ev) {
|
||||
if (!spinning) {
|
||||
return;
|
||||
}
|
||||
|
||||
ev.stopPropagation();
|
||||
stopSpin();
|
||||
});
|
||||
|
||||
elements.down.on('mouseout touchleave touchend touchcancel', function(ev) {
|
||||
if (!spinning) {
|
||||
return;
|
||||
}
|
||||
|
||||
ev.stopPropagation();
|
||||
stopSpin();
|
||||
});
|
||||
|
||||
elements.down.on('mousemove touchmove', function(ev) {
|
||||
if (!spinning) {
|
||||
return;
|
||||
}
|
||||
|
||||
ev.stopPropagation();
|
||||
ev.preventDefault();
|
||||
});
|
||||
|
||||
elements.up.on('mousemove touchmove', function(ev) {
|
||||
if (!spinning) {
|
||||
return;
|
||||
}
|
||||
|
||||
ev.stopPropagation();
|
||||
ev.preventDefault();
|
||||
});
|
||||
|
||||
$(document).on(_scopeEventNames(['mouseup', 'touchend', 'touchcancel'], _currentSpinnerId).join(' '), function(ev) {
|
||||
if (!spinning) {
|
||||
return;
|
||||
}
|
||||
|
||||
ev.preventDefault();
|
||||
stopSpin();
|
||||
});
|
||||
|
||||
$(document).on(_scopeEventNames(['mousemove', 'touchmove', 'scroll', 'scrollstart'], _currentSpinnerId).join(' '), function(ev) {
|
||||
if (!spinning) {
|
||||
return;
|
||||
}
|
||||
|
||||
ev.preventDefault();
|
||||
stopSpin();
|
||||
});
|
||||
|
||||
originalinput.on('mousewheel DOMMouseScroll', function(ev) {
|
||||
if (!settings.mousewheel || !originalinput.is(':focus')) {
|
||||
return;
|
||||
}
|
||||
|
||||
var delta = ev.originalEvent.wheelDelta || -ev.originalEvent.deltaY || -ev.originalEvent.detail;
|
||||
|
||||
ev.stopPropagation();
|
||||
ev.preventDefault();
|
||||
|
||||
if (delta < 0) {
|
||||
downOnce();
|
||||
}
|
||||
else {
|
||||
upOnce();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function _bindEventsInterface() {
|
||||
originalinput.on('touchspin.uponce', function() {
|
||||
stopSpin();
|
||||
upOnce();
|
||||
});
|
||||
|
||||
originalinput.on('touchspin.downonce', function() {
|
||||
stopSpin();
|
||||
downOnce();
|
||||
});
|
||||
|
||||
originalinput.on('touchspin.startupspin', function() {
|
||||
startUpSpin();
|
||||
});
|
||||
|
||||
originalinput.on('touchspin.startdownspin', function() {
|
||||
startDownSpin();
|
||||
});
|
||||
|
||||
originalinput.on('touchspin.stopspin', function() {
|
||||
stopSpin();
|
||||
});
|
||||
|
||||
originalinput.on('touchspin.updatesettings', function(e, newsettings) {
|
||||
changeSettings(newsettings);
|
||||
});
|
||||
}
|
||||
|
||||
function _forcestepdivisibility(value) {
|
||||
switch (settings.forcestepdivisibility) {
|
||||
case 'round':
|
||||
return (Math.round(value / settings.step) * settings.step).toFixed(settings.decimals);
|
||||
case 'floor':
|
||||
return (Math.floor(value / settings.step) * settings.step).toFixed(settings.decimals);
|
||||
case 'ceil':
|
||||
return (Math.ceil(value / settings.step) * settings.step).toFixed(settings.decimals);
|
||||
default:
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
function _checkValue() {
|
||||
var val, parsedval, returnval;
|
||||
|
||||
val = originalinput.val();
|
||||
|
||||
if (val === '') {
|
||||
if (settings.replacementval !== '') {
|
||||
originalinput.val(settings.replacementval);
|
||||
originalinput.trigger('change');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (settings.decimals > 0 && val === '.') {
|
||||
return;
|
||||
}
|
||||
|
||||
parsedval = parseFloat(val);
|
||||
|
||||
if (isNaN(parsedval)) {
|
||||
if (settings.replacementval !== '') {
|
||||
parsedval = settings.replacementval;
|
||||
}
|
||||
else {
|
||||
parsedval = 0;
|
||||
}
|
||||
}
|
||||
|
||||
returnval = parsedval;
|
||||
|
||||
if (parsedval.toString() !== val) {
|
||||
returnval = parsedval;
|
||||
}
|
||||
|
||||
if (parsedval < settings.min) {
|
||||
returnval = settings.min;
|
||||
}
|
||||
|
||||
if (parsedval > settings.max) {
|
||||
returnval = settings.max;
|
||||
}
|
||||
|
||||
returnval = _forcestepdivisibility(returnval);
|
||||
|
||||
if (Number(val).toString() !== returnval.toString()) {
|
||||
originalinput.val(returnval);
|
||||
originalinput.trigger('change');
|
||||
}
|
||||
}
|
||||
|
||||
function _getBoostedStep() {
|
||||
if (!settings.booster) {
|
||||
return settings.step;
|
||||
}
|
||||
else {
|
||||
var boosted = Math.pow(2, Math.floor(spincount / settings.boostat)) * settings.step;
|
||||
|
||||
if (settings.maxboostedstep) {
|
||||
if (boosted > settings.maxboostedstep) {
|
||||
boosted = settings.maxboostedstep;
|
||||
value = Math.round((value / boosted)) * boosted;
|
||||
}
|
||||
}
|
||||
|
||||
return Math.max(settings.step, boosted);
|
||||
}
|
||||
}
|
||||
|
||||
function upOnce() {
|
||||
_checkValue();
|
||||
|
||||
value = parseFloat(elements.input.val());
|
||||
if (isNaN(value)) {
|
||||
value = 0;
|
||||
}
|
||||
|
||||
var initvalue = value,
|
||||
boostedstep = _getBoostedStep();
|
||||
|
||||
value = value + boostedstep;
|
||||
|
||||
if (value > settings.max) {
|
||||
value = settings.max;
|
||||
originalinput.trigger('touchspin.on.max');
|
||||
stopSpin();
|
||||
}
|
||||
|
||||
elements.input.val(Number(value).toFixed(settings.decimals));
|
||||
|
||||
if (initvalue !== value) {
|
||||
originalinput.trigger('change');
|
||||
}
|
||||
}
|
||||
|
||||
function downOnce() {
|
||||
_checkValue();
|
||||
|
||||
value = parseFloat(elements.input.val());
|
||||
if (isNaN(value)) {
|
||||
value = 0;
|
||||
}
|
||||
|
||||
var initvalue = value,
|
||||
boostedstep = _getBoostedStep();
|
||||
|
||||
value = value - boostedstep;
|
||||
|
||||
if (value < settings.min) {
|
||||
value = settings.min;
|
||||
originalinput.trigger('touchspin.on.min');
|
||||
stopSpin();
|
||||
}
|
||||
|
||||
elements.input.val(value.toFixed(settings.decimals));
|
||||
|
||||
if (initvalue !== value) {
|
||||
originalinput.trigger('change');
|
||||
}
|
||||
}
|
||||
|
||||
function startDownSpin() {
|
||||
stopSpin();
|
||||
|
||||
spincount = 0;
|
||||
spinning = 'down';
|
||||
|
||||
originalinput.trigger('touchspin.on.startspin');
|
||||
originalinput.trigger('touchspin.on.startdownspin');
|
||||
|
||||
downDelayTimeout = setTimeout(function() {
|
||||
downSpinTimer = setInterval(function() {
|
||||
spincount++;
|
||||
downOnce();
|
||||
}, settings.stepinterval);
|
||||
}, settings.stepintervaldelay);
|
||||
}
|
||||
|
||||
function startUpSpin() {
|
||||
stopSpin();
|
||||
|
||||
spincount = 0;
|
||||
spinning = 'up';
|
||||
|
||||
originalinput.trigger('touchspin.on.startspin');
|
||||
originalinput.trigger('touchspin.on.startupspin');
|
||||
|
||||
upDelayTimeout = setTimeout(function() {
|
||||
upSpinTimer = setInterval(function() {
|
||||
spincount++;
|
||||
upOnce();
|
||||
}, settings.stepinterval);
|
||||
}, settings.stepintervaldelay);
|
||||
}
|
||||
|
||||
function stopSpin() {
|
||||
clearTimeout(downDelayTimeout);
|
||||
clearTimeout(upDelayTimeout);
|
||||
clearInterval(downSpinTimer);
|
||||
clearInterval(upSpinTimer);
|
||||
|
||||
switch (spinning) {
|
||||
case 'up':
|
||||
originalinput.trigger('touchspin.on.stopupspin');
|
||||
originalinput.trigger('touchspin.on.stopspin');
|
||||
break;
|
||||
case 'down':
|
||||
originalinput.trigger('touchspin.on.stopdownspin');
|
||||
originalinput.trigger('touchspin.on.stopspin');
|
||||
break;
|
||||
}
|
||||
|
||||
spincount = 0;
|
||||
spinning = false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
@@ -0,0 +1,206 @@
|
||||
/*!
|
||||
* The Final Countdown for jQuery v2.0.4 (http://hilios.github.io/jQuery.countdown/)
|
||||
* Copyright (c) 2014 Edson Hilios
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
(function(factory) {
|
||||
"use strict";
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define([ "jquery" ], factory);
|
||||
} else {
|
||||
factory(jQuery);
|
||||
}
|
||||
})(function($) {
|
||||
"use strict";
|
||||
var PRECISION = 100;
|
||||
var instances = [], matchers = [];
|
||||
matchers.push(/^[0-9]*$/.source);
|
||||
matchers.push(/([0-9]{1,2}\/){2}[0-9]{4}( [0-9]{1,2}(:[0-9]{2}){2})?/.source);
|
||||
matchers.push(/[0-9]{4}([\/\-][0-9]{1,2}){2}( [0-9]{1,2}(:[0-9]{2}){2})?/.source);
|
||||
matchers = new RegExp(matchers.join("|"));
|
||||
function parseDateString(dateString) {
|
||||
if (dateString instanceof Date) {
|
||||
return dateString;
|
||||
}
|
||||
if (String(dateString).match(matchers)) {
|
||||
if (String(dateString).match(/^[0-9]*$/)) {
|
||||
dateString = Number(dateString);
|
||||
}
|
||||
if (String(dateString).match(/\-/)) {
|
||||
dateString = String(dateString).replace(/\-/g, "/");
|
||||
}
|
||||
return new Date(dateString);
|
||||
} else {
|
||||
throw new Error("Couldn't cast `" + dateString + "` to a date object.");
|
||||
}
|
||||
}
|
||||
var DIRECTIVE_KEY_MAP = {
|
||||
Y: "years",
|
||||
m: "months",
|
||||
w: "weeks",
|
||||
d: "days",
|
||||
D: "totalDays",
|
||||
H: "hours",
|
||||
M: "minutes",
|
||||
S: "seconds"
|
||||
};
|
||||
function strftime(offsetObject) {
|
||||
return function(format) {
|
||||
var directives = format.match(/%(-|!)?[A-Z]{1}(:[^;]+;)?/gi);
|
||||
if (directives) {
|
||||
for (var i = 0, len = directives.length; i < len; ++i) {
|
||||
var directive = directives[i].match(/%(-|!)?([a-zA-Z]{1})(:[^;]+;)?/), regexp = new RegExp(directive[0]), modifier = directive[1] || "", plural = directive[3] || "", value = null;
|
||||
directive = directive[2];
|
||||
if (DIRECTIVE_KEY_MAP.hasOwnProperty(directive)) {
|
||||
value = DIRECTIVE_KEY_MAP[directive];
|
||||
value = Number(offsetObject[value]);
|
||||
}
|
||||
if (value !== null) {
|
||||
if (modifier === "!") {
|
||||
value = pluralize(plural, value);
|
||||
}
|
||||
if (modifier === "") {
|
||||
if (value < 10) {
|
||||
value = "0" + value.toString();
|
||||
}
|
||||
}
|
||||
format = format.replace(regexp, value.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
format = format.replace(/%%/, "%");
|
||||
return format;
|
||||
};
|
||||
}
|
||||
function pluralize(format, count) {
|
||||
var plural = "s", singular = "";
|
||||
if (format) {
|
||||
format = format.replace(/(:|;|\s)/gi, "").split(/\,/);
|
||||
if (format.length === 1) {
|
||||
plural = format[0];
|
||||
} else {
|
||||
singular = format[0];
|
||||
plural = format[1];
|
||||
}
|
||||
}
|
||||
if (Math.abs(count) === 1) {
|
||||
return singular;
|
||||
} else {
|
||||
return plural;
|
||||
}
|
||||
}
|
||||
var Countdown = function(el, finalDate, callback) {
|
||||
this.el = el;
|
||||
this.$el = $(el);
|
||||
this.interval = null;
|
||||
this.offset = {};
|
||||
this.instanceNumber = instances.length;
|
||||
instances.push(this);
|
||||
this.$el.data("countdown-instance", this.instanceNumber);
|
||||
if (callback) {
|
||||
this.$el.on("update.countdown", callback);
|
||||
this.$el.on("stoped.countdown", callback);
|
||||
this.$el.on("finish.countdown", callback);
|
||||
}
|
||||
this.setFinalDate(finalDate);
|
||||
this.start();
|
||||
};
|
||||
$.extend(Countdown.prototype, {
|
||||
start: function() {
|
||||
if (this.interval !== null) {
|
||||
clearInterval(this.interval);
|
||||
}
|
||||
var self = this;
|
||||
this.update();
|
||||
this.interval = setInterval(function() {
|
||||
self.update.call(self);
|
||||
}, PRECISION);
|
||||
},
|
||||
stop: function() {
|
||||
clearInterval(this.interval);
|
||||
this.interval = null;
|
||||
this.dispatchEvent("stoped");
|
||||
},
|
||||
pause: function() {
|
||||
this.stop.call(this);
|
||||
},
|
||||
resume: function() {
|
||||
this.start.call(this);
|
||||
},
|
||||
remove: function() {
|
||||
this.stop();
|
||||
instances[this.instanceNumber] = null;
|
||||
delete this.$el.data().countdownInstance;
|
||||
},
|
||||
setFinalDate: function(value) {
|
||||
this.finalDate = parseDateString(value);
|
||||
},
|
||||
update: function() {
|
||||
if (this.$el.closest("html").length === 0) {
|
||||
this.remove();
|
||||
return;
|
||||
}
|
||||
this.totalSecsLeft = this.finalDate.getTime() - new Date().getTime();
|
||||
this.totalSecsLeft = Math.ceil(this.totalSecsLeft / 1e3);
|
||||
this.totalSecsLeft = this.totalSecsLeft < 0 ? 0 : this.totalSecsLeft;
|
||||
this.offset = {
|
||||
seconds: this.totalSecsLeft % 60,
|
||||
minutes: Math.floor(this.totalSecsLeft / 60) % 60,
|
||||
hours: Math.floor(this.totalSecsLeft / 60 / 60) % 24,
|
||||
days: Math.floor(this.totalSecsLeft / 60 / 60 / 24) % 7,
|
||||
totalDays: Math.floor(this.totalSecsLeft / 60 / 60 / 24),
|
||||
weeks: Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 7),
|
||||
months: Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 30),
|
||||
years: Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 365)
|
||||
};
|
||||
if (this.totalSecsLeft === 0) {
|
||||
this.stop();
|
||||
this.dispatchEvent("finish");
|
||||
} else {
|
||||
this.dispatchEvent("update");
|
||||
}
|
||||
},
|
||||
dispatchEvent: function(eventName) {
|
||||
var event = $.Event(eventName + ".countdown");
|
||||
event.finalDate = this.finalDate;
|
||||
event.offset = $.extend({}, this.offset);
|
||||
event.strftime = strftime(this.offset);
|
||||
this.$el.trigger(event);
|
||||
}
|
||||
});
|
||||
$.fn.countdown = function() {
|
||||
var argumentsArray = Array.prototype.slice.call(arguments, 0);
|
||||
return this.each(function() {
|
||||
var instanceNumber = $(this).data("countdown-instance");
|
||||
if (instanceNumber !== undefined) {
|
||||
var instance = instances[instanceNumber], method = argumentsArray[0];
|
||||
if (Countdown.prototype.hasOwnProperty(method)) {
|
||||
instance[method].apply(instance, argumentsArray.slice(1));
|
||||
} else if (String(method).match(/^[$A-Z_][0-9A-Z_$]*$/i) === null) {
|
||||
instance.setFinalDate.call(instance, method);
|
||||
instance.start();
|
||||
} else {
|
||||
$.error("Method %s does not exist on jQuery.countdown".replace(/\%s/gi, method));
|
||||
}
|
||||
} else {
|
||||
new Countdown(this, argumentsArray[0], argumentsArray[1]);
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
5238
hamrokhaanpaan/wp-content/themes/stnews-theme/assets/js/jquery.fancybox.js
vendored
Normal file
5238
hamrokhaanpaan/wp-content/themes/stnews-theme/assets/js/jquery.fancybox.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4
hamrokhaanpaan/wp-content/themes/stnews-theme/assets/js/jquery.js
vendored
Normal file
4
hamrokhaanpaan/wp-content/themes/stnews-theme/assets/js/jquery.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,81 @@
|
||||
|
||||
var tpj=jQuery;
|
||||
var revapi486;
|
||||
tpj(document).ready(function() {
|
||||
if(tpj("#rev_slider_one").revolution == undefined){
|
||||
revslider_showDoubleJqueryError("#rev_slider_one");
|
||||
}else{
|
||||
revapi486 = tpj("#rev_slider_one").show().revolution({
|
||||
sliderType:"standard",
|
||||
jsFileLocation:"plugins/revolution/js/",
|
||||
sliderLayout:"fullwidth",
|
||||
dottedOverlay:"yes",
|
||||
delay:9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
|
||||
navigation: {
|
||||
keyboardNavigation:"off",
|
||||
keyboard_direction: "horizontal",
|
||||
mouseScrollNavigation:"off",
|
||||
mouseScrollReverse:"default",
|
||||
onHoverStop:"off",
|
||||
touch:{
|
||||
touchenabled:"on",
|
||||
touchOnDesktop:"off",
|
||||
swipe_threshold: 75,
|
||||
swipe_min_touches: 1,
|
||||
swipe_direction: "horizontal",
|
||||
drag_block_vertical: false
|
||||
},
|
||||
arrows: {
|
||||
style:"uranus",
|
||||
enable:true,
|
||||
hide_onmobile:true,
|
||||
hide_under:600,
|
||||
hide_onleave:false,
|
||||
tmp:'',
|
||||
left: {
|
||||
h_align:"left",
|
||||
v_align:"center",
|
||||
h_offset:0,
|
||||
v_offset:0
|
||||
},
|
||||
right: {
|
||||
h_align:"right",
|
||||
v_align:"center",
|
||||
h_offset:0,
|
||||
v_offset:0
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
responsiveLevels:[1200,1040,778,480],
|
||||
visibilityLevels:[1200,1040,778,480],
|
||||
gridwidth:[1200,1040,778,480],
|
||||
gridheight:[580,600,500,400],
|
||||
lazyType:"none",
|
||||
parallax: {
|
||||
type:"scroll",
|
||||
origo:"enterpoint",
|
||||
speed:400,
|
||||
levels:[5,10,15,20,25,30,35,40,45,50,46,47,48,49,50,55],
|
||||
type:"scroll",
|
||||
},
|
||||
shadow:0,
|
||||
spinner:"off",
|
||||
stopLoop:"off",
|
||||
stopAfterLoops:-1,
|
||||
stopAtSlide:-1,
|
||||
shuffle:"off",
|
||||
autoHeight:"off",
|
||||
hideThumbsOnMobile:"off",
|
||||
hideSliderAtLimit:0,
|
||||
hideCaptionAtLimit:0,
|
||||
hideAllCaptionAtLilmit:0,
|
||||
debugMode:false,
|
||||
fallbacks: {
|
||||
simplifyAll:"off",
|
||||
nextSlideOnWindowFocus:"off",
|
||||
disableFocusListener:false,
|
||||
}
|
||||
});
|
||||
}
|
||||
}); /*ready*/
|
@@ -0,0 +1,185 @@
|
||||
|
||||
/* --------------------------------------------
|
||||
Google Map
|
||||
-------------------------------------------- */
|
||||
window.onload = MapLoadScript;
|
||||
function GmapInit() {
|
||||
Gmap = $('.map-canvas');
|
||||
Gmap.each(function() {
|
||||
var $this = $(this),
|
||||
lat = '',
|
||||
lng = '',
|
||||
zoom = 12,
|
||||
scrollwheel = false,
|
||||
zoomcontrol = true,
|
||||
draggable = true,
|
||||
mapType = google.maps.MapTypeId.ROADMAP,
|
||||
title = '',
|
||||
contentString = '',
|
||||
theme_icon_path = $this.data('icon-path'),
|
||||
dataLat = $this.data('lat'),
|
||||
dataLng = $this.data('lng'),
|
||||
dataZoom = $this.data('zoom'),
|
||||
dataType = $this.data('type'),
|
||||
dataScrollwheel = $this.data('scrollwheel'),
|
||||
dataZoomcontrol = $this.data('zoomcontrol'),
|
||||
dataHue = $this.data('hue'),
|
||||
dataTitle = $this.data('title'),
|
||||
dataContent = $this.data('content');
|
||||
|
||||
if( dataZoom !== undefined && dataZoom !== false ) {
|
||||
zoom = parseFloat(dataZoom);
|
||||
}
|
||||
if( dataLat !== undefined && dataLat !== false ) {
|
||||
lat = parseFloat(dataLat);
|
||||
}
|
||||
if( dataLng !== undefined && dataLng !== false ) {
|
||||
lng = parseFloat(dataLng);
|
||||
}
|
||||
if( dataScrollwheel !== undefined && dataScrollwheel !== null ) {
|
||||
scrollwheel = dataScrollwheel;
|
||||
}
|
||||
if( dataZoomcontrol !== undefined && dataZoomcontrol !== null ) {
|
||||
zoomcontrol = dataZoomcontrol;
|
||||
}
|
||||
if( dataType !== undefined && dataType !== false ) {
|
||||
if( dataType == 'satellite' ) {
|
||||
mapType = google.maps.MapTypeId.SATELLITE;
|
||||
} else if( dataType == 'hybrid' ) {
|
||||
mapType = google.maps.MapTypeId.HYBRID;
|
||||
} else if( dataType == 'terrain' ) {
|
||||
mapType = google.maps.MapTypeId.TERRAIN;
|
||||
}
|
||||
}
|
||||
if( dataTitle !== undefined && dataTitle !== false ) {
|
||||
title = dataTitle;
|
||||
}
|
||||
if( navigator.userAgent.match(/iPad|iPhone|Android/i) ) {
|
||||
draggable = false;
|
||||
}
|
||||
|
||||
var mapOptions = {
|
||||
zoom : zoom,
|
||||
scrollwheel : scrollwheel,
|
||||
zoomControl : zoomcontrol,
|
||||
draggable : draggable,
|
||||
center : new google.maps.LatLng(lat, lng),
|
||||
mapTypeId : mapType
|
||||
};
|
||||
var map = new google.maps.Map($this[0], mapOptions);
|
||||
|
||||
//var image = 'images/icons/map-marker.png';
|
||||
var image = theme_icon_path;
|
||||
|
||||
if( dataContent !== undefined && dataContent !== false ) {
|
||||
contentString = '<div class="map-data">' + '<h6>' + title + '</h6>' + '<div class="map-content">' + dataContent + '</div>' + '</div>';
|
||||
}
|
||||
var infowindow = new google.maps.InfoWindow({
|
||||
content: contentString
|
||||
});
|
||||
|
||||
var marker = new google.maps.Marker({
|
||||
position : new google.maps.LatLng(lat, lng),
|
||||
map : map,
|
||||
icon : image,
|
||||
title : title
|
||||
});
|
||||
if( dataContent !== undefined && dataContent !== false ) {
|
||||
google.maps.event.addListener(marker, 'click', function() {
|
||||
infowindow.open(map,marker);
|
||||
});
|
||||
}
|
||||
|
||||
if( dataHue !== undefined && dataHue !== false ) {
|
||||
var styles = [
|
||||
{
|
||||
"featureType": "administrative",
|
||||
"elementType": "labels.text.fill",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#444444"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "landscape",
|
||||
"elementType": "all",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#f2f2f2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "poi",
|
||||
"elementType": "all",
|
||||
"stylers": [
|
||||
{
|
||||
"visibility": "off"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "road",
|
||||
"elementType": "all",
|
||||
"stylers": [
|
||||
{
|
||||
"saturation": -100
|
||||
},
|
||||
{
|
||||
"lightness": 45
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "road.highway",
|
||||
"elementType": "all",
|
||||
"stylers": [
|
||||
{
|
||||
"visibility": "simplified"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "road.arterial",
|
||||
"elementType": "labels.icon",
|
||||
"stylers": [
|
||||
{
|
||||
"visibility": "off"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "transit",
|
||||
"elementType": "all",
|
||||
"stylers": [
|
||||
{
|
||||
"visibility": "off"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"featureType": "water",
|
||||
"elementType": "all",
|
||||
"stylers": [
|
||||
{
|
||||
"color": "#98ceff"
|
||||
},
|
||||
{
|
||||
"visibility": "on"
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
map.setOptions({styles: styles});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function MapLoadScript() {
|
||||
var script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
GmapInit();
|
||||
document.body.appendChild(script);
|
||||
}
|
||||
|
2098
hamrokhaanpaan/wp-content/themes/stnews-theme/assets/js/mixitup.js
Normal file
2098
hamrokhaanpaan/wp-content/themes/stnews-theme/assets/js/mixitup.js
Normal file
File diff suppressed because it is too large
Load Diff
3273
hamrokhaanpaan/wp-content/themes/stnews-theme/assets/js/owl.js
Normal file
3273
hamrokhaanpaan/wp-content/themes/stnews-theme/assets/js/owl.js
Normal file
File diff suppressed because it is too large
Load Diff
2
hamrokhaanpaan/wp-content/themes/stnews-theme/assets/js/plyr.min.js
vendored
Normal file
2
hamrokhaanpaan/wp-content/themes/stnews-theme/assets/js/plyr.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
hamrokhaanpaan/wp-content/themes/stnews-theme/assets/js/popper.min.js
vendored
Normal file
5
hamrokhaanpaan/wp-content/themes/stnews-theme/assets/js/popper.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,353 @@
|
||||
/* Respond.js: min/max-width media query polyfill. (c) Scott Jehl. MIT Lic. j.mp/respondjs */
|
||||
(function( w ){
|
||||
|
||||
"use strict";
|
||||
|
||||
//exposed namespace
|
||||
var respond = {};
|
||||
w.respond = respond;
|
||||
|
||||
//define update even in native-mq-supporting browsers, to avoid errors
|
||||
respond.update = function(){};
|
||||
|
||||
//define ajax obj
|
||||
var requestQueue = [],
|
||||
xmlHttp = (function() {
|
||||
var xmlhttpmethod = false;
|
||||
try {
|
||||
xmlhttpmethod = new w.XMLHttpRequest();
|
||||
}
|
||||
catch( e ){
|
||||
xmlhttpmethod = new w.ActiveXObject( "Microsoft.XMLHTTP" );
|
||||
}
|
||||
return function(){
|
||||
return xmlhttpmethod;
|
||||
};
|
||||
})(),
|
||||
|
||||
//tweaked Ajax functions from Quirksmode
|
||||
ajax = function( url, callback ) {
|
||||
var req = xmlHttp();
|
||||
if (!req){
|
||||
return;
|
||||
}
|
||||
req.open( "GET", url, true );
|
||||
req.onreadystatechange = function () {
|
||||
if ( req.readyState !== 4 || req.status !== 200 && req.status !== 304 ){
|
||||
return;
|
||||
}
|
||||
callback( req.responseText );
|
||||
};
|
||||
if ( req.readyState === 4 ){
|
||||
return;
|
||||
}
|
||||
req.send( null );
|
||||
},
|
||||
isUnsupportedMediaQuery = function( query ) {
|
||||
return query.replace( respond.regex.minmaxwh, '' ).match( respond.regex.other );
|
||||
};
|
||||
|
||||
//expose for testing
|
||||
respond.ajax = ajax;
|
||||
respond.queue = requestQueue;
|
||||
respond.unsupportedmq = isUnsupportedMediaQuery;
|
||||
respond.regex = {
|
||||
media: /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,
|
||||
keyframes: /@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,
|
||||
comments: /\/\*[^*]*\*+([^/][^*]*\*+)*\//gi,
|
||||
urls: /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,
|
||||
findStyles: /@media *([^\{]+)\{([\S\s]+?)$/,
|
||||
only: /(only\s+)?([a-zA-Z]+)\s?/,
|
||||
minw: /\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,
|
||||
maxw: /\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,
|
||||
minmaxwh: /\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,
|
||||
other: /\([^\)]*\)/g
|
||||
};
|
||||
|
||||
//expose media query support flag for external use
|
||||
respond.mediaQueriesSupported = w.matchMedia && w.matchMedia( "only all" ) !== null && w.matchMedia( "only all" ).matches;
|
||||
|
||||
//if media queries are supported, exit here
|
||||
if( respond.mediaQueriesSupported ){
|
||||
return;
|
||||
}
|
||||
|
||||
//define vars
|
||||
var doc = w.document,
|
||||
docElem = doc.documentElement,
|
||||
mediastyles = [],
|
||||
rules = [],
|
||||
appendedEls = [],
|
||||
parsedSheets = {},
|
||||
resizeThrottle = 30,
|
||||
head = doc.getElementsByTagName( "head" )[0] || docElem,
|
||||
base = doc.getElementsByTagName( "base" )[0],
|
||||
links = head.getElementsByTagName( "link" ),
|
||||
|
||||
lastCall,
|
||||
resizeDefer,
|
||||
|
||||
//cached container for 1em value, populated the first time it's needed
|
||||
eminpx,
|
||||
|
||||
// returns the value of 1em in pixels
|
||||
getEmValue = function() {
|
||||
var ret,
|
||||
div = doc.createElement('div'),
|
||||
body = doc.body,
|
||||
originalHTMLFontSize = docElem.style.fontSize,
|
||||
originalBodyFontSize = body && body.style.fontSize,
|
||||
fakeUsed = false;
|
||||
|
||||
div.style.cssText = "position:absolute;font-size:1em;width:1em";
|
||||
|
||||
if( !body ){
|
||||
body = fakeUsed = doc.createElement( "body" );
|
||||
body.style.background = "none";
|
||||
}
|
||||
|
||||
// 1em in a media query is the value of the default font size of the browser
|
||||
// reset docElem and body to ensure the correct value is returned
|
||||
docElem.style.fontSize = "100%";
|
||||
body.style.fontSize = "100%";
|
||||
|
||||
body.appendChild( div );
|
||||
|
||||
if( fakeUsed ){
|
||||
docElem.insertBefore( body, docElem.firstChild );
|
||||
}
|
||||
|
||||
ret = div.offsetWidth;
|
||||
|
||||
if( fakeUsed ){
|
||||
docElem.removeChild( body );
|
||||
}
|
||||
else {
|
||||
body.removeChild( div );
|
||||
}
|
||||
|
||||
// restore the original values
|
||||
docElem.style.fontSize = originalHTMLFontSize;
|
||||
if( originalBodyFontSize ) {
|
||||
body.style.fontSize = originalBodyFontSize;
|
||||
}
|
||||
|
||||
|
||||
//also update eminpx before returning
|
||||
ret = eminpx = parseFloat(ret);
|
||||
|
||||
return ret;
|
||||
},
|
||||
|
||||
//enable/disable styles
|
||||
applyMedia = function( fromResize ){
|
||||
var name = "clientWidth",
|
||||
docElemProp = docElem[ name ],
|
||||
currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[ name ] || docElemProp,
|
||||
styleBlocks = {},
|
||||
lastLink = links[ links.length-1 ],
|
||||
now = (new Date()).getTime();
|
||||
|
||||
//throttle resize calls
|
||||
if( fromResize && lastCall && now - lastCall < resizeThrottle ){
|
||||
w.clearTimeout( resizeDefer );
|
||||
resizeDefer = w.setTimeout( applyMedia, resizeThrottle );
|
||||
return;
|
||||
}
|
||||
else {
|
||||
lastCall = now;
|
||||
}
|
||||
|
||||
for( var i in mediastyles ){
|
||||
if( mediastyles.hasOwnProperty( i ) ){
|
||||
var thisstyle = mediastyles[ i ],
|
||||
min = thisstyle.minw,
|
||||
max = thisstyle.maxw,
|
||||
minnull = min === null,
|
||||
maxnull = max === null,
|
||||
em = "em";
|
||||
|
||||
if( !!min ){
|
||||
min = parseFloat( min ) * ( min.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 );
|
||||
}
|
||||
if( !!max ){
|
||||
max = parseFloat( max ) * ( max.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 );
|
||||
}
|
||||
|
||||
// if there's no media query at all (the () part), or min or max is not null, and if either is present, they're true
|
||||
if( !thisstyle.hasquery || ( !minnull || !maxnull ) && ( minnull || currWidth >= min ) && ( maxnull || currWidth <= max ) ){
|
||||
if( !styleBlocks[ thisstyle.media ] ){
|
||||
styleBlocks[ thisstyle.media ] = [];
|
||||
}
|
||||
styleBlocks[ thisstyle.media ].push( rules[ thisstyle.rules ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//remove any existing respond style element(s)
|
||||
for( var j in appendedEls ){
|
||||
if( appendedEls.hasOwnProperty( j ) ){
|
||||
if( appendedEls[ j ] && appendedEls[ j ].parentNode === head ){
|
||||
head.removeChild( appendedEls[ j ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
appendedEls.length = 0;
|
||||
|
||||
//inject active styles, grouped by media type
|
||||
for( var k in styleBlocks ){
|
||||
if( styleBlocks.hasOwnProperty( k ) ){
|
||||
var ss = doc.createElement( "style" ),
|
||||
css = styleBlocks[ k ].join( "\n" );
|
||||
|
||||
ss.type = "text/css";
|
||||
ss.media = k;
|
||||
|
||||
//originally, ss was appended to a documentFragment and sheets were appended in bulk.
|
||||
//this caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set, so appending beforehand seems best. Thanks to @dvelyk for the initial research on this one!
|
||||
head.insertBefore( ss, lastLink.nextSibling );
|
||||
|
||||
if ( ss.styleSheet ){
|
||||
ss.styleSheet.cssText = css;
|
||||
}
|
||||
else {
|
||||
ss.appendChild( doc.createTextNode( css ) );
|
||||
}
|
||||
|
||||
//push to appendedEls to track for later removal
|
||||
appendedEls.push( ss );
|
||||
}
|
||||
}
|
||||
},
|
||||
//find media blocks in css text, convert to style blocks
|
||||
translate = function( styles, href, media ){
|
||||
var qs = styles.replace( respond.regex.comments, '' )
|
||||
.replace( respond.regex.keyframes, '' )
|
||||
.match( respond.regex.media ),
|
||||
ql = qs && qs.length || 0;
|
||||
|
||||
//try to get CSS path
|
||||
href = href.substring( 0, href.lastIndexOf( "/" ) );
|
||||
|
||||
var repUrls = function( css ){
|
||||
return css.replace( respond.regex.urls, "$1" + href + "$2$3" );
|
||||
},
|
||||
useMedia = !ql && media;
|
||||
|
||||
//if path exists, tack on trailing slash
|
||||
if( href.length ){ href += "/"; }
|
||||
|
||||
//if no internal queries exist, but media attr does, use that
|
||||
//note: this currently lacks support for situations where a media attr is specified on a link AND
|
||||
//its associated stylesheet has internal CSS media queries.
|
||||
//In those cases, the media attribute will currently be ignored.
|
||||
if( useMedia ){
|
||||
ql = 1;
|
||||
}
|
||||
|
||||
for( var i = 0; i < ql; i++ ){
|
||||
var fullq, thisq, eachq, eql;
|
||||
|
||||
//media attr
|
||||
if( useMedia ){
|
||||
fullq = media;
|
||||
rules.push( repUrls( styles ) );
|
||||
}
|
||||
//parse for styles
|
||||
else{
|
||||
fullq = qs[ i ].match( respond.regex.findStyles ) && RegExp.$1;
|
||||
rules.push( RegExp.$2 && repUrls( RegExp.$2 ) );
|
||||
}
|
||||
|
||||
eachq = fullq.split( "," );
|
||||
eql = eachq.length;
|
||||
|
||||
for( var j = 0; j < eql; j++ ){
|
||||
thisq = eachq[ j ];
|
||||
|
||||
if( isUnsupportedMediaQuery( thisq ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
mediastyles.push( {
|
||||
media : thisq.split( "(" )[ 0 ].match( respond.regex.only ) && RegExp.$2 || "all",
|
||||
rules : rules.length - 1,
|
||||
hasquery : thisq.indexOf("(") > -1,
|
||||
minw : thisq.match( respond.regex.minw ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ),
|
||||
maxw : thisq.match( respond.regex.maxw ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" )
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
applyMedia();
|
||||
},
|
||||
|
||||
//recurse through request queue, get css text
|
||||
makeRequests = function(){
|
||||
if( requestQueue.length ){
|
||||
var thisRequest = requestQueue.shift();
|
||||
|
||||
ajax( thisRequest.href, function( styles ){
|
||||
translate( styles, thisRequest.href, thisRequest.media );
|
||||
parsedSheets[ thisRequest.href ] = true;
|
||||
|
||||
// by wrapping recursive function call in setTimeout
|
||||
// we prevent "Stack overflow" error in IE7
|
||||
w.setTimeout(function(){ makeRequests(); },0);
|
||||
} );
|
||||
}
|
||||
},
|
||||
|
||||
//loop stylesheets, send text content to translate
|
||||
ripCSS = function(){
|
||||
|
||||
for( var i = 0; i < links.length; i++ ){
|
||||
var sheet = links[ i ],
|
||||
href = sheet.href,
|
||||
media = sheet.media,
|
||||
isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet";
|
||||
|
||||
//only links plz and prevent re-parsing
|
||||
if( !!href && isCSS && !parsedSheets[ href ] ){
|
||||
// selectivizr exposes css through the rawCssText expando
|
||||
if (sheet.styleSheet && sheet.styleSheet.rawCssText) {
|
||||
translate( sheet.styleSheet.rawCssText, href, media );
|
||||
parsedSheets[ href ] = true;
|
||||
} else {
|
||||
if( (!/^([a-zA-Z:]*\/\/)/.test( href ) && !base) ||
|
||||
href.replace( RegExp.$1, "" ).split( "/" )[0] === w.location.host ){
|
||||
// IE7 doesn't handle urls that start with '//' for ajax request
|
||||
// manually add in the protocol
|
||||
if ( href.substring(0,2) === "//" ) { href = w.location.protocol + href; }
|
||||
requestQueue.push( {
|
||||
href: href,
|
||||
media: media
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
makeRequests();
|
||||
};
|
||||
|
||||
//translate CSS
|
||||
ripCSS();
|
||||
|
||||
//expose update for re-running respond later on
|
||||
respond.update = ripCSS;
|
||||
|
||||
//expose getEmValue
|
||||
respond.getEmValue = getEmValue;
|
||||
|
||||
//adjust on resize
|
||||
function callMedia(){
|
||||
applyMedia( true );
|
||||
}
|
||||
|
||||
if( w.addEventListener ){
|
||||
w.addEventListener( "resize", callMedia, false );
|
||||
}
|
||||
else if( w.attachEvent ){
|
||||
w.attachEvent( "onresize", callMedia );
|
||||
}
|
||||
})(this);
|
@@ -0,0 +1,584 @@
|
||||
(function($) {
|
||||
|
||||
"use strict";
|
||||
|
||||
//Hide Loading Box (Preloader)
|
||||
function handlePreloader() {
|
||||
if($('.preloader').length){
|
||||
$('.preloader').delay(200).fadeOut(500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Update Header Style and Scroll to Top
|
||||
function headerStyle() {
|
||||
if($('.main-header').length){
|
||||
var windowpos = $(window).scrollTop();
|
||||
var siteHeader = $('.main-header');
|
||||
var scrollLink = $('.scroll-to-top');
|
||||
if (windowpos >= 250) {
|
||||
siteHeader.addClass('fixed-header');
|
||||
scrollLink.fadeIn(300);
|
||||
} else {
|
||||
siteHeader.removeClass('fixed-header');
|
||||
scrollLink.fadeOut(300);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
headerStyle();
|
||||
|
||||
|
||||
//Submenu Dropdown Toggle
|
||||
if($('.main-header li.dropdown ul').length){
|
||||
$('.main-header li.dropdown').append('<div class="dropdown-btn"><span class="fa fa-angle-down"></span></div>');
|
||||
|
||||
//Dropdown Button
|
||||
$('.main-header li.dropdown .dropdown-btn').on('click', function() {
|
||||
$(this).prev('ul').slideToggle(500);
|
||||
});
|
||||
|
||||
//Disable dropdown parent link
|
||||
$('.main-header .navigation li.dropdown > a,.hidden-bar .side-menu li.dropdown > a').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//Hidden Bar Menu Config
|
||||
function hiddenBarMenuConfig() {
|
||||
var menuWrap = $('.hidden-bar .side-menu');
|
||||
// hidding submenu
|
||||
menuWrap.find('.dropdown').children('ul').hide();
|
||||
// toggling child ul
|
||||
menuWrap.find('li.dropdown > a').each(function () {
|
||||
$(this).on('click', function (e) {
|
||||
e.preventDefault();
|
||||
$(this).parent('li.dropdown').children('ul').slideToggle();
|
||||
|
||||
// adding class to item container
|
||||
$(this).parent().toggleClass('open');
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
hiddenBarMenuConfig();
|
||||
|
||||
|
||||
//Hidden Sidebar
|
||||
if ($('.hidden-bar').length) {
|
||||
var hiddenBar = $('.hidden-bar');
|
||||
var hiddenBarOpener = $('.hidden-bar-opener');
|
||||
var hiddenBarCloser = $('.hidden-bar-closer');
|
||||
$('.hidden-bar-wrapper').mCustomScrollbar();
|
||||
|
||||
//Show Sidebar
|
||||
hiddenBarOpener.on('click', function () {
|
||||
hiddenBar.addClass('visible-sidebar');
|
||||
});
|
||||
|
||||
//Hide Sidebar
|
||||
hiddenBarCloser.on('click', function () {
|
||||
hiddenBar.removeClass('visible-sidebar');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//Panels Toggle (Shopping Cart Page)
|
||||
if ($('.toggle-panel').length) {
|
||||
var targetPanel = $('.toggle-content');
|
||||
|
||||
//Show Panel
|
||||
$('.toggle-panel').on('click', function () {
|
||||
$(this).toggleClass('active-panel');
|
||||
$(this).next(targetPanel).fadeToggle(300);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Panels Toggle (Shopping Cart Page)
|
||||
if ($('#audio-player').length) {
|
||||
//post audio
|
||||
const audioPlayer = new Plyr('#audio-player',{
|
||||
controls: ['play-large', 'play', 'progress', 'current-time', 'mute', 'volume',],
|
||||
hideControls: true,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Single Item Carousel
|
||||
if ($('.single-item-carousel').length) {
|
||||
$('.single-item-carousel').owlCarousel({
|
||||
loop:true,
|
||||
margin:4,
|
||||
nav:true,
|
||||
smartSpeed: 700,
|
||||
autoplay: 8000,
|
||||
/*animateOut: 'fadeOut',
|
||||
animateIn: 'fadeIn',*/
|
||||
navText: [ '<span class="fa fa-angle-left"></span>', '<span class="fa fa-angle-right"></span>' ],
|
||||
responsive:{
|
||||
0:{
|
||||
items:1
|
||||
},
|
||||
600:{
|
||||
items:1
|
||||
},
|
||||
800:{
|
||||
items:1
|
||||
},
|
||||
1024:{
|
||||
items:1
|
||||
},
|
||||
1200:{
|
||||
items:1
|
||||
},
|
||||
1300:{
|
||||
items:1
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//Two Item Carousel
|
||||
if ($('.two-item-carousel').length) {
|
||||
$('.two-item-carousel').owlCarousel({
|
||||
loop:true,
|
||||
margin:30,
|
||||
nav:true,
|
||||
smartSpeed: 700,
|
||||
autoplay: 8000,
|
||||
/*animateOut: 'fadeOut',
|
||||
animateIn: 'fadeIn',*/
|
||||
navText: [ '<span class="fa fa-angle-left"></span>', '<span class="fa fa-angle-right"></span>' ],
|
||||
responsive:{
|
||||
0:{
|
||||
items:1
|
||||
},
|
||||
600:{
|
||||
items:1
|
||||
},
|
||||
800:{
|
||||
items:1
|
||||
},
|
||||
1024:{
|
||||
items:2
|
||||
},
|
||||
1200:{
|
||||
items:2
|
||||
},
|
||||
1300:{
|
||||
items:2
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//Single Item Carousel
|
||||
if ($('.economics-items-carousel').length) {
|
||||
$('.economics-items-carousel').owlCarousel({
|
||||
loop:true,
|
||||
margin:30,
|
||||
nav:true,
|
||||
smartSpeed: 700,
|
||||
autoplay: 8000,
|
||||
navText: [ '<span class="fa fa-angle-left"></span>', '<span class="fa fa-angle-right"></span>' ],
|
||||
responsive:{
|
||||
0:{
|
||||
items:1
|
||||
},
|
||||
600:{
|
||||
items:1
|
||||
},
|
||||
800:{
|
||||
items:1
|
||||
},
|
||||
1024:{
|
||||
items:1
|
||||
},
|
||||
1200:{
|
||||
items:1
|
||||
},
|
||||
1300:{
|
||||
items:1
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//Three Item Carousel
|
||||
if ($('.three-item-carousel').length) {
|
||||
$('.three-item-carousel').owlCarousel({
|
||||
loop:true,
|
||||
margin:5,
|
||||
nav:true,
|
||||
smartSpeed: 700,
|
||||
autoplay: 8000,
|
||||
/*animateOut: 'fadeOut',
|
||||
animateIn: 'fadeIn',*/
|
||||
navText: [ '<span class="fa fa-angle-left"></span>', '<span class="fa fa-angle-right"></span>' ],
|
||||
responsive:{
|
||||
0:{
|
||||
items:1
|
||||
},
|
||||
600:{
|
||||
items:1
|
||||
},
|
||||
800:{
|
||||
items:2
|
||||
},
|
||||
1024:{
|
||||
items:3
|
||||
},
|
||||
1200:{
|
||||
items:3
|
||||
},
|
||||
1300:{
|
||||
items:3
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//Three Item Carousel
|
||||
if ($('.related-item-carousel').length) {
|
||||
$('.related-item-carousel').owlCarousel({
|
||||
loop:true,
|
||||
margin:30,
|
||||
nav:true,
|
||||
smartSpeed: 700,
|
||||
autoplay: 8000,
|
||||
navText: [ '<span class="fa fa-angle-left"></span>', '<span class="fa fa-angle-right"></span>' ],
|
||||
responsive:{
|
||||
0:{
|
||||
items:1
|
||||
},
|
||||
600:{
|
||||
items:1
|
||||
},
|
||||
800:{
|
||||
items:2
|
||||
},
|
||||
1024:{
|
||||
items:3
|
||||
},
|
||||
1200:{
|
||||
items:3
|
||||
},
|
||||
1300:{
|
||||
items:3
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Jquery Spinner / Quantity Spinner
|
||||
if($('.quantity-spinner').length){
|
||||
$("input.quantity-spinner").TouchSpin({
|
||||
verticalbuttons: true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//Event Countdown Timer
|
||||
if($('.time-countdown').length){
|
||||
$('.time-countdown').each(function() {
|
||||
var $this = $(this), finalDate = $(this).data('countdown');
|
||||
$this.countdown(finalDate, function(event) {
|
||||
var $this = $(this).html(event.strftime('' + '<div class="counter-column"><span class="count">%D</span>Days</div> ' + '<div class="counter-column"><span class="count">%H</span>Hours</div> ' + '<div class="counter-column"><span class="count">%M</span>Minutes</div> ' + '<div class="counter-column"><span class="count">%S</span>Seconds</div>'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//Three Item Carousel
|
||||
if ($('.four-item-carousel').length) {
|
||||
$('.four-item-carousel').owlCarousel({
|
||||
loop:true,
|
||||
margin:30,
|
||||
nav:true,
|
||||
smartSpeed: 700,
|
||||
autoplay: 8000,
|
||||
/*animateOut: 'fadeOut',
|
||||
animateIn: 'fadeIn',*/
|
||||
navText: [ '<span class="fa fa-angle-left"></span>', '<span class="fa fa-angle-right"></span>' ],
|
||||
responsive:{
|
||||
0:{
|
||||
items:1
|
||||
},
|
||||
600:{
|
||||
items:1
|
||||
},
|
||||
800:{
|
||||
items:2
|
||||
},
|
||||
1024:{
|
||||
items:3
|
||||
},
|
||||
1200:{
|
||||
items:4
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Accordion Box
|
||||
if($('.accordion-box').length){
|
||||
$(".accordion-box").on('click', '.acc-btn', function() {
|
||||
|
||||
var outerBox = $(this).parents('.accordion-box');
|
||||
var target = $(this).parents('.accordion');
|
||||
|
||||
if($(this).hasClass('active')!==true){
|
||||
$(outerBox).find('.accordion .acc-btn').removeClass('active');
|
||||
}
|
||||
|
||||
if ($(this).next('.acc-content').is(':visible')){
|
||||
return false;
|
||||
}else{
|
||||
$(this).addClass('active');
|
||||
$(outerBox).children('.accordion').removeClass('active-block');
|
||||
$(outerBox).find('.accordion').children('.acc-content').slideUp(300);
|
||||
target.addClass('active-block');
|
||||
$(this).next('.acc-content').slideDown(300);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Tabs Box
|
||||
if($('.tabs-box').length){
|
||||
$('.tabs-box .tab-buttons .tab-btn').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
var target = $($(this).attr('data-tab'));
|
||||
|
||||
if ($(target).is(':visible')){
|
||||
return false;
|
||||
}else{
|
||||
target.parents('.tabs-box').find('.tab-buttons').find('.tab-btn').removeClass('active-btn');
|
||||
$(this).addClass('active-btn');
|
||||
target.parents('.tabs-box').find('.tabs-content').find('.tab').fadeOut(0);
|
||||
target.parents('.tabs-box').find('.tabs-content').find('.tab').removeClass('active-tab');
|
||||
$(target).fadeIn(300);
|
||||
$(target).addClass('active-tab');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//Gallery Filters
|
||||
if($('.filter-list').length){
|
||||
$('.filter-list').mixItUp({});
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Masonary
|
||||
function enableMasonry() {
|
||||
if($('.masonry-items-container').length){
|
||||
|
||||
var winDow = $(window);
|
||||
// Needed variables
|
||||
var $container=$('.masonry-items-container');
|
||||
|
||||
$container.isotope({
|
||||
itemSelector: '.masonry-item',
|
||||
masonry: {
|
||||
columnWidth : '.masonry-item.col-lg-4'
|
||||
},
|
||||
animationOptions:{
|
||||
duration:500,
|
||||
easing:'linear'
|
||||
}
|
||||
});
|
||||
|
||||
winDow.bind('resize', function(){
|
||||
|
||||
$container.isotope({
|
||||
itemSelector: '.masonry-item',
|
||||
animationOptions: {
|
||||
duration: 500,
|
||||
easing : 'linear',
|
||||
queue : false
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
enableMasonry();
|
||||
|
||||
|
||||
|
||||
// Product Carousel Slider
|
||||
if ($('.shop-page .image-carousel').length && $('.shop-page .thumbs-carousel').length) {
|
||||
|
||||
var $sync3 = $(".shop-page .image-carousel"),
|
||||
$sync4 = $(".shop-page .thumbs-carousel"),
|
||||
flags = false,
|
||||
durations = 500;
|
||||
|
||||
$sync3
|
||||
.owlCarousel({
|
||||
loop:true,
|
||||
items: 1,
|
||||
margin: 0,
|
||||
nav: false,
|
||||
navText: [ '<span class="icon fa fa-angle-left"></span>', '<span class="icon fa fa-angle-right"></span>' ],
|
||||
dots: false,
|
||||
autoplay: true,
|
||||
autoplayTimeout: 5000
|
||||
})
|
||||
.on('changed.owl.carousel', function (e) {
|
||||
if (!flags) {
|
||||
flags = false;
|
||||
$sync4.trigger('to.owl.carousel', [e.item.index, durations, true]);
|
||||
flags = false;
|
||||
}
|
||||
});
|
||||
|
||||
$sync4
|
||||
.owlCarousel({
|
||||
loop:true,
|
||||
margin: 10,
|
||||
items: 1,
|
||||
nav: false,
|
||||
navText: [ '<span class="icon fa fa-angle-left"></span>', '<span class="icon fa fa-angle-right"></span>' ],
|
||||
dots: false,
|
||||
center: false,
|
||||
autoplay: true,
|
||||
autoplayTimeout: 5000,
|
||||
responsive: {
|
||||
0:{
|
||||
items:2,
|
||||
autoWidth: false
|
||||
},
|
||||
400:{
|
||||
items:3,
|
||||
autoWidth: false
|
||||
},
|
||||
600:{
|
||||
items:4,
|
||||
autoWidth: false
|
||||
},
|
||||
900:{
|
||||
items:5,
|
||||
autoWidth: false
|
||||
},
|
||||
1000:{
|
||||
items:6,
|
||||
autoWidth: false
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
.on('click', '.owl-item', function () {
|
||||
$sync3.trigger('to.owl.carousel', [$(this).index(), durations, true]);
|
||||
})
|
||||
.on('changed.owl.carousel', function (e) {
|
||||
if (!flags) {
|
||||
flags = true;
|
||||
$sync3.trigger('to.owl.carousel', [e.item.index, durations, true]);
|
||||
flags = false;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Progress Bar / Levels
|
||||
if($('.skill-progress .progress-box .bar-fill').length){
|
||||
$(".progress-box .bar-fill").each(function() {
|
||||
var progressWidth = $(this).attr('data-percent');
|
||||
$(this).css('width',progressWidth+'%');
|
||||
//$(this).parents('.progress-box').children('.percent').html(progressWidth+'%');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//LightBox / Fancybox
|
||||
if($('.lightbox-image').length) {
|
||||
$('.lightbox-image').fancybox({
|
||||
openEffect : 'fade',
|
||||
closeEffect : 'fade',
|
||||
helpers : {
|
||||
media : {}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Scroll to a Specific Div
|
||||
if($('.scroll-to-target').length){
|
||||
$(".scroll-to-target").on('click', function() {
|
||||
var target = $(this).attr('data-target');
|
||||
// animate
|
||||
$('html, body').animate({
|
||||
scrollTop: $(target).offset().top
|
||||
}, 1000);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//Contact Form Validation
|
||||
if($('#contact-form').length){
|
||||
$('#contact-form').validate({
|
||||
rules: {
|
||||
name: {
|
||||
required: true
|
||||
},
|
||||
email: {
|
||||
required: true
|
||||
},
|
||||
phone: {
|
||||
required: true
|
||||
},
|
||||
message: {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Elements Animation
|
||||
if($('.wow').length){
|
||||
var wow = new WOW(
|
||||
{
|
||||
boxClass: 'wow', // animated element css class (default is wow)
|
||||
animateClass: 'animated', // animation css class (default is animated)
|
||||
offset: 0, // distance to the element when triggering the animation (default is 0)
|
||||
mobile: false, // trigger animations on mobile devices (default is true)
|
||||
live: true // act on asynchronously loaded content (default is true)
|
||||
}
|
||||
);
|
||||
wow.init();
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
When document is Scrollig, do
|
||||
========================================================================== */
|
||||
|
||||
$(window).on('scroll', function() {
|
||||
headerStyle();
|
||||
});
|
||||
|
||||
/* ==========================================================================
|
||||
When document is loaded, do
|
||||
========================================================================== */
|
||||
|
||||
$(window).on('load', function() {
|
||||
handlePreloader();
|
||||
enableMasonry();
|
||||
});
|
||||
|
||||
|
||||
})(window.jQuery);
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user