");
k = $input.parent("." + settings.classes.main);
value = settings.value || $input.data("value");
if ($input.data("exist")) {
basename = $input.data("exist").replace(/\\/g, "/").replace(/.*\//, ""), formatted = settings.format(basename);
var l = new Image();
l.src = $input.data("exist");
l.onload = function() {
k.find("div").html($(l).fadeIn())
};
l.onerror = function() {
k.find("div").html("" + formatted + "")
};
k.addClass(settings.classes.accept)
}
if (value) {
o.preview(value)
}
if ($.isFunction(settings.init)) {
settings.init.apply($input, [value])
}
$input.on("focus.wavatar", function() {
k.addClass(settings.classes.focus)
}).on("blur.wavatar", function() {
k.removeClass(settings.classes.focus)
}).on("change.wavatar", function() {
var d = this.files[0];
if (!d) {
return
}
var f = d.name.replace(/\\/g, "/").replace(/.*\//, ""),
extension = d.name.split(".").pop(),
formatted = settings.format(f);
d.extension = extension;
var g = $input.attr("accept"),
accepted = false,
valid = true,
errors = {
mimeType: false,
maxSize: false,
width: false,
minWidth: false,
maxWidth: false,
height: false,
minHeight: false,
maxHeight: false
};
if (g) {
var h = g.split(/[,|]/);
$.each(h, function(i, c) {
c = $.trim(c);
if (d.type === c) {
accepted = true;
return false
}
if (c.indexOf("/*") !== false) {
var a = c.replace("/*", ""),
b = d.type.replace(/(\/.*)$/g, "");
if (a === b) {
accepted = true;
return false
}
}
});
if (accepted === false) {
errors.mimeType = true
}
} else {
accepted = true
}
k.removeClass(settings.classes.reject + " " + settings.classes.accept);
if (accepted !== true) {
$input.val("");
k.addClass(settings.classes.reject);
if ($.isFunction(settings.reject)) {
settings.reject.apply($input, [d, errors])
}
return false
}
var j = new FileReader(d);
j.readAsDataURL(d);
j.onload = function(e) {
var a = new Image(),
isImage;
d.data = e.target.result;
a.src = d.data;
setTimeout(function() {
isImage = (a.width && a.height);
if (settings.validators.maxSize && d.size > settings.validators.maxSize) {
valid = false;
errors.maxSize = true
}
if (isImage) {
d.width = a.width;
d.height = a.height;
if (settings.validators.width && a.width !== settings.validators.width) {
valid = false;
errors.width = true
}
if (settings.validators.maxWidth && a.width > settings.validators.maxWidth) {
valid = false;
errors.maxWidth = true
}
if (settings.validators.minWidth && a.width < settings.validators.minWidth) {
valid = false;
errors.minWidth = true
}
if (settings.validators.height && a.height !== settings.validators.height) {
valid = false;
errors.height = true
}
if (settings.validators.maxHeight && a.height > settings.validators.maxHeight) {
valid = false;
errors.maxHeight = true
}
if (settings.validators.minHeight && a.height < settings.validators.minHeight) {
valid = false;
errors.minHeight = true
}
}
if (valid === true) {
k.find("img").remove();
if (isImage && settings.previewImage === true) {
k.find("div").html($(a).fadeIn())
} else {
k.find("div").html("" + formatted + "")
}
k.addClass(settings.classes.accept);
if ($.isFunction(settings.accept)) {
settings.accept.apply($input, [d])
}
} else {
$input.val("");
k.addClass(settings.classes.reject);
if ($.isFunction(settings.reject)) {
settings.reject.apply($input, [d, errors])
}
}
}, 250)
}
})
};
p()
};
$.wavatar.prototype.preview = function(a, b) {
var c = this.settings,
$input = this.$input,
$wavatar = $input.parent("." + c.classes.main),
basename = a.replace(/\\/g, "/").replace(/.*\//, ""),
formatted = c.format(basename);
var d = new Image();
d.src = a;
d.onload = function() {
$wavatar.find("div").html($(d).fadeIn());
if ($.isFunction(b)) {
b.apply(this)
}
};
d.onerror = function() {
$wavatar.find("div").html("" + formatted + "");
if ($.isFunction(b)) {
b.apply(this)
}
};
$wavatar.addClass(c.classes.accept)
};
$.wavatar.prototype.destroy = function() {
var a = this.settings,
$input = this.$input;
$input.parent("." + a.classes.main).replaceWith($input);
$input.off("*.wavatar");
$input.removeData("wavatar")
};
$.wavatar.prototype.options = function(a) {
var b = this.settings;
if (!a) {
return b
}
$.extend(true, this.settings, a)
};
$.wavatar.prototype.container = function() {
var a = this.settings,
$input = this.$input;
return $input.parent("." + a.classes.main)
};
$.wavatar.isBrowserCompatible = function() {
return !!(window.File && window.FileList && window.FileReader)
};
$.wavatar.defaults = q;
$.fn.wavatar = function(a) {
var b = arguments,
plugin = $(this).data("wavatar");
if (!plugin) {
return $(this).data("wavatar", new $.wavatar(this, a))
}
if (plugin[a]) {
return plugin[a].apply(plugin, Array.prototype.slice.call(b, 1))
} else {
$.error("wavatar error-Method " + a + " does not exist.")
}
}
}));
/*wTabs*/
(function($, e, f, g) {
"use strict";
var h = 'wTabs';
function Plugin(a, b) {
this.element = a;
this._name = h;
this._defaults = $.fn.wTabs.defaults;
this.options = $.extend({}, this._defaults, $(this.element).data('wtabs'), b);
this.init()
}
$.extend(Plugin.prototype, {
init: function() {
this._initTabs();
this.bindEvents()
},
_initTabs: function() {
$(this.element).attr("id", this.makeid);
var a = $(this.element).attr("id");
$("#" + a + " .tab").children().hide();
$("#" + a + " .nav").children(":first").addClass("active");
$("#" + a + " .tab").children(":first").addClass("active").show()
},
bindEvents: function() {
var c = $(this.element).attr("id");
$("#" + c).on('click', '.nav li a', function() {
$("#" + c + " .nav li").removeClass("active");
$(this).parent().addClass("active");
$("#" + c + " .tab").children().hide();
var a = $(this).data("tab");
var b = $("#" + c + " .tab .item[data-tab=" + a + "]");
$("#" + c + " .tab").children().removeClass('active');
b.addClass('active').show()
})
},
makeid: function() {
var a = "";
var b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
for (var i = 0; i < 2; i++) {
a += b.charAt(Math.floor(Math.random() * b.length))
}
var c = "";
var d = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (var k = 0; k < 5; k++) {
c += d.charAt(Math.floor(Math.random() * d.length))
}
return a + c
},
});
$.fn.wTabs = function(a) {
this.each(function() {
if (!$.data(this, "plugin_" + h)) {
$.data(this, "plugin_" + h, new Plugin(this, a))
}
});
return this
};
$.fn.wTabs.defaults = {}
})(jQuery, window, document);
/*wAccordion*/
(function($, f, g, h) {
"use strict";
var i = 'wAccordion';
function Plugin(a, b) {
this.element = a;
this._name = i;
this._defaults = $.fn.wAccordion.defaults;
this.options = $.extend({}, this._defaults, $(this.element).data('waccordion'), b);
this.init()
}
$.extend(Plugin.prototype, {
init: function() {
var a = this;
var b = $(this.element).find("section .summary");
var c = $(this.element).find("section");
var d = $(this.element).find(".details");
if (this.options.collapsed === true) {
$(d).css('display', 'none')
}
$(b).click(function(e) {
e = $(this).siblings(".details");
e.slideToggle(a.options.slidingSpeed, function() {
a.options.onSlideToggle();
if ($(this).is(":visible")) {
$(this).parent().addClass("active")
} else {
$(this).parent().removeClass("active")
}
});
c.removeClass("active");
if (a.options.closeOther === true) {
$(".details").not(e).slideUp(a.options.slidingSpeed)
}
})
},
});
$.fn.wAccordion = function(a) {
this.each(function() {
if (!$.data(this, "plugin_" + i)) {
$.data(this, "plugin_" + i, new Plugin(this, a))
}
});
return this
};
$.fn.wAccordion.defaults = {
slidingSpeed: 300,
collapsed: true,
closeOther: false,
onSlideToggle: function() {},
}
})(jQuery, window, document);
/*wTags*/
(function($) {
"use strict";
var o = {
tagClass: function(a) {
return 'label'
},
focusClass: 'focus',
itemValue: function(a) {
return a ? a.toString() : a
},
itemText: function(a) {
return this.itemValue(a)
},
itemTitle: function(a) {
return null
},
freeInput: true,
addOnBlur: true,
maxTags: 3,
maxChars: undefined,
confirmKeys: [13, 44],
delimiter: ',',
delimiterRegex: null,
cancelConfirmKeysOnEmpty: false,
onTagExists: function(a, b) {
b.hide().fadeIn()
},
trimValue: false,
allowDuplicates: false,
triggerChange: true
};
function WojoTags(a, b) {
this.isInit = true;
this.itemsArray = [];
this.$element = $(a);
this.$element.hide();
this.objectItems = b && b.itemValue;
this.placeholderText = a.hasAttribute('placeholder') ? this.$element.attr('placeholder') : '';
this.inputSize = Math.max(1, this.placeholderText.length);
this.$container = $('
');
this.$input = $('').appendTo(this.$container);
this.$element.before(this.$container);
this.build(b);
this.isInit = false
}
WojoTags.prototype = {
constructor: WojoTags,
add: function(b, c, d) {
var e = this;
if (e.options.maxTags && e.itemsArray.length >= e.options.maxTags) return;
if (b !== false && !b) return;
if (typeof b === "string" && e.options.trimValue) {
b = $.trim(b)
}
if (typeof b === "object" && !e.objectItems) throw ("Can't add objects when itemValue option is not set");
if (b.toString().match(/^\s*$/)) return;
if (typeof b === "string" && this.$element[0].tagName === 'INPUT') {
var f = (e.options.delimiterRegex) ? e.options.delimiterRegex : e.options.delimiter;
var g = b.split(f);
if (g.length > 1) {
for (var i = 0; i < g.length; i++) {
this.add(g[i], true)
}
if (!c) e.pushVal(e.options.triggerChange);
return
}
}
var h = e.options.itemValue(b),
itemText = e.options.itemText(b),
tagClass = e.options.tagClass(b),
itemTitle = e.options.itemTitle(b);
var j = $.grep(e.itemsArray, function(a) {
return e.options.itemValue(a) === h
})[0];
if (j && !e.options.allowDuplicates) {
if (e.options.onTagExists) {
var k = $(".tag", e.$container).filter(function() {
return $(this).data("item") === j
});
e.options.onTagExists(b, k)
}
return
}
if (e.items().toString().length + b.length + 1 > e.options.maxInputLength) return;
var l = $.Event('beforeItemAdd', {
item: b,
cancel: false,
options: d
});
e.$element.trigger(l);
if (l.cancel) return;
e.itemsArray.push(b);
var m = $('' + htmlEncode(itemText) + '');
m.data('item', b);
e.findInputWrapper().before(m);
m.after(' ');
var n = ($('option[value="' + encodeURIComponent(h) + '"]', e.$element).length || $('option[value="' + htmlEncode(h) + '"]', e.$element).length);
if (!c) e.pushVal(e.options.triggerChange);
if (e.options.maxTags === e.itemsArray.length || e.items().toString().length === e.options.maxInputLength) e.$container.addClass('disabled');
if (this.isInit) {
e.$element.trigger($.Event('itemAddedOnInit', {
item: b,
options: d
}))
} else {
e.$element.trigger($.Event('itemAdded', {
item: b,
options: d
}))
}
},
remove: function(b, c, d) {
var e = this;
if (e.objectItems) {
if (typeof b === "object") b = $.grep(e.itemsArray, function(a) {
return e.options.itemValue(a) == e.options.itemValue(b)
});
else b = $.grep(e.itemsArray, function(a) {
return e.options.itemValue(a) == b
});
b = b[b.length - 1]
}
if (b) {
var f = $.Event('beforeItemRemove', {
item: b,
cancel: false,
options: d
});
e.$element.trigger(f);
if (f.cancel) return;
$('.tag', e.$container).filter(function() {
return $(this).data('item') === b
}).remove();
if ($.inArray(b, e.itemsArray) !== -1) e.itemsArray.splice($.inArray(b, e.itemsArray), 1)
}
if (!c) e.pushVal(e.options.triggerChange);
if (e.options.maxTags > e.itemsArray.length) e.$container.removeClass('disabled');
e.$element.trigger($.Event('itemRemoved', {
item: b,
options: d
}))
},
removeAll: function() {
var a = this;
$('.tag', a.$container).remove();
while (a.itemsArray.length > 0) a.itemsArray.pop();
a.pushVal(a.options.triggerChange)
},
refresh: function() {
var b = this;
$('.tag', b.$container).each(function() {
var a = $(this),
item = a.data('item'),
itemValue = b.options.itemValue(item),
itemText = b.options.itemText(item),
tagClass = b.options.tagClass(item);
a.attr('class', null);
a.addClass('tag ' + htmlEncode(tagClass));
a.contents().filter(function() {
return this.nodeType == 3
})[0].nodeValue = htmlEncode(itemText)
})
},
items: function() {
return this.itemsArray
},
pushVal: function() {
var b = this,
val = $.map(b.items(), function(a) {
return b.options.itemValue(a).toString()
});
b.$element.val(val, true);
if (b.options.triggerChange) b.$element.trigger('change')
},
build: function(h) {
var i = this;
i.options = $.extend({}, o, h);
if (i.objectItems) i.options.freeInput = false;
makeOptionItemFunction(i.options, 'itemValue');
makeOptionItemFunction(i.options, 'itemText');
makeOptionFunction(i.options, 'tagClass');
i.$container.on('click', $.proxy(function(a) {
if (!i.$element.attr('disabled')) {
i.$input.removeAttr('disabled')
}
i.$input.focus()
}, i));
if (i.options.addOnBlur && i.options.freeInput) {
i.$input.on('focusout', $.proxy(function(a) {}, i))
}
i.$container.on({
focusin: function() {
i.$container.addClass(i.options.focusClass)
},
focusout: function() {
i.$container.removeClass(i.options.focusClass)
},
});
i.$container.on('keydown', 'input', $.proxy(function(a) {
var b = $(a.target),
$inputWrapper = i.findInputWrapper();
if (i.$element.attr('disabled')) {
i.$input.attr('disabled', 'disabled');
return
}
switch (a.which) {
case 8:
if (doGetCaretPosition(b[0]) === 0) {
var c = $inputWrapper.prev();
if (c.length) {
i.remove(c.data('item'))
}
}
break;
case 46:
if (doGetCaretPosition(b[0]) === 0) {
var d = $inputWrapper.next();
if (d.length) {
i.remove(d.data('item'))
}
}
break;
case 37:
var e = $inputWrapper.prev();
if (b.val().length === 0 && e[0]) {
e.before($inputWrapper);
b.focus()
}
break;
case 39:
var f = $inputWrapper.next();
if (b.val().length === 0 && f[0]) {
f.after($inputWrapper);
b.focus()
}
break;
default:
}
var g = b.val().length,
wordSpace = Math.ceil(g / 5),
size = g + wordSpace + 1;
b.attr('size', Math.max(this.inputSize, b.val().length))
}, i));
i.$container.on('keypress', 'input', $.proxy(function(a) {
var b = $(a.target);
if (i.$element.attr('disabled')) {
i.$input.attr('disabled', 'disabled');
return
}
var c = b.val(),
maxLengthReached = i.options.maxChars && c.length >= i.options.maxChars;
if (i.options.freeInput && (keyCombinationInList(a, i.options.confirmKeys) || maxLengthReached)) {
if (c.length !== 0) {
i.add(maxLengthReached ? c.substr(0, i.options.maxChars) : c);
b.val('')
}
if (i.options.cancelConfirmKeysOnEmpty === false) {
a.preventDefault()
}
}
var d = b.val().length,
wordSpace = Math.ceil(d / 5),
size = d + wordSpace + 1;
b.attr('size', Math.max(this.inputSize, b.val().length))
}, i));
i.$container.on('click', '[data-role=remove]', $.proxy(function(a) {
if (i.$element.attr('disabled')) {
return
}
i.remove($(a.target).closest('.tag').data('item'))
}, i));
if (i.options.itemValue === o.itemValue) {
i.add(i.$element.val())
}
},
destroy: function() {
var a = this;
a.$container.off('keypress', 'input');
a.$container.off('click', '[role=remove]');
a.$container.remove();
a.$element.removeData('wTags');
a.$element.show()
},
focus: function() {
this.$input.focus()
},
input: function() {
return this.$input
},
findInputWrapper: function() {
var a = this.$input[0],
container = this.$container[0];
while (a && a.parentNode !== container) a = a.parentNode;
return $(a)
}
};
$.fn.wTags = function(c, d, e) {
var f = [];
this.each(function() {
var a = $(this).data('wTags');
if (!a) {
a = new WojoTags(this, c);
$(this).data('wTags', a);
f.push(a);
$(this).val($(this).val())
} else if (!c && !d) {
f.push(a)
} else if (a[c] !== undefined) {
if (a[c].length === 3 && e !== undefined) {
var b = a[c](d, null, e)
} else {
var b = a[c](d)
}
if (b !== undefined) f.push(b)
}
});
if (typeof c == 'string') {
return f.length > 1 ? f : f[0]
} else {
return f
}
};
$.fn.wTags.Constructor = WojoTags;
function makeOptionItemFunction(b, c) {
if (typeof b[c] !== 'function') {
var d = b[c];
b[c] = function(a) {
return a[d]
}
}
}
function makeOptionFunction(a, b) {
if (typeof a[b] !== 'function') {
var c = a[b];
a[b] = function() {
return c
}
}
}
var p = $('');
function htmlEncode(a) {
if (a) {
return p.text(a).html()
} else {
return ''
}
}
function doGetCaretPosition(a) {
var b = 0;
if (document.selection) {
a.focus();
var c = document.selection.createRange();
c.moveStart('character', -a.value.length);
b = c.text.length
} else if (a.selectionStart || a.selectionStart == '0') {
b = a.selectionStart
}
return (b)
}
function keyCombinationInList(d, e) {
var f = false;
$.each(e, function(a, b) {
if (typeof(b) === 'number' && d.which === b) {
f = true;
return false
}
if (d.which === b.which) {
var c = !b.hasOwnProperty('altKey') || d.altKey === b.altKey,
shift = !b.hasOwnProperty('shiftKey') || d.shiftKey === b.shiftKey,
ctrl = !b.hasOwnProperty('ctrlKey') || d.ctrlKey === b.ctrlKey;
if (c && shift && ctrl) {
f = true;
return false
}
}
});
return f
}
})(window.jQuery);
/*Dropdowns*/
(function($) {
"use strict";
var c;
$.fn.wDropdown = function(a, b) {
switch (a) {
case 'attach':
return $(this).attr('data-dropdown', b);
case 'detach':
return $(this).removeAttr('data-dropdown');
case 'show':
return c(null, $(this));
case 'hide':
$.wDropdown.hideAll();
return $(this);
case 'enable':
return $(this).removeClass('dropdown-disabled');
case 'disable':
return $(this).addClass('dropdown-disabled')
}
};
$.wDropdown = function() {};
$.wDropdown.attachAll = function() {
$('body').off('click.dropdown').on('click.dropdown', '[data-dropdown]', c);
$('[data-dropdown]').off('click.dropdown').on('click.dropdown', c);
$('html').off('click.dropdown').on('click.dropdown', $.wDropdown.hideAll);
$(window).off('resize.dropdown').on('resize.dropdown', $.wDropdown.hideAll);
return true
};
$.wDropdown.hideAll = function(e, a) {
var b, hideExceptionID, targetGroup, trigger;
if (e === null) {
e = null
}
if (a === null) {
a = null
}
targetGroup = e ? $(e.target).parents().addBack() : null;
if (targetGroup && targetGroup.hasClass('dropdown') && !targetGroup.is('A')) {
return
}
b = '.wojo.dropdown';
trigger = '[data-dropdown]';
hideExceptionID = '';
if (a) {
hideExceptionID = $(a).attr('id');
if (!$('[data-dropdown="#' + hideExceptionID + '"]').hasClass('open')) {
b = '.wojo.dropdown:not(#' + hideExceptionID + ')';
trigger = '[data-dropdown!="#' + hideExceptionID + '"]'
}
}
$('body').find(b).removeClass('active').end().find(trigger).removeClass('open');
return true
};
$.wDropdown.ANCHOR_POSITIONS = ['top-left', 'top-center', 'top-right', 'right-top', 'right-center', 'right-bottom', 'bottom-left', 'bottom-center', 'bottom-right', 'left-top', 'left-center', 'left-bottom'];
$.wDropdown.defaults = {
anchorPosition: 'center'
};
c = function(e, a) {
var b, $dropdown, $trigger, $menu, addAnchorX, addAnchorY, addX, addY, anchorPosition, anchorSide, bottomTrigger, hasAnchor, heightDropdown, heightTrigger, i, isDisabled, isOpen, left, leftTrigger, len, position, positionParts, ref, rightTrigger, top, topTrigger, widthDropdown, widthTrigger;
if (e === null) {
e = null
}
$trigger = a ? a : $(this);
$dropdown = $($trigger.data('dropdown'));
$menu = $dropdown.children();
b = $dropdown.find('.pointer');
hasAnchor = $dropdown.hasClass('pointing');
isOpen = $trigger.hasClass('active');
isDisabled = $trigger.hasClass('dropdown-disabled');
widthDropdown = $dropdown.outerWidth();
widthTrigger = $trigger.outerWidth();
heightDropdown = $dropdown.outerHeight();
heightTrigger = $trigger.outerHeight();
topTrigger = a ? $trigger.offset().top : $trigger.position().top;
leftTrigger = a ? $trigger.offset().left : $trigger.position().left;
if ($trigger.hasClass('dropdown-use-offset')) {
topTrigger = $trigger.offset().top;
leftTrigger = $trigger.offset().left
}
bottomTrigger = topTrigger + heightTrigger;
rightTrigger = leftTrigger + widthTrigger;
if ($dropdown.length < 1) {
return console.log('[wDropdown] Could not find dropdown: ' + $(this).data('dropdown'))
}
if (b.length < 1 && hasAnchor) {
b = $('');
$dropdown.prepend(b)
}
if (e !== null) {
e.preventDefault();
e.stopPropagation()
}
if (isOpen || isDisabled) {
return false
}
$dropdown.on('click', 'a.item', function() {
$dropdown.children('a.item').removeClass('active');
$(this).addClass('active');
if (typeof $(this).attr('data-value') !== "undefined") {
$dropdown.find('input[type=hidden]').val($(this).attr('data-value'))
}
if (typeof $(this).attr('data-html') !== "undefined") {
$trigger.find('.text').text($(this).attr('data-html'))
}
});
$.wDropdown.hideAll(null, $trigger.data('dropdown'));
anchorPosition = $.wDropdown.defaults.anchorPosition;
ref = $.wDropdown.ANCHOR_POSITIONS;
for (i = 0, len = ref.length; i < len; i++) {
position = ref[i];
if ($dropdown.hasClass(position)) {
anchorPosition = position
}
}
top = 0;
left = 0;
positionParts = anchorPosition.split('-');
anchorSide = positionParts[0];
anchorPosition = positionParts[1];
if (anchorSide === 'top' || anchorSide === 'bottom') {
switch (anchorPosition) {
case 'left':
left = leftTrigger;
break;
case 'center':
left = leftTrigger - widthDropdown / 2 + widthTrigger / 2;
break;
case 'right':
left = rightTrigger - widthDropdown
}
}
if (anchorSide === 'left' || anchorSide === 'right') {
switch (anchorPosition) {
case 'top':
top = topTrigger;
break;
case 'center':
top = topTrigger - heightDropdown / 2 + heightTrigger / 2;
break;
case 'bottom':
top = topTrigger + heightTrigger - heightDropdown
}
}
switch (anchorSide) {
case 'top':
top = topTrigger + heightTrigger;
break;
case 'right':
left = leftTrigger - widthDropdown;
break;
case 'bottom':
top = topTrigger - heightDropdown;
break;
case 'left':
left = leftTrigger + widthTrigger
}
addX = parseInt($dropdown.data('add-x'));
addY = parseInt($dropdown.data('add-y'));
if (!isNaN(addX)) {
left += addX
}
if (!isNaN(addY)) {
top += addY
}
addAnchorX = parseInt($trigger.data('add-anchor-x'));
addAnchorY = parseInt($trigger.data('add-anchor-y'));
if (!isNaN(addAnchorX)) {
b.css({
marginLeft: addAnchorX
})
}
if (!isNaN(addAnchorY)) {
b.css({
marginTop: addAnchorY
})
}
$dropdown.css({
top: top,
left: left,
display: 'block',
"minWidth": $trigger.outerWidth()
});
$dropdown.addClass('active');
$trigger.addClass('open');
return $trigger
};
return $(function() {
return $.wDropdown.attachAll()
})
})(jQuery);
/*Modal*/
(function(factory) {
if (typeof module === "object" && typeof module.exports === "object") {
factory(require("jquery"), window, document)
} else {
factory(jQuery, window, document)
}
}(function($, window, document, undefined) {
var modals = [],
getCurrent = function() {
return modals.length ? modals[modals.length - 1] : null
},
selectCurrent = function() {
var i, selected = false;
for (i = modals.length - 1; i >= 0; i--) {
if (modals[i].$blocker) {
modals[i].$blocker.toggleClass('current', !selected).toggleClass('behind', selected);
selected = true
}
}
};
$.modal = function(el, options) {
var remove, target;
this.$body = $('body');
this.options = $.extend({}, $.modal.defaults, options);
this.$blocker = null;
if (this.options.closeExisting)
while ($.modal.isActive()) $.modal.close();
modals.push(this);
if (el.is('a')) {
target = el.attr('href');
this.anchor = el;
if (/^#/.test(target)) {
this.$elm = $(target);
if (this.$elm.length !== 1) return null;
this.$body.append(this.$elm);
this.open()
}
} else {
this.$elm = el;
this.anchor = el;
this.$body.append(this.$elm);
this.open()
}
};
$.modal.prototype = {
constructor: $.modal,
open: function() {
var m = this;
this.block();
this.anchor.blur();
this.show();
$(document).off('keydown.modal').on('keydown.modal', function(event) {
var current = getCurrent();
if (event.which === 27 && current.options.escapeClose) current.close()
});
if (this.options.clickClose) this.$blocker.click(function(e) {
if (e.target === this) $.modal.close()
})
},
close: function() {
modals.pop();
this.unblock();
this.hide();
if (!$.modal.isActive()) $(document).off('keydown.modal')
},
block: function() {
this.$elm.trigger($.modal.BEFORE_BLOCK, [this._ctx()]);
this.$body.addClass("modal-open");
this.$blocker = $('').appendTo(this.$body);
selectCurrent();
this.$elm.trigger($.modal.BLOCK, [this._ctx()])
},
unblock: function(now) {
this.$blocker.children().appendTo(this.$body);
this.$blocker.remove();
this.$blocker = null;
selectCurrent();
if (!$.modal.isActive()) {
this.$body.removeClass("modal-open")
}
},
show: function() {
this.$elm.trigger($.modal.BEFORE_OPEN, [this._ctx()]);
this.$elm.attr({
"data-delay": this.options.delay,
"data-duration": this.options.speed
});
this.$elm.addClass("animate " + this.options.inAnimation);
if (this.options.showClose) {
this.closeButton = $('');
this.$elm.find(".header").append(this.closeButton)
}
this.$elm.appendTo(this.$blocker);
this.$elm.css('display', 'block');
this.$elm.trigger($.modal.OPEN, [this._ctx()])
},
hide: function() {
this.$elm.trigger($.modal.BEFORE_CLOSE, [this._ctx()]);
this.$elm.removeClass("animate " + this.options.inAnimation);
if (this.closeButton) this.closeButton.remove();
var _this = this;
this.$elm.hide(0, function() {
_this.$elm.trigger($.modal.AFTER_CLOSE, [_this._ctx()]);
if (_this.options.destroy) {
_this.$elm.remove()
}
});
this.$elm.trigger($.modal.CLOSE, [this._ctx()])
},
_ctx: function() {
return {
elm: this.$elm,
$elm: this.$elm,
$blocker: this.$blocker,
options: this.options,
$anchor: this.anchor
}
}
};
$.modal.close = function(event) {
if (!$.modal.isActive()) return;
if (event) event.preventDefault();
var current = getCurrent();
current.close();
return current.$elm
};
$.modal.isActive = function() {
return modals.length > 0
};
$.modal.getCurrent = getCurrent;
$.modal.defaults = {
closeExisting: true,
escapeClose: false,
clickClose: false,
closeText: '×',
showClose: true,
destroy: true,
delay: 40,
speed: 200,
inAnimation: "fadeInTop",
outAnimation: "fadeOutTop"
};
$.modal.BEFORE_BLOCK = 'modal:before-block';
$.modal.BLOCK = 'modal:block';
$.modal.BEFORE_OPEN = 'modal:before-open';
$.modal.OPEN = 'modal:open';
$.modal.BEFORE_CLOSE = 'modal:before-close';
$.modal.CLOSE = 'modal:close';
$.modal.AFTER_CLOSE = 'modal:after-close';
$.fn.modal = function(options) {
if (this.length === 1) {
new $.modal(this, options)
}
return this
};
$(document).on('click.wojo.modal', 'button[data="modal:close"]', $.modal.close);
$(document).on('click', '[data="modal:open"]', function(event) {
event.preventDefault();
$($(this).attr("data-modal")).modal($(this).data("options"))
})
}));
/*Browser Detect*/
! function(a) {
"function" == typeof define && define.amd ? define(["jquery"], function(b) {
return a(b)
}) : "object" == typeof module && "object" == typeof module.exports ? module.exports = a(require("jquery")) : a(window.jQuery)
}(function(a) {
"use strict";
function b(a) {
void 0 === a && (a = window.navigator.userAgent), a = a.toLowerCase();
var b = /(edge)\/([\w.]+)/.exec(a) || /(opr)[\/]([\w.]+)/.exec(a) || /(chrome)[ \/]([\w.]+)/.exec(a) || /(iemobile)[\/]([\w.]+)/.exec(a) || /(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a) || /(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a) || /(webkit)[ \/]([\w.]+)/.exec(a) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a) || /(msie) ([\w.]+)/.exec(a) || a.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec(a) || a.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a) || [],
c = /(ipad)/.exec(a) || /(ipod)/.exec(a) || /(windows phone)/.exec(a) || /(iphone)/.exec(a) || /(kindle)/.exec(a) || /(silk)/.exec(a) || /(android)/.exec(a) || /(win)/.exec(a) || /(mac)/.exec(a) || /(linux)/.exec(a) || /(cros)/.exec(a) || /(playbook)/.exec(a) || /(bb)/.exec(a) || /(blackberry)/.exec(a) || [],
d = {},
e = {
browser: b[5] || b[3] || b[1] || "",
version: b[2] || b[4] || "0",
versionNumber: b[4] || b[2] || "0",
platform: c[0] || ""
};
if (e.browser && (d[e.browser] = !0, d.version = e.version, d.versionNumber = parseInt(e.versionNumber, 10)), e.platform && (d[e.platform] = !0), (d.android || d.bb || d.blackberry || d.ipad || d.iphone || d.ipod || d.kindle || d.playbook || d.silk || d["windows phone"]) && (d.mobile = !0), (d.cros || d.mac || d.linux || d.win) && (d.desktop = !0), (d.chrome || d.opr || d.safari) && (d.webkit = !0), d.rv || d.iemobile) {
var f = "msie";
e.browser = f, d[f] = !0
}
if (d.edge) {
delete d.edge;
var g = "msedge";
e.browser = g, d[g] = !0
}
if (d.safari && d.blackberry) {
var h = "blackberry";
e.browser = h, d[h] = !0
}
if (d.safari && d.playbook) {
var i = "playbook";
e.browser = i, d[i] = !0
}
if (d.bb) {
var j = "blackberry";
e.browser = j, d[j] = !0
}
if (d.opr) {
var k = "opera";
e.browser = k, d[k] = !0
}
if (d.safari && d.android) {
var l = "android";
e.browser = l, d[l] = !0
}
if (d.safari && d.kindle) {
var m = "kindle";
e.browser = m, d[m] = !0
}
if (d.safari && d.silk) {
var n = "silk";
e.browser = n, d[n] = !0
}
return d.name = e.browser, d.platform = e.platform, d
}
return window.jQBrowser = b(window.navigator.userAgent), window.jQBrowser.uaMatch = b, a && (a.browser = window.jQBrowser), window.jQBrowser
});
/*color picker*/
(function($, h, j, k) {
"use strict";
var l = 'wColorPicker';
function Plugin(a, b) {
this.element = a;
this._name = l;
this._defaults = $.fn.wColorPicker.defaults;
this.options = $.extend({}, this._defaults, b);
this.init()
}
$.extend(Plugin.prototype, {
init: function() {
var b = [];
$.each(this.options.palette.map(function(x) {
return x.toUpperCase()
}), function(i, a) {
if ($.inArray(a, b) === -1) {
b.push(a)
}
});
this.palette = b;
this.bindEvents()
},
bindEvents: function() {
var c = this;
$(c.element).on('click' + '.' + c._name, function(b) {
b.preventDefault();
c._show();
$(".customColorHash", c._defaults.elementClass).val(c.color);
$(c._defaults.elementClass).on('click', ' .item', function(a) {
c.color = $(a.target).attr('hexValue');
c.callback();
c._appendToStorage($(a.target).attr('hexValue'));
c._onChange();
c._hide();
return false
});
$(c._defaults.elementClass).on('click', '.button.reset', function() {
if ($(c.element).is("input")) {
$(c.element).val('')
} else {
$(c.element).css({
'backgroundColor': '',
})
}
c._hide()
});
$(c._defaults.elementClass).on('click', '.button.apply', function() {
var a = $('.customColorHash', c._defaults.elementClass);
c._testHash(a, true)
});
$(c._defaults.elementClass).on('keyup', '.customColorHash', function() {
var a = $(this);
c._testHash(a, false)
});
$(c._defaults.elementClass).on('click', '.button[data-close]', function(a) {
c._hide();
a.preventDefault()
});
return false
})
},
_show: function() {
var c = this;
$(c._defaults.elementClass).remove();
$("body").append('
' + c.options.paletteLabel + '
');
jQuery.each(this.palette, function(a, b) {
$(c._defaults.elementClass).append('')
});
if (c.options.allowCustomColor === true) {
$(c._defaults.elementClass).append('')
}
if (c.options.allowRecent === true) {
$(c._defaults.elementClass).append('
' + c.options.recentLabel + '
');
if (JSON.parse(localStorage.getItem("wColorRecentItems")) === null || JSON.parse(localStorage.getItem("wColorRecentItems")) === []) {
$(c._defaults.elementClass).append('')
} else {
jQuery.each(JSON.parse(localStorage.getItem("wColorRecentItems")), function(a, b) {
$(c._defaults.elementClass).append('');
if (a === c.options.recentMax - 1) {
return false
}
})
}
}
var d = $(".item", c._defaults.elementClass);
var e = c.options.rows;
for (var i = 0; i < d.length; i += e) {
d.slice(i, i + e).wrapAll("")
}
var f = '';
var g = (c.options.allowCustomColor ? '' : '');
$(c._defaults.elementClass).append('
' + g + f + '
');
$(c._defaults.elementClass).prepend('');
c._setPosition();
$(c._defaults.elementClass).addClass(c.options.inAnimation)
},
_hide: function() {
var a = this;
$(a._defaults.elementClass).fadeOut(200, function() {
$(a._defaults.elementClass).remove();
return this
})
},
_appendToStorage: function(a) {
var b = this;
if (b.options.allowRecent === true) {
var c = JSON.parse(localStorage.getItem("wColorRecentItems"));
if (c === null) {
c = []
}
if ($.inArray(a, c) === -1) {
c.unshift(a);
c = c.slice(0, b.options.recentMax);
localStorage.setItem("wColorRecentItems", JSON.stringify(c))
}
}
},
_onChange: function() {
if ($(this.element).is("input")) {
$(this.element).val(this.color);
$(this.element).css("color", this.color)
} else {
$(this.element).css({
'backgroundColor': this.color,
})
}
},
_testHash: function(a, b) {
var c = this;
var d = a.val();
if (d.indexOf('#') !== 0) {
d = "#" + d
}
if (/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(d)) {
c.color = d;
c._appendToStorage(d);
c._onChange();
a.parent().removeClass('error');
(b) ? c._hide(): ''
} else {
a.parent().addClass('error')
}
},
_setPosition: function() {
var a = this,
target, picker, wWidth, left;
target = a._getElementOffset($(a.element));
picker = a._getElementOffset($(a._defaults.elementClass));
wWidth = $(h).width();
switch (a.options.alignment.toLowerCase()) {
case 'tl':
left = target.l;
left = (parseInt(left + picker.w) >= wWidth) ? wWidth - picker.w : left;
$(a._defaults.elementClass).css({
left: left,
top: target.t - (picker.h + 2)
});
break;
case 'tr':
left = (target.l + target.w) - picker.w;
left = (left <= 0) ? 16 : left;
$(a._defaults.elementClass).css({
left: left,
top: target.t - (picker.h + 2)
});
break;
case 'br':
left = (target.l + target.w) - picker.w;
left = (left <= 0) ? 16 : left;
$(a._defaults.elementClass).css({
left: left,
top: target.t + target.h + 2
});
break;
default:
left = target.l;
left = (parseInt(left + picker.w) >= wWidth) ? wWidth - picker.w - 16 : left;
$(a._defaults.elementClass).css({
left: left,
top: target.t + target.h + 2
});
break
}
},
_getElementOffset: function(a) {
var o = [];
var b = a.get(0);
o.w = b.offsetWidth;
o.h = b.offsetHeight;
o.l = a.offset().left;
o.t = a.offset().top;
return o
},
callback: function() {
var a = this.options.onChangeColor;
if (typeof a === 'function') {
a.call(this.color, this.element)
}
}
});
$.fn.wColorPicker = function(a) {
this.each(function() {
if (!$.data(this, "plugin_" + l)) {
$.data(this, "plugin_" + l, new Plugin(this, a))
}
});
return this
};
$.fn.wColorPicker.defaults = {
inAnimation: 'scaleIn',
applyLabel: "Apply:",
resetLabel: "Reset:",
recentLabel: "Recent:",
paletteLabel: 'Default Palette:',
elementClass: ".wojo.color.picker",
allowRecent: true,
recentMax: 10,
rows: 10,
alignment: "bl",
allowCustomColor: true,
palette: ["#1abc9c", "#16a085", "#2ecc71", "#27ae60", "#3498db", "#2980b9", "#9b59b6", "#8e44ad", "#34495e", "#2c3e50", "#f1c40f", "#f39c12", "#e67e22", "#d35400", "#e74c3c", "#c0392b", "#ecf0f1", "#bdc3c7", "#95a5a6", "#7f8c8d"],
onChangeColor: null
}
})(jQuery, window, document);
/*wNumber*/
(function($, d, f, g) {
"use strict";
var h;
var i = function(b, c) {
this.$el = b;
this.options = $.extend({}, i.rules.defaults, i.rules[c.rule] || {}, c);
this.min = Number(this.options.min) || 0;
this.max = Number(this.options.max) || 0;
this.spinningTimer = null;
this.$el.on({
'focus.spinner': $.proxy(function(e) {
e.preventDefault();
$(f).trigger('mouseup.spinner');
this.oldValue = this.value()
}, this),
'change.spinner': $.proxy(function(e) {
e.preventDefault();
this.value(this.$el.val())
}, this),
'keydown.spinner': $.proxy(function(e) {
var a = {
38: 'up',
40: 'down'
} [e.which];
if (a) {
e.preventDefault();
this.spin(a)
}
}, this)
});
this.oldValue = this.value();
this.value(this.$el.val());
return this
};
i.rules = {
defaults: {
min: null,
max: null,
step: 1,
precision: 0
},
currency: {
min: 0.00,
max: null,
step: 0.01,
precision: 2
},
quantity: {
min: 1,
max: 999,
step: 1,
precision: 0
},
percent: {
min: 1,
max: 100,
step: 1,
precision: 0
},
month: {
min: 1,
max: 12,
step: 1,
precision: 0
},
day: {
min: 1,
max: 31,
step: 1,
precision: 0
},
hour: {
min: 0,
max: 23,
step: 1,
precision: 0
},
minute: {
min: 1,
max: 59,
step: 1,
precision: 0
},
second: {
min: 1,
max: 59,
step: 1,
precision: 0
}
};
i.prototype = {
spin: function(a) {
if (this.$el.prop('disabled')) {
return
}
this.oldValue = this.value();
var b = $.isFunction(this.options.step) ? this.options.step.call(this, a) : this.options.step;
var c = a === 'up' ? 1 : -1;
this.value(this.oldValue + Number(b) * c)
},
value: function(v) {
if (v === null || v === g) {
return this.numeric(this.$el.val())
}
v = this.numeric(v);
var a = this.validate(v);
if (a !== 0) {
v = (a === -1) ? this.min : this.max
}
this.$el.val(v.toFixed(this.options.precision));
if (this.oldValue !== this.value()) {
this.$el.trigger('changing.spinner', [this.value(), this.oldValue]);
clearTimeout(this.spinningTimer);
this.spinningTimer = setTimeout($.proxy(function() {
this.$el.trigger('changed.spinner', [this.value(), this.oldValue])
}, this), h.delay)
}
},
numeric: function(v) {
v = this.options.precision > 0 ? parseFloat(v, 10) : parseInt(v, 10);
if (isFinite(v)) {
return v
}
return v || this.options.min || 0
},
validate: function(a) {
if (this.options.min !== null && a < this.min) {
return -1
}
if (this.options.max !== null && a > this.max) {
return 1
}
return 0
}
};
h = function(a, b) {
this.$el = $(a);
this.$spinning = this.$el.find('[data-spin="spinner"]');
if (this.$spinning.length === 0) {
this.$spinning = this.$el.find('input[type="text"]')
}
b = $.extend({}, b, this.$spinning.data());
this.spinning = new i(this.$spinning, b);
this.$el.on('click.spinner', '[data-spin="up"], [data-spin="down"]', $.proxy(this, 'spin')).on('mousedown.spinner', '[data-spin="up"], [data-spin="down"]', $.proxy(this, 'spin'));
$(f).on('mouseup.spinner', $.proxy(function() {
clearTimeout(this.spinTimeout);
clearInterval(this.spinInterval)
}, this));
if (b.delay) {
this.delay(b.delay)
}
if (b.changed) {
this.changed(b.changed)
}
if (b.changing) {
this.changing(b.changing)
}
};
h.delay = 500;
h.prototype = {
constructor: h,
spin: function(e) {
var a = $(e.currentTarget).data('spin');
switch (e.type) {
case 'click':
e.preventDefault();
this.spinning.spin(a);
break;
case 'mousedown':
if (e.which === 1) {
this.spinTimeout = setTimeout($.proxy(this, 'beginSpin', a), 300)
}
break
}
},
delay: function(a) {
var b = Number(a);
if (b >= 0) {
this.constructor.delay = b + 100
}
},
value: function() {
return this.spinning.value()
},
changed: function(a) {
this.bindHandler('changed.spinner', a)
},
changing: function(a) {
this.bindHandler('changing.spinner', a)
},
bindHandler: function(t, a) {
if ($.isFunction(a)) {
this.$spinning.on(t, a)
} else {
this.$spinning.off(t)
}
},
beginSpin: function(a) {
this.spinInterval = setInterval($.proxy(this.spinning, 'spin', a), 100)
}
};
var j = $.fn.wNumber;
$.fn.wNumber = function(b, c) {
return this.each(function() {
var a = $.data(this, 'spinner');
if (!a) {
a = new h(this, b);
$.data(this, 'spinner', a)
}
if (b === 'delay' || b === 'changed' || b === 'changing') {
a[b](c)
} else if (b === 'step' && c) {
a.spinning.step = c
} else if (b === 'spin' && c) {
a.spinning.spin(c)
}
})
};
$.fn.wNumber.Constructor = h;
$.fn.wNumber.noConflict = function() {
$.fn.wNumber = j;
return this
};
return $.fn.wNumber
})(jQuery, window, document);
/*! wRange.js - v2.3.2 | (c) 2018 @andreruffert | MIT license | https://github.com/andreruffert/wRange.js */
(function(factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory)
} else if (typeof exports === 'object') {
module.exports = factory(require('jquery'))
} else {
factory(jQuery)
}
}(function($) {
'use strict';
Number.isNaN = Number.isNaN || function(value) {
return typeof value === 'number' && value !== value
};
function supportsRange() {
var input = document.createElement('input');
input.setAttribute('type', 'range');
return input.type !== 'text'
}
var pluginName = 'wRange',
pluginIdentifier = 0,
hasInputRangeSupport = supportsRange(),
defaults = {
polyfill: false,
orientation: 'horizontal',
rangeClass: 'wojo range',
disabledClass: 'disabled',
activeClass: 'active',
horizontalClass: 'horizontal',
verticalClass: 'vertical',
fillClass: 'fill',
labelsClass: 'labels',
labelClass: 'label',
handleClass: 'handle',
startEvent: ['mousedown', 'touchstart', 'pointerdown'],
moveEvent: ['mousemove', 'touchmove', 'pointermove'],
endEvent: ['mouseup', 'touchend', 'pointerup']
},
constants = {
orientation: {
horizontal: {
dimension: 'width',
direction: 'left',
directionStyle: 'left',
coordinate: 'x'
},
vertical: {
dimension: 'height',
direction: 'top',
directionStyle: 'bottom',
coordinate: 'y'
}
}
};
function delay(fn, wait) {
var args = Array.prototype.slice.call(arguments, 2);
return setTimeout(function() {
return fn.apply(null, args)
}, wait)
}
function debounce(fn, debounceDuration) {
debounceDuration = debounceDuration || 100;
return function() {
if (!fn.debouncing) {
var args = Array.prototype.slice.apply(arguments);
fn.lastReturnVal = fn.apply(window, args);
fn.debouncing = true
}
clearTimeout(fn.debounceTimeout);
fn.debounceTimeout = setTimeout(function() {
fn.debouncing = false
}, debounceDuration);
return fn.lastReturnVal
}
}
function isHidden(element) {
return (element && (element.offsetWidth === 0 || element.offsetHeight === 0 || element.open === false))
}
function getHiddenParentNodes(element) {
var parents = [],
node = element.parentNode;
while (isHidden(node)) {
parents.push(node);
node = node.parentNode
}
return parents
}
function getDimension(element, key) {
var hiddenParentNodes = getHiddenParentNodes(element),
hiddenParentNodesLength = hiddenParentNodes.length,
inlineStyle = [],
dimension = element[key];
function toggleOpenProperty(element) {
if (typeof element.open !== 'undefined') {
element.open = (element.open) ? false : true
}
}
if (hiddenParentNodesLength) {
for (var i = 0; i < hiddenParentNodesLength; i++) {
inlineStyle[i] = hiddenParentNodes[i].style.cssText;
if (hiddenParentNodes[i].style.setProperty) {
hiddenParentNodes[i].style.setProperty('display', 'block', 'important')
} else {
hiddenParentNodes[i].style.cssText += ';display: block !important'
}
hiddenParentNodes[i].style.height = '0';
hiddenParentNodes[i].style.overflow = 'hidden';
hiddenParentNodes[i].style.visibility = 'hidden';
toggleOpenProperty(hiddenParentNodes[i])
}
dimension = element[key];
for (var j = 0; j < hiddenParentNodesLength; j++) {
hiddenParentNodes[j].style.cssText = inlineStyle[j];
toggleOpenProperty(hiddenParentNodes[j])
}
}
return dimension
}
function tryParseFloat(str, defaultValue) {
var value = parseFloat(str);
return Number.isNaN(value) ? defaultValue : value
}
function ucfirst(str) {
return str.charAt(0).toUpperCase() + str.substr(1)
}
function Plugin(element, options) {
this.$window = $(window);
this.$document = $(document);
this.$element = $(element);
this.options = $.extend({}, defaults, options);
this.polyfill = this.options.polyfill;
this.orientation = this.$element[0].getAttribute('data-orientation') || this.options.orientation;
this.onInit = this.options.onInit;
this.onSlide = this.options.onSlide;
this.onSlideEnd = this.options.onSlideEnd;
this.DIMENSION = constants.orientation[this.orientation].dimension;
this.DIRECTION = constants.orientation[this.orientation].direction;
this.DIRECTION_STYLE = constants.orientation[this.orientation].directionStyle;
this.COORDINATE = constants.orientation[this.orientation].coordinate;
if (this.polyfill) {
if (hasInputRangeSupport) {
return false
}
}
this.identifier = pluginName + '-' + (pluginIdentifier++);
this.startEvent = this.options.startEvent.join('.' + this.identifier + ' ') + '.' + this.identifier;
this.moveEvent = this.options.moveEvent.join('.' + this.identifier + ' ') + '.' + this.identifier;
this.endEvent = this.options.endEvent.join('.' + this.identifier + ' ') + '.' + this.identifier;
this.toFixed = (this.step + '').replace('.', '').length - 1;
this.$fill = $('');
this.$handle = $('');
this.$range = $('').insertAfter(this.$element).prepend(this.$fill, this.$handle);
var _this = this;
if (typeof this.$element.attr("class") !== "undefined" && this.$element.attr("class") !== false) {
this.$range.addClass(this.$element.attr("class"))
}
if (typeof this.$element.attr("data-labels") !== "undefined" && this.$element.attr("data-labels") !== false) {
var rangeLabels = this.$element.attr('data-labels');
rangeLabels = rangeLabels.split(',');
this.$range.append('');
var $el = this.$range;
$(rangeLabels).each(function(index, value) {
$el.find('.' + _this.options.labelsClass).append('' + value + '')
})
}
var suffix = '';
if (typeof this.$element.attr("data-suffix") !== "undefined" && this.$element.attr("data-suffix") !== false) {
suffix = '
0' + this.$element.attr("data-suffix") + '
'
} else {
suffix = '
0
'
}
this.$range.prepend(suffix);
this.$element.css({
'opacity': '0'
});
this.handleDown = $.proxy(this.handleDown, this);
this.handleMove = $.proxy(this.handleMove, this);
this.handleEnd = $.proxy(this.handleEnd, this);
this.init();
this.$window.on('resize.' + this.identifier, debounce(function() {
delay(function() {
_this.update(false, false)
}, 300)
}, 20));
this.$document.on(this.startEvent, '#' + this.identifier + ':not(.' + this.options.disabledClass + ')', this.handleDown);
this.$element.on('change.' + this.identifier, function(e, data) {
if (data && data.origin === _this.identifier) {
return
}
var value = e.target.value,
pos = _this.getPositionFromValue(value);
_this.setPosition(pos)
});
this.$range.find('.counter span').text(this.value)
}
Plugin.prototype.init = function() {
this.update(true, false);
if (this.onInit && typeof this.onInit === 'function') {
this.onInit()
}
};
Plugin.prototype.update = function(updateAttributes, triggerSlide) {
updateAttributes = updateAttributes || false;
if (updateAttributes) {
this.min = tryParseFloat(this.$element[0].getAttribute('min'), 0);
this.max = tryParseFloat(this.$element[0].getAttribute('max'), 100);
this.value = tryParseFloat(this.$element[0].value, Math.round(this.min + (this.max - this.min) / 2));
this.step = tryParseFloat(this.$element[0].getAttribute('step'), 1)
}
this.handleDimension = getDimension(this.$handle[0], 'offset' + ucfirst(this.DIMENSION));
this.rangeDimension = getDimension(this.$range[0], 'offset' + ucfirst(this.DIMENSION));
this.maxHandlePos = this.rangeDimension - this.handleDimension;
this.grabPos = this.handleDimension / 2;
this.position = this.getPositionFromValue(this.value);
if (this.$element[0].disabled) {
this.$range.addClass(this.options.disabledClass)
} else {
this.$range.removeClass(this.options.disabledClass)
}
this.setPosition(this.position, triggerSlide)
};
Plugin.prototype.handleDown = function(e) {
e.preventDefault();
if (e.button && e.button !== 0) {
return
}
this.$document.on(this.moveEvent, this.handleMove);
this.$document.on(this.endEvent, this.handleEnd);
this.$range.addClass(this.options.activeClass);
if ((' ' + e.target.className + ' ').replace(/[\n\t]/g, ' ').indexOf(this.options.handleClass) > -1) {
return
}
var pos = this.getRelativePosition(e),
rangePos = this.$range[0].getBoundingClientRect()[this.DIRECTION],
handlePos = this.getPositionFromNode(this.$handle[0]) - rangePos,
setPos = (this.orientation === 'vertical') ? (this.maxHandlePos - (pos - this.grabPos)) : (pos - this.grabPos);
this.setPosition(setPos);
if (pos >= handlePos && pos < handlePos + this.handleDimension) {
this.grabPos = pos - handlePos
}
};
Plugin.prototype.handleMove = function(e) {
e.preventDefault();
var pos = this.getRelativePosition(e);
var setPos = (this.orientation === 'vertical') ? (this.maxHandlePos - (pos - this.grabPos)) : (pos - this.grabPos);
this.setPosition(setPos);
this.$range.find('.counter span').text(this.value)
};
Plugin.prototype.handleEnd = function(e) {
e.preventDefault();
this.$document.off(this.moveEvent, this.handleMove);
this.$document.off(this.endEvent, this.handleEnd);
this.$range.removeClass(this.options.activeClass);
this.$element.trigger('change', {
origin: this.identifier
});
if (this.onSlideEnd && typeof this.onSlideEnd === 'function') {
this.onSlideEnd(this.position, this.value)
}
this.$range.find('.counter span').text(this.value)
};
Plugin.prototype.cap = function(pos, min, max) {
if (pos < min) {
return min
}
if (pos > max) {
return max
}
return pos
};
Plugin.prototype.setPosition = function(pos, triggerSlide) {
var value, newPos;
if (triggerSlide === undefined) {
triggerSlide = true
}
value = this.getValueFromPosition(this.cap(pos, 0, this.maxHandlePos));
newPos = this.getPositionFromValue(value);
this.$fill[0].style[this.DIMENSION] = (newPos + this.grabPos) + 'px';
this.$handle[0].style[this.DIRECTION_STYLE] = newPos + 'px';
this.setValue(value);
this.position = newPos;
this.value = value;
if (triggerSlide && this.onSlide && typeof this.onSlide === 'function') {
this.onSlide(newPos, value)
}
};
Plugin.prototype.getPositionFromNode = function(node) {
var i = 0;
while (node !== null) {
i += node.offsetLeft;
node = node.offsetParent
}
return i
};
Plugin.prototype.getRelativePosition = function(e) {
var ucCoordinate = ucfirst(this.COORDINATE),
rangePos = this.$range[0].getBoundingClientRect()[this.DIRECTION],
pageCoordinate = 0;
if (typeof e.originalEvent['client' + ucCoordinate] !== 'undefined') {
pageCoordinate = e.originalEvent['client' + ucCoordinate]
} else if (e.originalEvent.touches && e.originalEvent.touches[0] && typeof e.originalEvent.touches[0]['client' + ucCoordinate] !== 'undefined') {
pageCoordinate = e.originalEvent.touches[0]['client' + ucCoordinate]
} else if (e.currentPoint && typeof e.currentPoint[this.COORDINATE] !== 'undefined') {
pageCoordinate = e.currentPoint[this.COORDINATE]
}
return pageCoordinate - rangePos
};
Plugin.prototype.getPositionFromValue = function(value) {
var percentage, pos;
percentage = (value - this.min) / (this.max - this.min);
pos = (!Number.isNaN(percentage)) ? percentage * this.maxHandlePos : 0;
return pos
};
Plugin.prototype.getValueFromPosition = function(pos) {
var percentage, value;
percentage = ((pos) / (this.maxHandlePos || 1));
value = this.step * Math.round(percentage * (this.max - this.min) / this.step) + this.min;
return Number((value).toFixed(this.toFixed))
};
Plugin.prototype.setValue = function(value) {
if (value === this.value && this.$element[0].value !== '') {
return
}
this.$element.val(value).trigger('input', {
origin: this.identifier
})
};
Plugin.prototype.destroy = function() {
this.$document.off('.' + this.identifier);
this.$window.off('.' + this.identifier);
this.$element.off('.' + this.identifier).removeAttr('style').removeData('plugin_' + pluginName);
if (this.$range && this.$range.length) {
this.$range[0].parentNode.removeChild(this.$range[0])
}
};
$.fn[pluginName] = function(options) {
var args = Array.prototype.slice.call(arguments, 1);
return this.each(function() {
var $this = $(this),
data = $this.data('plugin_' + pluginName);
if (!data) {
$this.data('plugin_' + pluginName, (data = new Plugin(this, options)))
}
if (typeof options === 'string') {
data[options].apply(data, args)
}
})
};
return 'wRange.js is available in jQuery context e.g $(selector).wRange(options);'
}));
/*wDatePicker*/
(function(t, $, u) {
"use strict";
(function() {
Date.prototype.getDaysCount = function() {
return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate()
};
var s = [9, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123],
DCAL_DATA = '_wDate',
wDatePicker = function(a, b) {
var _ = this;
_.animating = false;
_.visible = false;
_.input = $(a);
_.config = b;
_.viewMode = 'calendar';
_.datepicker = {
container: $(''),
wrapper: $(''),
header: {
wrapper: $(''),
selectedYear: $(''),
selectedDate: $('')
},
calendarHolder: {
wrapper: $(''),
btnPrev: $(''),
btnNext: $(''),
calendarViews: {
wrapper: $(''),
calendars: []
},
yearsView: $(''),
monthsView: $(''),
buttons: {
wrapper: $(''),
btnClear: $(''),
btnToday: $(''),
btnCancel: $(''),
btnOk: $('')
}
}
};
_.date = _.input.val() === '' ? new Date() : _.parseDate(_.input.val()).date;
_.selected = {
year: _.date.getFullYear(),
month: _.date.getMonth(),
date: _.date.getDate()
};
_.viewMonth = _.selected.month;
_.viewYear = _.selected.year;
_.minDate = _.input.data('mindate') || _.config.minDate;
_.maxDate = _.input.data('maxdate') || _.config.maxDate;
_.rangeFromEl = _.input.data('rangefrom') || _.config.rangeFrom;
_.rangeToEl = _.input.data('rangeto') || _.config.rangeTo;
if (a.nodeName === 'INPUT') {
this.elIsInput = true
}
var c = _.input.prop("name");
var d = _.input.val();
if (this.elIsInput) {
if (!$('input[name="' + c + '_submit"]').length) {
$('', {
type: "hidden",
name: c + '_submit',
value: d,
}).insertAfter(_.input)
}
}
_.setupPicker();
_.setSelection()
};
wDatePicker.prototype = {
constructor: wDatePicker,
setupPicker: function() {
var _ = this,
picker = _.datepicker,
header = picker.header,
calendarHolder = picker.calendarHolder,
buttons = calendarHolder.buttons;
header.wrapper.append(header.selectedYear).append(header.selectedDate).appendTo(picker.wrapper);
var b = 0;
for (var r = 1; r < 4; r++) {
var c = $('');
for (var i = 0; i < 4; i++) {
var d = $('');
if (b === _.selected.month) {
d.addClass('selected')
}
d.text(_.config.short_months[b]).data('month', b).appendTo(c).on('click', function() {
var a = $(this),
_data = a.data('month');
_.viewMonth = _data;
_.setupCalendar();
_.switchView('calendar')
});
b++
}
calendarHolder.monthsView.append(c)
}
calendarHolder.yearsView.html(_.getYears());
if (_.config.clearBtn) {
buttons.wrapper.append(buttons.btnClear)
}
if (_.config.todayBtn) {
buttons.wrapper.append(buttons.btnToday)
}
if (_.config.cancelBtn) {
buttons.wrapper.append(buttons.btnCancel)
}
if (!_.config.auto) {
buttons.wrapper.append(buttons.btnOk)
}
calendarHolder.wrapper.append(calendarHolder.btnPrev).append(calendarHolder.btnNext).append(calendarHolder.calendarViews.wrapper).append(calendarHolder.monthsView).append(calendarHolder.yearsView).append(buttons.wrapper).appendTo(picker.wrapper);
picker.container.append(picker.wrapper).appendTo('body');
_.input.on('click', function() {
_.show()
}).on('keydown', function(e) {
if (e.keyCode === 13) {
_.show()
}
return !(s.indexOf(e.which) < 0)
}).prop('readonly', true);
header.selectedYear.click(function() {
if (_.viewMode !== 'years') {
_.switchView('years')
}
});
header.selectedDate.click(function() {
if ((_.viewMonth !== _.selected.month || _.viewYear !== _.selected.year) || _.viewMode !== 'calendar') {
_.viewMonth = _.selected.month;
_.viewYear = _.selected.year;
_.setupCalendar();
_.switchView('calendar')
}
});
calendarHolder.btnPrev.click(function() {
_.move('prev')
});
calendarHolder.btnNext.click(function() {
_.move('next')
});
calendarHolder.calendarViews.wrapper.on('click', '.heading', function() {
if (_.viewMode !== 'months') {
_.switchView('months')
}
});
if (_.config.clearBtn) {
buttons.btnClear.click(function() {
var a = new Date();
_.date = a;
_.input.val('').attr('value', '');
_.triggerChange($.Event('datechanged', {
date: null
}));
_.hide();
if ($('input[name="' + _.input.prop("name") + '_submit"]').length) {
$('input[name="' + _.input.prop("name") + '_submit"]').val('')
}
})
}
if (_.config.todayBtn) {
buttons.btnToday.click(function() {
var a = new Date();
_.date = a;
_.setValue(_.date);
_.hide()
})
}
if (_.config.overlayClose) {
picker.container.click(function() {
_.hide()
});
picker.wrapper.click(function(e) {
e.stopPropagation()
})
}
if (_.config.cancelBtn) {
buttons.btnCancel.click(function() {
_.hide()
})
}
buttons.btnOk.click(function() {
var a = new Date(_.selected.year, _.selected.month, _.selected.date);
if (_.disabledDate(a)) {
return
}
_.date = a;
_.setValue(_.date);
_.hide()
})
},
getDates: function(j, k) {
var _ = this,
day = 1,
now = new Date(),
today = new Date(now.getFullYear(), now.getMonth(), now.getDate()),
selected = new Date(_.selected.year, _.selected.month, _.selected.date),
date = new Date(j, k, day),
totalDays = date.getDaysCount(),
nmStartDay = 1,
weeks = [];
for (var l = 1; l <= 6; l++) {
var m = [$(''), $(''), $(''), $(''), $(''), $(''), $('')];
while (day <= totalDays) {
date.setDate(day);
var n = date.getDay();
m[n].data('date', day).data('month', k).data('year', j);
if (date.getTime() === today.getTime()) {
m[n].addClass('current')
}
if (_.disabledDate(date)) {
m[n].addClass('disabled')
}
if (l === 1 && n === 0) {
break
} else if (n < 6) {
if (date.getTime() === selected.getTime()) {
m[n].addClass('selected')
}
m[n].text(day++)
} else {
if (date.getTime() === selected.getTime()) {
m[n].addClass('selected')
}
m[n].text(day++);
break
}
}
if (l === 1 || l > 4) {
if (l === 1) {
var o = new Date(j, k - 1, 1),
prevMonthDays = o.getDaysCount();
for (var a = 6; a >= 0; a--) {
if (m[a].text() !== '') {
continue
}
m[a].data('date', prevMonthDays).data('month', k - 1).data('year', j);
o.setDate(prevMonthDays);
m[a].text((prevMonthDays--)).addClass('pm');
if (_.disabledDate(o)) {
m[a].addClass('disabled')
}
if (o.getTime() === selected.getTime()) {
m[a].addClass('selected')
}
if (o.getTime() === today.getTime()) {
m[a].addClass('current')
}
}
} else if (l > 4) {
var p = new Date(j, k + 1, 1);
for (var b = 0; b <= 6; b++) {
if (m[b].text() !== '') {
continue
}
m[b].data('date', nmStartDay).data('month', k + 1).data('year', j);
p.setDate(nmStartDay);
m[b].text((nmStartDay++)).addClass('nm');
if (_.disabledDate(p)) {
m[b].addClass('disabled')
}
if (p.getTime() === selected.getTime()) {
m[b].addClass('selected')
}
if (p.getTime() === today.getTime()) {
m[b].addClass('current')
}
}
}
}
weeks.push(m)
}
var q = [];
$.each(weeks, function(e, f) {
var g = $('');
for (var i = 0; i < f.length; i++) {
var h = f[i];
h.click(function() {
var d = $(this),
_year = d.data('year'),
_month = d.data('month'),
_date = d.data('date'),
_selected = new Date(_year, _month, _date);
if (_.disabledDate(_selected)) {
return
}
d.parents('.views').find('.item').each(function(a, b) {
var c = $(b).data('year'),
_deMonth = $(b).data('month'),
_deDate = $(b).data('date');
$(b)[(_year === c && _month === _deMonth && _date === _deDate) ? 'addClass' : 'removeClass']('selected')
});
d.parents('.dudp__cal-container').find('.month').each(function(a, b) {
var c = $(b).data('month');
$(b)[c === _month ? 'addClass' : 'removeClass']('selected')
});
d.addClass('selected');
_.selected = {
year: _year,
month: _month,
date: _date
};
_.setSelection();
if (_.config.auto) {
_.date = _selected;
_.setValue(_.date);
_.hide()
}
});
g.append(h)
}
q.push(g)
});
return q
},
getYears: function() {
var _ = this,
_minYear = _.viewYear - 100,
_maxYear = _.viewYear + 100,
_years = [];
for (var y = _minYear; y <= _maxYear; y++) {
var b = $('');
if (y === _.viewYear) {
b.addClass('selected')
}
b.text(y).data('year', y).on('click', function() {
var a = $(this),
_data = a.data('year');
_.viewYear = _data;
_.selected.year = _data;
_.setSelection();
_.setupCalendar();
_.switchView('calendar')
});
_years.push(b)
}
return _years
},
setupCalendar: function() {
var _ = this,
viewsHolder = _.datepicker.calendarHolder.calendarViews,
_year = _.viewYear,
_month = _.viewMonth;
var a = "" + _.config.days_min.map(function(x) {
return x
}).join("") + "";
viewsHolder.calendars.length = 0;
var b = {
wrapper: $(''),
header: $(''),
weekDays: $('