Initial commit
This commit is contained in:
@@ -0,0 +1,342 @@
|
||||
/*!
|
||||
* Add to Homescreen v2.0.8 ~ Copyright (c) 2013 Matteo Spinelli, http://cubiq.org
|
||||
* Released under MIT license, http://cubiq.org/license
|
||||
*/
|
||||
var addToHome = (function (w) {
|
||||
var nav = w.navigator,
|
||||
isIDevice = 'platform' in nav && (/iphone|ipod|ipad/gi).test(nav.platform),
|
||||
isIPad,
|
||||
isRetina,
|
||||
isSafari,
|
||||
isStandalone,
|
||||
OSVersion,
|
||||
startX = 0,
|
||||
startY = 0,
|
||||
lastVisit = 0,
|
||||
isExpired,
|
||||
isSessionActive,
|
||||
isReturningVisitor,
|
||||
balloon,
|
||||
overrideChecks,
|
||||
|
||||
positionInterval,
|
||||
closeTimeout,
|
||||
|
||||
options = {
|
||||
autostart: true, // Automatically open the balloon
|
||||
returningVisitor: false, // Show the balloon to returning visitors only (setting this to true is highly recommended)
|
||||
animationIn: 'drop', // drop || bubble || fade
|
||||
animationOut: 'fade', // drop || bubble || fade
|
||||
startDelay: 2000, // 2 seconds from page load before the balloon appears
|
||||
lifespan: 15000, // 15 seconds before it is automatically destroyed
|
||||
bottomOffset: 14, // Distance of the balloon from bottom
|
||||
expire: 0, // Minutes to wait before showing the popup again (0 = always displayed)
|
||||
message: '', // Customize your message or force a language ('' = automatic)
|
||||
touchIcon: false, // Display the touch icon
|
||||
arrow: true, // Display the balloon arrow
|
||||
hookOnLoad: true, // Should we hook to onload event? (really advanced usage)
|
||||
closeButton: true, // Let the user close the balloon
|
||||
iterations: 100 // Internal/debug use
|
||||
},
|
||||
|
||||
intl = {
|
||||
ar: '<span dir="rtl">قم بتثبيت هذا التطبيق على <span dir="ltr">%device:</span>انقر<span dir="ltr">%icon</span> ،<strong>ثم اضفه الى الشاشة الرئيسية.</strong></span>',
|
||||
ca_es: 'Per instal·lar aquesta aplicació al vostre %device premeu %icon i llavors <strong>Afegir a pantalla d\'inici</strong>.',
|
||||
cs_cz: 'Pro instalaci aplikace na Váš %device, stiskněte %icon a v nabídce <strong>Přidat na plochu</strong>.',
|
||||
da_dk: 'Tilføj denne side til din %device: tryk på %icon og derefter <strong>Føj til hjemmeskærm</strong>.',
|
||||
de_de: 'Installieren Sie diese App auf Ihrem %device: %icon antippen und dann <strong>Zum Home-Bildschirm</strong>.',
|
||||
el_gr: 'Εγκαταστήσετε αυτήν την Εφαρμογή στήν συσκευή σας %device: %icon μετά πατάτε <strong>Προσθήκη σε Αφετηρία</strong>.',
|
||||
en_us: 'Install this web app on your %device: tap %icon and then <strong>Add to Home Screen</strong>.',
|
||||
es_es: 'Para instalar esta app en su %device, pulse %icon y seleccione <strong>Añadir a pantalla de inicio</strong>.',
|
||||
fi_fi: 'Asenna tämä web-sovellus laitteeseesi %device: paina %icon ja sen jälkeen valitse <strong>Lisää Koti-valikkoon</strong>.',
|
||||
fr_fr: 'Ajoutez cette application sur votre %device en cliquant sur %icon, puis <strong>Ajouter à l\'écran d\'accueil</strong>.',
|
||||
he_il: '<span dir="rtl">התקן אפליקציה זו על ה-%device שלך: הקש %icon ואז <strong>הוסף למסך הבית</strong>.</span>',
|
||||
hr_hr: 'Instaliraj ovu aplikaciju na svoj %device: klikni na %icon i odaberi <strong>Dodaj u početni zaslon</strong>.',
|
||||
hu_hu: 'Telepítse ezt a web-alkalmazást az Ön %device-jára: nyomjon a %icon-ra majd a <strong>Főképernyőhöz adás</strong> gombra.',
|
||||
it_it: 'Installa questa applicazione sul tuo %device: premi su %icon e poi <strong>Aggiungi a Home</strong>.',
|
||||
ja_jp: 'このウェブアプリをあなたの%deviceにインストールするには%iconをタップして<strong>ホーム画面に追加</strong>を選んでください。',
|
||||
ko_kr: '%device에 웹앱을 설치하려면 %icon을 터치 후 "홈화면에 추가"를 선택하세요',
|
||||
nb_no: 'Installer denne appen på din %device: trykk på %icon og deretter <strong>Legg til på Hjem-skjerm</strong>',
|
||||
nl_nl: 'Installeer deze webapp op uw %device: tik %icon en dan <strong>Voeg toe aan beginscherm</strong>.',
|
||||
pl_pl: 'Aby zainstalować tę aplikacje na %device: naciśnij %icon a następnie <strong>Dodaj jako ikonę</strong>.',
|
||||
pt_br: 'Instale este aplicativo em seu %device: aperte %icon e selecione <strong>Adicionar à Tela Inicio</strong>.',
|
||||
pt_pt: 'Para instalar esta aplicação no seu %device, prima o %icon e depois em <strong>Adicionar ao ecrã principal</strong>.',
|
||||
ru_ru: 'Установите это веб-приложение на ваш %device: нажмите %icon, затем <strong>Добавить в «Домой»</strong>.',
|
||||
sv_se: 'Lägg till denna webbapplikation på din %device: tryck på %icon och därefter <strong>Lägg till på hemskärmen</strong>.',
|
||||
th_th: 'ติดตั้งเว็บแอพฯ นี้บน %device ของคุณ: แตะ %icon และ <strong>เพิ่มที่หน้าจอโฮม</strong>',
|
||||
tr_tr: 'Bu uygulamayı %device\'a eklemek için %icon simgesine sonrasında <strong>Ana Ekrana Ekle</strong> düğmesine basın.',
|
||||
uk_ua: 'Встановіть цей веб сайт на Ваш %device: натисніть %icon, а потім <strong>На початковий екран</strong>.',
|
||||
zh_cn: '您可以将此应用程式安装到您的 %device 上。请按 %icon 然后点选<strong>添加至主屏幕</strong>。',
|
||||
zh_tw: '您可以將此應用程式安裝到您的 %device 上。請按 %icon 然後點選<strong>加入主畫面螢幕</strong>。'
|
||||
};
|
||||
|
||||
function init () {
|
||||
// Preliminary check, all further checks are performed on iDevices only
|
||||
if ( !isIDevice ) return;
|
||||
|
||||
var now = Date.now(),
|
||||
i;
|
||||
|
||||
// Merge local with global options
|
||||
if ( w.addToHomeConfig ) {
|
||||
for ( i in w.addToHomeConfig ) {
|
||||
options[i] = w.addToHomeConfig[i];
|
||||
}
|
||||
}
|
||||
if ( !options.autostart ) options.hookOnLoad = false;
|
||||
|
||||
isIPad = (/ipad/gi).test(nav.platform);
|
||||
isRetina = w.devicePixelRatio && w.devicePixelRatio > 1;
|
||||
isSafari = (/Safari/i).test(nav.appVersion) && !(/CriOS/i).test(nav.appVersion);
|
||||
isStandalone = nav.standalone;
|
||||
OSVersion = nav.appVersion.match(/OS (\d+_\d+)/i);
|
||||
OSVersion = OSVersion && OSVersion[1] ? +OSVersion[1].replace('_', '.') : 0;
|
||||
|
||||
lastVisit = +w.localStorage.getItem('addToHome');
|
||||
|
||||
isSessionActive = w.sessionStorage.getItem('addToHomeSession');
|
||||
isReturningVisitor = options.returningVisitor ? lastVisit && lastVisit + 28*24*60*60*1000 > now : true;
|
||||
|
||||
if ( !lastVisit ) lastVisit = now;
|
||||
|
||||
// If it is expired we need to reissue a new balloon
|
||||
isExpired = isReturningVisitor && lastVisit <= now;
|
||||
|
||||
if ( options.hookOnLoad ) w.addEventListener('load', loaded, false);
|
||||
else if ( !options.hookOnLoad && options.autostart ) loaded();
|
||||
}
|
||||
|
||||
function loaded () {
|
||||
w.removeEventListener('load', loaded, false);
|
||||
|
||||
if ( !isReturningVisitor ) w.localStorage.setItem('addToHome', Date.now());
|
||||
else if ( options.expire && isExpired ) w.localStorage.setItem('addToHome', Date.now() + options.expire * 60000);
|
||||
|
||||
if ( !overrideChecks && ( !isSafari || !isExpired || isSessionActive || isStandalone || !isReturningVisitor ) ) return;
|
||||
|
||||
var touchIcon = '',
|
||||
platform = nav.platform.split(' ')[0],
|
||||
language = nav.language.replace('-', '_');
|
||||
|
||||
balloon = document.createElement('div');
|
||||
balloon.id = 'addToHomeScreen';
|
||||
balloon.style.cssText += 'left:-9999px;-webkit-transition-property:-webkit-transform,opacity;-webkit-transition-duration:0;-webkit-transform:translate3d(0,0,0);position:' + (OSVersion < 5 ? 'absolute' : 'fixed');
|
||||
|
||||
// Localize message
|
||||
if ( options.message in intl ) { // You may force a language despite the user's locale
|
||||
language = options.message;
|
||||
options.message = '';
|
||||
}
|
||||
if ( options.message === '' ) { // We look for a suitable language (defaulted to en_us)
|
||||
options.message = language in intl ? intl[language] : intl['en_us'];
|
||||
}
|
||||
|
||||
if ( options.touchIcon ) {
|
||||
touchIcon = isRetina ?
|
||||
document.querySelector('head link[rel^=apple-touch-icon][sizes="114x114"],head link[rel^=apple-touch-icon][sizes="144x144"],head link[rel^=apple-touch-icon]') :
|
||||
document.querySelector('head link[rel^=apple-touch-icon][sizes="57x57"],head link[rel^=apple-touch-icon]');
|
||||
|
||||
if ( touchIcon ) {
|
||||
touchIcon = '<span style="background-image:url(' + touchIcon.href + ')" class="addToHomeTouchIcon"></span>';
|
||||
}
|
||||
}
|
||||
|
||||
balloon.className = (isIPad ? 'addToHomeIpad' : 'addToHomeIphone') + (touchIcon ? ' addToHomeWide' : '');
|
||||
balloon.innerHTML = touchIcon +
|
||||
options.message.replace('%device', platform).replace('%icon', OSVersion >= 4.2 ? '<span class="addToHomeShare' + (OSVersion >= 7 ? ' addToHomeShareOS7' : '') + '"></span>' : '<span class="addToHomePlus">+</span>') +
|
||||
(options.arrow ? '<span class="addToHomeArrow"></span>' : '') +
|
||||
(options.closeButton ? '<span class="addToHomeClose">\u00D7</span>' : '');
|
||||
|
||||
document.body.appendChild(balloon);
|
||||
|
||||
// Add the close action
|
||||
if ( options.closeButton ) balloon.addEventListener('click', clicked, false);
|
||||
|
||||
if ( !isIPad && OSVersion >= 6 ) window.addEventListener('orientationchange', orientationCheck, false);
|
||||
|
||||
setTimeout(show, options.startDelay);
|
||||
}
|
||||
|
||||
function show () {
|
||||
var duration,
|
||||
iPadXShift = 208;
|
||||
|
||||
// Set the initial position
|
||||
if ( isIPad ) {
|
||||
if ( OSVersion < 5 ) {
|
||||
startY = w.scrollY;
|
||||
startX = w.scrollX;
|
||||
} else if ( OSVersion < 6 ) {
|
||||
iPadXShift = 160;
|
||||
}
|
||||
|
||||
balloon.style.top = startY + options.bottomOffset + 'px';
|
||||
balloon.style.left = startX + iPadXShift - Math.round(balloon.offsetWidth / 2) + 'px';
|
||||
|
||||
switch ( options.animationIn ) {
|
||||
case 'drop':
|
||||
duration = '0.6s';
|
||||
balloon.style.webkitTransform = 'translate3d(0,' + -(w.scrollY + options.bottomOffset + balloon.offsetHeight) + 'px,0)';
|
||||
break;
|
||||
case 'bubble':
|
||||
duration = '0.6s';
|
||||
balloon.style.opacity = '0';
|
||||
balloon.style.webkitTransform = 'translate3d(0,' + (startY + 50) + 'px,0)';
|
||||
break;
|
||||
default:
|
||||
duration = '1s';
|
||||
balloon.style.opacity = '0';
|
||||
}
|
||||
} else {
|
||||
startY = w.innerHeight + w.scrollY;
|
||||
|
||||
if ( OSVersion < 5 ) {
|
||||
startX = Math.round((w.innerWidth - balloon.offsetWidth) / 2) + w.scrollX;
|
||||
balloon.style.left = startX + 'px';
|
||||
balloon.style.top = startY - balloon.offsetHeight - options.bottomOffset + 'px';
|
||||
} else {
|
||||
balloon.style.left = '50%';
|
||||
balloon.style.marginLeft = -Math.round(balloon.offsetWidth / 2) - ( w.orientation%180 && OSVersion >= 6 ? 40 : 0 ) + 'px';
|
||||
balloon.style.bottom = options.bottomOffset + 'px';
|
||||
}
|
||||
|
||||
switch (options.animationIn) {
|
||||
case 'drop':
|
||||
duration = '1s';
|
||||
balloon.style.webkitTransform = 'translate3d(0,' + -(startY + options.bottomOffset) + 'px,0)';
|
||||
break;
|
||||
case 'bubble':
|
||||
duration = '0.6s';
|
||||
balloon.style.webkitTransform = 'translate3d(0,' + (balloon.offsetHeight + options.bottomOffset + 50) + 'px,0)';
|
||||
break;
|
||||
default:
|
||||
duration = '1s';
|
||||
balloon.style.opacity = '0';
|
||||
}
|
||||
}
|
||||
|
||||
balloon.offsetHeight; // repaint trick
|
||||
balloon.style.webkitTransitionDuration = duration;
|
||||
balloon.style.opacity = '1';
|
||||
balloon.style.webkitTransform = 'translate3d(0,0,0)';
|
||||
balloon.addEventListener('webkitTransitionEnd', transitionEnd, false);
|
||||
|
||||
closeTimeout = setTimeout(close, options.lifespan);
|
||||
}
|
||||
|
||||
function manualShow (override) {
|
||||
if ( !isIDevice || balloon ) return;
|
||||
|
||||
overrideChecks = override;
|
||||
loaded();
|
||||
}
|
||||
|
||||
function close () {
|
||||
clearInterval( positionInterval );
|
||||
clearTimeout( closeTimeout );
|
||||
closeTimeout = null;
|
||||
|
||||
// check if the popup is displayed and prevent errors
|
||||
if ( !balloon ) return;
|
||||
|
||||
var posY = 0,
|
||||
posX = 0,
|
||||
opacity = '1',
|
||||
duration = '0';
|
||||
|
||||
if ( options.closeButton ) balloon.removeEventListener('click', clicked, false);
|
||||
if ( !isIPad && OSVersion >= 6 ) window.removeEventListener('orientationchange', orientationCheck, false);
|
||||
|
||||
if ( OSVersion < 5 ) {
|
||||
posY = isIPad ? w.scrollY - startY : w.scrollY + w.innerHeight - startY;
|
||||
posX = isIPad ? w.scrollX - startX : w.scrollX + Math.round((w.innerWidth - balloon.offsetWidth)/2) - startX;
|
||||
}
|
||||
|
||||
balloon.style.webkitTransitionProperty = '-webkit-transform,opacity';
|
||||
|
||||
switch ( options.animationOut ) {
|
||||
case 'drop':
|
||||
if ( isIPad ) {
|
||||
duration = '0.4s';
|
||||
opacity = '0';
|
||||
posY += 50;
|
||||
} else {
|
||||
duration = '0.6s';
|
||||
posY += balloon.offsetHeight + options.bottomOffset + 50;
|
||||
}
|
||||
break;
|
||||
case 'bubble':
|
||||
if ( isIPad ) {
|
||||
duration = '0.8s';
|
||||
posY -= balloon.offsetHeight + options.bottomOffset + 50;
|
||||
} else {
|
||||
duration = '0.4s';
|
||||
opacity = '0';
|
||||
posY -= 50;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
duration = '0.8s';
|
||||
opacity = '0';
|
||||
}
|
||||
|
||||
balloon.addEventListener('webkitTransitionEnd', transitionEnd, false);
|
||||
balloon.style.opacity = opacity;
|
||||
balloon.style.webkitTransitionDuration = duration;
|
||||
balloon.style.webkitTransform = 'translate3d(' + posX + 'px,' + posY + 'px,0)';
|
||||
}
|
||||
|
||||
|
||||
function clicked () {
|
||||
w.sessionStorage.setItem('addToHomeSession', '1');
|
||||
isSessionActive = true;
|
||||
close();
|
||||
}
|
||||
|
||||
function transitionEnd () {
|
||||
balloon.removeEventListener('webkitTransitionEnd', transitionEnd, false);
|
||||
|
||||
balloon.style.webkitTransitionProperty = '-webkit-transform';
|
||||
balloon.style.webkitTransitionDuration = '0.2s';
|
||||
|
||||
// We reached the end!
|
||||
if ( !closeTimeout ) {
|
||||
balloon.parentNode.removeChild(balloon);
|
||||
balloon = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// On iOS 4 we start checking the element position
|
||||
if ( OSVersion < 5 && closeTimeout ) positionInterval = setInterval(setPosition, options.iterations);
|
||||
}
|
||||
|
||||
function setPosition () {
|
||||
var matrix = new WebKitCSSMatrix(w.getComputedStyle(balloon, null).webkitTransform),
|
||||
posY = isIPad ? w.scrollY - startY : w.scrollY + w.innerHeight - startY,
|
||||
posX = isIPad ? w.scrollX - startX : w.scrollX + Math.round((w.innerWidth - balloon.offsetWidth) / 2) - startX;
|
||||
|
||||
// Screen didn't move
|
||||
if ( posY == matrix.m42 && posX == matrix.m41 ) return;
|
||||
|
||||
balloon.style.webkitTransform = 'translate3d(' + posX + 'px,' + posY + 'px,0)';
|
||||
}
|
||||
|
||||
// Clear local and session storages (this is useful primarily in development)
|
||||
function reset () {
|
||||
w.localStorage.removeItem('addToHome');
|
||||
w.sessionStorage.removeItem('addToHomeSession');
|
||||
}
|
||||
|
||||
function orientationCheck () {
|
||||
balloon.style.marginLeft = -Math.round(balloon.offsetWidth / 2) - ( w.orientation%180 && OSVersion >= 6 ? 40 : 0 ) + 'px';
|
||||
}
|
||||
|
||||
// Bootstrap!
|
||||
init();
|
||||
|
||||
return {
|
||||
show: manualShow,
|
||||
close: close,
|
||||
reset: reset
|
||||
};
|
||||
})(window);
|
||||
Vendored
+78
File diff suppressed because one or more lines are too long
Vendored
+2
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,345 @@
|
||||
/**
|
||||
* Farbtastic Color Picker 1.2
|
||||
* © 2008 Steven Wittens
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
jQuery.fn.farbtastic = function (callback) {
|
||||
$.farbtastic(this, callback);
|
||||
return this;
|
||||
};
|
||||
|
||||
jQuery.farbtastic = function (container, callback) {
|
||||
var container = $(container).get(0);
|
||||
return container.farbtastic || (container.farbtastic = new jQuery._farbtastic(container, callback));
|
||||
}
|
||||
|
||||
jQuery._farbtastic = function (container, callback) {
|
||||
// Store farbtastic object
|
||||
var fb = this;
|
||||
|
||||
// Insert markup
|
||||
$(container).html('<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>');
|
||||
var e = $('.farbtastic', container);
|
||||
fb.wheel = $('.wheel', container).get(0);
|
||||
// Dimensions
|
||||
fb.radius = 84;
|
||||
fb.square = 100;
|
||||
fb.width = 194;
|
||||
|
||||
// Fix background PNGs in IE6
|
||||
if (navigator.appVersion.match(/MSIE [0-6]\./)) {
|
||||
$('*', e).each(function () {
|
||||
if (this.currentStyle.backgroundImage != 'none') {
|
||||
var image = this.currentStyle.backgroundImage;
|
||||
image = this.currentStyle.backgroundImage.substring(5, image.length - 2);
|
||||
$(this).css({
|
||||
'backgroundImage': 'none',
|
||||
'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Link to the given element(s) or callback.
|
||||
*/
|
||||
fb.linkTo = function (callback) {
|
||||
// Unbind previous nodes
|
||||
if (typeof fb.callback == 'object') {
|
||||
$(fb.callback).unbind('keyup', fb.updateValue);
|
||||
}
|
||||
|
||||
// Reset color
|
||||
fb.color = null;
|
||||
|
||||
// Bind callback or elements
|
||||
if (typeof callback == 'function') {
|
||||
fb.callback = callback;
|
||||
}
|
||||
else if (typeof callback == 'object' || typeof callback == 'string') {
|
||||
fb.callback = $(callback);
|
||||
fb.callback.bind('keyup', fb.updateValue);
|
||||
if (fb.callback.get(0).value) {
|
||||
fb.setColor(fb.callback.get(0).value);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
fb.updateValue = function (event) {
|
||||
if (this.value && this.value != fb.color) {
|
||||
fb.setColor(this.value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change color with HTML syntax #123456
|
||||
*/
|
||||
fb.setColor = function (color) {
|
||||
var unpack = fb.unpack(color);
|
||||
if (fb.color != color && unpack) {
|
||||
fb.color = color;
|
||||
fb.rgb = unpack;
|
||||
fb.hsl = fb.RGBToHSL(fb.rgb);
|
||||
fb.updateDisplay();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change color with HSL triplet [0..1, 0..1, 0..1]
|
||||
*/
|
||||
fb.setHSL = function (hsl) {
|
||||
fb.hsl = hsl;
|
||||
fb.rgb = fb.HSLToRGB(hsl);
|
||||
fb.color = fb.pack(fb.rgb);
|
||||
fb.updateDisplay();
|
||||
return this;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Retrieve the coordinates of the given event relative to the center
|
||||
* of the widget.
|
||||
*/
|
||||
fb.widgetCoords = function (event) {
|
||||
var x, y;
|
||||
var el = event.target || event.srcElement;
|
||||
var reference = fb.wheel;
|
||||
|
||||
if (typeof event.offsetX != 'undefined') {
|
||||
// Use offset coordinates and find common offsetParent
|
||||
var pos = { x: event.offsetX, y: event.offsetY };
|
||||
|
||||
// Send the coordinates upwards through the offsetParent chain.
|
||||
var e = el;
|
||||
while (e) {
|
||||
e.mouseX = pos.x;
|
||||
e.mouseY = pos.y;
|
||||
pos.x += e.offsetLeft;
|
||||
pos.y += e.offsetTop;
|
||||
e = e.offsetParent;
|
||||
}
|
||||
|
||||
// Look for the coordinates starting from the wheel widget.
|
||||
var e = reference;
|
||||
var offset = { x: 0, y: 0 }
|
||||
while (e) {
|
||||
if (typeof e.mouseX != 'undefined') {
|
||||
x = e.mouseX - offset.x;
|
||||
y = e.mouseY - offset.y;
|
||||
break;
|
||||
}
|
||||
offset.x += e.offsetLeft;
|
||||
offset.y += e.offsetTop;
|
||||
e = e.offsetParent;
|
||||
}
|
||||
|
||||
// Reset stored coordinates
|
||||
e = el;
|
||||
while (e) {
|
||||
e.mouseX = undefined;
|
||||
e.mouseY = undefined;
|
||||
e = e.offsetParent;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Use absolute coordinates
|
||||
var pos = fb.absolutePosition(reference);
|
||||
x = (event.pageX || 0*(event.clientX + $('html').get(0).scrollLeft)) - pos.x;
|
||||
y = (event.pageY || 0*(event.clientY + $('html').get(0).scrollTop)) - pos.y;
|
||||
}
|
||||
// Subtract distance to middle
|
||||
return { x: x - fb.width / 2, y: y - fb.width / 2 };
|
||||
}
|
||||
|
||||
/**
|
||||
* Mousedown handler
|
||||
*/
|
||||
fb.mousedown = function (event) {
|
||||
// Capture mouse
|
||||
if (!document.dragging) {
|
||||
$(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup);
|
||||
document.dragging = true;
|
||||
}
|
||||
|
||||
// Check which area is being dragged
|
||||
var pos = fb.widgetCoords(event);
|
||||
fb.circleDrag = Math.max(Math.abs(pos.x), Math.abs(pos.y)) * 2 > fb.square;
|
||||
|
||||
// Process
|
||||
fb.mousemove(event);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mousemove handler
|
||||
*/
|
||||
fb.mousemove = function (event) {
|
||||
// Get coordinates relative to color picker center
|
||||
var pos = fb.widgetCoords(event);
|
||||
|
||||
// Set new HSL parameters
|
||||
if (fb.circleDrag) {
|
||||
var hue = Math.atan2(pos.x, -pos.y) / 6.28;
|
||||
if (hue < 0) hue += 1;
|
||||
fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]);
|
||||
}
|
||||
else {
|
||||
var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5));
|
||||
var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5));
|
||||
fb.setHSL([fb.hsl[0], sat, lum]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mouseup handler
|
||||
*/
|
||||
fb.mouseup = function () {
|
||||
// Uncapture mouse
|
||||
$(document).unbind('mousemove', fb.mousemove);
|
||||
$(document).unbind('mouseup', fb.mouseup);
|
||||
document.dragging = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the markers and styles
|
||||
*/
|
||||
fb.updateDisplay = function () {
|
||||
// Markers
|
||||
var angle = fb.hsl[0] * 6.28;
|
||||
$('.h-marker', e).css({
|
||||
left: Math.round(Math.sin(angle) * fb.radius + fb.width / 2) + 'px',
|
||||
top: Math.round(-Math.cos(angle) * fb.radius + fb.width / 2) + 'px'
|
||||
});
|
||||
|
||||
$('.sl-marker', e).css({
|
||||
left: Math.round(fb.square * (.5 - fb.hsl[1]) + fb.width / 2) + 'px',
|
||||
top: Math.round(fb.square * (.5 - fb.hsl[2]) + fb.width / 2) + 'px'
|
||||
});
|
||||
|
||||
// Saturation/Luminance gradient
|
||||
$('.color', e).css('backgroundColor', fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5])));
|
||||
|
||||
// Linked elements or callback
|
||||
if (typeof fb.callback == 'object') {
|
||||
// Set background/foreground color
|
||||
$(fb.callback).css({
|
||||
backgroundColor: fb.color,
|
||||
color: fb.hsl[2] > 0.5 ? '#000' : '#fff'
|
||||
});
|
||||
|
||||
// Change linked value
|
||||
$(fb.callback).each(function() {
|
||||
if (this.value && this.value != fb.color) {
|
||||
this.value = fb.color;
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (typeof fb.callback == 'function') {
|
||||
fb.callback.call(fb, fb.color);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get absolute position of element
|
||||
*/
|
||||
fb.absolutePosition = function (el) {
|
||||
var r = { x: el.offsetLeft, y: el.offsetTop };
|
||||
// Resolve relative to offsetParent
|
||||
if (el.offsetParent) {
|
||||
var tmp = fb.absolutePosition(el.offsetParent);
|
||||
r.x += tmp.x;
|
||||
r.y += tmp.y;
|
||||
}
|
||||
return r;
|
||||
};
|
||||
|
||||
/* Various color utility functions */
|
||||
fb.pack = function (rgb) {
|
||||
var r = Math.round(rgb[0] * 255);
|
||||
var g = Math.round(rgb[1] * 255);
|
||||
var b = Math.round(rgb[2] * 255);
|
||||
return '#' + (r < 16 ? '0' : '') + r.toString(16) +
|
||||
(g < 16 ? '0' : '') + g.toString(16) +
|
||||
(b < 16 ? '0' : '') + b.toString(16);
|
||||
}
|
||||
|
||||
fb.unpack = function (color) {
|
||||
if (color.length == 7) {
|
||||
return [parseInt('0x' + color.substring(1, 3)) / 255,
|
||||
parseInt('0x' + color.substring(3, 5)) / 255,
|
||||
parseInt('0x' + color.substring(5, 7)) / 255];
|
||||
}
|
||||
else if (color.length == 4) {
|
||||
return [parseInt('0x' + color.substring(1, 2)) / 15,
|
||||
parseInt('0x' + color.substring(2, 3)) / 15,
|
||||
parseInt('0x' + color.substring(3, 4)) / 15];
|
||||
}
|
||||
}
|
||||
|
||||
fb.HSLToRGB = function (hsl) {
|
||||
var m1, m2, r, g, b;
|
||||
var h = hsl[0], s = hsl[1], l = hsl[2];
|
||||
m2 = (l <= 0.5) ? l * (s + 1) : l + s - l*s;
|
||||
m1 = l * 2 - m2;
|
||||
return [this.hueToRGB(m1, m2, h+0.33333),
|
||||
this.hueToRGB(m1, m2, h),
|
||||
this.hueToRGB(m1, m2, h-0.33333)];
|
||||
}
|
||||
|
||||
fb.hueToRGB = function (m1, m2, h) {
|
||||
h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h);
|
||||
if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;
|
||||
if (h * 2 < 1) return m2;
|
||||
if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6;
|
||||
return m1;
|
||||
}
|
||||
|
||||
fb.RGBToHSL = function (rgb) {
|
||||
var min, max, delta, h, s, l;
|
||||
var r = rgb[0], g = rgb[1], b = rgb[2];
|
||||
min = Math.min(r, Math.min(g, b));
|
||||
max = Math.max(r, Math.max(g, b));
|
||||
delta = max - min;
|
||||
l = (min + max) / 2;
|
||||
s = 0;
|
||||
if (l > 0 && l < 1) {
|
||||
s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l));
|
||||
}
|
||||
h = 0;
|
||||
if (delta > 0) {
|
||||
if (max == r && max != g) h += (g - b) / delta;
|
||||
if (max == g && max != b) h += (2 + (b - r) / delta);
|
||||
if (max == b && max != r) h += (4 + (r - g) / delta);
|
||||
h /= 6;
|
||||
}
|
||||
return [h, s, l];
|
||||
}
|
||||
|
||||
// Install mousedown handler (the others are set on the document on-demand)
|
||||
$('*', e).mousedown(fb.mousedown);
|
||||
|
||||
// Init color
|
||||
fb.setColor('#000000');
|
||||
|
||||
// Set linked elements/callback
|
||||
if (callback) {
|
||||
fb.linkTo(callback);
|
||||
}
|
||||
}
|
||||
Vendored
+8
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* jQuery resize event - v1.1 - 3/14/2010
|
||||
* http://benalman.com/projects/jquery-resize-plugin/
|
||||
*
|
||||
* Copyright (c) 2010 "Cowboy" Ben Alman
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://benalman.com/about/license/
|
||||
*/
|
||||
(function($,h,c){var a=$([]),e=$.resize=$.extend($.resize,{}),i,k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250;e[f]=true;$.event.special[j]={setup:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.add(l);$.data(this,d,{w:l.width(),h:l.height()});if(a.length===1){g()}},teardown:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.not(l);l.removeData(d);if(!a.length){clearTimeout(i)}},add:function(l){if(!e[f]&&this[k]){return false}var n;function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width();r.h=p!==c?p:q.height();n.apply(this,arguments)}if($.isFunction(l)){n=l;return m}else{n=l.handler;l.handler=m}}};function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);if(m!==o.w||l!==o.h){n.trigger(j,[o.w=m,o.h=l])}});g()},e[b])}})(jQuery,this);
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
"use strict";jQuery.base64=(function($){var _PADCHAR="=",_ALPHA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_VERSION="1.0";function _getbyte64(s,i){var idx=_ALPHA.indexOf(s.charAt(i));if(idx===-1){throw"Cannot decode base64"}return idx}function _decode(s){var pads=0,i,b10,imax=s.length,x=[];s=String(s);if(imax===0){return s}if(imax%4!==0){throw"Cannot decode base64"}if(s.charAt(imax-1)===_PADCHAR){pads=1;if(s.charAt(imax-2)===_PADCHAR){pads=2}imax-=4}for(i=0;i<imax;i+=4){b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12)|(_getbyte64(s,i+2)<<6)|_getbyte64(s,i+3);x.push(String.fromCharCode(b10>>16,(b10>>8)&255,b10&255))}switch(pads){case 1:b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12)|(_getbyte64(s,i+2)<<6);x.push(String.fromCharCode(b10>>16,(b10>>8)&255));break;case 2:b10=(_getbyte64(s,i)<<18)|(_getbyte64(s,i+1)<<12);x.push(String.fromCharCode(b10>>16));break}return x.join("")}function _getbyte(s,i){var x=s.charCodeAt(i);if(x>255){throw"INVALID_CHARACTER_ERR: DOM Exception 5"}return x}function _encode(s){if(arguments.length!==1){throw"SyntaxError: exactly one argument required"}s=String(s);var i,b10,x=[],imax=s.length-s.length%3;if(s.length===0){return s}for(i=0;i<imax;i+=3){b10=(_getbyte(s,i)<<16)|(_getbyte(s,i+1)<<8)|_getbyte(s,i+2);x.push(_ALPHA.charAt(b10>>18));x.push(_ALPHA.charAt((b10>>12)&63));x.push(_ALPHA.charAt((b10>>6)&63));x.push(_ALPHA.charAt(b10&63))}switch(s.length-imax){case 1:b10=_getbyte(s,i)<<16;x.push(_ALPHA.charAt(b10>>18)+_ALPHA.charAt((b10>>12)&63)+_PADCHAR+_PADCHAR);break;case 2:b10=(_getbyte(s,i)<<16)|(_getbyte(s,i+1)<<8);x.push(_ALPHA.charAt(b10>>18)+_ALPHA.charAt((b10>>12)&63)+_ALPHA.charAt((b10>>6)&63)+_PADCHAR);break}return x.join("")}return{decode:_decode,encode:_encode,VERSION:_VERSION}}(jQuery));
|
||||
+44
File diff suppressed because one or more lines are too long
+92
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
Input Mask plugin for jquery
|
||||
http://github.com/RobinHerbots/jquery.inputmask
|
||||
Copyright (c) 2010 - 2014 Robin Herbots
|
||||
Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
||||
Version: 2.5.8
|
||||
*/
|
||||
(function(e){if(void 0===e.fn.inputmask){var a=function(a){var c=document.createElement("input");a="on"+a;var d=a in c;d||(c.setAttribute(a,"return;"),d="function"==typeof c[a]);return d},f=function(a,c,d){return(a=d.aliases[a])?(a.alias&&f(a.alias,void 0,d),e.extend(!0,d,a),e.extend(!0,d,c),!0):!1},b=function(a){function c(d){a.numericInput&&(d=d.split("").reverse().join(""));var b=!1,f=0,g=a.greedy,x=a.repeat;"*"==x&&(g=!1);1==d.length&&!1==g&&0!=x&&(a.placeholder="");d=e.map(d.split(""),function(d,
|
||||
c){var e=[];if(d==a.escapeChar)b=!0;else if(d!=a.optionalmarker.start&&d!=a.optionalmarker.end||b){var g=a.definitions[d];if(g&&!b)for(var x=0;x<g.cardinality;x++)e.push(a.placeholder.charAt((f+x)%a.placeholder.length));else e.push(d),b=!1;f+=e.length;return e}});for(var h=d.slice(),T=1;T<x&&g;T++)h=h.concat(d.slice());return{mask:h,repeat:x,greedy:g}}function d(d){a.numericInput&&(d=d.split("").reverse().join(""));var c=!1,b=!1,f=!1;return e.map(d.split(""),function(d,e){var g=[];if(d==a.escapeChar)b=
|
||||
!0;else{if(d!=a.optionalmarker.start||b){if(d!=a.optionalmarker.end||b){var x=a.definitions[d];if(x&&!b){for(var h=x.prevalidator,T=h?h.length:0,l=1;l<x.cardinality;l++){var A=T>=l?h[l-1]:[],k=A.validator,A=A.cardinality;g.push({fn:k?"string"==typeof k?RegExp(k):new function(){this.test=k}:/./,cardinality:A?A:1,optionality:c,newBlockMarker:!0==c?f:!1,offset:0,casing:x.casing,def:x.definitionSymbol||d});!0==c&&(f=!1)}g.push({fn:x.validator?"string"==typeof x.validator?RegExp(x.validator):new function(){this.test=
|
||||
x.validator}:/./,cardinality:x.cardinality,optionality:c,newBlockMarker:f,offset:0,casing:x.casing,def:x.definitionSymbol||d})}else g.push({fn:null,cardinality:0,optionality:c,newBlockMarker:f,offset:0,casing:null,def:d}),b=!1;f=!1;return g}c=!1}else c=!0;f=!0}})}function f(d){for(var c=d.length,e=0;e<c&&d.charAt(e)!=a.optionalmarker.start;e++);var b=[d.substring(0,e)];e<c&&b.push(d.substring(e+1,c));return b}function b(l,k,m){for(var r=0,u=0,n=k.length,p=0;p<n&&!(k.charAt(p)==a.optionalmarker.start&&
|
||||
r++,k.charAt(p)==a.optionalmarker.end&&u++,0<r&&r==u);p++);r=[k.substring(0,p)];p<n&&r.push(k.substring(p+1,n));p=f(r[0]);1<p.length?(k=l+p[0]+(a.optionalmarker.start+p[1]+a.optionalmarker.end)+(1<r.length?r[1]:""),-1==e.inArray(k,h)&&""!=k&&(h.push(k),n=c(k),g.push({mask:k,_buffer:n.mask,buffer:n.mask.slice(),tests:d(k),lastValidPosition:-1,greedy:n.greedy,repeat:n.repeat,metadata:m})),k=l+p[0]+(1<r.length?r[1]:""),-1==e.inArray(k,h)&&""!=k&&(h.push(k),n=c(k),g.push({mask:k,_buffer:n.mask,buffer:n.mask.slice(),
|
||||
tests:d(k),lastValidPosition:-1,greedy:n.greedy,repeat:n.repeat,metadata:m})),1<f(p[1]).length&&b(l+p[0],p[1]+r[1],m),1<r.length&&1<f(r[1]).length&&(b(l+p[0]+(a.optionalmarker.start+p[1]+a.optionalmarker.end),r[1],m),b(l+p[0],r[1],m))):(k=l+r,-1==e.inArray(k,h)&&""!=k&&(h.push(k),n=c(k),g.push({mask:k,_buffer:n.mask,buffer:n.mask.slice(),tests:d(k),lastValidPosition:-1,greedy:n.greedy,repeat:n.repeat,metadata:m})))}var g=[],h=[];e.isFunction(a.mask)&&(a.mask=a.mask.call(this,a));e.isArray(a.mask)?
|
||||
e.each(a.mask,function(a,d){void 0!=d.mask?b("",d.mask.toString(),d):b("",d.toString())}):b("",a.mask.toString());return a.greedy?g:g.sort(function(a,d){return a.mask.length-d.mask.length})},g="function"===typeof ScriptEngineMajorVersion?ScriptEngineMajorVersion():10<=(new Function("/*@cc_on return @_jscript_version; @*/"))(),c=navigator.userAgent,h=null!==c.match(/iphone/i),k=null!==c.match(/android.*safari.*/i),m=null!==c.match(/android.*chrome.*/i),u=null!==c.match(/android.*firefox.*/i),M=/Kindle/i.test(c)||
|
||||
/Silk/i.test(c)||/KFTT/i.test(c)||/KFOT/i.test(c)||/KFJWA/i.test(c)||/KFJWI/i.test(c)||/KFSOWI/i.test(c)||/KFTHWA/i.test(c)||/KFTHWI/i.test(c)||/KFAPWA/i.test(c)||/KFAPWI/i.test(c),P=a("paste")?"paste":a("input")?"input":"propertychange",q=function(a,c,d,b){function f(){return a[c]}function q(){return f().tests}function t(){return f()._buffer}function l(){return f().buffer}function R(N,b,v){function y(a,c,f,N){for(var b=D(a),e=f?1:0,v="",da=c.buffer,y=c.tests[b].cardinality;y>e;y--)v+=H(da,b-(y-1));
|
||||
f&&(v+=f);return null!=c.tests[b].fn?c.tests[b].fn.test(v,da,a,N,d):f==H(c._buffer.slice(),a,!0)||f==d.skipOptionalPartCharacter?{refresh:!0,c:H(c._buffer.slice(),a,!0),pos:a}:!1}if(v=!0===v){var g=y(N,f(),b,v);!0===g&&(g={pos:N});return g}var h=[],g=!1,k=c,A=l().slice(),t=f().lastValidPosition;F(N);var m=[];e.each(a,function(a,d){if("object"==typeof d){c=a;var e=N,B=f().lastValidPosition,q;if(B==t){if(1<e-t)for(B=-1==B?0:B;B<e&&(q=y(B,f(),A[B],!0),!1!==q);B++)G(l(),B,A[B],!0),!0===q&&(q={pos:B}),
|
||||
q=q.pos||B,f().lastValidPosition<q&&(f().lastValidPosition=q);if(!r(e)&&!y(e,f(),b,v)){B=p(e)-e;for(q=0;q<B&&!1===y(++e,f(),b,v);q++);m.push(c)}}(f().lastValidPosition>=t||c==k)&&0<=e&&e<n()&&(g=y(e,f(),b,v),!1!==g&&(!0===g&&(g={pos:e}),q=g.pos||e,f().lastValidPosition<q&&(f().lastValidPosition=q)),h.push({activeMasksetIndex:a,result:g}))}});c=k;return function(c,d){var f=!1;e.each(d,function(a,d){if(f=-1==e.inArray(d.activeMasksetIndex,c)&&!1!==d.result)return!1});if(f)d=e.map(d,function(d,f){if(-1==
|
||||
e.inArray(d.activeMasksetIndex,c))return d;a[d.activeMasksetIndex].lastValidPosition=t});else{var v=-1,g=-1,h;e.each(d,function(a,d){-1!=e.inArray(d.activeMasksetIndex,c)&&!1!==d.result&(-1==v||v>d.result.pos)&&(v=d.result.pos,g=d.activeMasksetIndex)});d=e.map(d,function(d,f){if(-1!=e.inArray(d.activeMasksetIndex,c)){if(d.result.pos==v)return d;if(!1!==d.result){for(var k=N;k<v;k++)if(h=y(k,a[d.activeMasksetIndex],a[g].buffer[k],!0),!1===h){a[d.activeMasksetIndex].lastValidPosition=v-1;break}else G(a[d.activeMasksetIndex].buffer,
|
||||
k,a[g].buffer[k],!0),a[d.activeMasksetIndex].lastValidPosition=k;h=y(v,a[d.activeMasksetIndex],b,!0);!1!==h&&(G(a[d.activeMasksetIndex].buffer,v,b,!0),a[d.activeMasksetIndex].lastValidPosition=v);return d}}})}return d}(m,h)}function ba(){var d=c,b={activeMasksetIndex:0,lastValidPosition:-1,next:-1};e.each(a,function(a,d){"object"==typeof d&&(c=a,f().lastValidPosition>b.lastValidPosition?(b.activeMasksetIndex=a,b.lastValidPosition=f().lastValidPosition,b.next=p(f().lastValidPosition)):f().lastValidPosition==
|
||||
b.lastValidPosition&&(-1==b.next||b.next>p(f().lastValidPosition))&&(b.activeMasksetIndex=a,b.lastValidPosition=f().lastValidPosition,b.next=p(f().lastValidPosition)))});c=-1!=b.lastValidPosition&&a[d].lastValidPosition==b.lastValidPosition?d:b.activeMasksetIndex;d!=c&&(W(l(),p(b.lastValidPosition),n()),f().writeOutBuffer=!0);s.data("_inputmask").activeMasksetIndex=c}function r(a){a=D(a);a=q()[a];return void 0!=a?a.fn:!1}function D(a){return a%q().length}function n(){var a=t(),c=f().greedy,b=f().repeat,
|
||||
y=l();if(e.isFunction(d.getMaskLength))return d.getMaskLength(a,c,b,y,d);var g=a.length;c||("*"==b?g=y.length+1:1<b&&(g+=a.length*(b-1)));return g}function p(a){var d=n();if(a>=d)return d;for(;++a<d&&!r(a););return a}function F(a){if(0>=a)return 0;for(;0<--a&&!r(a););return a}function G(a,d,c,f){f&&(d=ca(a,d));f=q()[D(d)];var b=c;if(void 0!=b&&void 0!=f)switch(f.casing){case "upper":b=c.toUpperCase();break;case "lower":b=c.toLowerCase()}a[d]=b}function H(a,d,c){c&&(d=ca(a,d));return a[d]}function ca(a,
|
||||
d){for(var c;void 0==a[d]&&a.length<n();)for(c=0;void 0!==t()[c];)a.push(t()[c++]);return d}function I(a,d,c){a._valueSet(d.join(""));void 0!=c&&w(a,c)}function W(a,d,c,f){for(var b=n();d<c&&d<b;d++)!0===f?r(d)||G(a,d,""):G(a,d,H(t().slice(),d,!0))}function U(a,d){var c=D(d);G(a,d,H(t(),c))}function O(a){return d.placeholder.charAt(a%d.placeholder.length)}function J(d,b,v,g,h){g=void 0!=g?g.slice():X(d._valueGet()).split("");e.each(a,function(a,d){"object"==typeof d&&(d.buffer=d._buffer.slice(),d.lastValidPosition=
|
||||
-1,d.p=-1)});!0!==v&&(c=0);b&&d._valueSet("");n();e.each(g,function(a,c){if(!0===h){var g=f().p,g=-1==g?g:F(g),y=-1==g?a:p(g);-1==e.inArray(c,t().slice(g+1,y))&&V.call(d,void 0,!0,c.charCodeAt(0),b,v,a)}else V.call(d,void 0,!0,c.charCodeAt(0),b,v,a),v=v||0<a&&a>f().p});!0===v&&-1!=f().p&&(f().lastValidPosition=F(f().p))}function ea(a){return e.inputmask.escapeRegex.call(this,a)}function X(a){return a.replace(RegExp("("+ea(t().join(""))+")*$"),"")}function Y(a){var d=l(),c=d.slice(),f,b;for(b=c.length-
|
||||
1;0<=b;b--)if(f=D(b),q()[f].optionality)if(r(b)&&R(b,d[b],!0))break;else c.pop();else break;I(a,c)}function la(a,c){if(!q()||!0!==c&&a.hasClass("hasDatepicker"))return a[0]._valueGet();var f=e.map(l(),function(a,d){return r(d)&&R(d,a,!0)?a:null}),f=(z?f.reverse():f).join("");return e.isFunction(d.onUnMask)?d.onUnMask.call(a,l().join(""),f,d):f}function K(a){!z||"number"!=typeof a||d.greedy&&""==d.placeholder||(a=l().length-a);return a}function w(a,c,f){var b=a.jquery&&0<a.length?a[0]:a;if("number"==
|
||||
typeof c)c=K(c),f=K(f),e(b).is(":visible")&&(f="number"==typeof f?f:c,b.scrollLeft=b.scrollWidth,!1==d.insertMode&&c==f&&f++,b.setSelectionRange?(b.selectionStart=c,b.selectionEnd=f):b.createTextRange&&(a=b.createTextRange(),a.collapse(!0),a.moveEnd("character",f),a.moveStart("character",c),a.select()));else{if(!e(a).is(":visible"))return{begin:0,end:0};b.setSelectionRange?(c=b.selectionStart,f=b.selectionEnd):document.selection&&document.selection.createRange&&(a=document.selection.createRange(),
|
||||
c=0-a.duplicate().moveStart("character",-1E5),f=c+a.text.length);c=K(c);f=K(f);return{begin:c,end:f}}}function Q(f){if(e.isFunction(d.isComplete))return d.isComplete.call(s,f,d);if("*"!=d.repeat){var b=!1,g=0,y=c;e.each(a,function(a,d){if("object"==typeof d){c=a;var e=F(n());if(d.lastValidPosition>=g&&d.lastValidPosition==e){for(var y=!0,h=0;h<=e;h++){var k=r(h),l=D(h);if(k&&(void 0==f[h]||f[h]==O(h))||!k&&f[h]!=t()[l]){y=!1;break}}if(b=b||y)return!1}g=d.lastValidPosition}});c=y;return b}}function ma(a){a=
|
||||
e._data(a).events;e.each(a,function(a,d){e.each(d,function(a,d){if("inputmask"==d.namespace&&"setvalue"!=d.type){var c=d.handler;d.handler=function(a){if(this.readOnly||this.disabled)a.preventDefault;else return c.apply(this,arguments)}}})})}function na(a){function d(a){if(void 0==e.valHooks[a]||!0!=e.valHooks[a].inputmaskpatch){var c=e.valHooks[a]&&e.valHooks[a].get?e.valHooks[a].get:function(a){return a.value},f=e.valHooks[a]&&e.valHooks[a].set?e.valHooks[a].set:function(a,d){a.value=d;return a};
|
||||
e.valHooks[a]={get:function(a){var d=e(a);if(d.data("_inputmask")){if(d.data("_inputmask").opts.autoUnmask)return d.inputmask("unmaskedvalue");a=c(a);d=d.data("_inputmask");return a!=d.masksets[d.activeMasksetIndex]._buffer.join("")?a:""}return c(a)},set:function(a,d){var c=e(a),b=f(a,d);c.data("_inputmask")&&c.triggerHandler("setvalue.inputmask");return b},inputmaskpatch:!0}}}var c;Object.getOwnPropertyDescriptor&&(c=Object.getOwnPropertyDescriptor(a,"value"));if(c&&c.get){if(!a._valueGet){var f=
|
||||
c.get,b=c.set;a._valueGet=function(){return z?f.call(this).split("").reverse().join(""):f.call(this)};a._valueSet=function(a){b.call(this,z?a.split("").reverse().join(""):a)};Object.defineProperty(a,"value",{get:function(){var a=e(this),d=e(this).data("_inputmask"),c=d.masksets,b=d.activeMasksetIndex;return d&&d.opts.autoUnmask?a.inputmask("unmaskedvalue"):f.call(this)!=c[b]._buffer.join("")?f.call(this):""},set:function(a){b.call(this,a);e(this).triggerHandler("setvalue.inputmask")}})}}else document.__lookupGetter__&&
|
||||
a.__lookupGetter__("value")?a._valueGet||(f=a.__lookupGetter__("value"),b=a.__lookupSetter__("value"),a._valueGet=function(){return z?f.call(this).split("").reverse().join(""):f.call(this)},a._valueSet=function(a){b.call(this,z?a.split("").reverse().join(""):a)},a.__defineGetter__("value",function(){var a=e(this),d=e(this).data("_inputmask"),c=d.masksets,b=d.activeMasksetIndex;return d&&d.opts.autoUnmask?a.inputmask("unmaskedvalue"):f.call(this)!=c[b]._buffer.join("")?f.call(this):""}),a.__defineSetter__("value",
|
||||
function(a){b.call(this,a);e(this).triggerHandler("setvalue.inputmask")})):(a._valueGet||(a._valueGet=function(){return z?this.value.split("").reverse().join(""):this.value},a._valueSet=function(a){this.value=z?a.split("").reverse().join(""):a}),d(a.type))}function fa(a,d,c,b){var e=l();if(!1!==b)for(;!r(a)&&0<=a-1;)a--;for(b=a;b<d&&b<n();b++)if(r(b)){U(e,b);var g=p(b),h=H(e,g);if(h!=O(g))if(g<n()&&!1!==R(b,h,!0)&&q()[D(b)].def==q()[D(g)].def)G(e,b,h,!0);else if(r(b))break}else U(e,b);void 0!=c&&
|
||||
G(e,F(d),c);if(!1==f().greedy){d=X(e.join("")).split("");e.length=d.length;b=0;for(c=e.length;b<c;b++)e[b]=d[b];0==e.length&&(f().buffer=t().slice())}return a}function ga(a,d,c){var b=l();if(H(b,a,!0)!=O(a))for(var e=F(d);e>a&&0<=e;e--)if(r(e)){var g=F(e),h=H(b,g);h!=O(g)&&!1!==R(e,h,!0)&&q()[D(e)].def==q()[D(g)].def&&(G(b,e,h,!0),U(b,g))}else U(b,e);void 0!=c&&H(b,a)==O(a)&&G(b,a,c);a=b.length;if(!1==f().greedy){c=X(b.join("")).split("");b.length=c.length;e=0;for(g=b.length;e<g;e++)b[e]=c[e];0==
|
||||
b.length&&(f().buffer=t().slice())}return d-(a-b.length)}function ha(a,c,b){if(d.numericInput||z){switch(c){case d.keyCode.BACKSPACE:c=d.keyCode.DELETE;break;case d.keyCode.DELETE:c=d.keyCode.BACKSPACE}if(z){var e=b.end;b.end=b.begin;b.begin=e}}e=!0;b.begin==b.end?(e=c==d.keyCode.BACKSPACE?b.begin-1:b.begin,d.isNumeric&&""!=d.radixPoint&&l()[e]==d.radixPoint&&(b.begin=l().length-1==e?b.begin:c==d.keyCode.BACKSPACE?e:p(e),b.end=b.begin),e=!1,c==d.keyCode.BACKSPACE?b.begin--:c==d.keyCode.DELETE&&b.end++):
|
||||
1!=b.end-b.begin||d.insertMode||(e=!1,c==d.keyCode.BACKSPACE&&b.begin--);W(l(),b.begin,b.end);var g=n();if(!1==d.greedy&&(isNaN(d.repeat)||0<d.repeat))fa(b.begin,g,void 0,!z&&c==d.keyCode.BACKSPACE&&!e);else{for(var h=b.begin,k=b.begin;k<b.end;k++)if(r(k)||!e)h=fa(b.begin,g,void 0,!z&&c==d.keyCode.BACKSPACE&&!e);e||(b.begin=h)}c=p(-1);W(l(),b.begin,b.end,!0);J(a,!1,!1,l());f().lastValidPosition<c?(f().lastValidPosition=-1,f().p=c):f().p=b.begin}function Z(a){$=!1;var c=this,b=e(c),g=a.keyCode,k=w(c);
|
||||
g==d.keyCode.BACKSPACE||g==d.keyCode.DELETE||h&&127==g||a.ctrlKey&&88==g?(a.preventDefault(),88==g&&(L=l().join("")),ha(c,g,k),ba(),I(c,l(),f().p),c._valueGet()==t().join("")&&b.trigger("cleared"),d.showTooltip&&b.prop("title",f().mask)):g==d.keyCode.END||g==d.keyCode.PAGE_DOWN?setTimeout(function(){var b=p(f().lastValidPosition);d.insertMode||b!=n()||a.shiftKey||b--;w(c,a.shiftKey?k.begin:b,b)},0):g==d.keyCode.HOME&&!a.shiftKey||g==d.keyCode.PAGE_UP?w(c,0,a.shiftKey?k.begin:0):g==d.keyCode.ESCAPE||
|
||||
90==g&&a.ctrlKey?(J(c,!0,!1,L.split("")),b.click()):g!=d.keyCode.INSERT||a.shiftKey||a.ctrlKey?!1!=d.insertMode||a.shiftKey||(g==d.keyCode.RIGHT?setTimeout(function(){var a=w(c);w(c,a.begin)},0):g==d.keyCode.LEFT&&setTimeout(function(){var a=w(c);w(c,a.begin-1)},0)):(d.insertMode=!d.insertMode,w(c,d.insertMode||k.begin!=n()?k.begin:k.begin-1));b=w(c);!0===d.onKeyDown.call(this,a,l(),d)&&w(c,b.begin,b.end);ia=-1!=e.inArray(g,d.ignorables)}function V(b,g,h,k,A,t){if(void 0==h&&$)return!1;$=!0;var q=
|
||||
e(this);b=b||window.event;h=g?h:b.which||b.charCode||b.keyCode;if(!(!0===g||b.ctrlKey&&b.altKey)&&(b.ctrlKey||b.metaKey||ia))return!0;if(h){!0!==g&&46==h&&!1==b.shiftKey&&","==d.radixPoint&&(h=44);var m,s,r=String.fromCharCode(h);g?(h=A?t:f().lastValidPosition+1,m={begin:h,end:h}):m=w(this);t=z?1<m.begin-m.end||1==m.begin-m.end&&d.insertMode:1<m.end-m.begin||1==m.end-m.begin&&d.insertMode;var u=c;t&&(e.each(a,function(a,d){"object"==typeof d&&(c=a,f().undoBuffer=l().join(""))}),c=u,ha(this,d.keyCode.DELETE,
|
||||
m),d.insertMode||e.each(a,function(a,d){"object"==typeof d&&(c=a,ga(m.begin,n()),f().lastValidPosition=p(f().lastValidPosition))}),c=u);var S=l().join("").indexOf(d.radixPoint);d.isNumeric&&!0!==g&&-1!=S&&(d.greedy&&m.begin<=S?(m.begin=F(m.begin),m.end=m.begin):r==d.radixPoint&&(m.begin=S,m.end=m.begin));var C=m.begin;h=R(C,r,A);!0===A&&(h=[{activeMasksetIndex:c,result:h}]);var E=-1;e.each(h,function(a,b){c=b.activeMasksetIndex;f().writeOutBuffer=!0;var e=b.result;if(!1!==e){var g=!1,h=l();!0!==e&&
|
||||
(g=e.refresh,C=void 0!=e.pos?e.pos:C,r=void 0!=e.c?e.c:r);if(!0!==g){if(!0==d.insertMode){e=n();for(h=h.slice();H(h,e,!0)!=O(e)&&e>=C;)e=0==e?-1:F(e);e>=C?(ga(C,n(),r),h=f().lastValidPosition,e=p(h),e!=n()&&h>=C&&H(l().slice(),e,!0)!=O(e)&&(f().lastValidPosition=e)):f().writeOutBuffer=!1}else G(h,C,r,!0);if(-1==E||E>p(C))E=p(C)}else!A&&(h=C<n()?C+1:C,-1==E||E>h)&&(E=h);E>f().p&&(f().p=E)}});!0!==A&&(c=u,ba());if(!1!==k)if(e.each(h,function(a,d){if(d.activeMasksetIndex==c)return s=d,!1}),void 0!=s){var D=
|
||||
this;setTimeout(function(){d.onKeyValidation.call(D,s.result,d)},0);if(f().writeOutBuffer&&!1!==s.result){var J=l();k=g?void 0:d.numericInput?C>S?F(E):r==d.radixPoint?E-1:F(E-1):E;I(this,J,k);!0!==g&&setTimeout(function(){!0===Q(J)&&q.trigger("complete");aa=!0;q.trigger("input")},0)}else t&&(f().buffer=f().undoBuffer.split(""))}else t&&(f().buffer=f().undoBuffer.split(""));d.showTooltip&&q.prop("title",f().mask);b&&(b.preventDefault?b.preventDefault():b.returnValue=!1)}}function ja(a){var c=e(this),
|
||||
b=a.keyCode,f=l();d.onKeyUp.call(this,a,f,d);b==d.keyCode.TAB&&d.showMaskOnFocus&&(c.hasClass("focus.inputmask")&&0==this._valueGet().length?(f=t().slice(),I(this,f),w(this,0),L=l().join("")):(I(this,f),f.join("")==t().join("")&&-1!=e.inArray(d.radixPoint,f)?(w(this,K(0)),c.click()):w(this,K(0),K(n()))))}function ka(a){if(!0===aa&&"input"==a.type)return aa=!1,!0;var c=this,b=e(c);if("propertychange"==a.type&&c._valueGet().length<=n())return!0;setTimeout(function(){var a=e.isFunction(d.onBeforePaste)?
|
||||
d.onBeforePaste.call(c,c._valueGet(),d):c._valueGet();J(c,!1,!1,a.split(""),!0);I(c,l());!0===Q(l())&&b.trigger("complete");b.click()},0)}function oa(a){var c=e(this),b=w(this),f=this._valueGet(),f=f.replace(RegExp("("+ea(t().join(""))+")*"),"");b.begin>f.length&&(w(this,f.length),b=w(this));1!=l().length-f.length||f.charAt(b.begin)==l()[b.begin]||f.charAt(b.begin+1)==l()[b.begin]||r(b.begin)?(J(this,!1,!1,f.split("")),I(this,l()),!0===Q(l())&&c.trigger("complete"),c.click()):(a.keyCode=d.keyCode.BACKSPACE,
|
||||
Z.call(this,a));a.preventDefault()}function pa(b){s=e(b);if(s.is(":input")){s.data("_inputmask",{masksets:a,activeMasksetIndex:c,opts:d,isRTL:!1});d.showTooltip&&s.prop("title",f().mask);f().greedy=f().greedy?f().greedy:0==f().repeat;if(null!=s.attr("maxLength")){var h=s.prop("maxLength");-1<h&&e.each(a,function(a,d){"object"==typeof d&&"*"==d.repeat&&(d.repeat=h)});n()>=h&&-1<h&&(h<t().length&&(t().length=h),!1==f().greedy&&(f().repeat=Math.round(h/t().length)),s.prop("maxLength",2*n()))}na(b);d.numericInput&&
|
||||
(d.isNumeric=d.numericInput);("rtl"==b.dir||d.numericInput&&d.rightAlignNumerics||d.isNumeric&&d.rightAlignNumerics)&&s.css("text-align","right");if("rtl"==b.dir||d.numericInput){b.dir="ltr";s.removeAttr("dir");var A=s.data("_inputmask");A.isRTL=!0;s.data("_inputmask",A);z=!0}s.unbind(".inputmask");s.removeClass("focus.inputmask");s.closest("form").bind("submit",function(){L!=l().join("")&&s.change()}).bind("reset",function(){setTimeout(function(){s.trigger("setvalue")},0)});s.bind("mouseenter.inputmask",
|
||||
function(){!e(this).hasClass("focus.inputmask")&&d.showMaskOnHover&&this._valueGet()!=l().join("")&&I(this,l())}).bind("blur.inputmask",function(){var b=e(this),f=this._valueGet(),g=l();b.removeClass("focus.inputmask");L!=l().join("")&&b.change();d.clearMaskOnLostFocus&&""!=f&&(f==t().join("")?this._valueSet(""):Y(this));!1===Q(g)&&(b.trigger("incomplete"),d.clearIncomplete&&(e.each(a,function(a,d){"object"==typeof d&&(d.buffer=d._buffer.slice(),d.lastValidPosition=-1)}),c=0,d.clearMaskOnLostFocus?
|
||||
this._valueSet(""):(g=t().slice(),I(this,g))))}).bind("focus.inputmask",function(){var a=e(this),b=this._valueGet();d.showMaskOnFocus&&!a.hasClass("focus.inputmask")&&(!d.showMaskOnHover||d.showMaskOnHover&&""==b)&&this._valueGet()!=l().join("")&&I(this,l(),p(f().lastValidPosition));a.addClass("focus.inputmask");L=l().join("")}).bind("mouseleave.inputmask",function(){var a=e(this);d.clearMaskOnLostFocus&&(a.hasClass("focus.inputmask")||this._valueGet()==a.attr("placeholder")||(this._valueGet()==t().join("")||
|
||||
""==this._valueGet()?this._valueSet(""):Y(this)))}).bind("click.inputmask",function(){var a=this;setTimeout(function(){var b=w(a),c=l();if(b.begin==b.end){var b=z?K(b.begin):b.begin,g=f().lastValidPosition,c=d.isNumeric?!1===d.skipRadixDance&&""!=d.radixPoint&&-1!=e.inArray(d.radixPoint,c)?d.numericInput?p(e.inArray(d.radixPoint,c)):e.inArray(d.radixPoint,c):p(g):p(g);b<c?r(b)?w(a,b):w(a,p(b)):w(a,c)}},0)}).bind("dblclick.inputmask",function(){var a=this;setTimeout(function(){w(a,0,p(f().lastValidPosition))},
|
||||
0)}).bind(P+".inputmask dragdrop.inputmask drop.inputmask",ka).bind("setvalue.inputmask",function(){J(this,!0);L=l().join("");this._valueGet()==t().join("")&&this._valueSet("")}).bind("complete.inputmask",d.oncomplete).bind("incomplete.inputmask",d.onincomplete).bind("cleared.inputmask",d.oncleared);s.bind("keydown.inputmask",Z).bind("keypress.inputmask",V).bind("keyup.inputmask",ja);if(k||u||m||M)if(s.attr("autocomplete","off").attr("autocorrect","off").attr("autocapitalize","off").attr("spellcheck",
|
||||
!1),u||M)s.unbind("keydown.inputmask",Z).unbind("keypress.inputmask",V).unbind("keyup.inputmask",ja),"input"==P&&s.unbind(P+".inputmask"),s.bind("input.inputmask",oa);g&&s.bind("input.inputmask",ka);A=e.isFunction(d.onBeforeMask)?d.onBeforeMask.call(b,b._valueGet(),d):b._valueGet();J(b,!0,!1,A.split(""));L=l().join("");var q;try{q=document.activeElement}catch(S){}q===b?(s.addClass("focus.inputmask"),w(b,p(f().lastValidPosition))):d.clearMaskOnLostFocus?l().join("")==t().join("")?b._valueSet(""):Y(b):
|
||||
I(b,l());ma(b)}}var z=!1,L=l().join(""),s,$=!1,aa=!1,ia=!1;if(void 0!=b)switch(b.action){case "isComplete":return Q(b.buffer);case "unmaskedvalue":return z=b.$input.data("_inputmask").isRTL,la(b.$input,b.skipDatepickerCheck);case "mask":pa(b.el);break;case "format":return s=e({}),s.data("_inputmask",{masksets:a,activeMasksetIndex:c,opts:d,isRTL:d.numericInput}),d.numericInput&&(d.isNumeric=d.numericInput,z=!0),b=b.value.split(""),J(s,!1,!1,z?b.reverse():b,!0),z?l().reverse().join(""):l().join("");
|
||||
case "isValid":return s=e({}),s.data("_inputmask",{masksets:a,activeMasksetIndex:c,opts:d,isRTL:d.numericInput}),d.numericInput&&(d.isNumeric=d.numericInput,z=!0),b=b.value.split(""),J(s,!1,!0,z?b.reverse():b),Q(l())}};e.inputmask={defaults:{placeholder:"_",optionalmarker:{start:"[",end:"]"},quantifiermarker:{start:"{",end:"}"},groupmarker:{start:"(",end:")"},escapeChar:"\\",mask:null,oncomplete:e.noop,onincomplete:e.noop,oncleared:e.noop,repeat:0,greedy:!0,autoUnmask:!1,clearMaskOnLostFocus:!0,insertMode:!0,
|
||||
clearIncomplete:!1,aliases:{},onKeyUp:e.noop,onKeyDown:e.noop,onBeforeMask:void 0,onBeforePaste:void 0,onUnMask:void 0,showMaskOnFocus:!0,showMaskOnHover:!0,onKeyValidation:e.noop,skipOptionalPartCharacter:" ",showTooltip:!1,numericInput:!1,isNumeric:!1,radixPoint:"",skipRadixDance:!1,rightAlignNumerics:!0,definitions:{9:{validator:"[0-9]",cardinality:1,definitionSymbol:"*"},a:{validator:"[A-Za-z\u0410-\u044f\u0401\u0451]",cardinality:1,definitionSymbol:"*"},"*":{validator:"[A-Za-z\u0410-\u044f\u0401\u04510-9]",
|
||||
cardinality:1}},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91},ignorables:[8,9,13,19,27,33,34,35,36,37,38,39,40,45,46,93,112,113,114,115,116,117,118,119,120,121,122,123],
|
||||
getMaskLength:void 0,isComplete:void 0},escapeRegex:function(a){return a.replace(RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\)","gim"),"\\$1")},format:function(a,c){var d=e.extend(!0,{},e.inputmask.defaults,c);f(d.alias,c,d);return q(b(d),0,d,{action:"format",value:a})},isValid:function(a,c){var d=e.extend(!0,{},e.inputmask.defaults,c);f(d.alias,c,d);return q(b(d),0,d,{action:"isValid",value:a})}};e.fn.inputmask=function(a,c){var d=e.extend(!0,{},e.inputmask.defaults,c),g,h=0;if("string"===
|
||||
typeof a)switch(a){case "mask":return f(d.alias,c,d),g=b(d),0==g.length?this:this.each(function(){q(e.extend(!0,{},g),0,d,{action:"mask",el:this})});case "unmaskedvalue":var k=e(this);return k.data("_inputmask")?(g=k.data("_inputmask").masksets,h=k.data("_inputmask").activeMasksetIndex,d=k.data("_inputmask").opts,q(g,h,d,{action:"unmaskedvalue",$input:k})):k.val();case "remove":return this.each(function(){var a=e(this);if(a.data("_inputmask")){g=a.data("_inputmask").masksets;h=a.data("_inputmask").activeMasksetIndex;
|
||||
d=a.data("_inputmask").opts;this._valueSet(q(g,h,d,{action:"unmaskedvalue",$input:a,skipDatepickerCheck:!0}));a.removeData("_inputmask");a.unbind(".inputmask");a.removeClass("focus.inputmask");var b;Object.getOwnPropertyDescriptor&&(b=Object.getOwnPropertyDescriptor(this,"value"));b&&b.get?this._valueGet&&Object.defineProperty(this,"value",{get:this._valueGet,set:this._valueSet}):document.__lookupGetter__&&this.__lookupGetter__("value")&&this._valueGet&&(this.__defineGetter__("value",this._valueGet),
|
||||
this.__defineSetter__("value",this._valueSet));try{delete this._valueGet,delete this._valueSet}catch(c){this._valueSet=this._valueGet=void 0}}});case "getemptymask":return this.data("_inputmask")?(g=this.data("_inputmask").masksets,h=this.data("_inputmask").activeMasksetIndex,g[h]._buffer.join("")):"";case "hasMaskedValue":return this.data("_inputmask")?!this.data("_inputmask").opts.autoUnmask:!1;case "isComplete":return g=this.data("_inputmask").masksets,h=this.data("_inputmask").activeMasksetIndex,
|
||||
d=this.data("_inputmask").opts,q(g,h,d,{action:"isComplete",buffer:this[0]._valueGet().split("")});case "getmetadata":if(this.data("_inputmask"))return g=this.data("_inputmask").masksets,h=this.data("_inputmask").activeMasksetIndex,g[h].metadata;break;default:return f(a,c,d)||(d.mask=a),g=b(d),0==g.length?this:this.each(function(){q(e.extend(!0,{},g),h,d,{action:"mask",el:this})})}else{if("object"==typeof a)return d=e.extend(!0,{},e.inputmask.defaults,a),f(d.alias,a,d),g=b(d),0==g.length?this:this.each(function(){q(e.extend(!0,
|
||||
{},g),h,d,{action:"mask",el:this})});if(void 0==a)return this.each(function(){var a=e(this).attr("data-inputmask");if(a&&""!=a)try{var a=a.replace(RegExp("'","g"),'"'),b=e.parseJSON("{"+a+"}");e.extend(!0,b,c);d=e.extend(!0,{},e.inputmask.defaults,b);f(d.alias,b,d);d.alias=void 0;e(this).inputmask(d)}catch(g){}})}}}})(jQuery);
|
||||
(function(e){e.extend(e.inputmask.defaults.definitions,{A:{validator:"[A-Za-z]",cardinality:1,casing:"upper"},"#":{validator:"[A-Za-z\u0410-\u044f\u0401\u04510-9]",cardinality:1,casing:"upper"}});e.extend(e.inputmask.defaults.aliases,{url:{mask:"ir",placeholder:"",separator:"",defaultPrefix:"http://",regex:{urlpre1:/[fh]/,urlpre2:/(ft|ht)/,urlpre3:/(ftp|htt)/,urlpre4:/(ftp:|http|ftps)/,urlpre5:/(ftp:\/|ftps:|http:|https)/,urlpre6:/(ftp:\/\/|ftps:\/|http:\/|https:)/,urlpre7:/(ftp:\/\/|ftps:\/\/|http:\/\/|https:\/)/,
|
||||
urlpre8:/(ftp:\/\/|ftps:\/\/|http:\/\/|https:\/\/)/},definitions:{i:{validator:function(a,f,b,e,c){return!0},cardinality:8,prevalidator:function(){for(var a=[],f=0;8>f;f++)a[f]=function(){var a=f;return{validator:function(f,c,e,k,m){if(m.regex["urlpre"+(a+1)]){var u=f;0<a+1-f.length&&(u=c.join("").substring(0,a+1-f.length)+""+u);f=m.regex["urlpre"+(a+1)].test(u);if(!k&&!f){e-=a;for(k=0;k<m.defaultPrefix.length;k++)c[e]=m.defaultPrefix[k],e++;for(k=0;k<u.length-1;k++)c[e]=u[k],e++;return{pos:e}}return f}return!1},
|
||||
cardinality:a}}();return a}()},r:{validator:".",cardinality:50}},insertMode:!1,autoUnmask:!1},ip:{mask:["[[x]y]z.[[x]y]z.[[x]y]z.x[yz]","[[x]y]z.[[x]y]z.[[x]y]z.[[x]y][z]"],definitions:{x:{validator:"[012]",cardinality:1,definitionSymbol:"i"},y:{validator:function(a,f,b,e,c){a=-1<b-1&&"."!=f[b-1]?f[b-1]+a:"0"+a;return/2[0-5]|[01][0-9]/.test(a)},cardinality:1,definitionSymbol:"i"},z:{validator:function(a,f,b,e,c){-1<b-1&&"."!=f[b-1]?(a=f[b-1]+a,a=-1<b-2&&"."!=f[b-2]?f[b-2]+a:"0"+a):a="00"+a;return/25[0-5]|2[0-4][0-9]|[01][0-9][0-9]/.test(a)},
|
||||
cardinality:1,definitionSymbol:"i"}}}})})(jQuery);
|
||||
(function(e){e.extend(e.inputmask.defaults.definitions,{h:{validator:"[01][0-9]|2[0-3]",cardinality:2,prevalidator:[{validator:"[0-2]",cardinality:1}]},s:{validator:"[0-5][0-9]",cardinality:2,prevalidator:[{validator:"[0-5]",cardinality:1}]},d:{validator:"0[1-9]|[12][0-9]|3[01]",cardinality:2,prevalidator:[{validator:"[0-3]",cardinality:1}]},m:{validator:"0[1-9]|1[012]",cardinality:2,prevalidator:[{validator:"[01]",cardinality:1}]},y:{validator:"(19|20)\\d{2}",cardinality:4,prevalidator:[{validator:"[12]",
|
||||
cardinality:1},{validator:"(19|20)",cardinality:2},{validator:"(19|20)\\d",cardinality:3}]}});e.extend(e.inputmask.defaults.aliases,{"dd/mm/yyyy":{mask:"1/2/y",placeholder:"dd/mm/yyyy",regex:{val1pre:/[0-3]/,val1:/0[1-9]|[12][0-9]|3[01]/,val2pre:function(a){a=e.inputmask.escapeRegex.call(this,a);return RegExp("((0[1-9]|[12][0-9]|3[01])"+a+"[01])")},val2:function(a){a=e.inputmask.escapeRegex.call(this,a);return RegExp("((0[1-9]|[12][0-9])"+a+"(0[1-9]|1[012]))|(30"+a+"(0[13-9]|1[012]))|(31"+a+"(0[13578]|1[02]))")}},
|
||||
leapday:"29/02/",separator:"/",yearrange:{minyear:1900,maxyear:2099},isInYearRange:function(a,f,b){var e=parseInt(a.concat(f.toString().slice(a.length)));a=parseInt(a.concat(b.toString().slice(a.length)));return(isNaN(e)?!1:f<=e&&e<=b)||(isNaN(a)?!1:f<=a&&a<=b)},determinebaseyear:function(a,f,b){var e=(new Date).getFullYear();if(a>e)return a;if(f<e){for(var e=f.toString().slice(0,2),c=f.toString().slice(2,4);f<e+b;)e--;f=e+c;return a>f?a:f}return e},onKeyUp:function(a,f,b){f=e(this);a.ctrlKey&&a.keyCode==
|
||||
b.keyCode.RIGHT&&(a=new Date,f.val(a.getDate().toString()+(a.getMonth()+1).toString()+a.getFullYear().toString()))},definitions:{1:{validator:function(a,f,b,e,c){var h=c.regex.val1.test(a);return e||h||a.charAt(1)!=c.separator&&-1=="-./".indexOf(a.charAt(1))||!(h=c.regex.val1.test("0"+a.charAt(0)))?h:(f[b-1]="0",{pos:b,c:a.charAt(0)})},cardinality:2,prevalidator:[{validator:function(a,f,b,e,c){var h=c.regex.val1pre.test(a);return e||h||!(h=c.regex.val1.test("0"+a))?h:(f[b]="0",b++,{pos:b})},cardinality:1}]},
|
||||
2:{validator:function(a,f,b,e,c){var h=f.join("").substr(0,3);-1!=h.indexOf(c.placeholder[0])&&(h="01"+c.separator);var k=c.regex.val2(c.separator).test(h+a);return e||k||a.charAt(1)!=c.separator&&-1=="-./".indexOf(a.charAt(1))||!(k=c.regex.val2(c.separator).test(h+"0"+a.charAt(0)))?k:(f[b-1]="0",{pos:b,c:a.charAt(0)})},cardinality:2,prevalidator:[{validator:function(a,f,b,e,c){var h=f.join("").substr(0,3);-1!=h.indexOf(c.placeholder[0])&&(h="01"+c.separator);var k=c.regex.val2pre(c.separator).test(h+
|
||||
a);return e||k||!(k=c.regex.val2(c.separator).test(h+"0"+a))?k:(f[b]="0",b++,{pos:b})},cardinality:1}]},y:{validator:function(a,f,b,e,c){if(c.isInYearRange(a,c.yearrange.minyear,c.yearrange.maxyear)){if(f.join("").substr(0,6)!=c.leapday)return!0;a=parseInt(a,10);return 0===a%4?0===a%100?0===a%400?!0:!1:!0:!1}return!1},cardinality:4,prevalidator:[{validator:function(a,f,b,e,c){var h=c.isInYearRange(a,c.yearrange.minyear,c.yearrange.maxyear);if(!e&&!h){e=c.determinebaseyear(c.yearrange.minyear,c.yearrange.maxyear,
|
||||
a+"0").toString().slice(0,1);if(h=c.isInYearRange(e+a,c.yearrange.minyear,c.yearrange.maxyear))return f[b++]=e[0],{pos:b};e=c.determinebaseyear(c.yearrange.minyear,c.yearrange.maxyear,a+"0").toString().slice(0,2);if(h=c.isInYearRange(e+a,c.yearrange.minyear,c.yearrange.maxyear))return f[b++]=e[0],f[b++]=e[1],{pos:b}}return h},cardinality:1},{validator:function(a,f,b,e,c){var h=c.isInYearRange(a,c.yearrange.minyear,c.yearrange.maxyear);if(!e&&!h){e=c.determinebaseyear(c.yearrange.minyear,c.yearrange.maxyear,
|
||||
a).toString().slice(0,2);if(h=c.isInYearRange(a[0]+e[1]+a[1],c.yearrange.minyear,c.yearrange.maxyear))return f[b++]=e[1],{pos:b};e=c.determinebaseyear(c.yearrange.minyear,c.yearrange.maxyear,a).toString().slice(0,2);c.isInYearRange(e+a,c.yearrange.minyear,c.yearrange.maxyear)?f.join("").substr(0,6)!=c.leapday?h=!0:(c=parseInt(a,10),h=0===c%4?0===c%100?0===c%400?!0:!1:!0:!1):h=!1;if(h)return f[b-1]=e[0],f[b++]=e[1],f[b++]=a[0],{pos:b}}return h},cardinality:2},{validator:function(a,f,b,e,c){return c.isInYearRange(a,
|
||||
c.yearrange.minyear,c.yearrange.maxyear)},cardinality:3}]}},insertMode:!1,autoUnmask:!1},"mm/dd/yyyy":{placeholder:"mm/dd/yyyy",alias:"dd/mm/yyyy",regex:{val2pre:function(a){a=e.inputmask.escapeRegex.call(this,a);return RegExp("((0[13-9]|1[012])"+a+"[0-3])|(02"+a+"[0-2])")},val2:function(a){a=e.inputmask.escapeRegex.call(this,a);return RegExp("((0[1-9]|1[012])"+a+"(0[1-9]|[12][0-9]))|((0[13-9]|1[012])"+a+"30)|((0[13578]|1[02])"+a+"31)")},val1pre:/[01]/,val1:/0[1-9]|1[012]/},leapday:"02/29/",onKeyUp:function(a,
|
||||
f,b){f=e(this);a.ctrlKey&&a.keyCode==b.keyCode.RIGHT&&(a=new Date,f.val((a.getMonth()+1).toString()+a.getDate().toString()+a.getFullYear().toString()))}},"yyyy/mm/dd":{mask:"y/1/2",placeholder:"yyyy/mm/dd",alias:"mm/dd/yyyy",leapday:"/02/29",onKeyUp:function(a,f,b){f=e(this);a.ctrlKey&&a.keyCode==b.keyCode.RIGHT&&(a=new Date,f.val(a.getFullYear().toString()+(a.getMonth()+1).toString()+a.getDate().toString()))},definitions:{2:{validator:function(a,f,b,e,c){var h=f.join("").substr(5,3);-1!=h.indexOf(c.placeholder[5])&&
|
||||
(h="01"+c.separator);var k=c.regex.val2(c.separator).test(h+a);if(!(e||k||a.charAt(1)!=c.separator&&-1=="-./".indexOf(a.charAt(1)))&&(k=c.regex.val2(c.separator).test(h+"0"+a.charAt(0))))return f[b-1]="0",{pos:b,c:a.charAt(0)};if(k){if(f.join("").substr(4,4)+a!=c.leapday)return!0;a=parseInt(f.join("").substr(0,4),10);return 0===a%4?0===a%100?0===a%400?!0:!1:!0:!1}return k},cardinality:2,prevalidator:[{validator:function(a,f,b,e,c){var h=f.join("").substr(5,3);-1!=h.indexOf(c.placeholder[5])&&(h="01"+
|
||||
c.separator);var k=c.regex.val2pre(c.separator).test(h+a);return e||k||!(k=c.regex.val2(c.separator).test(h+"0"+a))?k:(f[b]="0",b++,{pos:b})},cardinality:1}]}}},"dd.mm.yyyy":{mask:"1.2.y",placeholder:"dd.mm.yyyy",leapday:"29.02.",separator:".",alias:"dd/mm/yyyy"},"dd-mm-yyyy":{mask:"1-2-y",placeholder:"dd-mm-yyyy",leapday:"29-02-",separator:"-",alias:"dd/mm/yyyy"},"mm.dd.yyyy":{mask:"1.2.y",placeholder:"mm.dd.yyyy",leapday:"02.29.",separator:".",alias:"mm/dd/yyyy"},"mm-dd-yyyy":{mask:"1-2-y",placeholder:"mm-dd-yyyy",
|
||||
leapday:"02-29-",separator:"-",alias:"mm/dd/yyyy"},"yyyy.mm.dd":{mask:"y.1.2",placeholder:"yyyy.mm.dd",leapday:".02.29",separator:".",alias:"yyyy/mm/dd"},"yyyy-mm-dd":{mask:"y-1-2",placeholder:"yyyy-mm-dd",leapday:"-02-29",separator:"-",alias:"yyyy/mm/dd"},datetime:{mask:"1/2/y h:s",placeholder:"dd/mm/yyyy hh:mm",alias:"dd/mm/yyyy",regex:{hrspre:/[012]/,hrs24:/2[0-9]|1[3-9]/,hrs:/[01][0-9]|2[0-3]/,ampm:/^[a|p|A|P][m|M]/},timeseparator:":",hourFormat:"24",definitions:{h:{validator:function(a,f,b,e,
|
||||
c){var h=c.regex.hrs.test(a);return e||h||a.charAt(1)!=c.timeseparator&&-1=="-.:".indexOf(a.charAt(1))||!(h=c.regex.hrs.test("0"+a.charAt(0)))?h&&"24"!==c.hourFormat&&c.regex.hrs24.test(a)?(a=parseInt(a,10),f[b+5]=24==a?"a":"p",f[b+6]="m",a-=12,10>a?(f[b]=a.toString(),f[b-1]="0"):(f[b]=a.toString().charAt(1),f[b-1]=a.toString().charAt(0)),{pos:b,c:f[b]}):h:(f[b-1]="0",f[b]=a.charAt(0),b++,{pos:b})},cardinality:2,prevalidator:[{validator:function(a,f,b,e,c){var h=c.regex.hrspre.test(a);return e||h||
|
||||
!(h=c.regex.hrs.test("0"+a))?h:(f[b]="0",b++,{pos:b})},cardinality:1}]},t:{validator:function(a,e,b,g,c){return c.regex.ampm.test(a+"m")},casing:"lower",cardinality:1}},insertMode:!1,autoUnmask:!1},datetime12:{mask:"1/2/y h:s t\\m",placeholder:"dd/mm/yyyy hh:mm xm",alias:"datetime",hourFormat:"12"},"hh:mm t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"h:s t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"hh:mm:ss":{mask:"h:s:s",autoUnmask:!1},
|
||||
"hh:mm":{mask:"h:s",autoUnmask:!1},date:{alias:"dd/mm/yyyy"},"mm/yyyy":{mask:"1/y",placeholder:"mm/yyyy",leapday:"donotuse",separator:"/",alias:"mm/dd/yyyy"}})})(jQuery);
|
||||
(function(e){e.extend(e.inputmask.defaults.aliases,{decimal:{mask:"~",placeholder:"",repeat:"*",greedy:!1,numericInput:!1,isNumeric:!0,digits:"*",groupSeparator:"",radixPoint:".",groupSize:3,autoGroup:!1,allowPlus:!0,allowMinus:!0,integerDigits:"*",defaultValue:"",prefix:"",suffix:"",getMaskLength:function(a,f,b,g,c){var h=a.length;f||("*"==b?h=g.length+1:1<b&&(h+=a.length*(b-1)));a=e.inputmask.escapeRegex.call(this,c.groupSeparator);c=e.inputmask.escapeRegex.call(this,c.radixPoint);g=g.join("");
|
||||
c=g.replace(RegExp(a,"g"),"").replace(RegExp(c),"");return h+(g.length-c.length)},postFormat:function(a,f,b,g){if(""==g.groupSeparator)return f;var c=a.slice();e.inArray(g.radixPoint,a);b||c.splice(f,0,"?");c=c.join("");if(g.autoGroup||b&&-1!=c.indexOf(g.groupSeparator)){for(var h=e.inputmask.escapeRegex.call(this,g.groupSeparator),c=c.replace(RegExp(h,"g"),""),h=c.split(g.radixPoint),c=h[0],k=RegExp("([-+]?[\\d?]+)([\\d?]{"+g.groupSize+"})");k.test(c);)c=c.replace(k,"$1"+g.groupSeparator+"$2"),c=
|
||||
c.replace(g.groupSeparator+g.groupSeparator,g.groupSeparator);1<h.length&&(c+=g.radixPoint+h[1])}a.length=c.length;g=0;for(h=c.length;g<h;g++)a[g]=c.charAt(g);c=e.inArray("?",a);b||a.splice(c,1);return b?f:c},regex:{number:function(a){var f=e.inputmask.escapeRegex.call(this,a.radixPoint),b=isNaN(a.digits)?a.digits:"{0,"+a.digits+"}",g=isNaN(a.integerDigits)?a.integerDigits:"{1,"+a.integerDigits+"}";return RegExp("^"+(a.allowPlus||a.allowMinus?"["+(a.allowPlus?"+":"")+(a.allowMinus?"-":"")+"]?":"")+
|
||||
"\\d"+g+"("+f+"\\d"+b+")?$")}},onKeyDown:function(a,f,b){var g=e(this);if(a.keyCode==b.keyCode.TAB){if(a=e.inArray(b.radixPoint,f),-1!=a){for(var c=g.data("_inputmask").masksets,g=g.data("_inputmask").activeMasksetIndex,h=1;h<=b.digits&&h<b.getMaskLength(c[g]._buffer,c[g].greedy,c[g].repeat,f,b);h++)if(void 0==f[a+h]||""==f[a+h])f[a+h]="0";this._valueSet(f.join(""))}}else if(a.keyCode==b.keyCode.DELETE||a.keyCode==b.keyCode.BACKSPACE)return b.postFormat(f,0,!0,b),this._valueSet(f.join("")),!0},definitions:{"~":{validator:function(a,
|
||||
f,b,g,c){var h=e.extend({},c,{digits:g?"*":c.digits});if(""==a)return!1;if(!g&&1>=b&&"0"===f[0]&&/[\d-]/.test(a)&&1==f.join("").length)return f[0]="",{pos:0};var k=g?f.slice(0,b):f.slice();k.splice(b,0,a);var k=k.join(""),m=e.inputmask.escapeRegex.call(this,c.groupSeparator),k=k.replace(RegExp(m,"g"),"");g&&k.lastIndexOf(c.radixPoint)==k.length-1&&(m=e.inputmask.escapeRegex.call(this,c.radixPoint),k=k.replace(RegExp(m,"g"),""));if(!g&&""==k)return!1;m=c.regex.number(h).test(k);if(!m&&(k+="0",m=c.regex.number(h).test(k),
|
||||
!m)){m=k.lastIndexOf(c.groupSeparator);for(m=k.length-m;3>=m;m++)k+="0";m=c.regex.number(h).test(k);if(!m&&!g&&a==c.radixPoint&&(m=c.regex.number(h).test("0"+k+"0")))return f[b]="0",b++,{pos:b}}return!1==m||g||a==c.radixPoint?m:{pos:c.postFormat(f,b,"-"==a||"+"==a?!0:!1,c)}},cardinality:1,prevalidator:null}},insertMode:!0,autoUnmask:!1},integer:{regex:{number:function(a){var f=e.inputmask.escapeRegex.call(this,a.groupSeparator);return RegExp("^"+(a.allowPlus||a.allowMinus?"["+(a.allowPlus?"+":"")+
|
||||
(a.allowMinus?"-":"")+"]?":"")+"(\\d+|\\d{1,"+a.groupSize+"}(("+f+"\\d{"+a.groupSize+"})?)+)$")}},alias:"decimal"}})})(jQuery);
|
||||
(function(e){e.extend(e.inputmask.defaults.aliases,{Regex:{mask:"r",greedy:!1,repeat:"*",regex:null,regexTokens:null,tokenizer:/\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,quantifierFilter:/[0-9]+[^,]/,isComplete:function(a,e){return RegExp(e.regex).test(a.join(""))},definitions:{r:{validator:function(a,e,b,g,c){function h(a,b){this.matches=
|
||||
[];this.isGroup=a||!1;this.isQuantifier=b||!1;this.quantifier={min:1,max:1};this.repeaterPart=void 0}function k(){var a=new h,b,e=[];for(c.regexTokens=[];b=c.tokenizer.exec(c.regex);)switch(b=b[0],b.charAt(0)){case "(":e.push(new h(!0));break;case ")":var d=e.pop();0<e.length?e[e.length-1].matches.push(d):a.matches.push(d);break;case "{":case "+":case "*":var f=new h(!1,!0);b=b.replace(/[{}]/g,"");d=b.split(",");b=isNaN(d[0])?d[0]:parseInt(d[0]);d=1==d.length?b:isNaN(d[1])?d[1]:parseInt(d[1]);f.quantifier=
|
||||
{min:b,max:d};if(0<e.length){var g=e[e.length-1].matches;b=g.pop();b.isGroup||(d=new h(!0),d.matches.push(b),b=d);g.push(b);g.push(f)}else b=a.matches.pop(),b.isGroup||(d=new h(!0),d.matches.push(b),b=d),a.matches.push(b),a.matches.push(f);break;default:0<e.length?e[e.length-1].matches.push(b):a.matches.push(b)}0<a.matches.length&&c.regexTokens.push(a)}function m(a,b){var c=!1;b&&(u+="(",M++);for(var d=0;d<a.matches.length;d++){var e=a.matches[d];if(!0==e.isGroup)c=m(e,!0);else if(!0==e.isQuantifier){var f=
|
||||
a.matches.indexOf(e),f=a.matches[f-1],h=u;if(isNaN(e.quantifier.max)){for(;e.repeaterPart&&e.repeaterPart!=u&&e.repeaterPart.length>u.length&&!(c=m(f,!0)););(c=c||m(f,!0))&&(e.repeaterPart=u);u=h+e.quantifier.max}else{for(var g=0,k=e.quantifier.max-1;g<k&&!(c=m(f,!0));g++);u=h+"{"+e.quantifier.min+","+e.quantifier.max+"}"}}else if(void 0!=e.matches)for(f=0;f<e.length&&!(c=m(e[f],b));f++);else{if("["==e[0]){c=u;c+=e;for(g=0;g<M;g++)c+=")";c=RegExp("^("+c+")$");c=c.test(P)}else for(f=0,h=e.length;f<
|
||||
h;f++)if("\\"!=e[f]){c=u;c+=e.substr(0,f+1);c=c.replace(/\|$/,"");for(g=0;g<M;g++)c+=")";c=RegExp("^("+c+")$");if(c=c.test(P))break}u+=e}if(c)break}b&&(u+=")",M--);return c}null==c.regexTokens&&k();g=e.slice();var u="";e=!1;var M=0;g.splice(b,0,a);var P=g.join("");for(a=0;a<c.regexTokens.length&&!(h=c.regexTokens[a],e=m(h,h.isGroup));a++);return e},cardinality:1}}}})})(jQuery);
|
||||
(function(e){e.extend(e.inputmask.defaults.aliases,{phone:{url:"phone-codes/phone-codes.json",mask:function(a){a.definitions={p:{validator:function(){return!1},cardinality:1},"#":{validator:"[0-9]",cardinality:1}};var f=[];e.ajax({url:a.url,async:!1,dataType:"json",success:function(a){f=a}});f.splice(0,0,"+p(ppp)ppp-pppp");return f}}})})(jQuery);
|
||||
File diff suppressed because one or more lines are too long
Vendored
+2
File diff suppressed because one or more lines are too long
+20
File diff suppressed because one or more lines are too long
@@ -0,0 +1,174 @@
|
||||
/* jshint forin:true, noarg:true, noempty:true, eqeqeq:true, boss:true, undef:true, curly:true, browser:true, jquery:true */
|
||||
/*
|
||||
* jQuery MultiSelect UI Widget Filtering Plugin 1.5pre
|
||||
* Copyright (c) 2012 Eric Hynds
|
||||
*
|
||||
* http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/
|
||||
*
|
||||
* Depends:
|
||||
* - jQuery UI MultiSelect widget
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
*/
|
||||
(function($) {
|
||||
var rEscape = /[\-\[\]{}()*+?.,\\\^$|#\s]/g;
|
||||
|
||||
$.widget('ech.multiselectfilter', {
|
||||
|
||||
options: {
|
||||
label: 'Filter:',
|
||||
width: null, /* override default width set in css file (px). null will inherit */
|
||||
placeholder: 'Enter keywords',
|
||||
autoReset: false
|
||||
},
|
||||
|
||||
_create: function() {
|
||||
var opts = this.options;
|
||||
var elem = $(this.element);
|
||||
|
||||
// get the multiselect instance
|
||||
var instance = (this.instance = (elem.data('echMultiselect') || elem.data("multiselect") || elem.data("ech-multiselect")));
|
||||
|
||||
// store header; add filter class so the close/check all/uncheck all links can be positioned correctly
|
||||
var header = (this.header = instance.menu.find('.ui-multiselect-header').addClass('ui-multiselect-hasfilter'));
|
||||
|
||||
// wrapper elem
|
||||
var wrapper = (this.wrapper = $('<div class="ui-multiselect-filter">' + (opts.label.length ? opts.label : '') + '<input placeholder="'+opts.placeholder+'" type="search"' + (/\d/.test(opts.width) ? 'style="width:'+opts.width+'px"' : '') + ' /></div>').prependTo(this.header));
|
||||
|
||||
// reference to the actual inputs
|
||||
this.inputs = instance.menu.find('input[type="checkbox"], input[type="radio"]');
|
||||
|
||||
// build the input box
|
||||
this.input = wrapper.find('input').bind({
|
||||
keydown: function(e) {
|
||||
// prevent the enter key from submitting the form / closing the widget
|
||||
if(e.which === 13) {
|
||||
e.preventDefault();
|
||||
}
|
||||
},
|
||||
keyup: $.proxy(this._handler, this),
|
||||
click: $.proxy(this._handler, this)
|
||||
});
|
||||
|
||||
// cache input values for searching
|
||||
this.updateCache();
|
||||
|
||||
// rewrite internal _toggleChecked fn so that when checkAll/uncheckAll is fired,
|
||||
// only the currently filtered elements are checked
|
||||
instance._toggleChecked = function(flag, group) {
|
||||
var $inputs = (group && group.length) ? group : this.labels.find('input');
|
||||
var _self = this;
|
||||
|
||||
// do not include hidden elems if the menu isn't open.
|
||||
var selector = instance._isOpen ? ':disabled, :hidden' : ':disabled';
|
||||
|
||||
$inputs = $inputs
|
||||
.not(selector)
|
||||
.each(this._toggleState('checked', flag));
|
||||
|
||||
// update text
|
||||
this.update();
|
||||
|
||||
// gather an array of the values that actually changed
|
||||
var values = $inputs.map(function() {
|
||||
return this.value;
|
||||
}).get();
|
||||
|
||||
// select option tags
|
||||
this.element.find('option').filter(function() {
|
||||
if(!this.disabled && $.inArray(this.value, values) > -1) {
|
||||
_self._toggleState('selected', flag).call(this);
|
||||
}
|
||||
});
|
||||
|
||||
// trigger the change event on the select
|
||||
if($inputs.length) {
|
||||
this.element.trigger('change');
|
||||
}
|
||||
};
|
||||
|
||||
// rebuild cache when multiselect is updated
|
||||
var doc = $(document).bind('multiselectrefresh', $.proxy(function() {
|
||||
this.updateCache();
|
||||
this._handler();
|
||||
}, this));
|
||||
|
||||
// automatically reset the widget on close?
|
||||
if(this.options.autoReset) {
|
||||
doc.bind('multiselectclose', $.proxy(this._reset, this));
|
||||
}
|
||||
},
|
||||
|
||||
// thx for the logic here ben alman
|
||||
_handler: function(e) {
|
||||
var term = $.trim(this.input[0].value.toLowerCase()),
|
||||
|
||||
// speed up lookups
|
||||
rows = this.rows, inputs = this.inputs, cache = this.cache;
|
||||
|
||||
if(!term) {
|
||||
rows.show();
|
||||
} else {
|
||||
rows.hide();
|
||||
|
||||
var regex = new RegExp(term.replace(rEscape, "\\$&"), 'gi');
|
||||
|
||||
this._trigger("filter", e, $.map(cache, function(v, i) {
|
||||
if(v.search(regex) !== -1) {
|
||||
rows.eq(i).show();
|
||||
return inputs.get(i);
|
||||
}
|
||||
|
||||
return null;
|
||||
}));
|
||||
}
|
||||
|
||||
// show/hide optgroups
|
||||
this.instance.menu.find(".ui-multiselect-optgroup-label").each(function() {
|
||||
var $this = $(this);
|
||||
var isVisible = $this.nextUntil('.ui-multiselect-optgroup-label').filter(function() {
|
||||
return $.css(this, "display") !== 'none';
|
||||
}).length;
|
||||
|
||||
$this[isVisible ? 'show' : 'hide']();
|
||||
});
|
||||
},
|
||||
|
||||
_reset: function() {
|
||||
this.input.val('').trigger('keyup');
|
||||
},
|
||||
|
||||
updateCache: function() {
|
||||
// each list item
|
||||
this.rows = this.instance.menu.find(".ui-multiselect-checkboxes li:not(.ui-multiselect-optgroup-label)");
|
||||
|
||||
// cache
|
||||
this.cache = this.element.children().map(function() {
|
||||
var elem = $(this);
|
||||
|
||||
// account for optgroups
|
||||
if(this.tagName.toLowerCase() === "optgroup") {
|
||||
elem = elem.children();
|
||||
}
|
||||
|
||||
return elem.map(function() {
|
||||
return this.innerHTML.toLowerCase();
|
||||
}).get();
|
||||
}).get();
|
||||
},
|
||||
|
||||
widget: function() {
|
||||
return this.wrapper;
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
$.Widget.prototype.destroy.call(this);
|
||||
this.input.val('').trigger("keyup");
|
||||
this.wrapper.remove();
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
+5
File diff suppressed because one or more lines are too long
+11
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* jQuery UI Touch Punch 0.2.2
|
||||
*
|
||||
* Copyright 2011, Dave Furfero
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.mouse.js
|
||||
*/
|
||||
(function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return;}var c=b.ui.mouse.prototype,e=c._mouseInit,a;function d(g,h){if(g.originalEvent.touches.length>1){return;}g.preventDefault();var i=g.originalEvent.changedTouches[0],f=document.createEvent("MouseEvents");f.initMouseEvent(h,true,true,window,1,i.screenX,i.screenY,i.clientX,i.clientY,false,false,false,false,0,null);g.target.dispatchEvent(f);}c._touchStart=function(g){var f=this;if(a||!f._mouseCapture(g.originalEvent.changedTouches[0])){return;}a=true;f._touchMoved=false;d(g,"mouseover");d(g,"mousemove");d(g,"mousedown");};c._touchMove=function(f){if(!a){return;}this._touchMoved=true;d(f,"mousemove");};c._touchEnd=function(f){if(!a){return;}d(f,"mouseup");d(f,"mouseout");if(!this._touchMoved){d(f,"click");}a=false;};c._mouseInit=function(){var f=this;f.element.bind("touchstart",b.proxy(f,"_touchStart")).bind("touchmove",b.proxy(f,"_touchMove")).bind("touchend",b.proxy(f,"_touchEnd"));e.call(f);};})(jQuery);
|
||||
@@ -0,0 +1,74 @@
|
||||
/*!
|
||||
* jQuery WakeUp plugin
|
||||
*
|
||||
* A JQuery plugin that will help detecting waking up from sleep and/or
|
||||
* hibernation and executing assigned functions.
|
||||
*
|
||||
* Based on code provided by Andrew Mu:
|
||||
* http://stackoverflow.com/questions/4079115
|
||||
*
|
||||
* Copyright (c) 2013, Paul Okopny <paul.okopny@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
*/
|
||||
(function ($, document, undefined) {
|
||||
var default_wakeup_interval = 5000;
|
||||
var wake_up_ids = new Array();
|
||||
// returns intervalId, which can be used to cancel future waking
|
||||
$.wakeUp = function (on_wakeup, params, interval) {
|
||||
|
||||
if ((!interval) || typeof(interval) !== 'number' ) {
|
||||
interval = default_wakeup_interval;
|
||||
}
|
||||
// on_wakeup should be a function
|
||||
if (typeof(on_wakeup) !== "function") {
|
||||
return null;
|
||||
}
|
||||
var lastTime = (new Date()).getTime();
|
||||
var intervalId = setInterval(function() {
|
||||
var currentTime = (new Date()).getTime();
|
||||
if (currentTime > (lastTime + interval + 5000)) { //
|
||||
var sleepTime = currentTime - lastTime;
|
||||
lastTime = currentTime;
|
||||
if (params) {
|
||||
on_wakeup(sleepTime, params);
|
||||
} else {
|
||||
on_wakeup(sleepTime);
|
||||
}
|
||||
} else {
|
||||
lastTime = currentTime;
|
||||
}
|
||||
}, interval);
|
||||
//add interval id to wake_up_ids array
|
||||
wake_up_ids.push(intervalId);
|
||||
return intervalId;
|
||||
};
|
||||
|
||||
$.ignoreBell = function (interval_id) {
|
||||
if (interval_id) {
|
||||
// delete only one wakeUp call
|
||||
wake_up_ids.splice($.inArray(interval_id, wake_up_ids),1);
|
||||
clearInterval(interval_id);
|
||||
}
|
||||
};
|
||||
|
||||
$.dreamOn = function() {
|
||||
// delete all current wake Up calls
|
||||
$.each(wake_up_ids, function (index_of, interval_id) {
|
||||
clearInterval(interval_id)
|
||||
});
|
||||
wake_up_ids = [];
|
||||
};
|
||||
|
||||
})(jQuery, document);
|
||||
@@ -0,0 +1,468 @@
|
||||
/*!
|
||||
* jQuery UI Selectmenu @VERSION
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2013 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/selectmenu
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.core.js
|
||||
* jquery.ui.widget.js
|
||||
* jquery.ui.position.js
|
||||
* jquery.ui.menu.js
|
||||
*/
|
||||
(function( $, undefined ) {
|
||||
|
||||
$.widget( "ui.selectmenu", {
|
||||
version: "@VERSION",
|
||||
defaultElement: "<select>",
|
||||
options: {
|
||||
appendTo: null,
|
||||
icons: {
|
||||
button: "ui-icon-triangle-1-s"
|
||||
},
|
||||
position: {
|
||||
my: "left top",
|
||||
at: "left bottom",
|
||||
collision: "none"
|
||||
},
|
||||
|
||||
// callbacks
|
||||
change: null,
|
||||
close: null,
|
||||
focus: null,
|
||||
open: null,
|
||||
select: null
|
||||
},
|
||||
|
||||
_create: function() {
|
||||
var selectmenuId = this.element.uniqueId().attr( "id" );
|
||||
this.ids = { id: selectmenuId, button: selectmenuId + "-button", menu: selectmenuId + "-menu" };
|
||||
|
||||
this._drawButton();
|
||||
this._drawMenu();
|
||||
|
||||
this._on( document, this._documentClick );
|
||||
|
||||
if ( this.options.disabled ) {
|
||||
this.disable();
|
||||
}
|
||||
},
|
||||
|
||||
_drawButton: function() {
|
||||
var tabindex = this.element.attr( "tabindex" );
|
||||
|
||||
// fix existing label
|
||||
this.label = $( "label[for='" + this.ids.id + "']" ).attr( "for", this.ids.button );
|
||||
this._on( this.label, {
|
||||
"click": function( event ) {
|
||||
this.button.focus();
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
// hide original select tag
|
||||
this.element.hide();
|
||||
|
||||
// create button
|
||||
this.button = $( "<span>", {
|
||||
"class": "ui-selectmenu-button ui-widget ui-state-default ui-corner-all",
|
||||
tabindex: ( tabindex ? tabindex : this.options.disabled ? -1 : 0 ),
|
||||
id: this.ids.button,
|
||||
width: this.element.outerWidth(),
|
||||
role: "combobox",
|
||||
"aria-expanded": false,
|
||||
"aria-autocomplete": "list",
|
||||
"aria-owns": this.ids.menu,
|
||||
"aria-haspopup": true
|
||||
})
|
||||
.insertAfter( this.element );
|
||||
|
||||
this.button.prepend( $( "<span>", {
|
||||
"class": "ui-icon " + this.options.icons.button
|
||||
}));
|
||||
|
||||
this.buttonText = $( "<span>", {
|
||||
"class": "ui-selectmenu-text"
|
||||
})
|
||||
.appendTo( this.button );
|
||||
this._setText( this.buttonText, this.element.find( "option:selected" ).text() );
|
||||
|
||||
this._on( this.button, this._buttonEvents );
|
||||
this._hoverable( this.button );
|
||||
this._focusable( this.button );
|
||||
},
|
||||
|
||||
_drawMenu: function() {
|
||||
var menuInstance,
|
||||
that = this;
|
||||
|
||||
// create menu portion, append to body
|
||||
this.menu = $( "<ul>", {
|
||||
"aria-hidden": true,
|
||||
"aria-labelledby": this.ids.button,
|
||||
id: this.ids.menu
|
||||
});
|
||||
|
||||
// wrap menu
|
||||
this.menuWrap = $( "<div>", {
|
||||
"class": "ui-selectmenu-menu",
|
||||
width: this.button.outerWidth()
|
||||
})
|
||||
.append( this.menu )
|
||||
.appendTo( this._appendTo() );
|
||||
|
||||
// init menu widget
|
||||
menuInstance = this.menu.menu({
|
||||
select: function( event, ui ) {
|
||||
var item = ui.item.data( "ui-selectmenu-item" );
|
||||
|
||||
that._select( item, event );
|
||||
|
||||
if ( that.isOpen ) {
|
||||
event.preventDefault();
|
||||
that.close( event );
|
||||
}
|
||||
},
|
||||
focus: function( event, ui ) {
|
||||
var item = ui.item.data( "ui-selectmenu-item" );
|
||||
// prevent inital focus from firing and checks if its a newly focused item
|
||||
if ( !that.isOpen && that.focus !== undefined && item.index !== that.focus ) {
|
||||
that._trigger( "focus", event, { item: item } );
|
||||
if ( !that.isOpen ) {
|
||||
that._select( item, event );
|
||||
}
|
||||
}
|
||||
that.focus = item.index;
|
||||
|
||||
// Set ARIA active descendant
|
||||
that.button.attr( "aria-activedescendant", that.menuItems.eq( item.index ).attr( "id" ) );
|
||||
},
|
||||
// set ARIA role
|
||||
role: "listbox"
|
||||
})
|
||||
.menu( "instance" );
|
||||
|
||||
// adjust border radius
|
||||
this.menu.addClass( "ui-corner-bottom" ).removeClass( "ui-corner-all" );
|
||||
|
||||
// make sure focus stays on selected item
|
||||
menuInstance.delay = 999999999;
|
||||
// unbind uneeded Menu events
|
||||
menuInstance._off( this.menu, "mouseleave" );
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
this.menu.empty();
|
||||
|
||||
var item,
|
||||
options = this.element.find( "option" );
|
||||
if ( options.length ) {
|
||||
this._readOptions( options );
|
||||
this._renderMenu( this.menu, this.items );
|
||||
|
||||
this.menu.menu( "refresh" );
|
||||
this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" ).find( "a" );
|
||||
|
||||
item = this._getSelectedItem();
|
||||
// make sure menu is selected item aware
|
||||
this.menu.menu( "focus", null, item );
|
||||
this._setAria( item.data( "ui-selectmenu-item" ) );
|
||||
|
||||
// set disabled state
|
||||
this._setOption( "disabled", this._getCreateOptions().disabled );
|
||||
}
|
||||
},
|
||||
|
||||
open: function( event ) {
|
||||
if ( this.options.disabled ) {
|
||||
return;
|
||||
}
|
||||
if ( !this.menuItems ) {
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
this.isOpen = true;
|
||||
this._toggleAttr();
|
||||
this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
|
||||
|
||||
this._trigger( "open", event );
|
||||
},
|
||||
|
||||
close: function( event ) {
|
||||
if ( !this.isOpen ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.isOpen = false;
|
||||
this._toggleAttr();
|
||||
|
||||
// check if we have an item to select
|
||||
if ( this.menuItems ) {
|
||||
this.menu.menu( "focus", null, this._getSelectedItem() );
|
||||
}
|
||||
|
||||
this._trigger( "close", event );
|
||||
},
|
||||
|
||||
widget: function() {
|
||||
return this.button;
|
||||
},
|
||||
|
||||
menuWidget: function() {
|
||||
return this.menu;
|
||||
},
|
||||
|
||||
_renderMenu: function( ul, items ) {
|
||||
var that = this,
|
||||
currentOptgroup = "";
|
||||
|
||||
$.each( items, function( index, item ) {
|
||||
if ( item.optgroup !== currentOptgroup ) {
|
||||
$( "<li>", {
|
||||
"class": "ui-selectmenu-optgroup" + ( item.element.parent( "optgroup" ).attr( "disabled" ) ? " ui-state-disabled" : "" ),
|
||||
text: item.optgroup
|
||||
}).appendTo( ul );
|
||||
currentOptgroup = item.optgroup;
|
||||
}
|
||||
that._renderItem( ul, item );
|
||||
});
|
||||
},
|
||||
|
||||
_renderItem: function( ul, item ) {
|
||||
var li = $( "<li>" ).data( "ui-selectmenu-item", item ),
|
||||
a = $( "<a>", { href: "#" });
|
||||
|
||||
if ( item.disabled ) {
|
||||
li.addClass( "ui-state-disabled" );
|
||||
}
|
||||
this._setText( a, item.label );
|
||||
|
||||
return li.append( a ).appendTo( ul );
|
||||
},
|
||||
|
||||
_setText: function( element, value ) {
|
||||
if ( value ) {
|
||||
element.text( value );
|
||||
} else {
|
||||
element.html( " " );
|
||||
}
|
||||
},
|
||||
|
||||
_move: function( direction, event ) {
|
||||
if ( direction === "first" || direction === "last" ) {
|
||||
// set focus manually for first or last item
|
||||
this.menu.menu( "focus", event, this.menuItems[ direction ]() );
|
||||
} else {
|
||||
// move to and focus next or prev item
|
||||
this.menu.menu( direction, event );
|
||||
}
|
||||
},
|
||||
|
||||
_getSelectedItem: function() {
|
||||
return this.menuItems.eq( this.element[ 0 ].selectedIndex ).parent( "li" );
|
||||
},
|
||||
|
||||
_toggle: function( event ) {
|
||||
if ( this.isOpen ) {
|
||||
this.close( event );
|
||||
} else {
|
||||
this.open( event );
|
||||
}
|
||||
},
|
||||
|
||||
_documentClick: {
|
||||
click: function( event ) {
|
||||
if ( this.isOpen && !$( event.target ).closest( "li.ui-state-disabled, li.ui-selectmenu-optgroup, #" + this.ids.button ).length ) {
|
||||
this.close( event );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_buttonEvents: {
|
||||
focus: function() {
|
||||
// init Menu on first focus
|
||||
this.refresh();
|
||||
// reset focus class as its removed by ui.widget._setOption
|
||||
this.button.addClass( "ui-state-focus" );
|
||||
this._off( this.button, "focus" );
|
||||
},
|
||||
click: function( event ) {
|
||||
this._toggle( event );
|
||||
event.preventDefault();
|
||||
},
|
||||
keydown: function( event ) {
|
||||
var prevDef = true;
|
||||
switch ( event.keyCode ) {
|
||||
case $.ui.keyCode.TAB:
|
||||
case $.ui.keyCode.ESCAPE:
|
||||
if ( this.isOpen ) {
|
||||
this.close( event );
|
||||
}
|
||||
prevDef = false;
|
||||
break;
|
||||
case $.ui.keyCode.ENTER:
|
||||
if ( this.isOpen ) {
|
||||
this.menu.menu( "select", event );
|
||||
}
|
||||
break;
|
||||
case $.ui.keyCode.UP:
|
||||
if ( event.altKey ) {
|
||||
this._toggle( event );
|
||||
} else {
|
||||
this._move( "previous", event );
|
||||
}
|
||||
break;
|
||||
case $.ui.keyCode.DOWN:
|
||||
if ( event.altKey ) {
|
||||
this._toggle( event );
|
||||
} else {
|
||||
this._move( "next", event );
|
||||
}
|
||||
break;
|
||||
case $.ui.keyCode.SPACE:
|
||||
if ( this.isOpen ) {
|
||||
this.menu.menu( "select", event );
|
||||
} else {
|
||||
this._toggle( event );
|
||||
}
|
||||
break;
|
||||
case $.ui.keyCode.LEFT:
|
||||
this._move( "previous", event );
|
||||
break;
|
||||
case $.ui.keyCode.RIGHT:
|
||||
this._move( "next", event );
|
||||
break;
|
||||
case $.ui.keyCode.HOME:
|
||||
case $.ui.keyCode.PAGE_UP:
|
||||
this._move( "first", event );
|
||||
break;
|
||||
case $.ui.keyCode.END:
|
||||
case $.ui.keyCode.PAGE_DOWN:
|
||||
this._move( "last", event );
|
||||
break;
|
||||
default:
|
||||
this.menu.trigger( event );
|
||||
prevDef = false;
|
||||
}
|
||||
if ( prevDef ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_select: function( item, event ) {
|
||||
var oldIndex = this.element[ 0 ].selectedIndex;
|
||||
// change native select element
|
||||
this.element[ 0 ].selectedIndex = item.index;
|
||||
this._setText( this.buttonText, item.label );
|
||||
this._setAria( item );
|
||||
this._trigger( "select", event, { item: item } );
|
||||
|
||||
if ( item.index !== oldIndex ) {
|
||||
this._trigger( "change", event, { item: item } );
|
||||
}
|
||||
},
|
||||
|
||||
_setAria: function( item ) {
|
||||
var link = this.menuItems.eq( item.index ),
|
||||
id = link.attr( "id" );
|
||||
|
||||
// change ARIA attr
|
||||
this.button.attr({
|
||||
"aria-labelledby": id,
|
||||
"aria-activedescendant": id
|
||||
});
|
||||
this.menu.attr( "aria-activedescendant", id );
|
||||
},
|
||||
|
||||
_setOption: function( key, value ) {
|
||||
if ( key === "icons" ) {
|
||||
this.button.find( "span.ui-icon" )
|
||||
.removeClass( this.options.icons.button )
|
||||
.addClass( value.button );
|
||||
}
|
||||
|
||||
this._super( key, value );
|
||||
|
||||
if ( key === "appendTo" ) {
|
||||
this.menuWrap.appendTo( this._appendTo() );
|
||||
}
|
||||
if ( key === "disabled" ) {
|
||||
this.menu.menu( "option", "disabled", value );
|
||||
this.button
|
||||
.toggleClass( "ui-state-disabled", !!value )
|
||||
.attr( "aria-disabled", value );
|
||||
|
||||
if ( value ) {
|
||||
this.element.attr( "disabled", "disabled" );
|
||||
this.button.attr( "tabindex", -1 );
|
||||
this.close();
|
||||
} else {
|
||||
this.element.removeAttr( "disabled" );
|
||||
this.button.attr( "tabindex", 0 );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_appendTo: function() {
|
||||
var element = this.options.appendTo;
|
||||
|
||||
if ( element ) {
|
||||
element = element.jquery || element.nodeType ?
|
||||
$( element ) :
|
||||
this.document.find( element ).eq( 0 );
|
||||
}
|
||||
|
||||
if ( !element ) {
|
||||
element = this.element.closest( ".ui-front" );
|
||||
}
|
||||
|
||||
if ( !element.length ) {
|
||||
element = this.document[0].body;
|
||||
}
|
||||
|
||||
return element;
|
||||
},
|
||||
|
||||
_toggleAttr: function(){
|
||||
this.button.toggleClass( "ui-corner-top", this.isOpen ).toggleClass( "ui-corner-all", !this.isOpen );
|
||||
this.menuWrap.toggleClass( "ui-selectmenu-open", this.isOpen );
|
||||
this.menu.attr( "aria-hidden", !this.isOpen);
|
||||
this.button.attr( "aria-expanded", this.isOpen);
|
||||
},
|
||||
|
||||
_getCreateOptions: function() {
|
||||
return { disabled: !!this.element.attr( "disabled" ) };
|
||||
},
|
||||
|
||||
_readOptions: function( options ) {
|
||||
var data = [];
|
||||
options.each( function( index, item ) {
|
||||
var option = $( item ),
|
||||
optgroup = option.parent( "optgroup" );
|
||||
data.push({
|
||||
element: option,
|
||||
index: index,
|
||||
value: option.attr( "value" ),
|
||||
label: option.text(),
|
||||
optgroup: optgroup.attr( "label" ) || "",
|
||||
disabled: optgroup.attr( "disabled" ) || option.attr( "disabled" )
|
||||
});
|
||||
});
|
||||
this.items = data;
|
||||
},
|
||||
|
||||
_destroy: function() {
|
||||
this.menuWrap.remove();
|
||||
this.button.remove();
|
||||
this.element.show();
|
||||
this.element.removeUniqueId();
|
||||
this.label.attr( "for", this.ids.id );
|
||||
}
|
||||
});
|
||||
|
||||
}( jQuery ));
|
||||
@@ -0,0 +1,2 @@
|
||||
// // Copyright (c) 2012 Florian H., https://github.com/js-coder https://github.com/js-coder/lostorage.js
|
||||
!function(e,t){var n={isArray:Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"},isPlainObj:function(e){return e===Object(e)},toArray:function(e){return Array.prototype.slice.call(e)},prepareArgs:function(e,t){return e=n.toArray(e),e.unshift(t),e},getObjKeyByValue:function(e,t){for(var n in e)if(e.hasOwnProperty(n)&&e[n]===t)return n},prepareReturn:function(t){return e[n.getObjKeyByValue(o,t)]},retrieve:function(e,n){return e==t?n:e},serialize:function(e){return JSON.stringify(e)},unserialize:function(e){return e==t?t:JSON.parse(e)}},r=function(){return r.get.apply(this,arguments)},i={storage:function(){return storage.get.apply(storage,arguments)},session:function(){return session.get.apply(session,arguments)}};r.set=function(e,t,r){if(n.isPlainObj(t))for(var i in t)t.hasOwnProperty(i)&&e.setItem(i,n.serialize(t[i]));else e.setItem(t,n.serialize(r));return n.prepareReturn(e)},r.invert=function(e,t){return this.set(e,t,!this.get(e,t))},r.add=function(e,t,n){return this.set(e,t,this.get(e,t)+parseInt(n,10))},r.increase=function(e,t,r){return this.add(e,t,n.retrieve(r,1))},r.decrease=function(e,t,r){return this.add(e,t,-n.retrieve(r,1))},r.concat=function(e,t,n){return this.set(e,t,this.get(e,t)+n)},r.push=function(e,t,r){var i=n.toArray(arguments),s=this.get(e,t,[]);return i.splice(0,2),s.push.apply(s,i),this.set(e,t,s)},r.extend=function(e,t,r,i){var s=this.get(e,t,{});if(n.isPlainObj(r))for(var o in r)r.hasOwnProperty(o)&&(s[o]=r[o]);else s[r]=i;return this.set(e,t,s)},r.remove=function(e,t){t=n.isArray(t)?t:n.toArray(arguments);for(var r=0,i=t.length;r<i;r++)delete e[t[r]];return n.prepareReturn(e)},r.empty=function(e){return e.clear(),n.prepareReturn(e)},r.get=function(e,r,i){i=i||t;if(n.isArray(r)){var s={};for(var o=0,u=r.length;o<u;o++){var a=r[o];s[a]=this.get(e,a,i)}return s}return n.retrieve(n.unserialize(e.getItem(r)),i)},r.all=function(e){var t={};for(var r=0,i=e.length;r<i;r++){var s=e.key(r);t[s]=n.unserialize(e.getItem(s))}return t};var s="set invert add increase decrease concat push extend remove empty get all".split(" "),o={storage:localStorage,session:sessionStorage};for(var u=0,a=s.length;u<a;u++){var f=s[u];for(var l in o){if(!o.hasOwnProperty(l))continue;var c=o[l];i[l][f]=function(e,t){return function(){var i=n.prepareArgs(arguments,t);return r[e].apply(r,i)}}(f,c)}}var h={storage:i.storage,session:i.session};typeof define=="function"&&define.amd?define(function(){return h}):typeof exports!="undefined"?module.exports=h:(e.storage=i.storage,e.session=i.session)}(window);
|
||||
+28
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,219 @@
|
||||
/*
|
||||
* Superclick v1.0.0 - jQuery menu widget
|
||||
* Copyright (c) 2013 Joel Birch
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
var methods = (function () {
|
||||
// private properties and methods go here
|
||||
var c = {
|
||||
bcClass: 'sf-breadcrumb',
|
||||
menuClass: 'sf-js-enabled',
|
||||
anchorClass: 'sf-with-ul',
|
||||
menuArrowClass: 'sf-arrows'
|
||||
},
|
||||
outerClick = (function () {
|
||||
$(window).load(function () {
|
||||
$('body').children().on('click.superclick', function () {
|
||||
var $allMenus = $('.sf-js-enabled');
|
||||
$allMenus.superclick('reset');
|
||||
});
|
||||
});
|
||||
})(),
|
||||
toggleMenuClasses = function ($menu, o) {
|
||||
var classes = c.menuClass;
|
||||
if (o.cssArrows) {
|
||||
classes += ' ' + c.menuArrowClass;
|
||||
}
|
||||
$menu.toggleClass(classes);
|
||||
},
|
||||
setPathToCurrent = function ($menu, o) {
|
||||
return $menu.find('li.' + o.pathClass).slice(0, o.pathLevels)
|
||||
.addClass(o.activeClass + ' ' + c.bcClass)
|
||||
.filter(function () {
|
||||
return ($(this).children(o.popUpSelector).hide().show().length);
|
||||
}).removeClass(o.pathClass);
|
||||
},
|
||||
toggleAnchorClass = function ($li) {
|
||||
$li.children('a').toggleClass(c.anchorClass);
|
||||
},
|
||||
toggleTouchAction = function ($menu) {
|
||||
var touchAction = $menu.css('ms-touch-action');
|
||||
touchAction = (touchAction === 'pan-y') ? 'auto' : 'pan-y';
|
||||
$menu.css('ms-touch-action', touchAction);
|
||||
},
|
||||
clickHandler = function (e) {
|
||||
var $this = $(this),
|
||||
$popUp = $this.siblings(e.data.popUpSelector),
|
||||
func;
|
||||
|
||||
if ($popUp.length) {
|
||||
func = ($popUp.is(':hidden')) ? over : out;
|
||||
$.proxy(func, $this.parent('li'))();
|
||||
return false;
|
||||
}
|
||||
},
|
||||
over = function () {
|
||||
var $this = $(this),
|
||||
o = getOptions($this);
|
||||
$this.siblings().superclick('hide').end().superclick('show');
|
||||
},
|
||||
out = function () {
|
||||
var $this = $(this),
|
||||
o = getOptions($this);
|
||||
$.proxy(close, $this, o)();
|
||||
},
|
||||
close = function (o) {
|
||||
o.retainPath = ($.inArray(this[0], o.$path) > -1);
|
||||
this.superclick('hide');
|
||||
|
||||
if (!this.parents('.' + o.activeClass).length) {
|
||||
o.onIdle.call(getMenu(this));
|
||||
if (o.$path.length) {
|
||||
$.proxy(over, o.$path)();
|
||||
}
|
||||
}
|
||||
},
|
||||
getMenu = function ($el) {
|
||||
return $el.closest('.' + c.menuClass);
|
||||
},
|
||||
getOptions = function ($el) {
|
||||
return getMenu($el).data('sf-options');
|
||||
};
|
||||
|
||||
return {
|
||||
// public methods
|
||||
hide: function (instant) {
|
||||
if (this.length) {
|
||||
var $this = this,
|
||||
o = getOptions($this);
|
||||
if (!o) {
|
||||
return this;
|
||||
}
|
||||
var not = (o.retainPath === true) ? o.$path : '',
|
||||
$popUp = $this.find('li.' + o.activeClass).add(this).not(not).removeClass(o.activeClass).children(o.popUpSelector),
|
||||
speed = o.speedOut;
|
||||
|
||||
if (instant) {
|
||||
$popUp.show();
|
||||
speed = 0;
|
||||
}
|
||||
o.retainPath = false;
|
||||
o.onBeforeHide.call($popUp);
|
||||
$popUp.stop(true, true).animate(o.animationOut, speed, function () {
|
||||
var $this = $(this);
|
||||
o.onHide.call($this);
|
||||
});
|
||||
}
|
||||
return this;
|
||||
},
|
||||
show: function () {
|
||||
var o = getOptions(this);
|
||||
if (!o) {
|
||||
return this;
|
||||
}
|
||||
var $this = this.addClass(o.activeClass),
|
||||
$popUp = $this.children(o.popUpSelector);
|
||||
|
||||
o.onBeforeShow.call($popUp);
|
||||
$popUp.stop(true, true).animate(o.animation, o.speed, function () {
|
||||
o.onShow.call($popUp);
|
||||
});
|
||||
return this;
|
||||
},
|
||||
destroy: function () {
|
||||
return this.each(function () {
|
||||
var $this = $(this),
|
||||
o = $this.data('sf-options'),
|
||||
$hasPopUp;
|
||||
if (!o) {
|
||||
return false;
|
||||
}
|
||||
$hasPopUp = $this.find(o.popUpSelector).parent('li');
|
||||
toggleMenuClasses($this, o);
|
||||
toggleAnchorClass($hasPopUp);
|
||||
toggleTouchAction($this);
|
||||
// remove event handlers
|
||||
$this.off('.superclick');
|
||||
// clear animation's inline display style
|
||||
$hasPopUp.children(o.popUpSelector).attr('style', function (i, style) {
|
||||
return style.replace(/display[^;]+;?/g, '');
|
||||
});
|
||||
// reset 'current' path classes
|
||||
o.$path.removeClass(o.activeClass + ' ' + c.bcClass).addClass(o.pathClass);
|
||||
$this.find('.' + o.activeClass).removeClass(o.activeClass);
|
||||
o.onDestroy.call($this);
|
||||
$this.removeData('sf-options');
|
||||
});
|
||||
},
|
||||
reset: function () {
|
||||
return this.each(function () {
|
||||
var $menu = $(this),
|
||||
o = getOptions($menu),
|
||||
$openLis = $($menu.find('.' + o.activeClass).toArray().reverse());
|
||||
$openLis.children('a').trigger('click');
|
||||
});
|
||||
},
|
||||
init: function (op) {
|
||||
return this.each(function () {
|
||||
var $this = $(this);
|
||||
if ($this.data('sf-options')) {
|
||||
return false;
|
||||
}
|
||||
var o = $.extend({}, $.fn.superclick.defaults, op),
|
||||
$hasPopUp = $this.find(o.popUpSelector).parent('li');
|
||||
o.$path = setPathToCurrent($this, o);
|
||||
|
||||
$this.data('sf-options', o);
|
||||
|
||||
toggleMenuClasses($this, o);
|
||||
toggleAnchorClass($hasPopUp);
|
||||
toggleTouchAction($this);
|
||||
$this.on('click.superclick', 'a', o, clickHandler);
|
||||
|
||||
$hasPopUp.not('.' + c.bcClass).superclick('hide', true);
|
||||
|
||||
o.onInit.call(this);
|
||||
});
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
$.fn.superclick = function (method, args) {
|
||||
if (methods[method]) {
|
||||
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
}
|
||||
else if (typeof method === 'object' || ! method) {
|
||||
return methods.init.apply(this, arguments);
|
||||
}
|
||||
else {
|
||||
return $.error('Method ' + method + ' does not exist on jQuery.fn.superclick');
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.superclick.defaults = {
|
||||
popUpSelector: 'ul,.sf-mega', // within menu context
|
||||
activeClass: 'sfHover', // keep 'hover' in classname for compatibility reasons
|
||||
pathClass: 'overrideThisToUse',
|
||||
pathLevels: 1,
|
||||
animation: {opacity: 'show'},
|
||||
animationOut: {opacity: 'hide'},
|
||||
speed: 'normal',
|
||||
speedOut: 'fast',
|
||||
cssArrows: true,
|
||||
onInit: $.noop,
|
||||
onBeforeShow: $.noop,
|
||||
onShow: $.noop,
|
||||
onBeforeHide: $.noop,
|
||||
onHide: $.noop,
|
||||
onIdle: $.noop,
|
||||
onDestroy: $.noop
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,119 @@
|
||||
var systemLang = 'en';
|
||||
var systemDictionary = {};
|
||||
|
||||
function translateWord(text, lang, dictionary) {
|
||||
if (!text) return '';
|
||||
lang = lang || systemLang;
|
||||
dictionary = dictionary || systemDictionary;
|
||||
|
||||
if (dictionary[text]) {
|
||||
var newText = dictionary[text][lang];
|
||||
if (newText) {
|
||||
return newText;
|
||||
} else if (lang != 'en') {
|
||||
newText = dictionary[text].en;
|
||||
if (newText) {
|
||||
return newText;
|
||||
}
|
||||
}
|
||||
} else if (typeof text == 'string' && !text.match(/_tooltip$/)) {
|
||||
console.log('"' + text + '": {"en": "' + text + '", "de": "' + text + '", "ru": "' + text + '"},');
|
||||
} else if (typeof text !== 'string') {
|
||||
console.warn('Trying to translate non-text:' + text);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
function translateAll(lang, dictionary) {
|
||||
lang = lang || systemLang;
|
||||
dictionary = dictionary || systemDictionary;
|
||||
|
||||
|
||||
// translate <div class="translate">textToTranslate</div>
|
||||
$(".translate").each(function (idx) {
|
||||
var text = $(this).attr('data-lang');
|
||||
if (!text) {
|
||||
text = $(this).html();
|
||||
$(this).attr('data-lang', text);
|
||||
}
|
||||
|
||||
var transText = translateWord(text, lang, dictionary);
|
||||
if (transText) {
|
||||
$(this).html(transText);
|
||||
}
|
||||
});
|
||||
// translate <input type="button" class="translateV" value="textToTranslate">
|
||||
$(".translateV").each(function (idx) {
|
||||
var text = $(this).attr('data-lang');
|
||||
if (!text) {
|
||||
text = $(this).attr('value');
|
||||
$(this).attr('data-lang', text);
|
||||
}
|
||||
|
||||
var transText = translateWord(text, lang, dictionary);
|
||||
if (transText) {
|
||||
$(this).attr('value', transText);
|
||||
}
|
||||
});
|
||||
$(".translateB").each(function (idx) {
|
||||
//<span class="ui-button-text" >Save</span>
|
||||
var text = $(this).attr('data-lang');
|
||||
if (!text) {
|
||||
text = $(this).html().match(/\>([\w ]+)\</);
|
||||
if (text && text.length > 1) {
|
||||
text = text[1];
|
||||
} else {
|
||||
text = $(this).html();
|
||||
$(this).attr('data-lang-pure', true);
|
||||
}
|
||||
$(this).attr('data-lang', text);
|
||||
}
|
||||
var transText = translateWord(text, lang, dictionary);
|
||||
if (transText) {
|
||||
if ($(this).attr('data-lang-pure')) {
|
||||
$(this).html(transText);
|
||||
} else {
|
||||
$(this).html($(this).html().replace(/>[\w ]+</, '>' + transText + '<'));
|
||||
}
|
||||
}
|
||||
});
|
||||
$(".translateT").each(function (idx) {
|
||||
//<span class="ui-button-text translateT" title="TextToTranslate">Save</span>
|
||||
var text = $(this).attr('data-lang');
|
||||
if (!text) {
|
||||
text = $(this).attr('title');
|
||||
$(this).attr('data-lang', text);
|
||||
}
|
||||
var transText = translateWord(text, lang, dictionary);
|
||||
if (transText) {
|
||||
$(this).attr('title', transText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// make possible _('words to translate')
|
||||
var _ = function (text, arg1, arg2, arg3) {
|
||||
text = translateWord(text);
|
||||
|
||||
var pos = text.indexOf('%s');
|
||||
if (pos != -1) {
|
||||
text = text.replace('%s', arg1);
|
||||
} else {
|
||||
return text;
|
||||
}
|
||||
|
||||
pos = text.indexOf('%s');
|
||||
if (pos != -1) {
|
||||
text = text.replace('%s', arg2);
|
||||
} else {
|
||||
return text;
|
||||
}
|
||||
|
||||
pos = text.indexOf('%s');
|
||||
if (pos != -1) {
|
||||
text = text.replace('%s', arg3);
|
||||
}
|
||||
|
||||
return text;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user