From 935fed3aef762373bb53c476fcbb67a5717913e1 Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Thu, 7 May 2015 20:44:41 +0400 Subject: [PATCH] Pre release commit --- build/owncloud/rainloop-app/appinfo/info.xml | 2 +- dev/App/User.js | 2 +- gulpfile.js | 8 +- package.json | 4 +- .../app/libraries/MailSo/Mail/MailClient.php | 3 +- .../0.0.0/app/libraries/RainLoop/Actions.php | 28 +- .../v/0.0.0/app/libraries/RainLoop/Social.php | 169 +- vendors/buzz/buzz.js | 719 ----- vendors/buzz/buzz.min.js | 11 - vendors/is.js/LICENSE | 21 - vendors/is.js/README.md | 2327 ----------------- vendors/is.js/bower.json | 35 - vendors/is.js/is.js | 818 ------ vendors/is.js/is.min.js | 1 - vendors/is.js/package.json | 12 - vendors/jquery-magnific-popup/LICENSE | 20 - vendors/jquery-magnific-popup/README.md | 69 - vendors/jquery-magnific-popup/bower.json | 17 - .../jquery.magnific-popup.js | 2048 --------------- .../jquery.magnific-popup.min.js | 4 - .../magnific-popup-animations.css | 45 - .../jquery-magnific-popup/magnific-popup.css | 368 --- .../magnific-popup.jquery.json | 29 - vendors/jquery-magnific-popup/package.json | 44 - .../jquery.ui.touch-punch.min.js | 11 - vendors/knockout-punches/knockout.punches.js | 589 ----- .../knockout-punches/knockout.punches.min.js | 20 - 27 files changed, 37 insertions(+), 7387 deletions(-) delete mode 100644 vendors/buzz/buzz.js delete mode 100644 vendors/buzz/buzz.min.js delete mode 100644 vendors/is.js/LICENSE delete mode 100644 vendors/is.js/README.md delete mode 100644 vendors/is.js/bower.json delete mode 100644 vendors/is.js/is.js delete mode 100644 vendors/is.js/is.min.js delete mode 100644 vendors/is.js/package.json delete mode 100644 vendors/jquery-magnific-popup/LICENSE delete mode 100644 vendors/jquery-magnific-popup/README.md delete mode 100644 vendors/jquery-magnific-popup/bower.json delete mode 100644 vendors/jquery-magnific-popup/jquery.magnific-popup.js delete mode 100644 vendors/jquery-magnific-popup/jquery.magnific-popup.min.js delete mode 100644 vendors/jquery-magnific-popup/magnific-popup-animations.css delete mode 100644 vendors/jquery-magnific-popup/magnific-popup.css delete mode 100644 vendors/jquery-magnific-popup/magnific-popup.jquery.json delete mode 100644 vendors/jquery-magnific-popup/package.json delete mode 100644 vendors/jquery-ui.touch-punch/jquery.ui.touch-punch.min.js delete mode 100644 vendors/knockout-punches/knockout.punches.js delete mode 100644 vendors/knockout-punches/knockout.punches.min.js diff --git a/build/owncloud/rainloop-app/appinfo/info.xml b/build/owncloud/rainloop-app/appinfo/info.xml index 7ec7dbdd9..26b7dc553 100644 --- a/build/owncloud/rainloop-app/appinfo/info.xml +++ b/build/owncloud/rainloop-app/appinfo/info.xml @@ -4,7 +4,7 @@ RainLoop Simple, modern and fast web-based email client. 0.0 - CC BY-NC-SA 3.0 + AGPL 3.0 RainLoop Team 6.0 diff --git a/dev/App/User.js b/dev/App/User.js index 2988b4331..84bd1bfd3 100644 --- a/dev/App/User.js +++ b/dev/App/User.js @@ -1463,7 +1463,7 @@ } else { - this.loginAndLogoutReload(false, true); + this.logout(); } }, self)); diff --git a/gulpfile.js b/gulpfile.js index b59a5379f..d981af14f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -93,7 +93,10 @@ cfg.paths.less = { src: 'dev/Styles/@Main.less', watch: ['dev/Styles/*.less'], options: { - paths: [path.join(__dirname, 'dev/Styles/'), path.join(__dirname, 'vendors/bootstrap/less/')] + paths: [ + path.join(__dirname, 'dev', 'Styles'), + path.join(__dirname, 'vendors', 'bootstrap', 'less') + ] } } }; @@ -152,10 +155,8 @@ cfg.paths.js = { src: [ 'vendors/modernizr.js', 'vendors/underscore/1.6.0/underscore-min.js', - 'vendors/is.js/is.min.js', 'vendors/jquery/jquery-1.11.2.min.js', 'vendors/jquery-ui/js/jquery-ui-1.10.3.custom.min.js', -// 'vendors/jquery-ui.touch-punch/jquery.ui.touch-punch.min.js', 'vendors/jquery-cookie/jquery.cookie-1.4.0.min.js', 'vendors/jquery-finger/jquery.finger.min.js', 'vendors/jquery-mousewheel/jquery.mousewheel-3.1.4.min.js', @@ -173,7 +174,6 @@ cfg.paths.js = { 'vendors/routes/hasher.min.js', 'vendors/routes/crossroads.min.js', 'vendors/knockout/knockout-3.3.0.js', -// 'vendors/knockout-punches/knockout.punches.min.js', 'vendors/knockout-projections/knockout-projections-1.0.0.min.js', 'vendors/knockout-sortable/knockout-sortable.min.js', 'vendors/ssm/ssm.min.js', diff --git a/package.json b/package.json index 47b1aa8d4..8b98cd936 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "RainLoop", "title": "RainLoop Webmail", "version": "1.9.0", - "release": "315", + "release": "322", "description": "Simple, modern & fast web-based email client", "homepage": "http://rainloop.net", "main": "gulpfile.js", @@ -36,7 +36,7 @@ "plugins" ], "readmeFilename": "README.md", - "ownCloudPackageVersion": "3.3", + "ownCloudPackageVersion": "4.0", "engines": { "node": ">= 0.10.0" }, diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php b/rainloop/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php index fa7c2261c..5b3ae9727 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php @@ -2089,7 +2089,7 @@ class MailClient { $aUids = array(); $iResultRootUid = 0; - + if (isset($mAllThreads[$iThreadUid])) { $iResultRootUid = $iThreadUid; @@ -2457,7 +2457,6 @@ class MailClient $oFolderCollection->IsThreadsSupported = $this->IsThreadsSupported(); } - return $oFolderCollection; } diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index 61a4549c9..3f6a174c9 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -4812,7 +4812,7 @@ class Actions public function DoChangePassword() { $mResult = false; - + $oAccount = $this->getAccountFromToken(); if ($oAccount) { @@ -5075,12 +5075,6 @@ class Actions // \sleep(1); // throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::MailServerError); - $sRawKey = (string) $this->GetActionParam('RawKey', ''); - if (0 < \strlen($sRawKey)) - { - $this->verifyCacheByKey($sRawKey); - } - $oAccount = $this->initMailClientConnection(); $oFolderCollection = null; @@ -5098,6 +5092,8 @@ class Actions if ($oFolderCollection instanceof \MailSo\Mail\FolderCollection) { + $oSettingsLocal = $this->SettingsProvider(true)->Load($oAccount); + $aSystemFolders = array(); $this->recFoldersTypes($oAccount, $oFolderCollection, $aSystemFolders); @@ -5106,6 +5102,7 @@ class Actions if ($this->Config()->Get('labs', 'autocreate_system_folders', true)) { $bDoItAgain = false; + $sNamespace = $oFolderCollection->GetNamespace(); $sParent = empty($sNamespace) ? '' : \substr($sNamespace, 0, -1); @@ -5113,23 +5110,28 @@ class Actions $aList = array(); $aMap = $this->systemFoldersNames($oAccount); - if ('' === $this->GetActionParam('SentFolder', '')) + + if ('' === $oSettingsLocal->GetConf('SentFolder', '')) { $aList[] = \MailSo\Imap\Enumerations\FolderType::SENT; } - if ('' === $this->GetActionParam('DraftFolder', '')) + + if ('' === $oSettingsLocal->GetConf('DraftFolder', '')) { $aList[] = \MailSo\Imap\Enumerations\FolderType::DRAFTS; } - if ('' === $this->GetActionParam('SpamFolder', '')) + + if ('' === $oSettingsLocal->GetConf('SpamFolder', '')) { $aList[] = \MailSo\Imap\Enumerations\FolderType::JUNK; } - if ('' === $this->GetActionParam('TrashFolder', '')) + + if ('' === $oSettingsLocal->GetConf('TrashFolder', '')) { $aList[] = \MailSo\Imap\Enumerations\FolderType::TRASH; } - if ('' === $this->GetActionParam('ArchiveFolder', '')) + + if ('' === $oSettingsLocal->GetConf('ArchiveFolder', '')) { $aList[] = \MailSo\Imap\Enumerations\FolderType::ALL; } @@ -5204,8 +5206,6 @@ class Actions if ($oFolderCollection) { $oFolderCollection->FoldersHash = \md5(\implode("\x0", $this->recFoldersNames($oFolderCollection))); - - $this->cacheByKey($sRawKey); } } diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Social.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Social.php index aa0175c40..6b363a0a3 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Social.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Social.php @@ -25,152 +25,6 @@ class Social $this->oActions = $oActions; } - /** - * @param array $oItem - * @param array $aPics - * - * @return array|null - */ - private function convertGoogleJsonContactToResponseContact($oItem, &$aPics) - { - $mResult = null; - if (!empty($oItem['gd$email'][0]['address'])) - { - $mEmail = \MailSo\Base\Utils::IdnToAscii($oItem['gd$email'][0]['address'], true); - if (\is_array($oItem['gd$email']) && 1 < \count($oItem['gd$email'])) - { - $mEmail = array(); - foreach ($oItem['gd$email'] as $oEmail) - { - if (!empty($oEmail['address'])) - { - $mEmail[] = \MailSo\Base\Utils::IdnToAscii($oEmail['address'], true); - } - } - } - - $sImg = ''; - if (!empty($oItem['link']) && \is_array($oItem['link'])) - { - foreach ($oItem['link'] as $oLink) - { - if ($oLink && isset($oLink['type'], $oLink['href'], $oLink['rel']) && - 'image/*' === $oLink['type'] && '#photo' === \substr($oLink['rel'], -6)) - { - $sImg = $oLink['href']; - break; - } - } - } - - $mResult = array( - 'email' => $mEmail, - 'name' => !empty($oItem['title']['$t']) ? $oItem['title']['$t'] : '' - ); - - if (0 < \strlen($sImg)) - { - $sHash = \RainLoop\Utils::EncodeKeyValues(array( - 'url' => $sImg, - 'type' => 'google_access_token' - )); - - $mData = array(); - if (isset($aPics[$sHash])) - { - $mData = $aPics[$sHash]; - if (!\is_array($mData)) - { - $mData = array($mData); - } - } - - if (\is_array($mEmail)) - { - $mData = \array_merge($mData, $mEmail); - $mData = \array_unique($mData); - } - else if (0 < \strlen($mEmail)) - { - $mData[] = $mEmail; - } - - if (\is_array($mData)) - { - if (1 === \count($mData) && !empty($mData[0])) - { - $aPics[$sHash] = $mData[0]; - } - else if (1 < \count($mData)) - { - $aPics[$sHash] = $mData; - } - } - } - } - - return $mResult; - } - - /** - * @return array - */ - public function GoogleUserContacts($oAccount) - { - $mResult = false; - $oGoogle = $this->GoogleConnector(); - $aPics = array(); - - if ($oAccount && $oGoogle) - { - $sAccessToken = $this->GoogleAccessToken($oAccount, $oGoogle); - if (!empty($sAccessToken)) - { - $oGoogle->setAccessToken($sAccessToken); - - $aResponse = $oGoogle->fetch('https://www.google.com/m8/feeds/contacts/default/full', array( - 'alt' => 'json' - )); - - if (!empty($aResponse['result']['feed']['entry']) && \is_array($aResponse['result']['feed']['entry'])) - { - $mResult = array(); - foreach ($aResponse['result']['feed']['entry'] as $oItem) - { - $aItem = $this->convertGoogleJsonContactToResponseContact($oItem, $aPics); - if ($aItem) - { - if (\is_array($aItem['email'])) - { - $aNewItem = $aItem; - unset($aNewItem['email']); - - foreach ($aItem['email'] as $sEmail) - { - $aNewItem['email'] = $sEmail; - $mResult[] = $aNewItem; - } - } - else - { - $mResult[] = $aItem; - } - } - } - } - } - else - { - $this->oActions->Logger()->Write('Empty Google Access Token', \MailSo\Log\Enumerations\Type::ERROR); - } - } - - return false !== $mResult ? array( - 'List' => $mResult, - 'Pics' => $aPics - ) : false; - } - /** * @return bool */ @@ -185,7 +39,7 @@ class Social if (!empty($sEncodedeData)) { $aData = \RainLoop\Utils::DecodeKeyValues($sEncodedeData); - if (\is_array($aData) && isset($aData['access_token'], $aData['id'])) + if (\is_array($aData) && !empty($aData['id'])) { $this->oActions->StorageProvider()->Clear(null, \RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY, @@ -332,15 +186,15 @@ class Social if (!empty($aAuthorizationResponse['result']['access_token'])) { $oGoogle->setAccessToken($aAuthorizationResponse['result']['access_token']); - $aUserinfoResponse = $oGoogle->fetch('https://www.googleapis.com/oauth2/v2/userinfo'); + $aUserInfoResponse = $oGoogle->fetch('https://www.googleapis.com/oauth2/v2/userinfo'); - if (!empty($aUserinfoResponse['result']['id'])) + if (!empty($aUserInfoResponse['result']['id'])) { if ($bLogin) { $sUserData = $this->oActions->StorageProvider()->Get(null, \RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY, - $this->GoogleUserLoginStorageKey($oGoogle, $aUserinfoResponse['result']['id']) + $this->GoogleUserLoginStorageKey($oGoogle, $aUserInfoResponse['result']['id']) ); $aUserData = \RainLoop\Utils::DecodeKeyValues($sUserData); @@ -359,21 +213,28 @@ class Social if ($oAccount) { $aUserData = array( + 'ID' => $aUserInfoResponse['result']['id'], 'Email' => $oAccount->Email(), 'Password' => $oAccount->Password() ); - $sSocialName = !empty($aUserinfoResponse['result']['name']) ? $aUserinfoResponse['result']['name'] : ''; - $sSocialName .= !empty($aUserinfoResponse['result']['email']) ? ' ('.$aUserinfoResponse['result']['email'].')' : ''; + $sSocialName = !empty($aUserInfoResponse['result']['name']) ? $aUserInfoResponse['result']['name'] : ''; + $sSocialName .= !empty($aUserInfoResponse['result']['email']) ? ' ('.$aUserInfoResponse['result']['email'].')' : ''; $sSocialName = \trim($sSocialName); $oSettings = $this->oActions->SettingsProvider()->Load($oAccount); + + $oSettings->SetConf('GoogleAccessToken', \RainLoop\Utils::EncodeKeyValues(array( + 'id' => $aUserInfoResponse['result']['id'] + ))); + $oSettings->SetConf('GoogleSocialName', $sSocialName); + $this->oActions->SettingsProvider()->Save($oAccount, $oSettings); $this->oActions->StorageProvider()->Put(null, \RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY, - $this->GoogleUserLoginStorageKey($oGoogle, $aUserinfoResponse['result']['id']), + $this->GoogleUserLoginStorageKey($oGoogle, $aUserInfoResponse['result']['id']), \RainLoop\Utils::EncodeKeyValues($aUserData)); $iErrorCode = 0; @@ -577,9 +438,7 @@ class Social if (200 === $iCode && isset($oTwitter->response['response'])) { - $this->oActions->Logger()->WriteDump($oTwitter->response['response']); $aAccessToken = $oTwitter->extract_params($oTwitter->response['response']); - $this->oActions->Logger()->WriteDump($aAccessToken); if ($aAccessToken && isset($aAccessToken['oauth_token']) && !empty($aAccessToken['user_id'])) { $oTwitter->config['user_token'] = $aAccessToken['oauth_token']; diff --git a/vendors/buzz/buzz.js b/vendors/buzz/buzz.js deleted file mode 100644 index 5bcd33ede..000000000 --- a/vendors/buzz/buzz.js +++ /dev/null @@ -1,719 +0,0 @@ - // ---------------------------------------------------------------------------- - // Buzz, a Javascript HTML5 Audio library - // v1.1.8 - Built 2015-01-12 11:08 - // Licensed under the MIT license. - // http://buzz.jaysalvat.com/ - // ---------------------------------------------------------------------------- - // Copyright (C) 2010-2015 Jay Salvat - // http://jaysalvat.com/ - // ---------------------------------------------------------------------------- - -(function(context, factory) { - "use strict"; - if (typeof module !== "undefined" && module.exports) { - module.exports = factory(); - } else if (typeof define === "function" && define.amd) { - define([], factory); - } else { - context.buzz = factory(); - } -})(this, function() { - "use strict"; - var AudioContext = window.AudioContext || window.webkitAudioContext; - var buzz = { - audioCtx: window.AudioContext ? new AudioContext() : null, - defaults: { - autoplay: false, - duration: 5e3, - formats: [], - loop: false, - placeholder: "--", - preload: "metadata", - volume: 80, - webAudioApi: false, - document: window.document - }, - types: { - mp3: "audio/mpeg", - ogg: "audio/ogg", - wav: "audio/wav", - aac: "audio/aac", - m4a: "audio/x-m4a" - }, - sounds: [], - el: document.createElement("audio"), - sound: function(src, options) { - options = options || {}; - var doc = options.document || buzz.defaults.document; - var pid = 0, events = [], eventsOnce = {}, supported = buzz.isSupported(); - this.load = function() { - if (!supported) { - return this; - } - this.sound.load(); - return this; - }; - this.play = function() { - if (!supported) { - return this; - } - this.sound.play(); - return this; - }; - this.togglePlay = function() { - if (!supported) { - return this; - } - if (this.sound.paused) { - this.sound.play(); - } else { - this.sound.pause(); - } - return this; - }; - this.pause = function() { - if (!supported) { - return this; - } - this.sound.pause(); - return this; - }; - this.isPaused = function() { - if (!supported) { - return null; - } - return this.sound.paused; - }; - this.stop = function() { - if (!supported) { - return this; - } - this.setTime(0); - this.sound.pause(); - return this; - }; - this.isEnded = function() { - if (!supported) { - return null; - } - return this.sound.ended; - }; - this.loop = function() { - if (!supported) { - return this; - } - this.sound.loop = "loop"; - this.bind("ended.buzzloop", function() { - this.currentTime = 0; - this.play(); - }); - return this; - }; - this.unloop = function() { - if (!supported) { - return this; - } - this.sound.removeAttribute("loop"); - this.unbind("ended.buzzloop"); - return this; - }; - this.mute = function() { - if (!supported) { - return this; - } - this.sound.muted = true; - return this; - }; - this.unmute = function() { - if (!supported) { - return this; - } - this.sound.muted = false; - return this; - }; - this.toggleMute = function() { - if (!supported) { - return this; - } - this.sound.muted = !this.sound.muted; - return this; - }; - this.isMuted = function() { - if (!supported) { - return null; - } - return this.sound.muted; - }; - this.setVolume = function(volume) { - if (!supported) { - return this; - } - if (volume < 0) { - volume = 0; - } - if (volume > 100) { - volume = 100; - } - this.volume = volume; - this.sound.volume = volume / 100; - return this; - }; - this.getVolume = function() { - if (!supported) { - return this; - } - return this.volume; - }; - this.increaseVolume = function(value) { - return this.setVolume(this.volume + (value || 1)); - }; - this.decreaseVolume = function(value) { - return this.setVolume(this.volume - (value || 1)); - }; - this.setTime = function(time) { - if (!supported) { - return this; - } - var set = true; - this.whenReady(function() { - if (set === true) { - set = false; - this.sound.currentTime = time; - } - }); - return this; - }; - this.getTime = function() { - if (!supported) { - return null; - } - var time = Math.round(this.sound.currentTime * 100) / 100; - return isNaN(time) ? buzz.defaults.placeholder : time; - }; - this.setPercent = function(percent) { - if (!supported) { - return this; - } - return this.setTime(buzz.fromPercent(percent, this.sound.duration)); - }; - this.getPercent = function() { - if (!supported) { - return null; - } - var percent = Math.round(buzz.toPercent(this.sound.currentTime, this.sound.duration)); - return isNaN(percent) ? buzz.defaults.placeholder : percent; - }; - this.setSpeed = function(duration) { - if (!supported) { - return this; - } - this.sound.playbackRate = duration; - return this; - }; - this.getSpeed = function() { - if (!supported) { - return null; - } - return this.sound.playbackRate; - }; - this.getDuration = function() { - if (!supported) { - return null; - } - var duration = Math.round(this.sound.duration * 100) / 100; - return isNaN(duration) ? buzz.defaults.placeholder : duration; - }; - this.getPlayed = function() { - if (!supported) { - return null; - } - return timerangeToArray(this.sound.played); - }; - this.getBuffered = function() { - if (!supported) { - return null; - } - return timerangeToArray(this.sound.buffered); - }; - this.getSeekable = function() { - if (!supported) { - return null; - } - return timerangeToArray(this.sound.seekable); - }; - this.getErrorCode = function() { - if (supported && this.sound.error) { - return this.sound.error.code; - } - return 0; - }; - this.getErrorMessage = function() { - if (!supported) { - return null; - } - switch (this.getErrorCode()) { - case 1: - return "MEDIA_ERR_ABORTED"; - - case 2: - return "MEDIA_ERR_NETWORK"; - - case 3: - return "MEDIA_ERR_DECODE"; - - case 4: - return "MEDIA_ERR_SRC_NOT_SUPPORTED"; - - default: - return null; - } - }; - this.getStateCode = function() { - if (!supported) { - return null; - } - return this.sound.readyState; - }; - this.getStateMessage = function() { - if (!supported) { - return null; - } - switch (this.getStateCode()) { - case 0: - return "HAVE_NOTHING"; - - case 1: - return "HAVE_METADATA"; - - case 2: - return "HAVE_CURRENT_DATA"; - - case 3: - return "HAVE_FUTURE_DATA"; - - case 4: - return "HAVE_ENOUGH_DATA"; - - default: - return null; - } - }; - this.getNetworkStateCode = function() { - if (!supported) { - return null; - } - return this.sound.networkState; - }; - this.getNetworkStateMessage = function() { - if (!supported) { - return null; - } - switch (this.getNetworkStateCode()) { - case 0: - return "NETWORK_EMPTY"; - - case 1: - return "NETWORK_IDLE"; - - case 2: - return "NETWORK_LOADING"; - - case 3: - return "NETWORK_NO_SOURCE"; - - default: - return null; - } - }; - this.set = function(key, value) { - if (!supported) { - return this; - } - this.sound[key] = value; - return this; - }; - this.get = function(key) { - if (!supported) { - return null; - } - return key ? this.sound[key] : this.sound; - }; - this.bind = function(types, func) { - if (!supported) { - return this; - } - types = types.split(" "); - var self = this, efunc = function(e) { - func.call(self, e); - }; - for (var t = 0; t < types.length; t++) { - var type = types[t], idx = type; - type = idx.split(".")[0]; - events.push({ - idx: idx, - func: efunc - }); - this.sound.addEventListener(type, efunc, true); - } - return this; - }; - this.unbind = function(types) { - if (!supported) { - return this; - } - types = types.split(" "); - for (var t = 0; t < types.length; t++) { - var idx = types[t], type = idx.split(".")[0]; - for (var i = 0; i < events.length; i++) { - var namespace = events[i].idx.split("."); - if (events[i].idx === idx || namespace[1] && namespace[1] === idx.replace(".", "")) { - this.sound.removeEventListener(type, events[i].func, true); - events.splice(i, 1); - } - } - } - return this; - }; - this.bindOnce = function(type, func) { - if (!supported) { - return this; - } - var self = this; - eventsOnce[pid++] = false; - this.bind(type + "." + pid, function() { - if (!eventsOnce[pid]) { - eventsOnce[pid] = true; - func.call(self); - } - self.unbind(type + "." + pid); - }); - return this; - }; - this.trigger = function(types, detail) { - if (!supported) { - return this; - } - types = types.split(" "); - for (var t = 0; t < types.length; t++) { - var idx = types[t]; - for (var i = 0; i < events.length; i++) { - var eventType = events[i].idx.split("."); - if (events[i].idx === idx || eventType[0] && eventType[0] === idx.replace(".", "")) { - var evt = doc.createEvent("HTMLEvents"); - evt.initEvent(eventType[0], false, true); - evt.originalEvent = detail; - this.sound.dispatchEvent(evt); - } - } - } - return this; - }; - this.fadeTo = function(to, duration, callback) { - if (!supported) { - return this; - } - if (duration instanceof Function) { - callback = duration; - duration = buzz.defaults.duration; - } else { - duration = duration || buzz.defaults.duration; - } - var from = this.volume, delay = duration / Math.abs(from - to), self = this; - this.play(); - function doFade() { - setTimeout(function() { - if (from < to && self.volume < to) { - self.setVolume(self.volume += 1); - doFade(); - } else if (from > to && self.volume > to) { - self.setVolume(self.volume -= 1); - doFade(); - } else if (callback instanceof Function) { - callback.apply(self); - } - }, delay); - } - this.whenReady(function() { - doFade(); - }); - return this; - }; - this.fadeIn = function(duration, callback) { - if (!supported) { - return this; - } - return this.setVolume(0).fadeTo(100, duration, callback); - }; - this.fadeOut = function(duration, callback) { - if (!supported) { - return this; - } - return this.fadeTo(0, duration, callback); - }; - this.fadeWith = function(sound, duration) { - if (!supported) { - return this; - } - this.fadeOut(duration, function() { - this.stop(); - }); - sound.play().fadeIn(duration); - return this; - }; - this.whenReady = function(func) { - if (!supported) { - return null; - } - var self = this; - if (this.sound.readyState === 0) { - this.bind("canplay.buzzwhenready", function() { - func.call(self); - }); - } else { - func.call(self); - } - }; - this.addSource = function(src) { - var self = this, source = doc.createElement("source"); - source.src = src; - if (buzz.types[getExt(src)]) { - source.type = buzz.types[getExt(src)]; - } - this.sound.appendChild(source); - source.addEventListener("error", function(e) { - self.sound.networkState = 3; - self.trigger("sourceerror", e); - }); - return source; - }; - function timerangeToArray(timeRange) { - var array = [], length = timeRange.length - 1; - for (var i = 0; i <= length; i++) { - array.push({ - start: timeRange.start(i), - end: timeRange.end(i) - }); - } - return array; - } - function getExt(filename) { - return filename.split(".").pop(); - } - if (supported && src) { - for (var i in buzz.defaults) { - if (buzz.defaults.hasOwnProperty(i)) { - if (options[i] === undefined) { - options[i] = buzz.defaults[i]; - } - } - } - this.sound = doc.createElement("audio"); - if (options.webAudioApi && buzz.audioCtx) { - this.source = buzz.audioCtx.createMediaElementSource(this.sound); - this.source.connect(buzz.audioCtx.destination); - } - if (src instanceof Array) { - for (var j in src) { - if (src.hasOwnProperty(j)) { - this.addSource(src[j]); - } - } - } else if (options.formats.length) { - for (var k in options.formats) { - if (options.formats.hasOwnProperty(k)) { - this.addSource(src + "." + options.formats[k]); - } - } - } else { - this.addSource(src); - } - if (options.loop) { - this.loop(); - } - if (options.autoplay) { - this.sound.autoplay = "autoplay"; - } - if (options.preload === true) { - this.sound.preload = "auto"; - } else if (options.preload === false) { - this.sound.preload = "none"; - } else { - this.sound.preload = options.preload; - } - this.setVolume(options.volume); - buzz.sounds.push(this); - } - }, - group: function(sounds) { - sounds = argsToArray(sounds, arguments); - this.getSounds = function() { - return sounds; - }; - this.add = function(soundArray) { - soundArray = argsToArray(soundArray, arguments); - for (var a = 0; a < soundArray.length; a++) { - sounds.push(soundArray[a]); - } - }; - this.remove = function(soundArray) { - soundArray = argsToArray(soundArray, arguments); - for (var a = 0; a < soundArray.length; a++) { - for (var i = 0; i < sounds.length; i++) { - if (sounds[i] === soundArray[a]) { - sounds.splice(i, 1); - break; - } - } - } - }; - this.load = function() { - fn("load"); - return this; - }; - this.play = function() { - fn("play"); - return this; - }; - this.togglePlay = function() { - fn("togglePlay"); - return this; - }; - this.pause = function(time) { - fn("pause", time); - return this; - }; - this.stop = function() { - fn("stop"); - return this; - }; - this.mute = function() { - fn("mute"); - return this; - }; - this.unmute = function() { - fn("unmute"); - return this; - }; - this.toggleMute = function() { - fn("toggleMute"); - return this; - }; - this.setVolume = function(volume) { - fn("setVolume", volume); - return this; - }; - this.increaseVolume = function(value) { - fn("increaseVolume", value); - return this; - }; - this.decreaseVolume = function(value) { - fn("decreaseVolume", value); - return this; - }; - this.loop = function() { - fn("loop"); - return this; - }; - this.unloop = function() { - fn("unloop"); - return this; - }; - this.setSpeed = function(speed) { - fn("setSpeed", speed); - return this; - }; - this.setTime = function(time) { - fn("setTime", time); - return this; - }; - this.set = function(key, value) { - fn("set", key, value); - return this; - }; - this.bind = function(type, func) { - fn("bind", type, func); - return this; - }; - this.unbind = function(type) { - fn("unbind", type); - return this; - }; - this.bindOnce = function(type, func) { - fn("bindOnce", type, func); - return this; - }; - this.trigger = function(type) { - fn("trigger", type); - return this; - }; - this.fade = function(from, to, duration, callback) { - fn("fade", from, to, duration, callback); - return this; - }; - this.fadeIn = function(duration, callback) { - fn("fadeIn", duration, callback); - return this; - }; - this.fadeOut = function(duration, callback) { - fn("fadeOut", duration, callback); - return this; - }; - function fn() { - var args = argsToArray(null, arguments), func = args.shift(); - for (var i = 0; i < sounds.length; i++) { - sounds[i][func].apply(sounds[i], args); - } - } - function argsToArray(array, args) { - return array instanceof Array ? array : Array.prototype.slice.call(args); - } - }, - all: function() { - return new buzz.group(buzz.sounds); - }, - isSupported: function() { - return !!buzz.el.canPlayType; - }, - isOGGSupported: function() { - return !!buzz.el.canPlayType && buzz.el.canPlayType('audio/ogg; codecs="vorbis"'); - }, - isWAVSupported: function() { - return !!buzz.el.canPlayType && buzz.el.canPlayType('audio/wav; codecs="1"'); - }, - isMP3Supported: function() { - return !!buzz.el.canPlayType && buzz.el.canPlayType("audio/mpeg;"); - }, - isAACSupported: function() { - return !!buzz.el.canPlayType && (buzz.el.canPlayType("audio/x-m4a;") || buzz.el.canPlayType("audio/aac;")); - }, - toTimer: function(time, withHours) { - var h, m, s; - h = Math.floor(time / 3600); - h = isNaN(h) ? "--" : h >= 10 ? h : "0" + h; - m = withHours ? Math.floor(time / 60 % 60) : Math.floor(time / 60); - m = isNaN(m) ? "--" : m >= 10 ? m : "0" + m; - s = Math.floor(time % 60); - s = isNaN(s) ? "--" : s >= 10 ? s : "0" + s; - return withHours ? h + ":" + m + ":" + s : m + ":" + s; - }, - fromTimer: function(time) { - var splits = time.toString().split(":"); - if (splits && splits.length === 3) { - time = parseInt(splits[0], 10) * 3600 + parseInt(splits[1], 10) * 60 + parseInt(splits[2], 10); - } - if (splits && splits.length === 2) { - time = parseInt(splits[0], 10) * 60 + parseInt(splits[1], 10); - } - return time; - }, - toPercent: function(value, total, decimal) { - var r = Math.pow(10, decimal || 0); - return Math.round(value * 100 / total * r) / r; - }, - fromPercent: function(percent, total, decimal) { - var r = Math.pow(10, decimal || 0); - return Math.round(total / 100 * percent * r) / r; - } - }; - return buzz; -}); \ No newline at end of file diff --git a/vendors/buzz/buzz.min.js b/vendors/buzz/buzz.min.js deleted file mode 100644 index 86cbfec4e..000000000 --- a/vendors/buzz/buzz.min.js +++ /dev/null @@ -1,11 +0,0 @@ - // ---------------------------------------------------------------------------- - // Buzz, a Javascript HTML5 Audio library - // v1.1.8 - Built 2015-01-12 11:08 - // Licensed under the MIT license. - // http://buzz.jaysalvat.com/ - // ---------------------------------------------------------------------------- - // Copyright (C) 2010-2015 Jay Salvat - // http://jaysalvat.com/ - // ---------------------------------------------------------------------------- - -(function(t,e){"use strict";"undefined"!=typeof module&&module.exports?module.exports=e():"function"==typeof define&&define.amd?define([],e):t.buzz=e()})(this,function(){"use strict";var t=window.AudioContext||window.webkitAudioContext,e={audioCtx:window.AudioContext?new t:null,defaults:{autoplay:!1,duration:5e3,formats:[],loop:!1,placeholder:"--",preload:"metadata",volume:80,webAudioApi:!1,document:window.document},types:{mp3:"audio/mpeg",ogg:"audio/ogg",wav:"audio/wav",aac:"audio/aac",m4a:"audio/x-m4a"},sounds:[],el:document.createElement("audio"),sound:function(t,n){function i(t){for(var e=[],n=t.length-1,i=0;n>=i;i++)e.push({start:t.start(i),end:t.end(i)});return e}function u(t){return t.split(".").pop()}n=n||{};var s=n.document||e.defaults.document,r=0,o=[],a={},h=e.isSupported();if(this.load=function(){return h?(this.sound.load(),this):this},this.play=function(){return h?(this.sound.play(),this):this},this.togglePlay=function(){return h?(this.sound.paused?this.sound.play():this.sound.pause(),this):this},this.pause=function(){return h?(this.sound.pause(),this):this},this.isPaused=function(){return h?this.sound.paused:null},this.stop=function(){return h?(this.setTime(0),this.sound.pause(),this):this},this.isEnded=function(){return h?this.sound.ended:null},this.loop=function(){return h?(this.sound.loop="loop",this.bind("ended.buzzloop",function(){this.currentTime=0,this.play()}),this):this},this.unloop=function(){return h?(this.sound.removeAttribute("loop"),this.unbind("ended.buzzloop"),this):this},this.mute=function(){return h?(this.sound.muted=!0,this):this},this.unmute=function(){return h?(this.sound.muted=!1,this):this},this.toggleMute=function(){return h?(this.sound.muted=!this.sound.muted,this):this},this.isMuted=function(){return h?this.sound.muted:null},this.setVolume=function(t){return h?(0>t&&(t=0),t>100&&(t=100),this.volume=t,this.sound.volume=t/100,this):this},this.getVolume=function(){return h?this.volume:this},this.increaseVolume=function(t){return this.setVolume(this.volume+(t||1))},this.decreaseVolume=function(t){return this.setVolume(this.volume-(t||1))},this.setTime=function(t){if(!h)return this;var e=!0;return this.whenReady(function(){e===!0&&(e=!1,this.sound.currentTime=t)}),this},this.getTime=function(){if(!h)return null;var t=Math.round(100*this.sound.currentTime)/100;return isNaN(t)?e.defaults.placeholder:t},this.setPercent=function(t){return h?this.setTime(e.fromPercent(t,this.sound.duration)):this},this.getPercent=function(){if(!h)return null;var t=Math.round(e.toPercent(this.sound.currentTime,this.sound.duration));return isNaN(t)?e.defaults.placeholder:t},this.setSpeed=function(t){return h?(this.sound.playbackRate=t,this):this},this.getSpeed=function(){return h?this.sound.playbackRate:null},this.getDuration=function(){if(!h)return null;var t=Math.round(100*this.sound.duration)/100;return isNaN(t)?e.defaults.placeholder:t},this.getPlayed=function(){return h?i(this.sound.played):null},this.getBuffered=function(){return h?i(this.sound.buffered):null},this.getSeekable=function(){return h?i(this.sound.seekable):null},this.getErrorCode=function(){return h&&this.sound.error?this.sound.error.code:0},this.getErrorMessage=function(){if(!h)return null;switch(this.getErrorCode()){case 1:return"MEDIA_ERR_ABORTED";case 2:return"MEDIA_ERR_NETWORK";case 3:return"MEDIA_ERR_DECODE";case 4:return"MEDIA_ERR_SRC_NOT_SUPPORTED";default:return null}},this.getStateCode=function(){return h?this.sound.readyState:null},this.getStateMessage=function(){if(!h)return null;switch(this.getStateCode()){case 0:return"HAVE_NOTHING";case 1:return"HAVE_METADATA";case 2:return"HAVE_CURRENT_DATA";case 3:return"HAVE_FUTURE_DATA";case 4:return"HAVE_ENOUGH_DATA";default:return null}},this.getNetworkStateCode=function(){return h?this.sound.networkState:null},this.getNetworkStateMessage=function(){if(!h)return null;switch(this.getNetworkStateCode()){case 0:return"NETWORK_EMPTY";case 1:return"NETWORK_IDLE";case 2:return"NETWORK_LOADING";case 3:return"NETWORK_NO_SOURCE";default:return null}},this.set=function(t,e){return h?(this.sound[t]=e,this):this},this.get=function(t){return h?t?this.sound[t]:this.sound:null},this.bind=function(t,e){if(!h)return this;t=t.split(" ");for(var n=this,i=function(t){e.call(n,t)},u=0;t.length>u;u++){var s=t[u],r=s;s=r.split(".")[0],o.push({idx:r,func:i}),this.sound.addEventListener(s,i,!0)}return this},this.unbind=function(t){if(!h)return this;t=t.split(" ");for(var e=0;t.length>e;e++)for(var n=t[e],i=n.split(".")[0],u=0;o.length>u;u++){var s=o[u].idx.split(".");(o[u].idx===n||s[1]&&s[1]===n.replace(".",""))&&(this.sound.removeEventListener(i,o[u].func,!0),o.splice(u,1))}return this},this.bindOnce=function(t,e){if(!h)return this;var n=this;return a[r++]=!1,this.bind(t+"."+r,function(){a[r]||(a[r]=!0,e.call(n)),n.unbind(t+"."+r)}),this},this.trigger=function(t,e){if(!h)return this;t=t.split(" ");for(var n=0;t.length>n;n++)for(var i=t[n],u=0;o.length>u;u++){var r=o[u].idx.split(".");if(o[u].idx===i||r[0]&&r[0]===i.replace(".","")){var a=s.createEvent("HTMLEvents");a.initEvent(r[0],!1,!0),a.originalEvent=e,this.sound.dispatchEvent(a)}}return this},this.fadeTo=function(t,n,i){function u(){setTimeout(function(){t>s&&t>o.volume?(o.setVolume(o.volume+=1),u()):s>t&&o.volume>t?(o.setVolume(o.volume-=1),u()):i instanceof Function&&i.apply(o)},r)}if(!h)return this;n instanceof Function?(i=n,n=e.defaults.duration):n=n||e.defaults.duration;var s=this.volume,r=n/Math.abs(s-t),o=this;return this.play(),this.whenReady(function(){u()}),this},this.fadeIn=function(t,e){return h?this.setVolume(0).fadeTo(100,t,e):this},this.fadeOut=function(t,e){return h?this.fadeTo(0,t,e):this},this.fadeWith=function(t,e){return h?(this.fadeOut(e,function(){this.stop()}),t.play().fadeIn(e),this):this},this.whenReady=function(t){if(!h)return null;var e=this;0===this.sound.readyState?this.bind("canplay.buzzwhenready",function(){t.call(e)}):t.call(e)},this.addSource=function(t){var n=this,i=s.createElement("source");return i.src=t,e.types[u(t)]&&(i.type=e.types[u(t)]),this.sound.appendChild(i),i.addEventListener("error",function(t){n.sound.networkState=3,n.trigger("sourceerror",t)}),i},h&&t){for(var d in e.defaults)e.defaults.hasOwnProperty(d)&&void 0===n[d]&&(n[d]=e.defaults[d]);if(this.sound=s.createElement("audio"),n.webAudioApi&&e.audioCtx&&(this.source=e.audioCtx.createMediaElementSource(this.sound),this.source.connect(e.audioCtx.destination)),t instanceof Array)for(var l in t)t.hasOwnProperty(l)&&this.addSource(t[l]);else if(n.formats.length)for(var c in n.formats)n.formats.hasOwnProperty(c)&&this.addSource(t+"."+n.formats[c]);else this.addSource(t);n.loop&&this.loop(),n.autoplay&&(this.sound.autoplay="autoplay"),this.sound.preload=n.preload===!0?"auto":n.preload===!1?"none":n.preload,this.setVolume(n.volume),e.sounds.push(this)}},group:function(t){function e(){for(var e=n(null,arguments),i=e.shift(),u=0;t.length>u;u++)t[u][i].apply(t[u],e)}function n(t,e){return t instanceof Array?t:Array.prototype.slice.call(e)}t=n(t,arguments),this.getSounds=function(){return t},this.add=function(e){e=n(e,arguments);for(var i=0;e.length>i;i++)t.push(e[i])},this.remove=function(e){e=n(e,arguments);for(var i=0;e.length>i;i++)for(var u=0;t.length>u;u++)if(t[u]===e[i]){t.splice(u,1);break}},this.load=function(){return e("load"),this},this.play=function(){return e("play"),this},this.togglePlay=function(){return e("togglePlay"),this},this.pause=function(t){return e("pause",t),this},this.stop=function(){return e("stop"),this},this.mute=function(){return e("mute"),this},this.unmute=function(){return e("unmute"),this},this.toggleMute=function(){return e("toggleMute"),this},this.setVolume=function(t){return e("setVolume",t),this},this.increaseVolume=function(t){return e("increaseVolume",t),this},this.decreaseVolume=function(t){return e("decreaseVolume",t),this},this.loop=function(){return e("loop"),this},this.unloop=function(){return e("unloop"),this},this.setSpeed=function(t){return e("setSpeed",t),this},this.setTime=function(t){return e("setTime",t),this},this.set=function(t,n){return e("set",t,n),this},this.bind=function(t,n){return e("bind",t,n),this},this.unbind=function(t){return e("unbind",t),this},this.bindOnce=function(t,n){return e("bindOnce",t,n),this},this.trigger=function(t){return e("trigger",t),this},this.fade=function(t,n,i,u){return e("fade",t,n,i,u),this},this.fadeIn=function(t,n){return e("fadeIn",t,n),this},this.fadeOut=function(t,n){return e("fadeOut",t,n),this}},all:function(){return new e.group(e.sounds)},isSupported:function(){return!!e.el.canPlayType},isOGGSupported:function(){return!!e.el.canPlayType&&e.el.canPlayType('audio/ogg; codecs="vorbis"')},isWAVSupported:function(){return!!e.el.canPlayType&&e.el.canPlayType('audio/wav; codecs="1"')},isMP3Supported:function(){return!!e.el.canPlayType&&e.el.canPlayType("audio/mpeg;")},isAACSupported:function(){return!!e.el.canPlayType&&(e.el.canPlayType("audio/x-m4a;")||e.el.canPlayType("audio/aac;"))},toTimer:function(t,e){var n,i,u;return n=Math.floor(t/3600),n=isNaN(n)?"--":n>=10?n:"0"+n,i=e?Math.floor(t/60%60):Math.floor(t/60),i=isNaN(i)?"--":i>=10?i:"0"+i,u=Math.floor(t%60),u=isNaN(u)?"--":u>=10?u:"0"+u,e?n+":"+i+":"+u:i+":"+u},fromTimer:function(t){var e=(""+t).split(":");return e&&3===e.length&&(t=3600*parseInt(e[0],10)+60*parseInt(e[1],10)+parseInt(e[2],10)),e&&2===e.length&&(t=60*parseInt(e[0],10)+parseInt(e[1],10)),t},toPercent:function(t,e,n){var i=Math.pow(10,n||0);return Math.round(100*t/e*i)/i},fromPercent:function(t,e,n){var i=Math.pow(10,n||0);return Math.round(e/100*t*i)/i}};return e}); \ No newline at end of file diff --git a/vendors/is.js/LICENSE b/vendors/is.js/LICENSE deleted file mode 100644 index 077f5b9d3..000000000 --- a/vendors/is.js/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2015 Aras Atasaygin - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendors/is.js/README.md b/vendors/is.js/README.md deleted file mode 100644 index b42f00deb..000000000 --- a/vendors/is.js/README.md +++ /dev/null @@ -1,2327 +0,0 @@ -is.js -===== -####This is a general-purpose check library. -- No dependencies -- AMD, Node & browser ready - -Node.js: -``` -npm install is_js -``` - -Bower: -``` -bower install is_js -``` - -Type checks -=========== - -is.arguments(value:any) ------------------------ -####Checks if the given value type is arguments. -interfaces: not, all, any - -```javascript -var getArguments = function() { - return arguments; -}; -var arguments = getArguments(); - -is.arguments(arguments); -=> true - -is.not.arguments({foo: 'bar'}); -=> true - -is.all.arguments(arguments, 'bar'); -=> false - -is.any.arguments(['foo'], arguments); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.arguments([arguments, 'foo', 'bar']); -=> false -``` - -is.array(value:any) -------------------- -####Checks if the given value type is array. -interfaces: not, all, any - -```javascript -is.array(['foo', 'bar', 'baz']); -=> true - -is.not.array({foo: 'bar'}); -=> true - -is.all.array(['foo'], 'bar'); -=> false - -is.any.array(['foo'], 'bar'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.array([[1, 2], 'foo', 'bar']); -=> false -``` - -is.boolean(value:any) ---------------------- -####Checks if the given value type is boolean. -interfaces: not, all, any - -```javascript -is.boolean(true); -=> true - -is.not.boolean({foo: 'bar'}); -=> true - -is.all.boolean(true, 'bar'); -=> false - -is.any.boolean(true, 'bar'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.boolean([true, 'foo', 'bar']); -=> false -``` - -is.date(value:any) ------------------- -####Checks if the given value type is date. -interfaces: not, all, any - -```javascript -is.date(new Date()); -=> true - -is.not.date({foo: 'bar'}); -=> true - -is.all.date(new Date(), 'bar'); -=> false - -is.any.date(new Date(), 'bar'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.date([new Date(), 'foo', 'bar']); -=> false -``` - -is.error(value:any) -------------------- -####Checks if the given value type is error. -interfaces: not, all, any - -```javascript -is.error(new Error()); -=> true - -is.not.error({foo: 'bar'}); -=> true - -is.all.error(new Error(), 'bar'); -=> false - -is.any.error(new Error(), 'bar'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.error([new Error(), 'foo', 'bar']); -=> false -``` - -is.function(value:any) ----------------------- -####Checks if the given value type is function. -interfaces: not, all, any - -```javascript -is.function(toString); -=> true - -is.not.function({foo: 'bar'}); -=> true - -is.all.function(toString, 'bar'); -=> false - -is.any.function(toString, 'bar'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.function([toString, 'foo', 'bar']); -=> false -``` - -is.nan(value:any) ------------------ -####Checks if the given value type is NaN. -interfaces: not, all, any - -```javascript -is.nan(NaN); -=> true - -is.not.nan(42); -=> true - -is.all.nan(NaN, 1); -=> false - -is.any.nan(NaN, 2); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.nan([NaN, 'foo', 1]); -=> false -``` - -is.null(value:any) ------------------- -####Checks if the given value type is null. -interfaces: not, all, any - -```javascript -is.null(null); -=> true - -is.not.null(42); -=> true - -is.all.null(null, 1); -=> false - -is.any.null(null, 2); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.null([null, 'foo', 1]); -=> false -``` - -is.number(value:any) --------------------- -####Checks if the given value type is number. -interfaces: not, all, any - -```javascript -is.number(42); -=> true - -is.not.number('42'); -=> true - -is.all.number('foo', 1); -=> false - -is.any.number({}, 2); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.number([42, 'foo', 1]); -=> false -``` - -is.object(value:any) --------------------- -####Checks if the given value type is object. -interfaces: not, all, any - -```javascript -is.object({foo: 'bar'}); -=> true - -// functions are also returning as true -is.object(toString); -=> true - -is.not.object('foo'); -=> true - -is.all.object({}, 1); -=> false - -is.any.object({}, 2); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.object([{}, new Object()]); -=> true -``` - -is.json(value:any) --------------------- -####Checks if the given value type is pure json object. -interfaces: not, all, any - -```javascript -is.json({foo: 'bar'}); -=> true - -// functions are returning as false -is.json(toString); -=> false - -is.not.json([]); -=> true - -is.all.json({}, 1); -=> false - -is.any.json({}, 2); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.json([{}, {foo: 'bar'}]); -=> true -``` - -is.regexp(value:any) --------------------- -####Checks if the given value type is RegExp. -interfaces: not, all, any - -```javascript -is.regexp(/test/); -=> true - -is.not.regexp(['foo']); -=> true - -is.all.regexp(/test/, 1); -=> false - -is.any.regexp(new RegExp('ab+c'), 2); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.regexp([{}, /test/]); -=> false -``` - -is.string(value:any) --------------------- -####Checks if the given value type is string. -interfaces: not, all, any - -```javascript -is.string('foo'); -=> true - -is.not.string(['foo']); -=> true - -is.all.string('foo', 1); -=> false - -is.any.string('foo', 2); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.string([{}, 'foo']); -=> false -``` - -is.char(value:any) --------------------- -####Checks if the given value type is char. -interfaces: not, all, any - -```javascript -is.char('f'); -=> true - -is.not.char(['foo']); -=> true - -is.all.char('f', 1); -=> false - -is.any.char('f', 2); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.char(['f', 'o', 'o']); -=> true -``` - -is.undefined(value:any) ------------------------ -####Checks if the given value type is undefined. -interfaces: not, all, any - -```javascript -is.undefined(undefined); -=> true - -is.not.undefined(null); -=> true - -is.all.undefined(undefined, 1); -=> false - -is.any.undefined(undefined, 2); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.undefined([{}, undefined]); -=> false -``` - -is.sameType(value:any, value:any) ---------------------------------- -####Checks if the given value types are same type. -interface: not - -```javascript -is.sameType(42, 7); -=> true - -is.sameType(42, '7'); -=> false - -is.not.sameType(42, 7); -=> false -``` - -Presence checks -=============== - -is.empty(value:object|array|string) ------------------------------------ -####Checks if the given value is empty. -interfaces: not, all, any - -```javascript -is.empty({}); -=> true - -is.empty([]); -=> true - -is.empty(''); -=> true - -is.not.empty(['foo']); -=> true - -is.all.empty('', {}, ['foo']); -=> false - -is.any.empty([], 42); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.empty([{}, 'foo']); -=> false -``` - -is.existy(value:any) --------------------- -####Checks if the given value is existy. (not null or undefined) -interfaces: not, all, any - -```javascript -is.existy({}); -=> true - -is.existy(null); -=> false - -is.not.existy(undefined); -=> true - -is.all.existy(null, ['foo']); -=> false - -is.any.existy(undefined, 42); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.existy([{}, 'foo']); -=> true -``` - -is.truthy(value:any) --------------------- -####Checks if the given value is truthy. (existy and not false) -interfaces: not, all, any - -```javascript -is.truthy(true); -=> true - -is.truthy(null); -=> false - -is.not.truthy(false); -=> true - -is.all.truthy(null, true); -=> false - -is.any.truthy(undefined, true); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.truthy([{}, true]); -=> true -``` - -is.falsy(value:any) -------------------- -####Checks if the given value is falsy. -interfaces: not, all, any - -```javascript -is.falsy(false); -=> true - -is.falsy(null); -=> true - -is.not.falsy(true); -=> true - -is.all.falsy(null, false); -=> true - -is.any.falsy(undefined, true); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.falsy([false, true, undefined]); -=> false -``` - -is.space(value:string) ----------------------- -####Checks if the given value is space. -interfaces: not, all, any - -```javascript -is.space(' '); -=> true - -is.space('foo'); -=> false - -is.not.space(true); -=> true - -is.all.space(' ', 'foo'); -=> false - -is.any.space(' ', true); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.space([' ', 'foo', undefined]); -=> false -``` - -RegExp checks -============= - -is.url(value:any) ------------------ -####Checks if the given value matches url regexp. -interfaces: not, all, any - -```javascript -is.url('http://www.test.com'); -=> true - -is.url('foo'); -=> false - -is.not.url(true); -=> true - -is.all.url('http://www.test.com', 'foo'); -=> false - -is.any.url('http://www.test.com', true); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.url(['http://www.test.com', 'foo', undefined]); -=> false -``` - -is.email(value:any) -------------------- -####Checks if the given value matches email regexp. -interfaces: not, all, any - -```javascript -is.email('test@test.com'); -=> true - -is.email('foo'); -=> false - -is.not.email('foo'); -=> true - -is.all.email('test@test.com', 'foo'); -=> false - -is.any.email('test@test.com', 'foo'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.email(['test@test.com', 'foo', undefined]); -=> false -``` - -is.creditCard(value:any) ------------------------- -####Checks if the given value matches credit card regexp. -interfaces: not, all, any - -```javascript -is.creditCard(378282246310005); -=> true - -is.creditCard(123); -=> false - -is.not.creditCard(123); -=> true - -is.all.creditCard(378282246310005, 123); -=> false - -is.any.creditCard(378282246310005, 123); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.creditCard([378282246310005, 123, undefined]); -=> false -``` - -is.alphaNumeric(value:any) --------------------------- -####Checks if the given value matches alpha numeric regexp. -interfaces: not, all, any - -```javascript -is.alphaNumeric('alphaNu3er1k'); -=> true - -is.alphaNumeric('*?'); -=> false - -is.not.alphaNumeric('*?'); -=> true - -is.all.alphaNumeric('alphaNu3er1k', '*?'); -=> false - -is.any.alphaNumeric('alphaNu3er1k', '*?'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.alphaNumeric(['alphaNu3er1k', '*?']); -=> false -``` - -is.timeString(value:any) ------------------------- -####Checks if the given value matches time string regexp. -interfaces: not, all, any - -```javascript -is.timeString('13:45:30'); -=> true - -is.timeString('90:90:90'); -=> false - -is.not.timeString('90:90:90'); -=> true - -is.all.timeString('13:45:30', '90:90:90'); -=> false - -is.any.timeString('13:45:30', '90:90:90'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.timeString(['13:45:30', '90:90:90']); -=> false -``` - -is.dateString(value:any) ------------------------- -####Checks if the given value matches date string regexp. -interfaces: not, all, any - -```javascript -is.dateString('11/11/2011'); -=> true - -is.dateString('90/11/2011'); -=> false - -is.not.dateString('90/11/2011'); -=> true - -is.all.dateString('11/11/2011', '90/11/2011'); -=> false - -is.any.dateString('11/11/2011', '90/11/2011'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.dateString(['11/11/2011', '90/11/2011']); -=> false -``` - -is.usZipCode(value:any) ------------------------ -####Checks if the given value matches US zip code regexp. -interfaces: not, all, any - -```javascript -is.usZipCode('02201-1020'); -=> true - -is.usZipCode('123'); -=> false - -is.not.usZipCode('123'); -=> true - -is.all.usZipCode('02201-1020', '123'); -=> false - -is.any.usZipCode('02201-1020', '123'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.usZipCode(['02201-1020', '123']); -=> false -``` - -is.caPostalCode(value:any) --------------------------- -####Checks if the given value matches Canada postal code regexp. -interfaces: not, all, any - -```javascript -is.caPostalCode('L8V3Y1'); -=> true - -is.caPostalCode('L8V 3Y1'); -=> true - -is.caPostalCode('123'); -=> false - -is.not.caPostalCode('123'); -=> true - -is.all.caPostalCode('L8V3Y1', '123'); -=> false - -is.any.caPostalCode('L8V3Y1', '123'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.caPostalCode(['L8V3Y1', '123']); -=> false -``` - -is.ukPostCode(value:any) ------------------------- -####Checks if the given value matches UK post code regexp. -interfaces: not, all, any - -```javascript -is.ukPostCode('B184BJ'); -=> true - -is.ukPostCode('123'); -=> false - -is.not.ukPostCode('123'); -=> true - -is.all.ukPostCode('B184BJ', '123'); -=> false - -is.any.ukPostCode('B184BJ', '123'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.ukPostCode(['B184BJ', '123']); -=> false -``` - -is.nanpPhone(value:any) ------------------------ -####Checks if the given value matches North American numbering plan phone regexp. -interfaces: not, all, any - -```javascript -is.nanpPhone('609-555-0175'); -=> true - -is.nanpPhone('123'); -=> false - -is.not.nanpPhone('123'); -=> true - -is.all.nanpPhone('609-555-0175', '123'); -=> false - -is.any.nanpPhone('609-555-0175', '123'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.nanpPhone(['609-555-0175', '123']); -=> false -``` - -is.eppPhone(value:any) ----------------------- -####Checks if the given value matches extensible provisioning protocol phone regexp. -interfaces: not, all, any - -```javascript -is.eppPhone('+90.2322456789'); -=> true - -is.eppPhone('123'); -=> false - -is.not.eppPhone('123'); -=> true - -is.all.eppPhone('+90.2322456789', '123'); -=> false - -is.any.eppPhone('+90.2322456789', '123'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.eppPhone(['+90.2322456789', '123']); -=> false -``` - -is.socialSecurityNumber(value:any) ----------------------------------- -####Checks if the given value matches social security number regexp. -interfaces: not, all, any - -```javascript -is.socialSecurityNumber('017-90-7890'); -=> true - -is.socialSecurityNumber('123'); -=> false - -is.not.socialSecurityNumber('123'); -=> true - -is.all.socialSecurityNumber('017-90-7890', '123'); -=> false - -is.any.socialSecurityNumber('017-90-7890', '123'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.socialSecurityNumber(['017-90-7890', '123']); -=> false -``` - -is.affirmative(value:any) -------------------------- -####Checks if the given value matches affirmative regexp. -interfaces: not, all, any - -```javascript -is.affirmative('yes'); -=> true - -is.affirmative('no'); -=> false - -is.not.affirmative('no'); -=> true - -is.all.affirmative('yes', 'no'); -=> false - -is.any.affirmative('yes', 'no'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.affirmative(['yes', 'y', 'true', 't', 'ok', 'okay']); -=> true -``` - -is.hexadecimal(value:any) -------------------------- -####Checks if the given value matches hexadecimal regexp. -interfaces: not, all, any - -```javascript -is.hexadecimal('f0f0f0'); -=> true - -is.hexadecimal(2.5); -=> false - -is.not.hexadecimal('string'); -=> true - -is.all.hexadecimal('ff', 'f50'); -=> true - -is.any.hexadecimal('ff5500', true); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.hexadecimal(['fff', '333', 'f50']); -=> true -``` - -is.hexColor(value:any) -------------------------- -####Checks if the given value matches hexcolor regexp. -interfaces: not, all, any - -```javascript -is.hexColor('#333'); -=> true - -is.hexColor('#3333'); -=> false - -is.not.hexColor(0.5); -=> true - -is.all.hexColor('fff', 'f50'); -=> true - -is.any.hexColor('ff5500', 0.5); -=> false - -// 'all' and 'any' interfaces can also take array parameter -is.all.hexColor(['fff', '333', 'f50']); -=> true -``` - -is.ip(value:string) -------------------------- -####Checks if the given value matches ip regexp -interfaces: not, all, any - -```javascript -is.ip('198.156.23.5'); -=> true - -is.ip('1.2..5'); -=> false - -is.not.ip('8:::::::7'); -=> true - -is.all.ip('0:1::4:ff5:54:987:C', '123.123.123.123'); -=> true - -is.any.ip('123.8.4.3', '0.0.0.0'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.ip(['123.123.23.12', 'A:B:C:D:E:F:0:0']); -=> true -``` - -is.ipv4(value:string) -------------------------- -####Checks if the given value matches ipv4 regexp -interfaces: not, all, any - -```javascript -is.ipv4('198.12.3.142'); -=> true - -is.ipv4('1.2..5'); -=> false - -is.not.ipv4('8:::::::7'); -=> true - -is.all.ipv4('198.12.3.142', '123.123.123.123'); -=> true - -is.any.ipv4('255.255.255.255', '850..1.4'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.ipv4(['198.12.3.142', '1.2.3']); -=> false - -``` - -is.ipv6(value:string) -------------------------- -####Checks if the given value matches ipv6 regexp -interfaces: not, all, any - -```javascript -is.ipv6('2001:DB8:0:0:1::1'); -=> true - -is.ipv6('985.12.3.4'); -=> true - -is.not.ipv6('8:::::::7'); -=> true - -is.all.ipv6('2001:DB8:0:0:1::1', '1:50:198:2::1:2:8'); -=> true - -is.any.ipv6('255.255.255.255', '2001:DB8:0:0:1::1'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.ipv6(['2001:DB8:0:0:1::1', '1.2.3']); -=> false -``` - -String checks -============= - -is.include(value:string, value:substring) ------------------------------------------ -####Checks if the given string contains a substring. -interface: not - -```javascript -is.include('Some text goes here', 'text'); -=> true - -is.include('test', 'text'); -=> false - -is.not.include('test', 'text'); -=> true -``` - -is.upperCase(value:string) --------------------------- -####Checks if the given string is UPPERCASE. -interfaces: not, all, any - -```javascript -is.upperCase('YEAP'); -=> true - -is.upperCase('nope'); -=> false - -is.not.upperCase('Nope'); -=> true - -is.all.upperCase('YEAP', 'nope'); -=> false - -is.any.upperCase('YEAP', 'nope'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.upperCase(['YEAP', 'ALL UPPERCASE']); -=> true -``` - - -is.lowerCase(value:string) --------------------------- -####Checks if the given string is lowercase. -interfaces: not, all, any - -```javascript -is.lowerCase('yeap'); -=> true - -is.lowerCase('NOPE'); -=> false - -is.not.lowerCase('Nope'); -=> true - -is.all.lowerCase('yeap', 'NOPE'); -=> false - -is.any.lowerCase('yeap', 'NOPE'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.lowerCase(['yeap', 'all lowercase']); -=> true -``` - -is.startWith(value:string, value:substring) -------------------------------------------- -####Checks if the given string starts with substring. -interface: not - -```javascript -is.startWith('yeap', 'ye'); -=> true - -is.startWith('nope', 'ye'); -=> false - -is.not.startWith('nope not that', 'not'); -=> true -``` - -is.endWith(value:string, value:substring) ------------------------------------------ -####Checks if the given string ends with substring. -interfaces: not - -```javascript -is.endWith('yeap', 'ap'); -=> true - -is.endWith('nope', 'no'); -=> false - -is.not.endWith('nope not that', 'not'); -=> true - -is.endWith('yeap that one', 'one'); -=> true -``` - -is.capitalized(value:string, value:substring) ---------------------------------------------- -####Checks if the given string is capitalized. -interfaces: not, all, any - -```javascript -is.capitalized('Yeap'); -=> true - -is.capitalized('nope'); -=> false - -is.not.capitalized('nope not capitalized'); -=> true - -is.not.capitalized('nope Capitalized'); -=> true - -is.all.capitalized('Yeap', 'All', 'Capitalized'); -=> true - -is.any.capitalized('Yeap', 'some', 'Capitalized'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.capitalized(['Nope', 'not']); -=> false -``` - -is.palindrome(value:string, value:substring) ---------------------------------------------- -####Checks if the given string is palindrome. -interfaces: not, all, any - -```javascript -is.palindrome('testset'); -=> true - -is.palindrome('nope'); -=> false - -is.not.palindrome('nope not palindrome'); -=> true - -is.not.palindrome('tt'); -=> false - -is.all.palindrome('testset', 'tt'); -=> true - -is.any.palindrome('Yeap', 'some', 'testset'); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.palindrome(['Nope', 'testset']); -=> false -``` - -Arithmetic checks -================= - -is.equal(value:any, value:any) ------------------------------- -####Checks if the given values are equal. -interfaces: not - -```javascript -is.equal(42, 40 + 2); -=> true - -is.equal('yeap', 'yeap'); -=> true - -is.equal(true, true); -=> true - -is.not.equal('yeap', 'nope'); -=> true -``` - -is.even(value:number) ---------------------- -####Checks if the given value is even. -interfaces: not, all, any - -```javascript -is.even(42); -=> true - -is.not.even(41); -=> true - -is.all.even(40, 42, 44); -=> true - -is.any.even(39, 42, 43); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.even([40, 42, 43]); -=> false -``` - -is.odd(value:number) --------------------- -####Checks if the given value is odd. -interfaces: not, all, any - -```javascript -is.odd(41); -=> true - -is.not.odd(42); -=> true - -is.all.odd(39, 41, 43); -=> true - -is.any.odd(39, 42, 44); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.odd([40, 42, 43]); -=> false -``` - -is.positive(value:number) -------------------------- -####Checks if the given value is positive. -interfaces: not, all, any - -```javascript -is.positive(41); -=> true - -is.not.positive(-42); -=> true - -is.all.positive(39, 41, 43); -=> true - -is.any.positive(-39, 42, -44); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.positive([40, 42, -43]); -=> false -``` - -is.negative(value:number) -------------------------- -####Checks if the given value is negative. -interfaces: not, all, any - -```javascript -is.negative(-41); -=> true - -is.not.negative(42); -=> true - -is.all.negative(-39, -41, -43); -=> true - -is.any.negative(-39, 42, 44); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.negative([40, 42, -43]); -=> false -``` - -is.above(value:number, min) ---------------------------- -####Checks if the given value is above minimum value. -interface: not - -```javascript -is.above(41, 30); -=> true - -is.not.above(42, 50); -=> true -``` - -is.under(value:number, min) ---------------------------- -####Checks if the given value is under maximum value. -interface: not - -```javascript -is.under(30, 35); -=> true - -is.not.under(42, 30); -=> true -``` - -is.within(value:number, min, max) ---------------------------------- -####Checks if the given value is within minimum and maximum values. -interface: not - -```javascript -is.within(30, 20, 40); -=> true - -is.not.within(40, 30, 35); -=> true -``` - -is.decimal(value:number) ------------------------- -####Checks if the given value is decimal. -interfaces: not, all, any - -```javascript -is.decimal(41.5); -=> true - -is.not.decimal(42); -=> true - -is.all.decimal(39.5, 41.5, -43.5); -=> true - -is.any.decimal(-39, 42.5, 44); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.decimal([40, 42.5, -43]); -=> false -``` - -is.integer(value:number) ------------------------- -####Checks if the given value is integer. -interfaces: not, all, any - -```javascript -is.integer(41); -=> true - -is.not.integer(42.5); -=> true - -is.all.integer(39, 41, -43); -=> true - -is.any.integer(-39, 42.5, 44); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.integer([40, 42.5, -43]); -=> false -``` - -is.finite(value:number) ------------------------ -####Checks if the given value is finite. -interfaces: not, all, any - -```javascript -is.finite(41); -=> true - -is.not.finite(42 / 0); -=> true - -is.all.finite(39, 41, -43); -=> true - -is.any.finite(-39, Infinity, 44); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.finite([Infinity, -Infinity, 42.5]); -=> false -``` - -is.infinite(value:number) -------------------------- -####Checks if the given value is infinite. -interfaces: not, all, any - -```javascript -is.infinite(Infinity); -=> true - -is.not.infinite(42); -=> true - -is.all.infinite(Infinity, -Infinity, -43 / 0); -=> true - -is.any.infinite(-39, Infinity, 44); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.infinite([Infinity, -Infinity, 42.5]); -=> false -``` - -Object checks -============= - -is.propertyCount(value:object, count) -------------------------------------- -####Checks if objects' property count is equal to given count. -interface: not - -```javascript -is.propertyCount({this: 'is', 'sample': object}, 2); -=> true - -is.propertyCount({this: 'is', 'sample': object}, 3); -=> false - -is.not.propertyCount({}, 2); -=> true -``` - -is.propertyDefined(value:object, property) ------------------------------------------- -####Checks if the given property is defined on object. -interface: not - -```javascript -is.propertyDefined({yeap: 'yeap'}, 'yeap'); -=> true - -is.propertyDefined({yeap: 'yeap'}, 'nope'); -=> false - -is.not.propertyDefined({}, 'nope'); -=> true -``` - -is.windowObject(value:window) ------------------------------ -####Checks if the given object is window object. -interfaces: not, all, any - -```javascript -is.windowObject(window); -=> true - -is.windowObject({nope: 'nope'}); -=> false - -is.not.windowObject({}); -=> true - -is.all.windowObject(window, {nope: 'nope'}); -=> false - -is.any.windowObject(window, {nope: 'nope'}); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.windowObject([window, {nope: 'nope'}]); -=> false -``` - -is.domNode(value:object) ------------------------------ -####Checks if the given object is a dom node. -interfaces: not, all, any - -```javascript -var obj = document.createElement('div'); -is.domNode(obj); -=> true - -is.domNode({nope: 'nope'}); -=> false - -is.not.domNode({}); -=> true - -is.all.domNode(obj, obj); -=> true - -is.any.domNode(obj, {nope: 'nope'}); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.domNode([obj, {nope: 'nope'}]); -=> false -``` - -Array checks -============ - -is.inArray(value:any, array) ---------------------- -####Checks if the given item is in array? -interface: not -```javascript -is.inArray(2, [1, 2, 3]); -=> true - -is.inArray(4, [1, 2, 3]); -=> false - -is.not.inArray(4, [1, 2, 3]); -=> true -``` - -is.sorted(value:array) ----------------------- -####Checks if the given array is sorted. -interfaces: not, all, any - -```javascript -is.sorted([1, 2, 3]); -=> true - -is.sorted([1, 2, 4, 3]); -=> false - -is.not.sorted([5, 4, 3]); -=> true - -is.all.sorted([1, 2], [3, 4]); -=> true - -is.any.sorted([1, 2], [5, 4]); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.sorted([[1, 2], [5, 4]]); -=> false -``` - -Environment checks -================== -####Environment checks are not available as node module. - -is.ie(value:number) -------------------- -####Checks if current browser is ie. Parameter is optional version number of browser. -interface: not - -```javascript -is.ie(); -=> true if current browser is ie - -is.ie(6); -=> hopefully false - -is.not.ie(); -=> false if current browser is ie -``` - -is.chrome() ------------ -####Checks if current browser is chrome. -interface: not - -```javascript -is.chrome(); -=> true if current browser is chrome - -is.not.chrome(); -=> false if current browser is chrome -``` - -is.firefox() ------------- -####Checks if current browser is firefox. -interface: not - -```javascript -is.firefox(); -=> true if current browser is firefox - -is.not.firefox(); -=> false if current browser is firefox -``` - -is.opera() ----------- -####Checks if current browser is opera. -interface: not - -```javascript -is.opera(); -=> true if current browser is opera - -is.not.opera(); -=> false if current browser is opera -``` - -is.safari() ------------ -####Checks if current browser is safari. -interface: not - -```javascript -is.safari(); -=> true if current browser is safari - -is.not.safari(); -=> false if current browser is safari -``` - -is.ios() --------- -####Checks if current device has ios. -interface: not - -```javascript -is.ios(); -=> true if current device is iPhone, iPad or iPod - -is.not.ios(); -=> true if current device is not iPhone, iPad or iPod -``` - -is.iphone() ------------ -####Checks if current device is iPhone. -interface: not - -```javascript -is.iphone(); -=> true if current device is iPhone - -is.not.iphone(); -=> true if current device is not iPhone -``` - -is.ipad() ---------- -####Checks if current device is iPad. -interface: not - -```javascript -is.ipad(); -=> true if current device is iPad - -is.not.ipad(); -=> true if current device is not iPad -``` - -is.ipod() ---------- -####Checks if current device is iPod. -interface: not - -```javascript -is.ipod(); -=> true if current device is iPod - -is.not.ipod(); -=> true if current device is not iPod -``` - -is.android() ------------- -####Checks if current device has Android. -interface: not - -```javascript -is.android(); -=> true if current device has Android OS - -is.not.android(); -=> true if current device has not Android OS -``` - -is.androidPhone() ------------------ -####Checks if current device is Android phone. -interface: not - -```javascript -is.androidPhone(); -=> true if current device is Android phone - -is.not.androidPhone(); -=> true if current device is not Android phone -``` - -is.androidTablet() ------------------- -####Checks if current device is Android tablet. -interface: not - -```javascript -is.androidTablet(); -=> true if current device is Android tablet - -is.not.androidTablet(); -=> true if current device is not Android tablet -``` - -is.blackberry() ---------------- -####Checks if current device is Blackberry. -interface: not - -```javascript -is.blackberry(); -=> true if current device is Blackberry - -is.not.blackberry(); -=> true if current device is not Blackberry -``` - -is.windowsPhone() ------------------ -####Checks if current device is Windows phone. -interface: not - -```javascript -is.windowsPhone(); -=> true if current device is Windows phone - -is.not.windowsPhone(); -=> true if current device is not Windows Phone -``` - -is.windowsTablet() ------------------- -####Checks if current device is Windows tablet. -interface: not - -```javascript -is.windowsTablet(); -=> true if current device is Windows tablet - -is.not.windowsTablet(); -=> true if current device is not Windows tablet -``` - -is.windows() ------------- -####Checks if current OS is Windows. -interface: not - -```javascript -is.windows(); -=> true if current OS is Windows - -is.not.windows(); -=> true if current OS is not Windows -``` - -is.mac() --------- -####Checks if current OS is Mac OS X. -interface: not - -```javascript -is.mac(); -=> true if current OS is Mac OS X - -is.not.mac(); -=> true if current OS is not Mac OS X -``` - -is.linux() ----------- -####Checks if current OS is linux. -interface: not - -```javascript -is.linux(); -=> true if current OS is linux - -is.not.linux(); -=> true if current OS is not linux -``` - -is.desktop() ------------- -####Checks if current device is desktop. -interface: not - -```javascript -is.desktop(); -=> true if current device is desktop - -is.not.desktop(); -=> true if current device is not desktop -``` - -is.mobile() ------------ -####Checks if current device is mobile. -interface: not -iPhone, iPod, Android Phone, Windows Phone, Blackberry. -```javascript - -is.mobile(); -=> true if current device is mobile - -is.not.mobile(); -=> true if current device is not mobile -``` - -is.tablet() ------------ -####Checks if current device is tablet. -interface: not -iPad, Android Tablet, Windows Tablet -```javascript - -is.tablet(); -=> true if current device is tablet - -is.not.tablet(); -=> true if current device is not tablet -``` - -is.online() ------------ -####Checks if current device is online. -interface: not - -```javascript -is.online(); -=> true if current device is online - -is.not.online(); -=> true if current device is not online -``` - -is.offline() ------------- -####Checks if current device is offline. -interface: not - -```javascript -is.offline(); -=> true if current device is offline - -is.not.offline(); -=> true if current device is not offline -``` - -Time checks -=========== - -is.today(value:object) ----------------------- -####Checks if the given date object indicate today. -interfaces: not, all, any - -```javascript -var today = new Date(); -is.today(today); -=> true - -var yesterday = new Date(new Date().setDate(new Date().getDate() - 1)); -is.today(yesterday); -=> false - -is.not.today(yesterday); -=> true - -is.all.today(today, today); -=> true - -is.any.today(today, yesterday); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.today([today, yesterday]); -=> false -``` - -is.yesterday(value:object) --------------------------- -####Checks if the given date object indicate yesterday. -interfaces: not, all, any - -```javascript -var today = new Date(); -is.yesterday(today); -=> false - -var yesterday = new Date(new Date().setDate(new Date().getDate() - 1)); -is.yesterday(yesterday); -=> true - -is.not.yesterday(today); -=> true - -is.all.yesterday(yesterday, today); -=> false - -is.any.yesterday(today, yesterday); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.yesterday([today, yesterday]); -=> false -``` - -is.tomorrow(value:object) -------------------------- -####Checks if the given date object indicate tomorrow. -interfaces: not, all, any - -```javascript -var today = new Date(); -is.tomorrow(today); -=> false - -var tomorrow = new Date(new Date().setDate(new Date().getDate() + 1)); -is.tomorrow(tomorrow); -=> true - -is.not.tomorrow(today); -=> true - -is.all.tomorrow(tomorrow, today); -=> false - -is.any.tomorrow(today, tomorrow); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.tomorrow([today, tomorrow]); -=> false -``` - -is.past(value:object) ---------------------- -####Checks if the given date object indicate past. -interfaces: not, all, any - -```javascript -var yesterday = new Date(new Date().setDate(new Date().getDate() - 1)); -var tomorrow = new Date(new Date().setDate(new Date().getDate() + 1)); - -is.past(yesterday); -=> true - -is.past(tomorrow); -=> false - -is.not.past(tomorrow); -=> true - -is.all.past(tomorrow, yesterday); -=> false - -is.any.past(yesterday, tomorrow); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.past([yesterday, tomorrow]); -=> false -``` - -is.future(value:object) ------------------------ -####Checks if the given date object indicate future. -interfaces: not, all, any - -```javascript -var yesterday = new Date(new Date().setDate(new Date().getDate() - 1)); -var tomorrow = new Date(new Date().setDate(new Date().getDate() + 1)); - -is.future(yesterday); -=> false - -is.future(tomorrow); -=> true - -is.not.future(yesterday); -=> true - -is.all.future(tomorrow, yesterday); -=> false - -is.any.future(yesterday, tomorrow); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.future([yesterday, tomorrow]); -=> false -``` - -is.day(value:object, dayString) -------------------------------- -####Checks if the given date objects' day equal given dayString parameter. -interface: not - -```javascript -var mondayObj = new Date('01/26/2015'); -var tuesdayObj = new Date('01/27/2015'); -is.day(mondayObj, 'monday'); -=> true - -is.day(mondayObj, 'tuesday'); -=> false - -is.not.day(mondayObj, 'tuesday'); -=> true -``` - -is.month(value:object, monthString) ------------------------------------ -####Checks if the given date objects' month equal given monthString parameter. -interface: not - -```javascript -var januaryObj = new Date('01/26/2015'); -var februaryObj = new Date('02/26/2015'); -is.month(januaryObj, 'january'); -=> true - -is.month(februaryObj, 'january'); -=> false - -is.not.month(februaryObj, 'january'); -=> true -``` - -is.year(value:object, yearNumber) ---------------------------------- -####Checks if the given date objects' year equal given yearNumber parameter. -interface: not - -```javascript -var year2015 = new Date('01/26/2015'); -var year2016 = new Date('01/26/2016'); -is.year(year2015, 2015); -=> true - -is.year(year2016, 2015); -=> false - -is.not.year(year2016, 2015); -=> true -``` - -is.leapYear(value:number) ---------------------------------- -####Checks if the given year number is a leap year -interfaces: not, all, any - -```javascript -is.leapYear(2016); -=> true - -is.leapYear(2015); -=> false - -is.not.leapYear(2015); -=> true - -is.all.leapYear(2015, 2016); -=> false - -is.any.leapYear(2015, 2016); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.leapYear([2016, 2080]); -=> true -``` - -is.weekend(value:object) ------------------------- -####Checks if the given date objects' day is weekend. -interfaces: not, all, any - -```javascript -var monday = new Date('01/26/2015'); -var sunday = new Date('01/25/2015'); -var saturday = new Date('01/24/2015'); -is.weekend(sunday); -=> true - -is.weekend(monday); -=> false - -is.not.weekend(monday); -=> true - -is.all.weekend(sunday, saturday); -=> true - -is.any.weekend(sunday, saturday, monday); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.weekend([sunday, saturday, monday]); -=> false -``` - -is.weekday(value:object) ------------------------- -####Checks if the given date objects' day is weekday. -interfaces: not, all, any - -```javascript -var monday = new Date('01/26/2015'); -var sunday = new Date('01/25/2015'); -var saturday = new Date('01/24/2015'); -is.weekday(monday); -=> true - -is.weekday(sunday); -=> false - -is.not.weekday(sunday); -=> true - -is.all.weekday(monday, saturday); -=> false - -is.any.weekday(sunday, saturday, monday); -=> true - -// 'all' and 'any' interfaces can also take array parameter -is.all.weekday([sunday, saturday, monday]); -=> false -``` - -is.inDateRange(value:object, startObject, endObject) ----------------------------------------------------- -####Checks if date is within given range. -interface: not - -```javascript -var saturday = new Date('01/24/2015'); -var sunday = new Date('01/25/2015'); -var monday = new Date('01/26/2015'); -is.inDateRange(sunday, saturday, monday); -=> true - -is.inDateRange(saturday, sunday, monday); -=> false - -is.not.inDateRange(saturday, sunday, monday); -=> true -``` - -is.inLastWeek(value:object) ---------------------------- -####Checks if the given date is between now and 7 days ago. -interface: not - -```javascript -var twoDaysAgo = new Date(new Date().setDate(new Date().getDate() - 2)); -var nineDaysAgo = new Date(new Date().setDate(new Date().getDate() - 9)); -is.inLastWeek(twoDaysAgo); -=> true - -is.inLastWeek(nineDaysAgo); -=> false - -is.not.inLastWeek(nineDaysAgo); -=> true -``` - -is.inLastMonth(value:object) ----------------------------- -####Checks if the given date is between now and a month ago. -interface: not - -```javascript -var tenDaysAgo = new Date(new Date().setDate(new Date().getDate() - 10)); -var fortyDaysAgo = new Date(new Date().setDate(new Date().getDate() - 40)); -is.inLastMonth(tenDaysAgo); -=> true - -is.inLastMonth(fortyDaysAgo); -=> false - -is.not.inLastMonth(fortyDaysAgo); -=> true -``` - -is.inLastYear(value:object) ---------------------------- -####Checks if the given date is between now and a year ago. -interface: not - -```javascript -var twoMonthsAgo = new Date(new Date().setMonth(new Date().getMonth() - 2)); -var thirteenMonthsAgo = new Date(new Date().setMonth(new Date().getMonth() - 13)); -is.inLastYear(twoMonthsAgo); -=> true - -is.inLastYear(thirteenMonthsAgo); -=> false - -is.not.inLastYear(thirteenMonthsAgo); -=> true -``` - -is.inNextWeek(value:object) ---------------------------- -####Checks if the given date is between now and 7 days later. -interface: not - -```javascript -var twoDaysLater = new Date(new Date().setDate(new Date().getDate() + 2)); -var nineDaysLater = new Date(new Date().setDate(new Date().getDate() + 9)); -is.inNextWeek(twoDaysLater); -=> true - -is.inNextWeek(nineDaysLater); -=> false - -is.not.inNextWeek(nineDaysLater); -=> true -``` - -is.inNextMonth(value:object) ----------------------------- -####Checks if the given date is between now and a month later. -interface: not - -```javascript -var tenDaysLater = new Date(new Date().setDate(new Date().getDate() + 10)); -var fortyDaysLater = new Date(new Date().setDate(new Date().getDate() + 40)); -is.inNextMonth(tenDaysLater); -=> true - -is.inNextMonth(fortyDaysLater); -=> false - -is.not.inNextMonth(fortyDaysLater); -=> true -``` - -is.inNextYear(value:object) ---------------------------- -####Checks if the given date is between now and a year later. -interface: not - -```javascript -var twoMonthsLater = new Date(new Date().setMonth(new Date().getMonth() + 2)); -var thirteenMonthsLater = new Date(new Date().setMonth(new Date().getMonth() + 13)); -is.inNextYear(twoMonthsLater); -=> true - -is.inNextYear(thirteenMonthsLater); -=> false - -is.not.inNextYear(thirteenMonthsLater); -=> true -``` - -is.quarterOfYear(value:object, quarterNumber) ---------------------------------------------- -####Checks if the given date is in the parameter quarter. -interface: not - -```javascript -var firstQuarter = new Date('01/26/2015'); -var secondQuarter = new Date('05/26/2015'); -is.quarterOfYear(firstQuarter, 1); -=> true - -is.quarterOfYear(secondQuarter, 1); -=> false - -is.not.quarterOfYear(secondQuarter, 1); -=> true -``` - -is.dayLightSavingTime(value:object, quarterNumber) --------------------------------------------------- -####Checks if the given date is in daylight saving time. -interface: not - -```javascript -// For Turkey Time Zone -var january1 = new Date('01/01/2015'); -var june1 = new Date('06/01/2015'); - -is.dayLightSavingTime(june1); -=> true - -is.dayLightSavingTime(january1); -=> false - -is.not.dayLightSavingTime(january1); -=> true -``` - -Configuration methods -===================== - -is.setRegexp(value:RegExp, regexpString) ----------------------------------------- -Override RegExps if you think they suck. - -```javascript -is.url('https://www.duckduckgo.com'); -=> true - -is.setRegexp(/quack/, 'url'); -is.url('quack'); -=> true -``` - -is.setNamespace() ------------------ -Change namespace of library to prevent name collisions. - -```javascript -var customName = is.setNamespace(); -customName.odd(3); -=> true -``` diff --git a/vendors/is.js/bower.json b/vendors/is.js/bower.json deleted file mode 100644 index 3ab0941d0..000000000 --- a/vendors/is.js/bower.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "is_js", - "main": "is.js", - "version": "0.6.0", - "homepage": "http://arasatasaygin.github.io/is.js/", - "authors": [ - "arasatasaygin " - ], - "description": "micro check library", - "moduleType": [ - "amd", - "globals", - "node" - ], - "keywords": [ - "type", - "presence", - "regexp", - "string", - "arithmetic", - "object", - "array", - "environment", - "time", - "configuration" - ], - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ] -} diff --git a/vendors/is.js/is.js b/vendors/is.js/is.js deleted file mode 100644 index 5c98e3298..000000000 --- a/vendors/is.js/is.js +++ /dev/null @@ -1,818 +0,0 @@ -// is.js 0.6.0 -// Author: Aras Atasaygin - -// AMD with global, Node, or global -;(function(root, factory) { - if(typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['is'], function(is) { - // Also create a global in case some scripts - // that are loaded still are looking for - // a global even when an AMD loader is in use. - return (root.is = factory(is)); - }); - } else if(typeof exports === 'object') { - // Node. Does not work with strict CommonJS, but - // only CommonJS-like enviroments that support module.exports, - // like Node. - module.exports = factory(require('is_js')); - } else { - // Browser globals (root is window) - root.is = factory(root.is); - } -}(this, function(is) { - - // Baseline - /* -------------------------------------------------------------------------- */ - - var root = this; - var previousIs = root.is; - - // define 'is' object and current version - is = {}; - is.VERSION = '0.6.0'; - - // define interfaces - is.not = {}; - is.all = {}; - is.any = {}; - - // cache some methods to call later on - var toString = Object.prototype.toString; - var arraySlice = Array.prototype.slice; - var hasOwnProperty = Object.prototype.hasOwnProperty; - - // helper function which reverses the sense of predicate result - function not(func) { - return function() { - return !func.apply(null, arraySlice.call(arguments)); - }; - } - - // helper function which call predicate function per parameter and return true if all pass - function all(func) { - return function() { - var parameters = arraySlice.call(arguments); - var length = parameters.length; - if(length === 1 && is.array(parameters[0])) { // support array - parameters = parameters[0]; - length = parameters.length; - } - for (var i = 0; i < length; i++) { - if (!func.call(null, parameters[i])) { - return false; - } - } - return true; - }; - } - - // helper function which call predicate function per parameter and return true if any pass - function any(func) { - return function() { - var parameters = arraySlice.call(arguments); - var length = parameters.length; - if(length === 1 && is.array(parameters[0])) { // support array - parameters = parameters[0]; - length = parameters.length; - } - for (var i = 0; i < length; i++) { - if (func.call(null, parameters[i])) { - return true; - } - } - return false; - }; - } - - // Type checks - /* -------------------------------------------------------------------------- */ - - // is a given value Arguments? - is.arguments = function(value) { // fallback check is for IE - return is.not.null(value) && (toString.call(value) === '[object Arguments]' || (typeof value === 'object' && 'callee' in value)); - }; - - // is a given value Array? - is.array = Array.isArray || function(value) { // check native isArray first - return toString.call(value) === '[object Array]'; - }; - - // is a given value Boolean? - is.boolean = function(value) { - return value === true || value === false || toString.call(value) === '[object Boolean]'; - }; - - // is a given value Date Object? - is.date = function(value) { - return toString.call(value) === '[object Date]'; - }; - - // is a given value Error object? - is.error = function(value) { - return toString.call(value) === '[object Error]'; - }; - - // is a given value function? - is.function = function(value) { // fallback check is for IE - return toString.call(value) === '[object Function]' || typeof value === 'function'; - }; - - // is a given value NaN? - is.nan = function(value) { // NaN is number :) Also it is the only value which does not equal itself - return value !== value; - }; - - // is a given value null? - is.null = function(value) { - return value === null || toString.call(value) === '[object Null]'; - }; - - // is a given value number? - is.number = function(value) { - return toString.call(value) === '[object Number]'; - }; - - // is a given value object? - is.object = function(value) { - var type = typeof value; - return type === 'function' || type === 'object' && !!value; - }; - - // is given value a pure JSON object? - is.json = function(value) { - return toString.call(value) === '[object Object]'; - }; - - // is a given value RegExp? - is.regexp = function(value) { - return toString.call(value) === '[object RegExp]'; - }; - - // are given values same type? - // prevent NaN, Number same type check - is.sameType = function(value1, value2) { - if(is.nan(value1) || is.nan(value2)) { - return is.nan(value1) === is.nan(value2); - } - return toString.call(value1) === toString.call(value2); - }; - // sameType method does not support 'all' and 'any' interfaces - is.sameType.api = ['not']; - - // is a given value String? - is.string = function(value) { - return toString.call(value) === '[object String]'; - }; - - // is a given value Char? - is.char = function(value) { - return is.string(value) && value.length === 1; - }; - - // is a given value undefined? - is.undefined = function(value) { - return value === void 0; - }; - - // Presence checks - /* -------------------------------------------------------------------------- */ - - //is a given value empty? Objects, arrays, strings - is.empty = function(value) { - if(is.object(value)){ - var num = Object.getOwnPropertyNames(value).length; - if(num === 0 || (num === 1 && is.array(value)) || (num === 2 && is.arguments(value))){ - return true; - } - return false; - } else { - return value === ''; - } - }; - - // is a given value existy? - is.existy = function(value) { - return value !== null && value !== undefined; - }; - - // is a given value truthy? - is.truthy = function(value) { - return is.existy(value) && value !== false && is.not.nan(value) && value !== "" && value !== 0; - }; - - // is a given value falsy? - is.falsy = not(is.truthy); - - // is a given value space? - // horizantal tab: 9, line feed: 10, vertical tab: 11, form feed: 12, carriage return: 13, space: 32 - is.space = function(value) { - if(is.char(value)) { - var characterCode = value.charCodeAt(0); - return (characterCode > 8 && characterCode < 14) || characterCode === 32; - } else { - return false; - } - }; - - // Arithmetic checks - /* -------------------------------------------------------------------------- */ - - // are given values equal? supports numbers, strings, regexps, booleans - // TODO: Add object and array support - is.equal = function(value1, value2) { - // check 0 and -0 equity with Infinity and -Infinity - if(is.all.number(value1, value2)) { - return value1 === value2 && 1 / value1 === 1 / value2; - } - // check regexps as strings too - if(is.all.string(value1, value2) || is.all.regexp(value1, value2)) { - return '' + value1 === '' + value2; - } - if(is.all.boolean(value1, value2)) { - return value1 === value2; - } - return false; - }; - // equal method does not support 'all' and 'any' interfaces - is.equal.api = ['not']; - - // is a given number even? - is.even = function(numb) { - return is.number(numb) && numb % 2 === 0; - }; - - // is a given number odd? - is.odd = function(numb) { - return is.number(numb) && numb % 2 !== 0; - }; - - // is a given number positive? - is.positive = function(numb) { - return is.number(numb) && numb > 0; - }; - - // is a given number negative? - is.negative = function(numb) { - return is.number(numb) && numb < 0; - }; - - // is a given number above minimum parameter? - is.above = function(numb, min) { - return is.all.number(numb, min) && numb > min; - }; - // above method does not support 'all' and 'any' interfaces - is.above.api = ['not']; - - // is a given number above maximum parameter? - is.under = function(numb, max) { - return is.all.number(numb, max) && numb < max; - }; - // least method does not support 'all' and 'any' interfaces - is.under.api = ['not']; - - // is a given number within minimum and maximum parameters? - is.within = function(numb, min, max) { - return is.all.number(numb, min, max) && numb > min && numb < max; - }; - // within method does not support 'all' and 'any' interfaces - is.within.api = ['not']; - - // is a given number decimal? - is.decimal = function(numb) { - return is.number(numb) && numb % 1 !== 0; - }; - - // is a given number integer? - is.integer = function(numb) { - return is.number(numb) && numb % 1 === 0; - }; - - // is a given number finite? - is.finite = isFinite || function(numb) { - return numb !== Infinity && numb !== -Infinity && is.not.nan(numb); - }; - - // is a given number infinite? - is.infinite = not(is.finite); - - // Regexp checks - /* -------------------------------------------------------------------------- */ - // Steven Levithan, Jan Goyvaerts: Regular Expressions Cookbook - // Scott Gonzalez: Email address validation - - // eppPhone match extensible provisioning protocol format - // nanpPhone match north american number plan format - // dateString match m/d/yy and mm/dd/yyyy, allowing any combination of one or two digits for the day and month, and two or four digits for the year - // time match hours, minutes, and seconds, 24-hour clock - var regexps = { - url: /^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/, - email: /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i, - creditCard: /^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/, - alphaNumeric: /^[A-Za-z0-9]+$/, - timeString: /^(2[0-3]|[01]?[0-9]):([0-5]?[0-9]):([0-5]?[0-9])$/, - dateString: /^(1[0-2]|0?[1-9])\/(3[01]|[12][0-9]|0?[1-9])\/(?:[0-9]{2})?[0-9]{2}$/, - usZipCode: /^[0-9]{5}(?:-[0-9]{4})?$/, - caPostalCode: /^(?!.*[DFIOQU])[A-VXY][0-9][A-Z]\s?[0-9][A-Z][0-9]$/, - ukPostCode: /^[A-Z]{1,2}[0-9RCHNQ][0-9A-Z]?\s?[0-9][ABD-HJLNP-UW-Z]{2}$|^[A-Z]{2}-?[0-9]{4}$/, - nanpPhone: /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/, - eppPhone: /^\+[0-9]{1,3}\.[0-9]{4,14}(?:x.+)?$/, - socialSecurityNumber: /^(?!000|666)[0-8][0-9]{2}-(?!00)[0-9]{2}-(?!0000)[0-9]{4}$/, - affirmative: /^(?:1|t(?:rue)?|y(?:es)?|ok(?:ay)?)$/, - hexadecimal: /^[0-9a-fA-F]+$/, - hexColor: /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/, - ipv4: /^(?:(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])$/, - ipv6: /^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$|^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/, - ip: /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$|^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/ - }; - - // create regexp checks methods from 'regexp' object - for(var regexp in regexps) { - if(regexps.hasOwnProperty(regexp)) { - regexpCheck(regexp, regexps); - } - } - - function regexpCheck(regexp, regexps) { - is[regexp] = function(value) { - return regexps[regexp].test(value); - }; - } - - // String checks - /* -------------------------------------------------------------------------- */ - - // is a given string include parameter substring? - is.include = String.prototype.includes || function(str, substr) { - return str.indexOf(substr) > -1; - }; - // include method does not support 'all' and 'any' interfaces - is.include.api = ['not']; - - // is a given string all uppercase? - is.upperCase = function(str) { - return is.string(str) && str === str.toUpperCase(); - }; - - // is a given string all lowercase? - is.lowerCase = function(str) { - return is.string(str) && str === str.toLowerCase(); - }; - - // is string start with a given startWith parameter? - is.startWith = function(str, startWith) { - return is.string(str) && str.indexOf(startWith) === 0; - }; - // startWith method does not support 'all' and 'any' interfaces - is.startWith.api = ['not']; - - // is string end with a given endWith parameter? - is.endWith = function(str, endWith) { - return is.string(str) && str.indexOf(endWith) > -1 && str.indexOf(endWith) === str.length - endWith.length; - }; - // endWith method does not support 'all' and 'any' interfaces - is.endWith.api = ['not']; - - // is a given string or sentence capitalized? - is.capitalized = function(str) { - if(is.not.string(str)) { - return false; - } - var words = str.split(' '); - var capitalized = []; - for(var i = 0; i < words.length; i++) { - capitalized.push(words[i][0] === words[i][0].toUpperCase()); - } - return is.all.truthy.apply(null, capitalized); - }; - - // is a given string palindrome? - is.palindrome = function(str) { - return is.string(str) && str == str.split('').reverse().join(''); - }; - - // Time checks - /* -------------------------------------------------------------------------- */ - - var days = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']; - var months = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december']; - - // is a given date indicate today? - is.today = function(obj) { - var now = new Date(); - var todayString = now.toDateString(); - return is.date(obj) && obj.toDateString() === todayString; - }; - - // is a given date indicate yesterday? - is.yesterday = function(obj) { - var now = new Date(); - var yesterdayString = new Date(now.setDate(now.getDate() - 1)).toDateString(); - return is.date(obj) && obj.toDateString() === yesterdayString; - }; - - // is a given date indicate tomorrow? - is.tomorrow = function(obj) { - var now = new Date(); - var tomorrowString = new Date(now.setDate(now.getDate() + 1)).toDateString(); - return is.date(obj) && obj.toDateString() === tomorrowString; - }; - - // is a given date past? - is.past = function(obj) { - var now = new Date(); - return is.date(obj) && obj.getTime() < now.getTime(); - }; - - // is a given date future? - is.future = not(is.past); - - // is a given dates day equal given dayString parameter? - is.day = function(obj, dayString) { - return is.date(obj) && dayString.toLowerCase() === days[obj.getDay()]; - }; - // day method does not support 'all' and 'any' interfaces - is.day.api = ['not']; - - // is a given dates month equal given monthString parameter? - is.month = function(obj, monthString) { - return is.date(obj) && monthString.toLowerCase() === months[obj.getMonth()]; - }; - // month method does not support 'all' and 'any' interfaces - is.month.api = ['not']; - - // is a given dates year equal given year parameter? - is.year = function(obj, year) { - return is.date(obj) && is.number(year) && year === obj.getFullYear(); - }; - // year method does not support 'all' and 'any' interfaces - is.year.api = ['not']; - - // is the given year a leap year? - is.leapYear = function(year) { - return is.number(year) && ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0); - }; - - // is a given date weekend? - // 6: Saturday, 0: Sunday - is.weekend = function(obj) { - return is.date(obj) && (obj.getDay() === 6 || obj.getDay() === 0); - }; - - // is a given date weekday? - is.weekday = not(is.weekend); - - // is date within given range? - is.inDateRange = function(obj, startObj, endObj) { - if(is.not.date(obj) || is.not.date(startObj) || is.not.date(endObj)) { - return false; - } - var givenDate = obj.getTime(); - var start = startObj.getTime(); - var end = endObj.getTime(); - return givenDate > start && givenDate < end; - }; - // inDateRange method does not support 'all' and 'any' interfaces - is.inDateRange.api = ['not']; - - // is a given date in last week range? - is.inLastWeek = function(obj) { - return is.inDateRange(obj, new Date(new Date().setDate(new Date().getDate() - 7)), new Date()); - }; - - // is a given date in last month range? - is.inLastMonth = function(obj) { - return is.inDateRange(obj, new Date(new Date().setMonth(new Date().getMonth() - 1)), new Date()); - }; - - // is a given date in last year range? - is.inLastYear = function(obj) { - return is.inDateRange(obj, new Date(new Date().setFullYear(new Date().getFullYear() - 1)), new Date()); - }; - - // is a given date in next week range? - is.inNextWeek = function(obj) { - return is.inDateRange(obj, new Date(), new Date(new Date().setDate(new Date().getDate() + 7))); - }; - - // is a given date in next month range? - is.inNextMonth = function(obj) { - return is.inDateRange(obj, new Date(), new Date(new Date().setMonth(new Date().getMonth() + 1))); - }; - - // is a given date in next year range? - is.inNextYear = function(obj) { - return is.inDateRange(obj, new Date(), new Date(new Date().setFullYear(new Date().getFullYear() + 1))); - }; - - // is a given date in the parameter quarter? - is.quarterOfYear = function(obj, quarterNumber) { - return is.date(obj) && is.number(quarterNumber) && quarterNumber === Math.floor((obj.getMonth() + 3) / 3); - }; - // quarterOfYear method does not support 'all' and 'any' interfaces - is.quarterOfYear.api = ['not']; - - // is a given date in daylight saving time? - is.dayLightSavingTime = function(obj) { - var january = new Date(obj.getFullYear(), 0, 1); - var july = new Date(obj.getFullYear(), 6, 1); - var stdTimezoneOffset = Math.max(january.getTimezoneOffset(), july.getTimezoneOffset()); - return obj.getTimezoneOffset() < stdTimezoneOffset; - }; - - // Environment checks - /* -------------------------------------------------------------------------- */ - - // check if library is used as a Node.js module - if(typeof window !== 'undefined') { - - // store navigator properties to use later - var userAgent = 'navigator' in window && 'userAgent' in navigator && navigator.userAgent.toLowerCase() || ''; - var vendor = 'navigator' in window && 'vendor' in navigator && navigator.vendor.toLowerCase() || ''; - var appVersion = 'navigator' in window && 'appVersion' in navigator && navigator.appVersion.toLowerCase() || ''; - - // is current browser chrome? - is.chrome = function() { - return /chrome|chromium/i.test(userAgent) && /google inc/.test(vendor); - }; - // chrome method does not support 'all' and 'any' interfaces - is.chrome.api = ['not']; - - // is current browser firefox? - is.firefox = function() { - return /firefox/i.test(userAgent); - }; - // firefox method does not support 'all' and 'any' interfaces - is.firefox.api = ['not']; - - // is current browser internet explorer? - // parameter is optional - is.ie = function(version) { - if(!version) { - return /msie/i.test(userAgent) || "ActiveXObject" in window; - } - if(version >= 11) { - return "ActiveXObject" in window; - } - return new RegExp('msie ' + version).test(userAgent); - }; - // ie method does not support 'all' and 'any' interfaces - is.ie.api = ['not']; - - // is current browser opera? - is.opera = function() { - return /^Opera\//.test(userAgent) || // Opera 12 and older versions - /\x20OPR\//.test(userAgent); // Opera 15+ - }; - // opera method does not support 'all' and 'any' interfaces - is.opera.api = ['not']; - - // is current browser safari? - is.safari = function() { - return /safari/i.test(userAgent) && /apple computer/i.test(vendor); - }; - // safari method does not support 'all' and 'any' interfaces - is.safari.api = ['not']; - - // is current device ios? - is.ios = function() { - return is.iphone() || is.ipad() || is.ipod(); - }; - // ios method does not support 'all' and 'any' interfaces - is.ios.api = ['not']; - - // is current device iphone? - is.iphone = function() { - return /iphone/i.test(userAgent); - }; - // iphone method does not support 'all' and 'any' interfaces - is.iphone.api = ['not']; - - // is current device ipad? - is.ipad = function() { - return /ipad/i.test(userAgent); - }; - // ipad method does not support 'all' and 'any' interfaces - is.ipad.api = ['not']; - - // is current device ipod? - is.ipod = function() { - return /ipod/i.test(userAgent); - }; - // ipod method does not support 'all' and 'any' interfaces - is.ipod.api = ['not']; - - // is current device android? - is.android = function() { - return /android/i.test(userAgent); - }; - // android method does not support 'all' and 'any' interfaces - is.android.api = ['not']; - - // is current device android phone? - is.androidPhone = function() { - return /android/i.test(userAgent) && /mobile/i.test(userAgent); - }; - // androidPhone method does not support 'all' and 'any' interfaces - is.androidPhone.api = ['not']; - - // is current device android tablet? - is.androidTablet = function() { - return /android/i.test(userAgent) && !/mobile/i.test(userAgent); - }; - // androidTablet method does not support 'all' and 'any' interfaces - is.androidTablet.api = ['not']; - - // is current device blackberry? - is.blackberry = function() { - return /blackberry/i.test(userAgent); - }; - // blackberry method does not support 'all' and 'any' interfaces - is.blackberry.api = ['not']; - - // is current device desktop? - is.desktop = function() { - return is.not.mobile() && is.not.tablet(); - }; - // desktop method does not support 'all' and 'any' interfaces - is.desktop.api = ['not']; - - // is current operating system linux? - is.linux = function() { - return /linux/i.test(appVersion); - }; - // linux method does not support 'all' and 'any' interfaces - is.linux.api = ['not']; - - // is current operating system mac? - is.mac = function() { - return /mac/i.test(appVersion); - }; - // mac method does not support 'all' and 'any' interfaces - is.mac.api = ['not']; - - // is current operating system windows? - is.windows = function() { - return /win/i.test(appVersion); - }; - // windows method does not support 'all' and 'any' interfaces - is.windows.api = ['not']; - - // is current device windows phone? - is.windowsPhone = function() { - return is.windows() && /phone/i.test(userAgent); - }; - // windowsPhone method does not support 'all' and 'any' interfaces - is.windowsPhone.api = ['not']; - - // is current device windows tablet? - is.windowsTablet = function() { - return is.windows() && is.not.windowsPhone() && /touch/i.test(userAgent); - }; - // windowsTablet method does not support 'all' and 'any' interfaces - is.windowsTablet.api = ['not']; - - // is current device mobile? - is.mobile = function() { - return is.iphone() || is.ipod() || is.androidPhone() || is.blackberry() || is.windowsPhone(); - }; - // mobile method does not support 'all' and 'any' interfaces - is.mobile.api = ['not']; - - // is current device tablet? - is.tablet = function() { - return is.ipad() || is.androidTablet() || is.windowsTablet(); - }; - // tablet method does not support 'all' and 'any' interfaces - is.tablet.api = ['not']; - - // is current state online? - is.online = function() { - return navigator.onLine; - }; - // online method does not support 'all' and 'any' interfaces - is.online.api = ['not']; - - // is current state offline? - is.offline = not(is.online); - // offline method does not support 'all' and 'any' interfaces - is.offline.api = ['not']; - } - - // Object checks - /* -------------------------------------------------------------------------- */ - - // has a given object got parameterized count property? - is.propertyCount = function(obj, count) { - if(!is.object(obj) || !is.number(count)) { - return false; - } - if(Object.keys) { - return Object.keys(obj).length === count; - } - var properties = [], - property; - for(property in obj) { - if (hasOwnProperty.call(obj, property)) { - properties.push(property); - } - } - return properties.length === count; - }; - // propertyCount method does not support 'all' and 'any' interfaces - is.propertyCount.api = ['not']; - - // is given object has parameterized property? - is.propertyDefined = function(obj, property) { - return is.object(obj) && is.string(property) && property in obj; - }; - // propertyDefined method does not support 'all' and 'any' interfaces - is.propertyDefined.api = ['not']; - - // is a given object window? - // setInterval method is only available for window object - is.windowObject = function(obj) { - return typeof obj === 'object' && 'setInterval' in obj; - }; - - // is a given object a DOM node? - is.domNode = function(obj) { - return is.object(obj) && obj.nodeType > 0; - }; - - // Array checks - /* -------------------------------------------------------------------------- */ - - // is a given item in an array? - is.inArray = function(val, arr){ - if(is.not.array(arr)) { - return false; - } - for(var i = 0; i < arr.length; i++) { - if (arr[i] === val) return true; - } - return false; - }; - // inArray method does not support 'all' and 'any' interfaces - is.inArray.api = ['not']; - - // is a given array sorted? - is.sorted = function(arr) { - if(is.not.array(arr)) { - return false; - } - for(var i = 0; i < arr.length; i++) { - if(arr[i] > arr[i + 1]) return false; - } - return true; - }; - - // API - // Set 'not', 'all' and 'any' interfaces to methods based on their api property - /* -------------------------------------------------------------------------- */ - - function setInterfaces() { - var options = is; - for(var option in options) { - if(hasOwnProperty.call(options, option) && is.function(options[option])) { - var interfaces = options[option].api || ['not', 'all', 'any']; - for (var i = 0; i < interfaces.length; i++) { - if(interfaces[i] === 'not') { - is.not[option] = not(is[option]); - } - if(interfaces[i] === 'all') { - is.all[option] = all(is[option]); - } - if(interfaces[i] === 'any') { - is.any[option] = any(is[option]); - } - } - } - } - } - setInterfaces(); - - // Configuration methods - // Intentionally added after setInterfaces function - /* -------------------------------------------------------------------------- */ - - // set optional regexps to methods if you think they suck - is.setRegexp = function(regexp, regexpName) { - for(var r in regexps) { - if(hasOwnProperty.call(regexps, r) && (regexpName === r)) { - regexps[r] = regexp; - } - } - }; - - // change namespace of library to prevent name collisions - // var preferredName = is.setNamespace(); - // preferredName.odd(3); - // => true - is.setNamespace = function() { - root.is = previousIs; - return this; - }; - - return is; -})); diff --git a/vendors/is.js/is.min.js b/vendors/is.js/is.min.js deleted file mode 100644 index 3aa617a79..000000000 --- a/vendors/is.js/is.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(a,b){"function"==typeof define&&define.amd?define(["is"],function(c){return a.is=b(c)}):"object"==typeof exports?module.exports=b(require("is_js")):a.is=b(a.is)}(this,function(a){function b(a){return function(){return!a.apply(null,j.call(arguments))}}function c(b){return function(){var c=j.call(arguments),d=c.length;1===d&&a.array(c[0])&&(c=c[0],d=c.length);for(var e=0;d>e;e++)if(!b.call(null,c[e]))return!1;return!0}}function d(b){return function(){var c=j.call(arguments),d=c.length;1===d&&a.array(c[0])&&(c=c[0],d=c.length);for(var e=0;d>e;e++)if(b.call(null,c[e]))return!0;return!1}}function e(b,c){a[b]=function(a){return c[b].test(a)}}function f(){var e=a;for(var f in e)if(k.call(e,f)&&a["function"](e[f]))for(var g=e[f].api||["not","all","any"],h=0;h8&&14>c||32===c}return!1},a.equal=function(b,c){return a.all.number(b,c)?b===c&&1/b===1/c:a.all.string(b,c)||a.all.regexp(b,c)?""+b==""+c:a.all["boolean"](b,c)?b===c:!1},a.equal.api=["not"],a.even=function(b){return a.number(b)&&b%2===0},a.odd=function(b){return a.number(b)&&b%2!==0},a.positive=function(b){return a.number(b)&&b>0},a.negative=function(b){return a.number(b)&&0>b},a.above=function(b,c){return a.all.number(b,c)&&b>c},a.above.api=["not"],a.under=function(b,c){return a.all.number(b,c)&&c>b},a.under.api=["not"],a.within=function(b,c,d){return a.all.number(b,c,d)&&b>c&&d>b},a.within.api=["not"],a.decimal=function(b){return a.number(b)&&b%1!==0},a.integer=function(b){return a.number(b)&&b%1===0},a.finite=isFinite||function(b){return 1/0!==b&&b!==-1/0&&a.not.nan(b)},a.infinite=b(a.finite);var l={url:/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/,email:/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,creditCard:/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/,alphaNumeric:/^[A-Za-z0-9]+$/,timeString:/^(2[0-3]|[01]?[0-9]):([0-5]?[0-9]):([0-5]?[0-9])$/,dateString:/^(1[0-2]|0?[1-9])\/(3[01]|[12][0-9]|0?[1-9])\/(?:[0-9]{2})?[0-9]{2}$/,usZipCode:/^[0-9]{5}(?:-[0-9]{4})?$/,caPostalCode:/^(?!.*[DFIOQU])[A-VXY][0-9][A-Z]\s?[0-9][A-Z][0-9]$/,ukPostCode:/^[A-Z]{1,2}[0-9RCHNQ][0-9A-Z]?\s?[0-9][ABD-HJLNP-UW-Z]{2}$|^[A-Z]{2}-?[0-9]{4}$/,nanpPhone:/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/,eppPhone:/^\+[0-9]{1,3}\.[0-9]{4,14}(?:x.+)?$/,socialSecurityNumber:/^(?!000|666)[0-8][0-9]{2}-(?!00)[0-9]{2}-(?!0000)[0-9]{4}$/,affirmative:/^(?:1|t(?:rue)?|y(?:es)?|ok(?:ay)?)$/,hexadecimal:/^[0-9a-fA-F]+$/,hexColor:/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,ipv4:/^(?:(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(?:\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])$/,ipv6:/^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$|^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,ip:/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$|^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/};for(var m in l)l.hasOwnProperty(m)&&e(m,l);a.include=String.prototype.includes||function(a,b){return a.indexOf(b)>-1},a.include.api=["not"],a.upperCase=function(b){return a.string(b)&&b===b.toUpperCase()},a.lowerCase=function(b){return a.string(b)&&b===b.toLowerCase()},a.startWith=function(b,c){return a.string(b)&&0===b.indexOf(c)},a.startWith.api=["not"],a.endWith=function(b,c){return a.string(b)&&b.indexOf(c)>-1&&b.indexOf(c)===b.length-c.length},a.endWith.api=["not"],a.capitalized=function(b){if(a.not.string(b))return!1;for(var c=b.split(" "),d=[],e=0;ef&&g>e},a.inDateRange.api=["not"],a.inLastWeek=function(b){return a.inDateRange(b,new Date((new Date).setDate((new Date).getDate()-7)),new Date)},a.inLastMonth=function(b){return a.inDateRange(b,new Date((new Date).setMonth((new Date).getMonth()-1)),new Date)},a.inLastYear=function(b){return a.inDateRange(b,new Date((new Date).setFullYear((new Date).getFullYear()-1)),new Date)},a.inNextWeek=function(b){return a.inDateRange(b,new Date,new Date((new Date).setDate((new Date).getDate()+7)))},a.inNextMonth=function(b){return a.inDateRange(b,new Date,new Date((new Date).setMonth((new Date).getMonth()+1)))},a.inNextYear=function(b){return a.inDateRange(b,new Date,new Date((new Date).setFullYear((new Date).getFullYear()+1)))},a.quarterOfYear=function(b,c){return a.date(b)&&a.number(c)&&c===Math.floor((b.getMonth()+3)/3)},a.quarterOfYear.api=["not"],a.dayLightSavingTime=function(a){var b=new Date(a.getFullYear(),0,1),c=new Date(a.getFullYear(),6,1),d=Math.max(b.getTimezoneOffset(),c.getTimezoneOffset());return a.getTimezoneOffset()=11?"ActiveXObject"in window:new RegExp("msie "+a).test(p):/msie/i.test(p)||"ActiveXObject"in window},a.ie.api=["not"],a.opera=function(){return/^Opera\//.test(p)||/\x20OPR\//.test(p)},a.opera.api=["not"],a.safari=function(){return/safari/i.test(p)&&/apple computer/i.test(q)},a.safari.api=["not"],a.ios=function(){return a.iphone()||a.ipad()||a.ipod()},a.ios.api=["not"],a.iphone=function(){return/iphone/i.test(p)},a.iphone.api=["not"],a.ipad=function(){return/ipad/i.test(p)},a.ipad.api=["not"],a.ipod=function(){return/ipod/i.test(p)},a.ipod.api=["not"],a.android=function(){return/android/i.test(p)},a.android.api=["not"],a.androidPhone=function(){return/android/i.test(p)&&/mobile/i.test(p)},a.androidPhone.api=["not"],a.androidTablet=function(){return/android/i.test(p)&&!/mobile/i.test(p)},a.androidTablet.api=["not"],a.blackberry=function(){return/blackberry/i.test(p)},a.blackberry.api=["not"],a.desktop=function(){return a.not.mobile()&&a.not.tablet()},a.desktop.api=["not"],a.linux=function(){return/linux/i.test(r)},a.linux.api=["not"],a.mac=function(){return/mac/i.test(r)},a.mac.api=["not"],a.windows=function(){return/win/i.test(r)},a.windows.api=["not"],a.windowsPhone=function(){return a.windows()&&/phone/i.test(p)},a.windowsPhone.api=["not"],a.windowsTablet=function(){return a.windows()&&a.not.windowsPhone()&&/touch/i.test(p)},a.windowsTablet.api=["not"],a.mobile=function(){return a.iphone()||a.ipod()||a.androidPhone()||a.blackberry()||a.windowsPhone()},a.mobile.api=["not"],a.tablet=function(){return a.ipad()||a.androidTablet()||a.windowsTablet()},a.tablet.api=["not"],a.online=function(){return navigator.onLine},a.online.api=["not"],a.offline=b(a.online),a.offline.api=["not"]}return a.propertyCount=function(b,c){if(!a.object(b)||!a.number(c))return!1;if(Object.keys)return Object.keys(b).length===c;var d,e=[];for(d in b)k.call(b,d)&&e.push(d);return e.length===c},a.propertyCount.api=["not"],a.propertyDefined=function(b,c){return a.object(b)&&a.string(c)&&c in b},a.propertyDefined.api=["not"],a.windowObject=function(a){return"object"==typeof a&&"setInterval"in a},a.domNode=function(b){return a.object(b)&&b.nodeType>0},a.inArray=function(b,c){if(a.not.array(c))return!1;for(var d=0;db[c+1])return!1;return!0},f(),a.setRegexp=function(a,b){for(var c in l)k.call(l,c)&&b===c&&(l[c]=a)},a.setNamespace=function(){return g.is=h,this},a}); \ No newline at end of file diff --git a/vendors/is.js/package.json b/vendors/is.js/package.json deleted file mode 100644 index d179a84c7..000000000 --- a/vendors/is.js/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "is_js", - "version": "0.6.0", - "main": "is.js", - "license": "MIT", - "devDependencies": { - "grunt": "~0.4.5", - "grunt-contrib-jshint": "~0.10.0", - "grunt-contrib-uglify": "~0.5.0", - "grunt-mocha-phantomjs": "0.6.0" - } -} diff --git a/vendors/jquery-magnific-popup/LICENSE b/vendors/jquery-magnific-popup/LICENSE deleted file mode 100644 index f6ea3a9d4..000000000 --- a/vendors/jquery-magnific-popup/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Dmitry Semenov, http://dimsemenov.com - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendors/jquery-magnific-popup/README.md b/vendors/jquery-magnific-popup/README.md deleted file mode 100644 index 3254c223d..000000000 --- a/vendors/jquery-magnific-popup/README.md +++ /dev/null @@ -1,69 +0,0 @@ -# Magnific Popup Repository - -[![Build Status](https://travis-ci.org/dimsemenov/Magnific-Popup.png)](https://travis-ci.org/dimsemenov/Magnific-Popup) - -Fast, light and responsive lightbox plugin, for jQuery and Zepto.js. - -- [Documentation and getting started guide](http://dimsemenov.com/plugins/magnific-popup/documentation.html). -- [Examples and plugin home page](http://dimsemenov.com/plugins/magnific-popup/). -- More examples in [CodePen collection](http://codepen.io/collection/nLcqo). - -Optionally, install via Bower: `bower install magnific-popup`. -[Ruby gem](https://rubygems.org/gems/magnific-popup-rails), `gem install magnific-popup-rails`. - -## Extensions - -- WordPress plugin - [under development](http://dimsemenov.com/plugins/magnific-popup/wordpress.html). -- [Drupal module](https://drupal.org/project/magnific_popup). -- [Concrete5 add-on](https://github.com/cdowdy/concrete5-Magnific-Popup). -- [Redaxo add-on](http://www.redaxo.org/de/download/addons/?addon_id=1131). -- [Contao extension](https://github.com/fritzmg/contao-magnific-popup). - -If you created an extension for some CMS, email me and I'll add it to this list. - -## Location of stuff - -- Generated popup JS and CSS files are in folder [dist/](https://github.com/dimsemenov/Magnific-Popup/tree/master/dist). (Online build tool is on [documentation page](http://dimsemenov.com/plugins/magnific-popup/documentation.html)). -- Source files are in folder [src/](https://github.com/dimsemenov/Magnific-Popup/tree/master/src). They include [Sass CSS file](https://github.com/dimsemenov/Magnific-Popup/blob/master/src/css/main.scss) and js parts (edit them if you wish to submit commit). -- Website (examples & documentation) is in folder [website/](https://github.com/dimsemenov/Magnific-Popup/tree/master/website). -- Documentation page itself is in [website/documentation.md](https://github.com/dimsemenov/Magnific-Popup/blob/master/website/documentation.md) (contributions to it are very welcome). - - - -## Using Magnific Popup? - -If you used Magnific Popup in some interesting way, or on site of popular brand, I'd be very grateful if you shoot me a link to it. - - -## Build - -To compile Magnific Popup by yourself, first of make sure that you have [Node.js](http://nodejs.org/), [Grunt.js](https://github.com/cowboy/grunt), [Ruby](http://www.ruby-lang.org/) and [Jekyll](https://github.com/mojombo/jekyll/) installed, then: - -1) Copy repository - - git clone https://github.com/dimsemenov/Magnific-Popup.git - -2) Go inside Magnific Popup folder that you fetched and install Node dependencies - - cd Magnific-Popup && npm install - -3) Now simply run `grunt` to generate JS and CSS in folder `dist` and site in folder `_site/`. - - grunt - -Optionally: - -- Run `grunt watch` to automatically rebuild script when you change files in `src/` or in `website/`. -- If you don't have and don't want to install Jekyll, run `grunt nosite` to just build JS and CSS files related to popup in `dist/`. - - - -## [Changelog](https://github.com/dimsemenov/Magnific-Popup/releases) - -## License - -Script is MIT licensed and free and will always be kept this way. But has a small restriction from me - please do not create public WordPress plugin based on it(or at least contact me before creating it), because I will make it and it'll be open source too ([want to get notified?](http://dimsemenov.com/subscribe.html)). - -Created by [@dimsemenov](http://twitter.com/dimsemenov) & [contributors](https://github.com/dimsemenov/Magnific-Popup/contributors). - -[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/dimsemenov/magnific-popup/trend.png)](https://bitdeli.com/free "Bitdeli Badge") diff --git a/vendors/jquery-magnific-popup/bower.json b/vendors/jquery-magnific-popup/bower.json deleted file mode 100644 index 0c84a6bd3..000000000 --- a/vendors/jquery-magnific-popup/bower.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "magnific-popup", - "version": "0.9.9", - "main": [ - "dist/jquery.magnific-popup.js", - "dist/magnific-popup.css" - ], - "dependencies": { - "jquery": ">=1.8.0" - }, - "ignore": [ - "node_modules/", - "components/", - "website/", - "libs/" - ] -} \ No newline at end of file diff --git a/vendors/jquery-magnific-popup/jquery.magnific-popup.js b/vendors/jquery-magnific-popup/jquery.magnific-popup.js deleted file mode 100644 index 4d6985477..000000000 --- a/vendors/jquery-magnific-popup/jquery.magnific-popup.js +++ /dev/null @@ -1,2048 +0,0 @@ -/*! Magnific Popup - v0.9.9 - 2014-09-06 -* http://dimsemenov.com/plugins/magnific-popup/ -* Copyright (c) 2014 Dmitry Semenov; */ -;(function($) { - -/*>>core*/ -/** - * - * Magnific Popup Core JS file - * - */ - - -/** - * Private static constants - */ -var CLOSE_EVENT = 'Close', - BEFORE_CLOSE_EVENT = 'BeforeClose', - AFTER_CLOSE_EVENT = 'AfterClose', - BEFORE_APPEND_EVENT = 'BeforeAppend', - MARKUP_PARSE_EVENT = 'MarkupParse', - OPEN_EVENT = 'Open', - CHANGE_EVENT = 'Change', - NS = 'mfp', - EVENT_NS = '.' + NS, - READY_CLASS = 'mfp-ready', - REMOVING_CLASS = 'mfp-removing', - PREVENT_CLOSE_CLASS = 'mfp-prevent-close'; - - -/** - * Private vars - */ -var mfp, // As we have only one instance of MagnificPopup object, we define it locally to not to use 'this' - MagnificPopup = function(){}, - _isJQ = !!(window.jQuery), - _prevStatus, - _window = $(window), - _body, - _document, - _prevContentType, - _wrapClasses, - _currPopupType; - - -/** - * Private functions - */ -var _mfpOn = function(name, f) { - mfp.ev.on(NS + name + EVENT_NS, f); - }, - _getEl = function(className, appendTo, html, raw) { - var el = document.createElement('div'); - el.className = 'mfp-'+className; - if(html) { - el.innerHTML = html; - } - if(!raw) { - el = $(el); - if(appendTo) { - el.appendTo(appendTo); - } - } else if(appendTo) { - appendTo.appendChild(el); - } - return el; - }, - _mfpTrigger = function(e, data) { - mfp.ev.triggerHandler(NS + e, data); - - if(mfp.st.callbacks) { - // converts "mfpEventName" to "eventName" callback and triggers it if it's present - e = e.charAt(0).toLowerCase() + e.slice(1); - if(mfp.st.callbacks[e]) { - mfp.st.callbacks[e].apply(mfp, $.isArray(data) ? data : [data]); - } - } - }, - _getCloseBtn = function(type) { - if(type !== _currPopupType || !mfp.currTemplate.closeBtn) { - mfp.currTemplate.closeBtn = $( mfp.st.closeMarkup.replace('%title%', mfp.st.tClose ) ); - _currPopupType = type; - } - return mfp.currTemplate.closeBtn; - }, - // Initialize Magnific Popup only when called at least once - _checkInstance = function() { - if(!$.magnificPopup.instance) { - mfp = new MagnificPopup(); - mfp.init(); - $.magnificPopup.instance = mfp; - } - }, - // CSS transition detection, http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr - supportsTransitions = function() { - var s = document.createElement('p').style, // 's' for style. better to create an element if body yet to exist - v = ['ms','O','Moz','Webkit']; // 'v' for vendor - - if( s['transition'] !== undefined ) { - return true; - } - - while( v.length ) { - if( v.pop() + 'Transition' in s ) { - return true; - } - } - - return false; - }; - - - -/** - * Public functions - */ -MagnificPopup.prototype = { - - constructor: MagnificPopup, - - /** - * Initializes Magnific Popup plugin. - * This function is triggered only once when $.fn.magnificPopup or $.magnificPopup is executed - */ - init: function() { - var appVersion = navigator.appVersion; - mfp.isIE7 = appVersion.indexOf("MSIE 7.") !== -1; - mfp.isIE8 = appVersion.indexOf("MSIE 8.") !== -1; - mfp.isLowIE = mfp.isIE7 || mfp.isIE8; - mfp.isAndroid = (/android/gi).test(appVersion); - mfp.isIOS = (/iphone|ipad|ipod/gi).test(appVersion); - mfp.supportsTransition = supportsTransitions(); - - // We disable fixed positioned lightbox on devices that don't handle it nicely. - // If you know a better way of detecting this - let me know. - mfp.probablyMobile = (mfp.isAndroid || mfp.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent) ); - _document = $(document); - - mfp.popupsCache = {}; - }, - - /** - * Opens popup - * @param data [description] - */ - open: function(data) { - - if(!_body) { - _body = $(document.body); - } - - var i; - - if(data.isObj === false) { - // convert jQuery collection to array to avoid conflicts later - mfp.items = data.items.toArray(); - - mfp.index = 0; - var items = data.items, - item; - for(i = 0; i < items.length; i++) { - item = items[i]; - if(item.parsed) { - item = item.el[0]; - } - if(item === data.el[0]) { - mfp.index = i; - break; - } - } - } else { - mfp.items = $.isArray(data.items) ? data.items : [data.items]; - mfp.index = data.index || 0; - } - - // if popup is already opened - we just update the content - if(mfp.isOpen) { - mfp.updateItemHTML(); - return; - } - - mfp.types = []; - _wrapClasses = ''; - if(data.mainEl && data.mainEl.length) { - mfp.ev = data.mainEl.eq(0); - } else { - mfp.ev = _document; - } - - if(data.key) { - if(!mfp.popupsCache[data.key]) { - mfp.popupsCache[data.key] = {}; - } - mfp.currTemplate = mfp.popupsCache[data.key]; - } else { - mfp.currTemplate = {}; - } - - - - mfp.st = $.extend(true, {}, $.magnificPopup.defaults, data ); - mfp.fixedContentPos = mfp.st.fixedContentPos === 'auto' ? !mfp.probablyMobile : mfp.st.fixedContentPos; - - if(mfp.st.modal) { - mfp.st.closeOnContentClick = false; - mfp.st.closeOnBgClick = false; - mfp.st.showCloseBtn = false; - mfp.st.enableEscapeKey = false; - } - - - // Building markup - // main containers are created only once - if(!mfp.bgOverlay) { - - // Dark overlay - mfp.bgOverlay = _getEl('bg').on('click'+EVENT_NS, function() { - mfp.close(); - }); - - mfp.wrap = _getEl('wrap').attr('tabindex', -1).on('click'+EVENT_NS, function(e) { - if(mfp._checkIfClose(e.target)) { - mfp.close(); - } - }); - - mfp.container = _getEl('container', mfp.wrap); - } - - mfp.contentContainer = _getEl('content'); - if(mfp.st.preloader) { - mfp.preloader = _getEl('preloader', mfp.container, mfp.st.tLoading); - } - - - // Initializing modules - var modules = $.magnificPopup.modules; - for(i = 0; i < modules.length; i++) { - var n = modules[i]; - n = n.charAt(0).toUpperCase() + n.slice(1); - mfp['init'+n].call(mfp); - } - _mfpTrigger('BeforeOpen'); - - - if(mfp.st.showCloseBtn) { - // Close button - if(!mfp.st.closeBtnInside) { - mfp.wrap.append( _getCloseBtn() ); - } else { - _mfpOn(MARKUP_PARSE_EVENT, function(e, template, values, item) { - values.close_replaceWith = _getCloseBtn(item.type); - }); - _wrapClasses += ' mfp-close-btn-in'; - } - } - - if(mfp.st.alignTop) { - _wrapClasses += ' mfp-align-top'; - } - - - - if(mfp.fixedContentPos) { - mfp.wrap.css({ - overflow: mfp.st.overflowY, - overflowX: 'hidden', - overflowY: mfp.st.overflowY - }); - } else { - mfp.wrap.css({ - top: _window.scrollTop(), - position: 'absolute' - }); - } - if( mfp.st.fixedBgPos === false || (mfp.st.fixedBgPos === 'auto' && !mfp.fixedContentPos) ) { - mfp.bgOverlay.css({ - height: _document.height(), - position: 'absolute' - }); - } - - - - if(mfp.st.enableEscapeKey) { - // Close on ESC key - _document.on('keyup' + EVENT_NS, function(e) { - if(e.keyCode === 27) { - mfp.close(); - } - }); - } - - _window.on('resize' + EVENT_NS, function() { - mfp.updateSize(); - }); - - - if(!mfp.st.closeOnContentClick) { - _wrapClasses += ' mfp-auto-cursor'; - } - - if(_wrapClasses) - mfp.wrap.addClass(_wrapClasses); - - - // this triggers recalculation of layout, so we get it once to not to trigger twice - var windowHeight = mfp.wH = _window.height(); - - - var windowStyles = {}; - - if( mfp.fixedContentPos ) { - if(mfp._hasScrollBar(windowHeight)){ - var s = mfp._getScrollbarSize(); - if(s) { - windowStyles.marginRight = s; - } - } - } - - if(mfp.fixedContentPos) { - if(!mfp.isIE7) { - windowStyles.overflow = 'hidden'; - } else { - // ie7 double-scroll bug - $('body, html').css('overflow', 'hidden'); - } - } - - - - var classesToadd = mfp.st.mainClass; - if(mfp.isIE7) { - classesToadd += ' mfp-ie7'; - } - if(classesToadd) { - mfp._addClassToMFP( classesToadd ); - } - - // add content - mfp.updateItemHTML(); - - _mfpTrigger('BuildControls'); - - // remove scrollbar, add margin e.t.c - $('html').css(windowStyles); - - // add everything to DOM - mfp.bgOverlay.add(mfp.wrap).prependTo( mfp.st.prependTo || _body ); - - // Save last focused element - mfp._lastFocusedEl = document.activeElement; - - // Wait for next cycle to allow CSS transition - setTimeout(function() { - - if(mfp.content) { - mfp._addClassToMFP(READY_CLASS); - mfp._setFocus(); - } else { - // if content is not defined (not loaded e.t.c) we add class only for BG - mfp.bgOverlay.addClass(READY_CLASS); - } - - // Trap the focus in popup - _document.on('focusin' + EVENT_NS, mfp._onFocusIn); - - }, 16); - - mfp.isOpen = true; - mfp.updateSize(windowHeight); - _mfpTrigger(OPEN_EVENT); - - return data; - }, - - /** - * Closes the popup - */ - close: function() { - if(!mfp.isOpen) return; - _mfpTrigger(BEFORE_CLOSE_EVENT); - - mfp.isOpen = false; - // for CSS3 animation - if(mfp.st.removalDelay && !mfp.isLowIE && mfp.supportsTransition ) { - mfp._addClassToMFP(REMOVING_CLASS); - setTimeout(function() { - mfp._close(); - }, mfp.st.removalDelay); - } else { - mfp._close(); - } - }, - - /** - * Helper for close() function - */ - _close: function() { - _mfpTrigger(CLOSE_EVENT); - - var classesToRemove = REMOVING_CLASS + ' ' + READY_CLASS + ' '; - - mfp.bgOverlay.detach(); - mfp.wrap.detach(); - mfp.container.empty(); - - if(mfp.st.mainClass) { - classesToRemove += mfp.st.mainClass + ' '; - } - - mfp._removeClassFromMFP(classesToRemove); - - if(mfp.fixedContentPos) { - var windowStyles = {marginRight: ''}; - if(mfp.isIE7) { - $('body, html').css('overflow', ''); - } else { - windowStyles.overflow = ''; - } - $('html').css(windowStyles); - } - - _document.off('keyup' + EVENT_NS + ' focusin' + EVENT_NS); - mfp.ev.off(EVENT_NS); - - // clean up DOM elements that aren't removed - mfp.wrap.attr('class', 'mfp-wrap').removeAttr('style'); - mfp.bgOverlay.attr('class', 'mfp-bg'); - mfp.container.attr('class', 'mfp-container'); - - // remove close button from target element - if(mfp.st.showCloseBtn && - (!mfp.st.closeBtnInside || mfp.currTemplate[mfp.currItem.type] === true)) { - if(mfp.currTemplate.closeBtn) - mfp.currTemplate.closeBtn.detach(); - } - - - if(mfp._lastFocusedEl) { - $(mfp._lastFocusedEl).focus(); // put tab focus back - } - mfp.currItem = null; - mfp.content = null; - mfp.currTemplate = null; - mfp.prevHeight = 0; - - _mfpTrigger(AFTER_CLOSE_EVENT); - }, - - updateSize: function(winHeight) { - - if(mfp.isIOS) { - // fixes iOS nav bars https://github.com/dimsemenov/Magnific-Popup/issues/2 - var zoomLevel = document.documentElement.clientWidth / window.innerWidth; - var height = window.innerHeight * zoomLevel; - mfp.wrap.css('height', height); - mfp.wH = height; - } else { - mfp.wH = winHeight || _window.height(); - } - // Fixes #84: popup incorrectly positioned with position:relative on body - if(!mfp.fixedContentPos) { - mfp.wrap.css('height', mfp.wH); - } - - _mfpTrigger('Resize'); - - }, - - /** - * Set content of popup based on current index - */ - updateItemHTML: function() { - var item = mfp.items[mfp.index]; - - // Detach and perform modifications - mfp.contentContainer.detach(); - - if(mfp.content) - mfp.content.detach(); - - if(!item.parsed) { - item = mfp.parseEl( mfp.index ); - } - - var type = item.type; - - _mfpTrigger('BeforeChange', [mfp.currItem ? mfp.currItem.type : '', type]); - // BeforeChange event works like so: - // _mfpOn('BeforeChange', function(e, prevType, newType) { }); - - mfp.currItem = item; - - - - - - if(!mfp.currTemplate[type]) { - var markup = mfp.st[type] ? mfp.st[type].markup : false; - - // allows to modify markup - _mfpTrigger('FirstMarkupParse', markup); - - if(markup) { - mfp.currTemplate[type] = $(markup); - } else { - // if there is no markup found we just define that template is parsed - mfp.currTemplate[type] = true; - } - } - - if(_prevContentType && _prevContentType !== item.type) { - mfp.container.removeClass('mfp-'+_prevContentType+'-holder'); - } - - var newContent = mfp['get' + type.charAt(0).toUpperCase() + type.slice(1)](item, mfp.currTemplate[type]); - mfp.appendContent(newContent, type); - - item.preloaded = true; - - _mfpTrigger(CHANGE_EVENT, item); - _prevContentType = item.type; - - // Append container back after its content changed - mfp.container.prepend(mfp.contentContainer); - - _mfpTrigger('AfterChange'); - }, - - - /** - * Set HTML content of popup - */ - appendContent: function(newContent, type) { - mfp.content = newContent; - - if(newContent) { - if(mfp.st.showCloseBtn && mfp.st.closeBtnInside && - mfp.currTemplate[type] === true) { - // if there is no markup, we just append close button element inside - if(!mfp.content.find('.mfp-close').length) { - mfp.content.append(_getCloseBtn()); - } - } else { - mfp.content = newContent; - } - } else { - mfp.content = ''; - } - - _mfpTrigger(BEFORE_APPEND_EVENT); - mfp.container.addClass('mfp-'+type+'-holder'); - - mfp.contentContainer.append(mfp.content); - }, - - - - - /** - * Creates Magnific Popup data object based on given data - * @param {int} index Index of item to parse - */ - parseEl: function(index) { - var item = mfp.items[index], - type; - - if(item.tagName) { - item = { el: $(item) }; - } else { - type = item.type; - item = { data: item, src: item.src }; - } - - if(item.el) { - var types = mfp.types; - - // check for 'mfp-TYPE' class - for(var i = 0; i < types.length; i++) { - if( item.el.hasClass('mfp-'+types[i]) ) { - type = types[i]; - break; - } - } - - item.src = item.el.attr('data-mfp-src'); - if(!item.src) { - item.src = item.el.attr('href'); - } - } - - item.type = type || mfp.st.type || 'inline'; - item.index = index; - item.parsed = true; - mfp.items[index] = item; - _mfpTrigger('ElementParse', item); - - return mfp.items[index]; - }, - - - /** - * Initializes single popup or a group of popups - */ - addGroup: function(el, options) { - var eHandler = function(e) { - e.mfpEl = this; - mfp._openClick(e, el, options); - }; - - if(!options) { - options = {}; - } - - var eName = 'click.magnificPopup'; - options.mainEl = el; - - if(options.items) { - options.isObj = true; - el.off(eName).on(eName, eHandler); - } else { - options.isObj = false; - if(options.delegate) { - el.off(eName).on(eName, options.delegate , eHandler); - } else { - options.items = el; - el.off(eName).on(eName, eHandler); - } - } - }, - _openClick: function(e, el, options) { - var midClick = options.midClick !== undefined ? options.midClick : $.magnificPopup.defaults.midClick; - - - if(!midClick && ( e.which === 2 || e.ctrlKey || e.metaKey ) ) { - return; - } - - var disableOn = options.disableOn !== undefined ? options.disableOn : $.magnificPopup.defaults.disableOn; - - if(disableOn) { - if($.isFunction(disableOn)) { - if( !disableOn.call(mfp) ) { - return true; - } - } else { // else it's number - if( _window.width() < disableOn ) { - return true; - } - } - } - - if(e.type) { - e.preventDefault(); - - // This will prevent popup from closing if element is inside and popup is already opened - if(mfp.isOpen) { - e.stopPropagation(); - } - } - - - options.el = $(e.mfpEl); - if(options.delegate) { - options.items = el.find(options.delegate); - } - mfp.open(options); - }, - - - /** - * Updates text on preloader - */ - updateStatus: function(status, text) { - - if(mfp.preloader) { - if(_prevStatus !== status) { - mfp.container.removeClass('mfp-s-'+_prevStatus); - } - - if(!text && status === 'loading') { - text = mfp.st.tLoading; - } - - var data = { - status: status, - text: text - }; - // allows to modify status - _mfpTrigger('UpdateStatus', data); - - status = data.status; - text = data.text; - - mfp.preloader.html(text); - - mfp.preloader.find('a').on('click', function(e) { - e.stopImmediatePropagation(); - }); - - mfp.container.addClass('mfp-s-'+status); - _prevStatus = status; - } - }, - - - /* - "Private" helpers that aren't private at all - */ - // Check to close popup or not - // "target" is an element that was clicked - _checkIfClose: function(target) { - - if($(target).hasClass(PREVENT_CLOSE_CLASS)) { - return; - } - - var closeOnContent = mfp.st.closeOnContentClick; - var closeOnBg = mfp.st.closeOnBgClick; - - if(closeOnContent && closeOnBg) { - return true; - } else { - - // We close the popup if click is on close button or on preloader. Or if there is no content. - if(!mfp.content || $(target).hasClass('mfp-close') || (mfp.preloader && target === mfp.preloader[0]) ) { - return true; - } - - // if click is outside the content - if( (target !== mfp.content[0] && !$.contains(mfp.content[0], target)) ) { - if(closeOnBg) { - // last check, if the clicked element is in DOM, (in case it's removed onclick) - if( $.contains(document, target) ) { - return true; - } - } - } else if(closeOnContent) { - return true; - } - - } - return false; - }, - _addClassToMFP: function(cName) { - mfp.bgOverlay.addClass(cName); - mfp.wrap.addClass(cName); - }, - _removeClassFromMFP: function(cName) { - this.bgOverlay.removeClass(cName); - mfp.wrap.removeClass(cName); - }, - _hasScrollBar: function(winHeight) { - return ( (mfp.isIE7 ? _document.height() : document.body.scrollHeight) > (winHeight || _window.height()) ); - }, - _setFocus: function() { - (mfp.st.focus ? mfp.content.find(mfp.st.focus).eq(0) : mfp.wrap).focus(); - }, - _onFocusIn: function(e) { - if( e.target !== mfp.wrap[0] && !$.contains(mfp.wrap[0], e.target) ) { - mfp._setFocus(); - return false; - } - }, - _parseMarkup: function(template, values, item) { - var arr; - if(item.data) { - values = $.extend(item.data, values); - } - _mfpTrigger(MARKUP_PARSE_EVENT, [template, values, item] ); - - $.each(values, function(key, value) { - if(value === undefined || value === false) { - return true; - } - arr = key.split('_'); - if(arr.length > 1) { - var el = template.find(EVENT_NS + '-'+arr[0]); - - if(el.length > 0) { - var attr = arr[1]; - if(attr === 'replaceWith') { - if(el[0] !== value[0]) { - el.replaceWith(value); - } - } else if(attr === 'img') { - if(el.is('img')) { - el.attr('src', value); - } else { - el.replaceWith( '' ); - } - } else { - el.attr(arr[1], value); - } - } - - } else { - template.find(EVENT_NS + '-'+key).html(value); - } - }); - }, - - _getScrollbarSize: function() { - // thx David - if(mfp.scrollbarSize === undefined) { - var scrollDiv = document.createElement("div"); - scrollDiv.style.cssText = 'width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;'; - document.body.appendChild(scrollDiv); - mfp.scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth; - document.body.removeChild(scrollDiv); - } - return mfp.scrollbarSize; - } - -}; /* MagnificPopup core prototype end */ - - - - -/** - * Public static functions - */ -$.magnificPopup = { - instance: null, - proto: MagnificPopup.prototype, - modules: [], - - open: function(options, index) { - _checkInstance(); - - if(!options) { - options = {}; - } else { - options = $.extend(true, {}, options); - } - - - options.isObj = true; - options.index = index || 0; - return this.instance.open(options); - }, - - close: function() { - return $.magnificPopup.instance && $.magnificPopup.instance.close(); - }, - - registerModule: function(name, module) { - if(module.options) { - $.magnificPopup.defaults[name] = module.options; - } - $.extend(this.proto, module.proto); - this.modules.push(name); - }, - - defaults: { - - // Info about options is in docs: - // http://dimsemenov.com/plugins/magnific-popup/documentation.html#options - - disableOn: 0, - - key: null, - - midClick: false, - - mainClass: '', - - preloader: true, - - focus: '', // CSS selector of input to focus after popup is opened - - closeOnContentClick: false, - - closeOnBgClick: true, - - closeBtnInside: true, - - showCloseBtn: true, - - enableEscapeKey: true, - - modal: false, - - alignTop: false, - - removalDelay: 0, - - prependTo: null, - - fixedContentPos: 'auto', - - fixedBgPos: 'auto', - - overflowY: 'auto', - - closeMarkup: '', - - tClose: 'Close (Esc)', - - tLoading: 'Loading...' - - } -}; - - - -$.fn.magnificPopup = function(options) { - _checkInstance(); - - var jqEl = $(this); - - // We call some API method of first param is a string - if (typeof options === "string" ) { - - if(options === 'open') { - var items, - itemOpts = _isJQ ? jqEl.data('magnificPopup') : jqEl[0].magnificPopup, - index = parseInt(arguments[1], 10) || 0; - - if(itemOpts.items) { - items = itemOpts.items[index]; - } else { - items = jqEl; - if(itemOpts.delegate) { - items = items.find(itemOpts.delegate); - } - items = items.eq( index ); - } - mfp._openClick({mfpEl:items}, jqEl, itemOpts); - } else { - if(mfp.isOpen) - mfp[options].apply(mfp, Array.prototype.slice.call(arguments, 1)); - } - - } else { - // clone options obj - options = $.extend(true, {}, options); - - /* - * As Zepto doesn't support .data() method for objects - * and it works only in normal browsers - * we assign "options" object directly to the DOM element. FTW! - */ - if(_isJQ) { - jqEl.data('magnificPopup', options); - } else { - jqEl[0].magnificPopup = options; - } - - mfp.addGroup(jqEl, options); - - } - return jqEl; -}; - - -//Quick benchmark -/* -var start = performance.now(), - i, - rounds = 1000; - -for(i = 0; i < rounds; i++) { - -} -console.log('Test #1:', performance.now() - start); - -start = performance.now(); -for(i = 0; i < rounds; i++) { - -} -console.log('Test #2:', performance.now() - start); -*/ - - -/*>>core*/ - -/*>>inline*/ - -var INLINE_NS = 'inline', - _hiddenClass, - _inlinePlaceholder, - _lastInlineElement, - _putInlineElementsBack = function() { - if(_lastInlineElement) { - _inlinePlaceholder.after( _lastInlineElement.addClass(_hiddenClass) ).detach(); - _lastInlineElement = null; - } - }; - -$.magnificPopup.registerModule(INLINE_NS, { - options: { - hiddenClass: 'hide', // will be appended with `mfp-` prefix - markup: '', - tNotFound: 'Content not found' - }, - proto: { - - initInline: function() { - mfp.types.push(INLINE_NS); - - _mfpOn(CLOSE_EVENT+'.'+INLINE_NS, function() { - _putInlineElementsBack(); - }); - }, - - getInline: function(item, template) { - - _putInlineElementsBack(); - - if(item.src) { - var inlineSt = mfp.st.inline, - el = $(item.src); - - if(el.length) { - - // If target element has parent - we replace it with placeholder and put it back after popup is closed - var parent = el[0].parentNode; - if(parent && parent.tagName) { - if(!_inlinePlaceholder) { - _hiddenClass = inlineSt.hiddenClass; - _inlinePlaceholder = _getEl(_hiddenClass); - _hiddenClass = 'mfp-'+_hiddenClass; - } - // replace target inline element with placeholder - _lastInlineElement = el.after(_inlinePlaceholder).detach().removeClass(_hiddenClass); - } - - mfp.updateStatus('ready'); - } else { - mfp.updateStatus('error', inlineSt.tNotFound); - el = $('
'); - } - - item.inlineElement = el; - return el; - } - - mfp.updateStatus('ready'); - mfp._parseMarkup(template, {}, item); - return template; - } - } -}); - -/*>>inline*/ - -/*>>ajax*/ -var AJAX_NS = 'ajax', - _ajaxCur, - _removeAjaxCursor = function() { - if(_ajaxCur) { - _body.removeClass(_ajaxCur); - } - }, - _destroyAjaxRequest = function() { - _removeAjaxCursor(); - if(mfp.req) { - mfp.req.abort(); - } - }; - -$.magnificPopup.registerModule(AJAX_NS, { - - options: { - settings: null, - cursor: 'mfp-ajax-cur', - tError: 'The content could not be loaded.' - }, - - proto: { - initAjax: function() { - mfp.types.push(AJAX_NS); - _ajaxCur = mfp.st.ajax.cursor; - - _mfpOn(CLOSE_EVENT+'.'+AJAX_NS, _destroyAjaxRequest); - _mfpOn('BeforeChange.' + AJAX_NS, _destroyAjaxRequest); - }, - getAjax: function(item) { - - if(_ajaxCur) - _body.addClass(_ajaxCur); - - mfp.updateStatus('loading'); - - var opts = $.extend({ - url: item.src, - success: function(data, textStatus, jqXHR) { - var temp = { - data:data, - xhr:jqXHR - }; - - _mfpTrigger('ParseAjax', temp); - - mfp.appendContent( $(temp.data), AJAX_NS ); - - item.finished = true; - - _removeAjaxCursor(); - - mfp._setFocus(); - - setTimeout(function() { - mfp.wrap.addClass(READY_CLASS); - }, 16); - - mfp.updateStatus('ready'); - - _mfpTrigger('AjaxContentAdded'); - }, - error: function() { - _removeAjaxCursor(); - item.finished = item.loadError = true; - mfp.updateStatus('error', mfp.st.ajax.tError.replace('%url%', item.src)); - } - }, mfp.st.ajax.settings); - - mfp.req = $.ajax(opts); - - return ''; - } - } -}); - - - - - - - -/*>>ajax*/ - -/*>>image*/ -var _imgInterval, - _getTitle = function(item) { - if(item.data && item.data.title !== undefined) - return item.data.title; - - var src = mfp.st.image.titleSrc; - - if(src) { - if($.isFunction(src)) { - return src.call(mfp, item); - } else if(item.el) { - return item.el.attr(src) || ''; - } - } - return ''; - }; - -$.magnificPopup.registerModule('image', { - - options: { - markup: '
'+ - '
'+ - '
'+ - '
'+ - '
'+ - '
'+ - '
'+ - '
'+ - '
'+ - '
'+ - '
'+ - '
', - cursor: 'mfp-zoom-out-cur', - titleSrc: 'title', - verticalFit: true, - tError: 'The image could not be loaded.' - }, - - proto: { - initImage: function() { - var imgSt = mfp.st.image, - ns = '.image'; - - mfp.types.push('image'); - - _mfpOn(OPEN_EVENT+ns, function() { - if(mfp.currItem.type === 'image' && imgSt.cursor) { - _body.addClass(imgSt.cursor); - } - }); - - _mfpOn(CLOSE_EVENT+ns, function() { - if(imgSt.cursor) { - _body.removeClass(imgSt.cursor); - } - _window.off('resize' + EVENT_NS); - }); - - _mfpOn('Resize'+ns, mfp.resizeImage); - if(mfp.isLowIE) { - _mfpOn('AfterChange', mfp.resizeImage); - } - }, - resizeImage: function() { - var item = mfp.currItem; - if(!item || !item.img) return; - - if(mfp.st.image.verticalFit) { - var decr = 0; - // fix box-sizing in ie7/8 - if(mfp.isLowIE) { - decr = parseInt(item.img.css('padding-top'), 10) + parseInt(item.img.css('padding-bottom'),10); - } - item.img.css('max-height', mfp.wH-decr); - } - }, - _onImageHasSize: function(item) { - if(item.img) { - - item.hasSize = true; - - if(_imgInterval) { - clearInterval(_imgInterval); - } - - item.isCheckingImgSize = false; - - _mfpTrigger('ImageHasSize', item); - - if(item.imgHidden) { - if(mfp.content) - mfp.content.removeClass('mfp-loading'); - - item.imgHidden = false; - } - - } - }, - - /** - * Function that loops until the image has size to display elements that rely on it asap - */ - findImageSize: function(item) { - - var counter = 0, - img = item.img[0], - mfpSetInterval = function(delay) { - - if(_imgInterval) { - clearInterval(_imgInterval); - } - // decelerating interval that checks for size of an image - _imgInterval = setInterval(function() { - if(img.naturalWidth > 0) { - mfp._onImageHasSize(item); - return; - } - - if(counter > 200) { - clearInterval(_imgInterval); - } - - counter++; - if(counter === 3) { - mfpSetInterval(10); - } else if(counter === 40) { - mfpSetInterval(50); - } else if(counter === 100) { - mfpSetInterval(500); - } - }, delay); - }; - - mfpSetInterval(1); - }, - - getImage: function(item, template) { - - var guard = 0, - - // image load complete handler - onLoadComplete = function() { - if(item) { - if (item.img[0].complete) { - item.img.off('.mfploader'); - - if(item === mfp.currItem){ - mfp._onImageHasSize(item); - - mfp.updateStatus('ready'); - } - - item.hasSize = true; - item.loaded = true; - - _mfpTrigger('ImageLoadComplete'); - - } - else { - // if image complete check fails 200 times (20 sec), we assume that there was an error. - guard++; - if(guard < 200) { - setTimeout(onLoadComplete,100); - } else { - onLoadError(); - } - } - } - }, - - // image error handler - onLoadError = function() { - if(item) { - item.img.off('.mfploader'); - if(item === mfp.currItem){ - mfp._onImageHasSize(item); - mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) ); - } - - item.hasSize = true; - item.loaded = true; - item.loadError = true; - } - }, - imgSt = mfp.st.image; - - - var el = template.find('.mfp-img'); - if(el.length) { - var img = document.createElement('img'); - img.className = 'mfp-img'; - item.img = $(img).on('load.mfploader', onLoadComplete).on('error.mfploader', onLoadError); - img.src = item.src; - - // without clone() "error" event is not firing when IMG is replaced by new IMG - // TODO: find a way to avoid such cloning - if(el.is('img')) { - item.img = item.img.clone(); - } - - img = item.img[0]; - if(img.naturalWidth > 0) { - item.hasSize = true; - } else if(!img.width) { - item.hasSize = false; - } - } - - mfp._parseMarkup(template, { - title: _getTitle(item), - img_replaceWith: item.img - }, item); - - mfp.resizeImage(); - - if(item.hasSize) { - if(_imgInterval) clearInterval(_imgInterval); - - if(item.loadError) { - template.addClass('mfp-loading'); - mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) ); - } else { - template.removeClass('mfp-loading'); - mfp.updateStatus('ready'); - } - return template; - } - - mfp.updateStatus('loading'); - item.loading = true; - - if(!item.hasSize) { - item.imgHidden = true; - template.addClass('mfp-loading'); - mfp.findImageSize(item); - } - - return template; - } - } -}); - - - -/*>>image*/ - -/*>>zoom*/ -var hasMozTransform, - getHasMozTransform = function() { - if(hasMozTransform === undefined) { - hasMozTransform = document.createElement('p').style.MozTransform !== undefined; - } - return hasMozTransform; - }; - -$.magnificPopup.registerModule('zoom', { - - options: { - enabled: false, - easing: 'ease-in-out', - duration: 300, - opener: function(element) { - return element.is('img') ? element : element.find('img'); - } - }, - - proto: { - - initZoom: function() { - var zoomSt = mfp.st.zoom, - ns = '.zoom', - image; - - if(!zoomSt.enabled || !mfp.supportsTransition) { - return; - } - - var duration = zoomSt.duration, - getElToAnimate = function(image) { - var newImg = image.clone().removeAttr('style').removeAttr('class').addClass('mfp-animated-image'), - transition = 'all '+(zoomSt.duration/1000)+'s ' + zoomSt.easing, - cssObj = { - position: 'fixed', - zIndex: 9999, - left: 0, - top: 0, - '-webkit-backface-visibility': 'hidden' - }, - t = 'transition'; - - cssObj['-webkit-'+t] = cssObj['-moz-'+t] = cssObj['-o-'+t] = cssObj[t] = transition; - - newImg.css(cssObj); - return newImg; - }, - showMainContent = function() { - mfp.content.css('visibility', 'visible'); - }, - openTimeout, - animatedImg; - - _mfpOn('BuildControls'+ns, function() { - if(mfp._allowZoom()) { - - clearTimeout(openTimeout); - mfp.content.css('visibility', 'hidden'); - - // Basically, all code below does is clones existing image, puts in on top of the current one and animated it - - image = mfp._getItemToZoom(); - - if(!image) { - showMainContent(); - return; - } - - animatedImg = getElToAnimate(image); - - animatedImg.css( mfp._getOffset() ); - - mfp.wrap.append(animatedImg); - - openTimeout = setTimeout(function() { - animatedImg.css( mfp._getOffset( true ) ); - openTimeout = setTimeout(function() { - - showMainContent(); - - setTimeout(function() { - animatedImg.remove(); - image = animatedImg = null; - _mfpTrigger('ZoomAnimationEnded'); - }, 16); // avoid blink when switching images - - }, duration); // this timeout equals animation duration - - }, 16); // by adding this timeout we avoid short glitch at the beginning of animation - - - // Lots of timeouts... - } - }); - _mfpOn(BEFORE_CLOSE_EVENT+ns, function() { - if(mfp._allowZoom()) { - - clearTimeout(openTimeout); - - mfp.st.removalDelay = duration; - - if(!image) { - image = mfp._getItemToZoom(); - if(!image) { - return; - } - animatedImg = getElToAnimate(image); - } - - - animatedImg.css( mfp._getOffset(true) ); - mfp.wrap.append(animatedImg); - mfp.content.css('visibility', 'hidden'); - - setTimeout(function() { - animatedImg.css( mfp._getOffset() ); - }, 16); - } - - }); - - _mfpOn(CLOSE_EVENT+ns, function() { - if(mfp._allowZoom()) { - showMainContent(); - if(animatedImg) { - animatedImg.remove(); - } - image = null; - } - }); - }, - - _allowZoom: function() { - return mfp.currItem.type === 'image'; - }, - - _getItemToZoom: function() { - if(mfp.currItem.hasSize) { - return mfp.currItem.img; - } else { - return false; - } - }, - - // Get element postion relative to viewport - _getOffset: function(isLarge) { - var el; - if(isLarge) { - el = mfp.currItem.img; - } else { - el = mfp.st.zoom.opener(mfp.currItem.el || mfp.currItem); - } - - var offset = el.offset(); - var paddingTop = parseInt(el.css('padding-top'),10); - var paddingBottom = parseInt(el.css('padding-bottom'),10); - offset.top -= ( $(window).scrollTop() - paddingTop ); - - - /* - - Animating left + top + width/height looks glitchy in Firefox, but perfect in Chrome. And vice-versa. - - */ - var obj = { - width: el.width(), - // fix Zepto height+padding issue - height: (_isJQ ? el.innerHeight() : el[0].offsetHeight) - paddingBottom - paddingTop - }; - - // I hate to do this, but there is no another option - if( getHasMozTransform() ) { - obj['-moz-transform'] = obj['transform'] = 'translate(' + offset.left + 'px,' + offset.top + 'px)'; - } else { - obj.left = offset.left; - obj.top = offset.top; - } - return obj; - } - - } -}); - - - -/*>>zoom*/ - -/*>>iframe*/ - -var IFRAME_NS = 'iframe', - _emptyPage = '//about:blank', - - _fixIframeBugs = function(isShowing) { - if(mfp.currTemplate[IFRAME_NS]) { - var el = mfp.currTemplate[IFRAME_NS].find('iframe'); - if(el.length) { - // reset src after the popup is closed to avoid "video keeps playing after popup is closed" bug - if(!isShowing) { - el[0].src = _emptyPage; - } - - // IE8 black screen bug fix - if(mfp.isIE8) { - el.css('display', isShowing ? 'block' : 'none'); - } - } - } - }; - -$.magnificPopup.registerModule(IFRAME_NS, { - - options: { - markup: '
'+ - '
'+ - ''+ - '
', - - srcAction: 'iframe_src', - - // we don't care and support only one default type of URL by default - patterns: { - youtube: { - index: 'youtube.com', - id: 'v=', - src: '//www.youtube.com/embed/%id%?autoplay=1' - }, - vimeo: { - index: 'vimeo.com/', - id: '/', - src: '//player.vimeo.com/video/%id%?autoplay=1' - }, - gmaps: { - index: '//maps.google.', - src: '%id%&output=embed' - } - } - }, - - proto: { - initIframe: function() { - mfp.types.push(IFRAME_NS); - - _mfpOn('BeforeChange', function(e, prevType, newType) { - if(prevType !== newType) { - if(prevType === IFRAME_NS) { - _fixIframeBugs(); // iframe if removed - } else if(newType === IFRAME_NS) { - _fixIframeBugs(true); // iframe is showing - } - }// else { - // iframe source is switched, don't do anything - //} - }); - - _mfpOn(CLOSE_EVENT + '.' + IFRAME_NS, function() { - _fixIframeBugs(); - }); - }, - - getIframe: function(item, template) { - var embedSrc = item.src; - var iframeSt = mfp.st.iframe; - - $.each(iframeSt.patterns, function() { - if(embedSrc.indexOf( this.index ) > -1) { - if(this.id) { - if(typeof this.id === 'string') { - embedSrc = embedSrc.substr(embedSrc.lastIndexOf(this.id)+this.id.length, embedSrc.length); - } else { - embedSrc = this.id.call( this, embedSrc ); - } - } - embedSrc = this.src.replace('%id%', embedSrc ); - return false; // break; - } - }); - - var dataObj = {}; - if(iframeSt.srcAction) { - dataObj[iframeSt.srcAction] = embedSrc; - } - mfp._parseMarkup(template, dataObj, item); - - mfp.updateStatus('ready'); - - return template; - } - } -}); - - - -/*>>iframe*/ - -/*>>gallery*/ -/** - * Get looped index depending on number of slides - */ -var _getLoopedId = function(index) { - var numSlides = mfp.items.length; - if(index > numSlides - 1) { - return index - numSlides; - } else if(index < 0) { - return numSlides + index; - } - return index; - }, - _replaceCurrTotal = function(text, curr, total) { - return text.replace(/%curr%/gi, curr + 1).replace(/%total%/gi, total); - }; - -$.magnificPopup.registerModule('gallery', { - - options: { - enabled: false, - arrowMarkup: '', - preload: [0,2], - navigateByImgClick: true, - arrows: true, - - tPrev: 'Previous (Left arrow key)', - tNext: 'Next (Right arrow key)', - tCounter: '%curr% of %total%' - }, - - proto: { - initGallery: function() { - - var gSt = mfp.st.gallery, - ns = '.mfp-gallery', - supportsFastClick = Boolean($.fn.mfpFastClick); - - mfp.direction = true; // true - next, false - prev - - if(!gSt || !gSt.enabled ) return false; - - _wrapClasses += ' mfp-gallery'; - - _mfpOn(OPEN_EVENT+ns, function() { - - if(gSt.navigateByImgClick) { - mfp.wrap.on('click'+ns, '.mfp-img', function() { - if(mfp.items.length > 1) { - mfp.next(); - return false; - } - }); - } - - _document.on('keydown'+ns, function(e) { - if (e.keyCode === 37) { - mfp.prev(); - } else if (e.keyCode === 39) { - mfp.next(); - } - }); - }); - - _mfpOn('UpdateStatus'+ns, function(e, data) { - if(data.text) { - data.text = _replaceCurrTotal(data.text, mfp.currItem.index, mfp.items.length); - } - }); - - _mfpOn(MARKUP_PARSE_EVENT+ns, function(e, element, values, item) { - var l = mfp.items.length; - values.counter = l > 1 ? _replaceCurrTotal(gSt.tCounter, item.index, l) : ''; - }); - - _mfpOn('BuildControls' + ns, function() { - if(mfp.items.length > 1 && gSt.arrows && !mfp.arrowLeft) { - var markup = gSt.arrowMarkup, - arrowLeft = mfp.arrowLeft = $( markup.replace(/%title%/gi, gSt.tPrev).replace(/%dir%/gi, 'left') ).addClass(PREVENT_CLOSE_CLASS), - arrowRight = mfp.arrowRight = $( markup.replace(/%title%/gi, gSt.tNext).replace(/%dir%/gi, 'right') ).addClass(PREVENT_CLOSE_CLASS); - - var eName = supportsFastClick ? 'mfpFastClick' : 'click'; - arrowLeft[eName](function() { - mfp.prev(); - }); - arrowRight[eName](function() { - mfp.next(); - }); - - // Polyfill for :before and :after (adds elements with classes mfp-a and mfp-b) - if(mfp.isIE7) { - _getEl('b', arrowLeft[0], false, true); - _getEl('a', arrowLeft[0], false, true); - _getEl('b', arrowRight[0], false, true); - _getEl('a', arrowRight[0], false, true); - } - - mfp.container.append(arrowLeft.add(arrowRight)); - } - }); - - _mfpOn(CHANGE_EVENT+ns, function() { - if(mfp._preloadTimeout) clearTimeout(mfp._preloadTimeout); - - mfp._preloadTimeout = setTimeout(function() { - mfp.preloadNearbyImages(); - mfp._preloadTimeout = null; - }, 16); - }); - - - _mfpOn(CLOSE_EVENT+ns, function() { - _document.off(ns); - mfp.wrap.off('click'+ns); - - if(mfp.arrowLeft && supportsFastClick) { - mfp.arrowLeft.add(mfp.arrowRight).destroyMfpFastClick(); - } - mfp.arrowRight = mfp.arrowLeft = null; - }); - - }, - next: function() { - mfp.direction = true; - mfp.index = _getLoopedId(mfp.index + 1); - mfp.updateItemHTML(); - }, - prev: function() { - mfp.direction = false; - mfp.index = _getLoopedId(mfp.index - 1); - mfp.updateItemHTML(); - }, - goTo: function(newIndex) { - mfp.direction = (newIndex >= mfp.index); - mfp.index = newIndex; - mfp.updateItemHTML(); - }, - preloadNearbyImages: function() { - var p = mfp.st.gallery.preload, - preloadBefore = Math.min(p[0], mfp.items.length), - preloadAfter = Math.min(p[1], mfp.items.length), - i; - - for(i = 1; i <= (mfp.direction ? preloadAfter : preloadBefore); i++) { - mfp._preloadItem(mfp.index+i); - } - for(i = 1; i <= (mfp.direction ? preloadBefore : preloadAfter); i++) { - mfp._preloadItem(mfp.index-i); - } - }, - _preloadItem: function(index) { - index = _getLoopedId(index); - - if(mfp.items[index].preloaded) { - return; - } - - var item = mfp.items[index]; - if(!item.parsed) { - item = mfp.parseEl( index ); - } - - _mfpTrigger('LazyLoad', item); - - if(item.type === 'image') { - item.img = $('').on('load.mfploader', function() { - item.hasSize = true; - }).on('error.mfploader', function() { - item.hasSize = true; - item.loadError = true; - _mfpTrigger('LazyLoadError', item); - }).attr('src', item.src); - } - - - item.preloaded = true; - } - } -}); - -/* -Touch Support that might be implemented some day - -addSwipeGesture: function() { - var startX, - moved, - multipleTouches; - - return; - - var namespace = '.mfp', - addEventNames = function(pref, down, move, up, cancel) { - mfp._tStart = pref + down + namespace; - mfp._tMove = pref + move + namespace; - mfp._tEnd = pref + up + namespace; - mfp._tCancel = pref + cancel + namespace; - }; - - if(window.navigator.msPointerEnabled) { - addEventNames('MSPointer', 'Down', 'Move', 'Up', 'Cancel'); - } else if('ontouchstart' in window) { - addEventNames('touch', 'start', 'move', 'end', 'cancel'); - } else { - return; - } - _window.on(mfp._tStart, function(e) { - var oE = e.originalEvent; - multipleTouches = moved = false; - startX = oE.pageX || oE.changedTouches[0].pageX; - }).on(mfp._tMove, function(e) { - if(e.originalEvent.touches.length > 1) { - multipleTouches = e.originalEvent.touches.length; - } else { - //e.preventDefault(); - moved = true; - } - }).on(mfp._tEnd + ' ' + mfp._tCancel, function(e) { - if(moved && !multipleTouches) { - var oE = e.originalEvent, - diff = startX - (oE.pageX || oE.changedTouches[0].pageX); - - if(diff > 20) { - mfp.next(); - } else if(diff < -20) { - mfp.prev(); - } - } - }); -}, -*/ - - -/*>>gallery*/ - -/*>>retina*/ - -var RETINA_NS = 'retina'; - -$.magnificPopup.registerModule(RETINA_NS, { - options: { - replaceSrc: function(item) { - return item.src.replace(/\.\w+$/, function(m) { return '@2x' + m; }); - }, - ratio: 1 // Function or number. Set to 1 to disable. - }, - proto: { - initRetina: function() { - if(window.devicePixelRatio > 1) { - - var st = mfp.st.retina, - ratio = st.ratio; - - ratio = !isNaN(ratio) ? ratio : ratio(); - - if(ratio > 1) { - _mfpOn('ImageHasSize' + '.' + RETINA_NS, function(e, item) { - item.img.css({ - 'max-width': item.img[0].naturalWidth / ratio, - 'width': '100%' - }); - }); - _mfpOn('ElementParse' + '.' + RETINA_NS, function(e, item) { - item.src = st.replaceSrc(item, ratio); - }); - } - } - - } - } -}); - -/*>>retina*/ - -/*>>fastclick*/ -/** - * FastClick event implementation. (removes 300ms delay on touch devices) - * Based on https://developers.google.com/mobile/articles/fast_buttons - * - * You may use it outside the Magnific Popup by calling just: - * - * $('.your-el').mfpFastClick(function() { - * console.log('Clicked!'); - * }); - * - * To unbind: - * $('.your-el').destroyMfpFastClick(); - * - * - * Note that it's a very basic and simple implementation, it blocks ghost click on the same element where it was bound. - * If you need something more advanced, use plugin by FT Labs https://github.com/ftlabs/fastclick - * - */ - -(function() { - var ghostClickDelay = 1000, - supportsTouch = 'ontouchstart' in window, - unbindTouchMove = function() { - _window.off('touchmove'+ns+' touchend'+ns); - }, - eName = 'mfpFastClick', - ns = '.'+eName; - - - // As Zepto.js doesn't have an easy way to add custom events (like jQuery), so we implement it in this way - $.fn.mfpFastClick = function(callback) { - - return $(this).each(function() { - - var elem = $(this), - lock; - - if( supportsTouch ) { - - var timeout, - startX, - startY, - pointerMoved, - point, - numPointers; - - elem.on('touchstart' + ns, function(e) { - pointerMoved = false; - numPointers = 1; - - point = e.originalEvent ? e.originalEvent.touches[0] : e.touches[0]; - startX = point.clientX; - startY = point.clientY; - - _window.on('touchmove'+ns, function(e) { - point = e.originalEvent ? e.originalEvent.touches : e.touches; - numPointers = point.length; - point = point[0]; - if (Math.abs(point.clientX - startX) > 10 || - Math.abs(point.clientY - startY) > 10) { - pointerMoved = true; - unbindTouchMove(); - } - }).on('touchend'+ns, function(e) { - unbindTouchMove(); - if(pointerMoved || numPointers > 1) { - return; - } - lock = true; - e.preventDefault(); - clearTimeout(timeout); - timeout = setTimeout(function() { - lock = false; - }, ghostClickDelay); - callback(); - }); - }); - - } - - elem.on('click' + ns, function() { - if(!lock) { - callback(); - } - }); - }); - }; - - $.fn.destroyMfpFastClick = function() { - $(this).off('touchstart' + ns + ' click' + ns); - if(supportsTouch) _window.off('touchmove'+ns+' touchend'+ns); - }; -})(); - -/*>>fastclick*/ - _checkInstance(); })(window.jQuery || window.Zepto); \ No newline at end of file diff --git a/vendors/jquery-magnific-popup/jquery.magnific-popup.min.js b/vendors/jquery-magnific-popup/jquery.magnific-popup.min.js deleted file mode 100644 index 4e3e16ffd..000000000 --- a/vendors/jquery-magnific-popup/jquery.magnific-popup.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! Magnific Popup - v0.9.9 - 2014-09-06 -* http://dimsemenov.com/plugins/magnific-popup/ -* Copyright (c) 2014 Dmitry Semenov; */ -(function(e){var t,n,i,o,r,a,s,l="Close",c="BeforeClose",d="AfterClose",u="BeforeAppend",p="MarkupParse",f="Open",m="Change",g="mfp",h="."+g,v="mfp-ready",C="mfp-removing",y="mfp-prevent-close",w=function(){},b=!!window.jQuery,I=e(window),x=function(e,n){t.ev.on(g+e+h,n)},k=function(t,n,i,o){var r=document.createElement("div");return r.className="mfp-"+t,i&&(r.innerHTML=i),o?n&&n.appendChild(r):(r=e(r),n&&r.appendTo(n)),r},T=function(n,i){t.ev.triggerHandler(g+n,i),t.st.callbacks&&(n=n.charAt(0).toLowerCase()+n.slice(1),t.st.callbacks[n]&&t.st.callbacks[n].apply(t,e.isArray(i)?i:[i]))},E=function(n){return n===s&&t.currTemplate.closeBtn||(t.currTemplate.closeBtn=e(t.st.closeMarkup.replace("%title%",t.st.tClose)),s=n),t.currTemplate.closeBtn},_=function(){e.magnificPopup.instance||(t=new w,t.init(),e.magnificPopup.instance=t)},S=function(){var e=document.createElement("p").style,t=["ms","O","Moz","Webkit"];if(void 0!==e.transition)return!0;for(;t.length;)if(t.pop()+"Transition"in e)return!0;return!1};w.prototype={constructor:w,init:function(){var n=navigator.appVersion;t.isIE7=-1!==n.indexOf("MSIE 7."),t.isIE8=-1!==n.indexOf("MSIE 8."),t.isLowIE=t.isIE7||t.isIE8,t.isAndroid=/android/gi.test(n),t.isIOS=/iphone|ipad|ipod/gi.test(n),t.supportsTransition=S(),t.probablyMobile=t.isAndroid||t.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),o=e(document),t.popupsCache={}},open:function(n){i||(i=e(document.body));var r;if(n.isObj===!1){t.items=n.items.toArray(),t.index=0;var s,l=n.items;for(r=0;l.length>r;r++)if(s=l[r],s.parsed&&(s=s.el[0]),s===n.el[0]){t.index=r;break}}else t.items=e.isArray(n.items)?n.items:[n.items],t.index=n.index||0;if(t.isOpen)return t.updateItemHTML(),void 0;t.types=[],a="",t.ev=n.mainEl&&n.mainEl.length?n.mainEl.eq(0):o,n.key?(t.popupsCache[n.key]||(t.popupsCache[n.key]={}),t.currTemplate=t.popupsCache[n.key]):t.currTemplate={},t.st=e.extend(!0,{},e.magnificPopup.defaults,n),t.fixedContentPos="auto"===t.st.fixedContentPos?!t.probablyMobile:t.st.fixedContentPos,t.st.modal&&(t.st.closeOnContentClick=!1,t.st.closeOnBgClick=!1,t.st.showCloseBtn=!1,t.st.enableEscapeKey=!1),t.bgOverlay||(t.bgOverlay=k("bg").on("click"+h,function(){t.close()}),t.wrap=k("wrap").attr("tabindex",-1).on("click"+h,function(e){t._checkIfClose(e.target)&&t.close()}),t.container=k("container",t.wrap)),t.contentContainer=k("content"),t.st.preloader&&(t.preloader=k("preloader",t.container,t.st.tLoading));var c=e.magnificPopup.modules;for(r=0;c.length>r;r++){var d=c[r];d=d.charAt(0).toUpperCase()+d.slice(1),t["init"+d].call(t)}T("BeforeOpen"),t.st.showCloseBtn&&(t.st.closeBtnInside?(x(p,function(e,t,n,i){n.close_replaceWith=E(i.type)}),a+=" mfp-close-btn-in"):t.wrap.append(E())),t.st.alignTop&&(a+=" mfp-align-top"),t.fixedContentPos?t.wrap.css({overflow:t.st.overflowY,overflowX:"hidden",overflowY:t.st.overflowY}):t.wrap.css({top:I.scrollTop(),position:"absolute"}),(t.st.fixedBgPos===!1||"auto"===t.st.fixedBgPos&&!t.fixedContentPos)&&t.bgOverlay.css({height:o.height(),position:"absolute"}),t.st.enableEscapeKey&&o.on("keyup"+h,function(e){27===e.keyCode&&t.close()}),I.on("resize"+h,function(){t.updateSize()}),t.st.closeOnContentClick||(a+=" mfp-auto-cursor"),a&&t.wrap.addClass(a);var u=t.wH=I.height(),m={};if(t.fixedContentPos&&t._hasScrollBar(u)){var g=t._getScrollbarSize();g&&(m.marginRight=g)}t.fixedContentPos&&(t.isIE7?e("body, html").css("overflow","hidden"):m.overflow="hidden");var C=t.st.mainClass;return t.isIE7&&(C+=" mfp-ie7"),C&&t._addClassToMFP(C),t.updateItemHTML(),T("BuildControls"),e("html").css(m),t.bgOverlay.add(t.wrap).prependTo(t.st.prependTo||i),t._lastFocusedEl=document.activeElement,setTimeout(function(){t.content?(t._addClassToMFP(v),t._setFocus()):t.bgOverlay.addClass(v),o.on("focusin"+h,t._onFocusIn)},16),t.isOpen=!0,t.updateSize(u),T(f),n},close:function(){t.isOpen&&(T(c),t.isOpen=!1,t.st.removalDelay&&!t.isLowIE&&t.supportsTransition?(t._addClassToMFP(C),setTimeout(function(){t._close()},t.st.removalDelay)):t._close())},_close:function(){T(l);var n=C+" "+v+" ";if(t.bgOverlay.detach(),t.wrap.detach(),t.container.empty(),t.st.mainClass&&(n+=t.st.mainClass+" "),t._removeClassFromMFP(n),t.fixedContentPos){var i={marginRight:""};t.isIE7?e("body, html").css("overflow",""):i.overflow="",e("html").css(i)}o.off("keyup"+h+" focusin"+h),t.ev.off(h),t.wrap.attr("class","mfp-wrap").removeAttr("style"),t.bgOverlay.attr("class","mfp-bg"),t.container.attr("class","mfp-container"),!t.st.showCloseBtn||t.st.closeBtnInside&&t.currTemplate[t.currItem.type]!==!0||t.currTemplate.closeBtn&&t.currTemplate.closeBtn.detach(),t._lastFocusedEl&&e(t._lastFocusedEl).focus(),t.currItem=null,t.content=null,t.currTemplate=null,t.prevHeight=0,T(d)},updateSize:function(e){if(t.isIOS){var n=document.documentElement.clientWidth/window.innerWidth,i=window.innerHeight*n;t.wrap.css("height",i),t.wH=i}else t.wH=e||I.height();t.fixedContentPos||t.wrap.css("height",t.wH),T("Resize")},updateItemHTML:function(){var n=t.items[t.index];t.contentContainer.detach(),t.content&&t.content.detach(),n.parsed||(n=t.parseEl(t.index));var i=n.type;if(T("BeforeChange",[t.currItem?t.currItem.type:"",i]),t.currItem=n,!t.currTemplate[i]){var o=t.st[i]?t.st[i].markup:!1;T("FirstMarkupParse",o),t.currTemplate[i]=o?e(o):!0}r&&r!==n.type&&t.container.removeClass("mfp-"+r+"-holder");var a=t["get"+i.charAt(0).toUpperCase()+i.slice(1)](n,t.currTemplate[i]);t.appendContent(a,i),n.preloaded=!0,T(m,n),r=n.type,t.container.prepend(t.contentContainer),T("AfterChange")},appendContent:function(e,n){t.content=e,e?t.st.showCloseBtn&&t.st.closeBtnInside&&t.currTemplate[n]===!0?t.content.find(".mfp-close").length||t.content.append(E()):t.content=e:t.content="",T(u),t.container.addClass("mfp-"+n+"-holder"),t.contentContainer.append(t.content)},parseEl:function(n){var i,o=t.items[n];if(o.tagName?o={el:e(o)}:(i=o.type,o={data:o,src:o.src}),o.el){for(var r=t.types,a=0;r.length>a;a++)if(o.el.hasClass("mfp-"+r[a])){i=r[a];break}o.src=o.el.attr("data-mfp-src"),o.src||(o.src=o.el.attr("href"))}return o.type=i||t.st.type||"inline",o.index=n,o.parsed=!0,t.items[n]=o,T("ElementParse",o),t.items[n]},addGroup:function(e,n){var i=function(i){i.mfpEl=this,t._openClick(i,e,n)};n||(n={});var o="click.magnificPopup";n.mainEl=e,n.items?(n.isObj=!0,e.off(o).on(o,i)):(n.isObj=!1,n.delegate?e.off(o).on(o,n.delegate,i):(n.items=e,e.off(o).on(o,i)))},_openClick:function(n,i,o){var r=void 0!==o.midClick?o.midClick:e.magnificPopup.defaults.midClick;if(r||2!==n.which&&!n.ctrlKey&&!n.metaKey){var a=void 0!==o.disableOn?o.disableOn:e.magnificPopup.defaults.disableOn;if(a)if(e.isFunction(a)){if(!a.call(t))return!0}else if(a>I.width())return!0;n.type&&(n.preventDefault(),t.isOpen&&n.stopPropagation()),o.el=e(n.mfpEl),o.delegate&&(o.items=i.find(o.delegate)),t.open(o)}},updateStatus:function(e,i){if(t.preloader){n!==e&&t.container.removeClass("mfp-s-"+n),i||"loading"!==e||(i=t.st.tLoading);var o={status:e,text:i};T("UpdateStatus",o),e=o.status,i=o.text,t.preloader.html(i),t.preloader.find("a").on("click",function(e){e.stopImmediatePropagation()}),t.container.addClass("mfp-s-"+e),n=e}},_checkIfClose:function(n){if(!e(n).hasClass(y)){var i=t.st.closeOnContentClick,o=t.st.closeOnBgClick;if(i&&o)return!0;if(!t.content||e(n).hasClass("mfp-close")||t.preloader&&n===t.preloader[0])return!0;if(n===t.content[0]||e.contains(t.content[0],n)){if(i)return!0}else if(o&&e.contains(document,n))return!0;return!1}},_addClassToMFP:function(e){t.bgOverlay.addClass(e),t.wrap.addClass(e)},_removeClassFromMFP:function(e){this.bgOverlay.removeClass(e),t.wrap.removeClass(e)},_hasScrollBar:function(e){return(t.isIE7?o.height():document.body.scrollHeight)>(e||I.height())},_setFocus:function(){(t.st.focus?t.content.find(t.st.focus).eq(0):t.wrap).focus()},_onFocusIn:function(n){return n.target===t.wrap[0]||e.contains(t.wrap[0],n.target)?void 0:(t._setFocus(),!1)},_parseMarkup:function(t,n,i){var o;i.data&&(n=e.extend(i.data,n)),T(p,[t,n,i]),e.each(n,function(e,n){if(void 0===n||n===!1)return!0;if(o=e.split("_"),o.length>1){var i=t.find(h+"-"+o[0]);if(i.length>0){var r=o[1];"replaceWith"===r?i[0]!==n[0]&&i.replaceWith(n):"img"===r?i.is("img")?i.attr("src",n):i.replaceWith(''):i.attr(o[1],n)}}else t.find(h+"-"+e).html(n)})},_getScrollbarSize:function(){if(void 0===t.scrollbarSize){var e=document.createElement("div");e.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(e),t.scrollbarSize=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return t.scrollbarSize}},e.magnificPopup={instance:null,proto:w.prototype,modules:[],open:function(t,n){return _(),t=t?e.extend(!0,{},t):{},t.isObj=!0,t.index=n||0,this.instance.open(t)},close:function(){return e.magnificPopup.instance&&e.magnificPopup.instance.close()},registerModule:function(t,n){n.options&&(e.magnificPopup.defaults[t]=n.options),e.extend(this.proto,n.proto),this.modules.push(t)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'',tClose:"Close (Esc)",tLoading:"Loading..."}},e.fn.magnificPopup=function(n){_();var i=e(this);if("string"==typeof n)if("open"===n){var o,r=b?i.data("magnificPopup"):i[0].magnificPopup,a=parseInt(arguments[1],10)||0;r.items?o=r.items[a]:(o=i,r.delegate&&(o=o.find(r.delegate)),o=o.eq(a)),t._openClick({mfpEl:o},i,r)}else t.isOpen&&t[n].apply(t,Array.prototype.slice.call(arguments,1));else n=e.extend(!0,{},n),b?i.data("magnificPopup",n):i[0].magnificPopup=n,t.addGroup(i,n);return i};var P,O,z,M="inline",B=function(){z&&(O.after(z.addClass(P)).detach(),z=null)};e.magnificPopup.registerModule(M,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){t.types.push(M),x(l+"."+M,function(){B()})},getInline:function(n,i){if(B(),n.src){var o=t.st.inline,r=e(n.src);if(r.length){var a=r[0].parentNode;a&&a.tagName&&(O||(P=o.hiddenClass,O=k(P),P="mfp-"+P),z=r.after(O).detach().removeClass(P)),t.updateStatus("ready")}else t.updateStatus("error",o.tNotFound),r=e("
");return n.inlineElement=r,r}return t.updateStatus("ready"),t._parseMarkup(i,{},n),i}}});var F,H="ajax",L=function(){F&&i.removeClass(F)},A=function(){L(),t.req&&t.req.abort()};e.magnificPopup.registerModule(H,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'The content could not be loaded.'},proto:{initAjax:function(){t.types.push(H),F=t.st.ajax.cursor,x(l+"."+H,A),x("BeforeChange."+H,A)},getAjax:function(n){F&&i.addClass(F),t.updateStatus("loading");var o=e.extend({url:n.src,success:function(i,o,r){var a={data:i,xhr:r};T("ParseAjax",a),t.appendContent(e(a.data),H),n.finished=!0,L(),t._setFocus(),setTimeout(function(){t.wrap.addClass(v)},16),t.updateStatus("ready"),T("AjaxContentAdded")},error:function(){L(),n.finished=n.loadError=!0,t.updateStatus("error",t.st.ajax.tError.replace("%url%",n.src))}},t.st.ajax.settings);return t.req=e.ajax(o),""}}});var j,N=function(n){if(n.data&&void 0!==n.data.title)return n.data.title;var i=t.st.image.titleSrc;if(i){if(e.isFunction(i))return i.call(t,n);if(n.el)return n.el.attr(i)||""}return""};e.magnificPopup.registerModule("image",{options:{markup:'
',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'The image could not be loaded.'},proto:{initImage:function(){var e=t.st.image,n=".image";t.types.push("image"),x(f+n,function(){"image"===t.currItem.type&&e.cursor&&i.addClass(e.cursor)}),x(l+n,function(){e.cursor&&i.removeClass(e.cursor),I.off("resize"+h)}),x("Resize"+n,t.resizeImage),t.isLowIE&&x("AfterChange",t.resizeImage)},resizeImage:function(){var e=t.currItem;if(e&&e.img&&t.st.image.verticalFit){var n=0;t.isLowIE&&(n=parseInt(e.img.css("padding-top"),10)+parseInt(e.img.css("padding-bottom"),10)),e.img.css("max-height",t.wH-n)}},_onImageHasSize:function(e){e.img&&(e.hasSize=!0,j&&clearInterval(j),e.isCheckingImgSize=!1,T("ImageHasSize",e),e.imgHidden&&(t.content&&t.content.removeClass("mfp-loading"),e.imgHidden=!1))},findImageSize:function(e){var n=0,i=e.img[0],o=function(r){j&&clearInterval(j),j=setInterval(function(){return i.naturalWidth>0?(t._onImageHasSize(e),void 0):(n>200&&clearInterval(j),n++,3===n?o(10):40===n?o(50):100===n&&o(500),void 0)},r)};o(1)},getImage:function(n,i){var o=0,r=function(){n&&(n.img[0].complete?(n.img.off(".mfploader"),n===t.currItem&&(t._onImageHasSize(n),t.updateStatus("ready")),n.hasSize=!0,n.loaded=!0,T("ImageLoadComplete")):(o++,200>o?setTimeout(r,100):a()))},a=function(){n&&(n.img.off(".mfploader"),n===t.currItem&&(t._onImageHasSize(n),t.updateStatus("error",s.tError.replace("%url%",n.src))),n.hasSize=!0,n.loaded=!0,n.loadError=!0)},s=t.st.image,l=i.find(".mfp-img");if(l.length){var c=document.createElement("img");c.className="mfp-img",n.img=e(c).on("load.mfploader",r).on("error.mfploader",a),c.src=n.src,l.is("img")&&(n.img=n.img.clone()),c=n.img[0],c.naturalWidth>0?n.hasSize=!0:c.width||(n.hasSize=!1)}return t._parseMarkup(i,{title:N(n),img_replaceWith:n.img},n),t.resizeImage(),n.hasSize?(j&&clearInterval(j),n.loadError?(i.addClass("mfp-loading"),t.updateStatus("error",s.tError.replace("%url%",n.src))):(i.removeClass("mfp-loading"),t.updateStatus("ready")),i):(t.updateStatus("loading"),n.loading=!0,n.hasSize||(n.imgHidden=!0,i.addClass("mfp-loading"),t.findImageSize(n)),i)}}});var W,R=function(){return void 0===W&&(W=void 0!==document.createElement("p").style.MozTransform),W};e.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(e){return e.is("img")?e:e.find("img")}},proto:{initZoom:function(){var e,n=t.st.zoom,i=".zoom";if(n.enabled&&t.supportsTransition){var o,r,a=n.duration,s=function(e){var t=e.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),i="all "+n.duration/1e3+"s "+n.easing,o={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},r="transition";return o["-webkit-"+r]=o["-moz-"+r]=o["-o-"+r]=o[r]=i,t.css(o),t},d=function(){t.content.css("visibility","visible")};x("BuildControls"+i,function(){if(t._allowZoom()){if(clearTimeout(o),t.content.css("visibility","hidden"),e=t._getItemToZoom(),!e)return d(),void 0;r=s(e),r.css(t._getOffset()),t.wrap.append(r),o=setTimeout(function(){r.css(t._getOffset(!0)),o=setTimeout(function(){d(),setTimeout(function(){r.remove(),e=r=null,T("ZoomAnimationEnded")},16)},a)},16)}}),x(c+i,function(){if(t._allowZoom()){if(clearTimeout(o),t.st.removalDelay=a,!e){if(e=t._getItemToZoom(),!e)return;r=s(e)}r.css(t._getOffset(!0)),t.wrap.append(r),t.content.css("visibility","hidden"),setTimeout(function(){r.css(t._getOffset())},16)}}),x(l+i,function(){t._allowZoom()&&(d(),r&&r.remove(),e=null)})}},_allowZoom:function(){return"image"===t.currItem.type},_getItemToZoom:function(){return t.currItem.hasSize?t.currItem.img:!1},_getOffset:function(n){var i;i=n?t.currItem.img:t.st.zoom.opener(t.currItem.el||t.currItem);var o=i.offset(),r=parseInt(i.css("padding-top"),10),a=parseInt(i.css("padding-bottom"),10);o.top-=e(window).scrollTop()-r;var s={width:i.width(),height:(b?i.innerHeight():i[0].offsetHeight)-a-r};return R()?s["-moz-transform"]=s.transform="translate("+o.left+"px,"+o.top+"px)":(s.left=o.left,s.top=o.top),s}}});var Z="iframe",q="//about:blank",D=function(e){if(t.currTemplate[Z]){var n=t.currTemplate[Z].find("iframe");n.length&&(e||(n[0].src=q),t.isIE8&&n.css("display",e?"block":"none"))}};e.magnificPopup.registerModule(Z,{options:{markup:'
',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){t.types.push(Z),x("BeforeChange",function(e,t,n){t!==n&&(t===Z?D():n===Z&&D(!0))}),x(l+"."+Z,function(){D()})},getIframe:function(n,i){var o=n.src,r=t.st.iframe;e.each(r.patterns,function(){return o.indexOf(this.index)>-1?(this.id&&(o="string"==typeof this.id?o.substr(o.lastIndexOf(this.id)+this.id.length,o.length):this.id.call(this,o)),o=this.src.replace("%id%",o),!1):void 0});var a={};return r.srcAction&&(a[r.srcAction]=o),t._parseMarkup(i,a,n),t.updateStatus("ready"),i}}});var K=function(e){var n=t.items.length;return e>n-1?e-n:0>e?n+e:e},Y=function(e,t,n){return e.replace(/%curr%/gi,t+1).replace(/%total%/gi,n)};e.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var n=t.st.gallery,i=".mfp-gallery",r=Boolean(e.fn.mfpFastClick);return t.direction=!0,n&&n.enabled?(a+=" mfp-gallery",x(f+i,function(){n.navigateByImgClick&&t.wrap.on("click"+i,".mfp-img",function(){return t.items.length>1?(t.next(),!1):void 0}),o.on("keydown"+i,function(e){37===e.keyCode?t.prev():39===e.keyCode&&t.next()})}),x("UpdateStatus"+i,function(e,n){n.text&&(n.text=Y(n.text,t.currItem.index,t.items.length))}),x(p+i,function(e,i,o,r){var a=t.items.length;o.counter=a>1?Y(n.tCounter,r.index,a):""}),x("BuildControls"+i,function(){if(t.items.length>1&&n.arrows&&!t.arrowLeft){var i=n.arrowMarkup,o=t.arrowLeft=e(i.replace(/%title%/gi,n.tPrev).replace(/%dir%/gi,"left")).addClass(y),a=t.arrowRight=e(i.replace(/%title%/gi,n.tNext).replace(/%dir%/gi,"right")).addClass(y),s=r?"mfpFastClick":"click";o[s](function(){t.prev()}),a[s](function(){t.next()}),t.isIE7&&(k("b",o[0],!1,!0),k("a",o[0],!1,!0),k("b",a[0],!1,!0),k("a",a[0],!1,!0)),t.container.append(o.add(a))}}),x(m+i,function(){t._preloadTimeout&&clearTimeout(t._preloadTimeout),t._preloadTimeout=setTimeout(function(){t.preloadNearbyImages(),t._preloadTimeout=null},16)}),x(l+i,function(){o.off(i),t.wrap.off("click"+i),t.arrowLeft&&r&&t.arrowLeft.add(t.arrowRight).destroyMfpFastClick(),t.arrowRight=t.arrowLeft=null}),void 0):!1},next:function(){t.direction=!0,t.index=K(t.index+1),t.updateItemHTML()},prev:function(){t.direction=!1,t.index=K(t.index-1),t.updateItemHTML()},goTo:function(e){t.direction=e>=t.index,t.index=e,t.updateItemHTML()},preloadNearbyImages:function(){var e,n=t.st.gallery.preload,i=Math.min(n[0],t.items.length),o=Math.min(n[1],t.items.length);for(e=1;(t.direction?o:i)>=e;e++)t._preloadItem(t.index+e);for(e=1;(t.direction?i:o)>=e;e++)t._preloadItem(t.index-e)},_preloadItem:function(n){if(n=K(n),!t.items[n].preloaded){var i=t.items[n];i.parsed||(i=t.parseEl(n)),T("LazyLoad",i),"image"===i.type&&(i.img=e('').on("load.mfploader",function(){i.hasSize=!0}).on("error.mfploader",function(){i.hasSize=!0,i.loadError=!0,T("LazyLoadError",i)}).attr("src",i.src)),i.preloaded=!0}}}});var U="retina";e.magnificPopup.registerModule(U,{options:{replaceSrc:function(e){return e.src.replace(/\.\w+$/,function(e){return"@2x"+e})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var e=t.st.retina,n=e.ratio;n=isNaN(n)?n():n,n>1&&(x("ImageHasSize."+U,function(e,t){t.img.css({"max-width":t.img[0].naturalWidth/n,width:"100%"})}),x("ElementParse."+U,function(t,i){i.src=e.replaceSrc(i,n)}))}}}}),function(){var t=1e3,n="ontouchstart"in window,i=function(){I.off("touchmove"+r+" touchend"+r)},o="mfpFastClick",r="."+o;e.fn.mfpFastClick=function(o){return e(this).each(function(){var a,s=e(this);if(n){var l,c,d,u,p,f;s.on("touchstart"+r,function(e){u=!1,f=1,p=e.originalEvent?e.originalEvent.touches[0]:e.touches[0],c=p.clientX,d=p.clientY,I.on("touchmove"+r,function(e){p=e.originalEvent?e.originalEvent.touches:e.touches,f=p.length,p=p[0],(Math.abs(p.clientX-c)>10||Math.abs(p.clientY-d)>10)&&(u=!0,i())}).on("touchend"+r,function(e){i(),u||f>1||(a=!0,e.preventDefault(),clearTimeout(l),l=setTimeout(function(){a=!1},t),o())})})}s.on("click"+r,function(){a||o()})})},e.fn.destroyMfpFastClick=function(){e(this).off("touchstart"+r+" click"+r),n&&I.off("touchmove"+r+" touchend"+r)}}(),_()})(window.jQuery||window.Zepto); \ No newline at end of file diff --git a/vendors/jquery-magnific-popup/magnific-popup-animations.css b/vendors/jquery-magnific-popup/magnific-popup-animations.css deleted file mode 100644 index 3dfd27a65..000000000 --- a/vendors/jquery-magnific-popup/magnific-popup-animations.css +++ /dev/null @@ -1,45 +0,0 @@ - -/* overlay at start */ -.mfp-fade.mfp-bg { - opacity: 0; - - -webkit-transition: all 0.2s ease-out; - -moz-transition: all 0.2s ease-out; - transition: all 0.2s ease-out; -} -/* overlay animate in */ -.mfp-fade.mfp-bg.mfp-ready { - opacity: 0.8; -} -/* overlay animate out */ -.mfp-fade.mfp-bg.mfp-removing { - opacity: 0; -} - -/* content at start */ -.mfp-fade.mfp-wrap .mfp-content { - opacity: 0; - - -webkit-transition: all 0.15s ease-out; - -moz-transition: all 0.15s ease-out; - transition: all 0.15s ease-out; - - -webkit-transform: translateX(-50px); - -moz-transform: translateX(-50px); - transform: translateX(-50px); -} - -/* content animate it */ -.mfp-fade.mfp-wrap.mfp-ready .mfp-content { - opacity: 1; - -webkit-transform: translateX(0); - -moz-transform: translateX(0); - transform: translateX(0); -} -/* content animate out */ -.mfp-fade.mfp-wrap.mfp-removing .mfp-content { - opacity: 0; - -webkit-transform: translateX(50px); - -moz-transform: translateX(50px); - transform: translateX(50px); -} diff --git a/vendors/jquery-magnific-popup/magnific-popup.css b/vendors/jquery-magnific-popup/magnific-popup.css deleted file mode 100644 index 798ac9d8f..000000000 --- a/vendors/jquery-magnific-popup/magnific-popup.css +++ /dev/null @@ -1,368 +0,0 @@ -/* Magnific Popup CSS */ -.mfp-bg { - top: 0; - left: 0; - width: 100%; - height: 100%; - z-index: 1042; - overflow: hidden; - position: fixed; - background: #0b0b0b; - opacity: 0.8; - filter: alpha(opacity=80); } - -.mfp-wrap { - top: 0; - left: 0; - width: 100%; - height: 100%; - z-index: 1043; - position: fixed; - outline: none !important; - -webkit-backface-visibility: hidden; } - -.mfp-container { - text-align: center; - position: absolute; - width: 100%; - height: 100%; - left: 0; - top: 0; - padding: 0 8px; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; } - -.mfp-container:before { - content: ''; - display: inline-block; - height: 100%; - vertical-align: middle; } - -.mfp-align-top .mfp-container:before { - display: none; } - -.mfp-content { - position: relative; - display: inline-block; - vertical-align: middle; - margin: 0 auto; - text-align: left; - z-index: 1045; } - -.mfp-inline-holder .mfp-content, .mfp-ajax-holder .mfp-content { - width: 100%; - cursor: auto; } - -.mfp-ajax-cur { - cursor: progress; } - -.mfp-zoom-out-cur, .mfp-zoom-out-cur .mfp-image-holder .mfp-close { - cursor: -moz-zoom-out; - cursor: -webkit-zoom-out; - cursor: zoom-out; } - -.mfp-zoom { - cursor: pointer; - cursor: -webkit-zoom-in; - cursor: -moz-zoom-in; - cursor: zoom-in; } - -.mfp-auto-cursor .mfp-content { - cursor: auto; } - -.mfp-close, .mfp-arrow, .mfp-preloader, .mfp-counter { - -webkit-user-select: none; - -moz-user-select: none; - user-select: none; } - -.mfp-loading.mfp-figure { - display: none; } - -.mfp-hide { - display: none !important; } - -.mfp-preloader { - color: #cccccc; - position: absolute; - top: 50%; - width: auto; - text-align: center; - margin-top: -0.8em; - left: 8px; - right: 8px; - z-index: 1044; } - .mfp-preloader a { - color: #cccccc; } - .mfp-preloader a:hover { - color: white; } - -.mfp-s-ready .mfp-preloader { - display: none; } - -.mfp-s-error .mfp-content { - display: none; } - -button.mfp-close, button.mfp-arrow { - overflow: visible; - cursor: pointer; - background: transparent; - border: 0; - -webkit-appearance: none; - display: block; - outline: none; - padding: 0; - z-index: 1046; - -webkit-box-shadow: none; - box-shadow: none; } -button::-moz-focus-inner { - padding: 0; - border: 0; } - -.mfp-close { - width: 44px; - height: 44px; - line-height: 44px; - position: absolute; - right: 0; - top: 0; - text-decoration: none; - text-align: center; - opacity: 0.65; - filter: alpha(opacity=65); - padding: 0 0 18px 10px; - color: white; - font-style: normal; - font-size: 28px; - font-family: Arial, Baskerville, monospace; } - .mfp-close:hover, .mfp-close:focus { - opacity: 1; - filter: alpha(opacity=100); } - .mfp-close:active { - top: 1px; } - -.mfp-close-btn-in .mfp-close { - color: #333333; } - -.mfp-image-holder .mfp-close, .mfp-iframe-holder .mfp-close { - color: white; - right: -6px; - text-align: right; - padding-right: 6px; - width: 100%; } - -.mfp-counter { - position: absolute; - top: 0; - right: 0; - color: #cccccc; - font-size: 12px; - line-height: 18px; } - -.mfp-arrow { - position: absolute; - opacity: 0.65; - filter: alpha(opacity=65); - margin: 0; - top: 50%; - margin-top: -55px; - padding: 0; - width: 90px; - height: 110px; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } - .mfp-arrow:active { - margin-top: -54px; } - .mfp-arrow:hover, .mfp-arrow:focus { - opacity: 1; - filter: alpha(opacity=100); } - .mfp-arrow:before, .mfp-arrow:after, .mfp-arrow .mfp-b, .mfp-arrow .mfp-a { - content: ''; - display: block; - width: 0; - height: 0; - position: absolute; - left: 0; - top: 0; - margin-top: 35px; - margin-left: 35px; - border: medium inset transparent; } - .mfp-arrow:after, .mfp-arrow .mfp-a { - border-top-width: 13px; - border-bottom-width: 13px; - top: 8px; } - .mfp-arrow:before, .mfp-arrow .mfp-b { - border-top-width: 21px; - border-bottom-width: 21px; - opacity: 0.7; } - -.mfp-arrow-left { - left: 0; } - .mfp-arrow-left:after, .mfp-arrow-left .mfp-a { - border-right: 17px solid white; - margin-left: 31px; } - .mfp-arrow-left:before, .mfp-arrow-left .mfp-b { - margin-left: 25px; - border-right: 27px solid #3f3f3f; } - -.mfp-arrow-right { - right: 0; } - .mfp-arrow-right:after, .mfp-arrow-right .mfp-a { - border-left: 17px solid white; - margin-left: 39px; } - .mfp-arrow-right:before, .mfp-arrow-right .mfp-b { - border-left: 27px solid #3f3f3f; } - -.mfp-iframe-holder { - padding-top: 40px; - padding-bottom: 40px; } - .mfp-iframe-holder .mfp-content { - line-height: 0; - width: 100%; - max-width: 900px; } - .mfp-iframe-holder .mfp-close { - top: -40px; } - -.mfp-iframe-scaler { - width: 100%; - height: 0; - overflow: hidden; - padding-top: 56.25%; } - .mfp-iframe-scaler iframe { - position: absolute; - display: block; - top: 0; - left: 0; - width: 100%; - height: 100%; - box-shadow: 0 0 8px rgba(0, 0, 0, 0.6); - background: black; } - -/* Main image in popup */ -img.mfp-img { - width: auto; - max-width: 100%; - height: auto; - display: block; - line-height: 0; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - padding: 40px 0 40px; - margin: 0 auto; } - -/* The shadow behind the image */ -.mfp-figure { - line-height: 0; } - .mfp-figure:after { - content: ''; - position: absolute; - left: 0; - top: 40px; - bottom: 40px; - display: block; - right: 0; - width: auto; - height: auto; - z-index: -1; - box-shadow: 0 0 8px rgba(0, 0, 0, 0.6); - background: #444444; } - .mfp-figure small { - color: #bdbdbd; - display: block; - font-size: 12px; - line-height: 14px; } - .mfp-figure figure { - margin: 0; } - -.mfp-bottom-bar { - margin-top: -36px; - position: absolute; - top: 100%; - left: 0; - width: 100%; - cursor: auto; } - -.mfp-title { - text-align: left; - line-height: 18px; - color: #f3f3f3; - word-wrap: break-word; - padding-right: 36px; } - -.mfp-image-holder .mfp-content { - max-width: 100%; } - -.mfp-gallery .mfp-image-holder .mfp-figure { - cursor: pointer; } - -@media screen and (max-width: 800px) and (orientation: landscape), screen and (max-height: 300px) { - /** - * Remove all paddings around the image on small screen - */ - .mfp-img-mobile .mfp-image-holder { - padding-left: 0; - padding-right: 0; } - .mfp-img-mobile img.mfp-img { - padding: 0; } - .mfp-img-mobile .mfp-figure:after { - top: 0; - bottom: 0; } - .mfp-img-mobile .mfp-figure small { - display: inline; - margin-left: 5px; } - .mfp-img-mobile .mfp-bottom-bar { - background: rgba(0, 0, 0, 0.6); - bottom: 0; - margin: 0; - top: auto; - padding: 3px 5px; - position: fixed; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; } - .mfp-img-mobile .mfp-bottom-bar:empty { - padding: 0; } - .mfp-img-mobile .mfp-counter { - right: 5px; - top: 3px; } - .mfp-img-mobile .mfp-close { - top: 0; - right: 0; - width: 35px; - height: 35px; - line-height: 35px; - background: rgba(0, 0, 0, 0.6); - position: fixed; - text-align: center; - padding: 0; } } - -@media all and (max-width: 900px) { - .mfp-arrow { - -webkit-transform: scale(0.75); - transform: scale(0.75); } - .mfp-arrow-left { - -webkit-transform-origin: 0; - transform-origin: 0; } - .mfp-arrow-right { - -webkit-transform-origin: 100%; - transform-origin: 100%; } - .mfp-container { - padding-left: 6px; - padding-right: 6px; } } - -.mfp-ie7 .mfp-img { - padding: 0; } -.mfp-ie7 .mfp-bottom-bar { - width: 600px; - left: 50%; - margin-left: -300px; - margin-top: 5px; - padding-bottom: 5px; } -.mfp-ie7 .mfp-container { - padding: 0; } -.mfp-ie7 .mfp-content { - padding-top: 44px; } -.mfp-ie7 .mfp-close { - top: 0; - right: 0; - padding-top: 0; } diff --git a/vendors/jquery-magnific-popup/magnific-popup.jquery.json b/vendors/jquery-magnific-popup/magnific-popup.jquery.json deleted file mode 100644 index a7de75fb2..000000000 --- a/vendors/jquery-magnific-popup/magnific-popup.jquery.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "magnific-popup", - "title": "Magnific Popup", - "description": "Fast, light, mobile-friendly and responsive lightbox and modal dialog plugin. Open inline HTML, ajax loaded content, image, form, iframe (YouTube video, Vimeo, Google Maps), photo gallery. Animation effects added with CSS3 transitions. For jQuery or Zepto.", - "version": "0.9.9", - "homepage": "http://dimsemenov.com/plugins/magnific-popup/", - "demo": "http://dimsemenov.com/plugins/magnific-popup/", - "docs": "http://dimsemenov.com/plugins/magnific-popup/documentation.html", - "author": { - "name": "Dmitry Semenov", - "email": "diiiimaaaa@gmail.com", - "url": "http://dimsemenov.com" - }, - "repository": { - "type": "git", - "url": "https://github.com/dimsemenov/Magnific-Popup.git" - }, - "bugs": "https://github.com/dimsemenov/Magnific-Popup/issues", - "dependencies": { - "jquery": ">=1.7.2" - }, - "keywords": ["lightbox","popup","modal","window","dialog","ui","gallery","slideshow","video","image","ajax","html5","animation","jquery","photo","responsive","mobile"], - "licenses": [ - { - "type": "MIT", - "url": "http://www.opensource.org/licenses/mit-license.php" - } - ] -} \ No newline at end of file diff --git a/vendors/jquery-magnific-popup/package.json b/vendors/jquery-magnific-popup/package.json deleted file mode 100644 index b2b4984a4..000000000 --- a/vendors/jquery-magnific-popup/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "magnific-popup", - - "version": "0.9.9", - "title": "Magnific Popup", - "description": "Lightbox and modal dialog plugin. Can display inline HTML, iframes (YouTube video, Vimeo, Google Maps), or an image gallery. Animation effects are added with CSS3 transitions. For jQuery or Zepto.", - "keywords": ["lightbox","popup","modal","window","dialog","gallery","jquery","photo","responsive","mobile"], - "author": { - "name": "Dmitry Semenov", - "email": "diiiimaaaa@gmail.com", - "web": "http://dimsemenov.com" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/dimsemenov/Magnific-Popup/issues" - }, - "main": "dist/jquery.magnific-popup.js", - "homepage": "http://dimsemenov.com/plugins/magnific-popup/", - - - - "engines": { - "node": ">= 0.8.0" - }, - "scripts": { - "test": "grunt jshint" - }, - "devDependencies": { - "grunt-contrib-jshint": "~0.1.1", - "grunt-contrib-concat": "~0.1.2", - "grunt-contrib-uglify": "~0.1.1", - "grunt-contrib-watch": "~0.2.0", - "grunt-contrib-clean": "~0.4.0", - "grunt": "~0.4.0", - "grunt-contrib-cssmin": "~0.4.1", - "grunt-contrib-copy": "~0.4.0", - "grunt-jekyll": "~0.3.9", - "grunt-sass": "~0.6.1" - }, - "repository": { - "type": "git", - "url": "https://github.com/dimsemenov/Magnific-Popup.git" - } -} diff --git a/vendors/jquery-ui.touch-punch/jquery.ui.touch-punch.min.js b/vendors/jquery-ui.touch-punch/jquery.ui.touch-punch.min.js deleted file mode 100644 index 31272ce6f..000000000 --- a/vendors/jquery-ui.touch-punch/jquery.ui.touch-punch.min.js +++ /dev/null @@ -1,11 +0,0 @@ -/*! - * jQuery UI Touch Punch 0.2.3 - * - * Copyright 2011–2014, Dave Furfero - * Dual licensed under the MIT or GPL Version 2 licenses. - * - * Depends: - * jquery.ui.widget.js - * jquery.ui.mouse.js - */ -!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery); \ No newline at end of file diff --git a/vendors/knockout-punches/knockout.punches.js b/vendors/knockout-punches/knockout.punches.js deleted file mode 100644 index 62d50297c..000000000 --- a/vendors/knockout-punches/knockout.punches.js +++ /dev/null @@ -1,589 +0,0 @@ -/** - * @license Knockout.Punches - * Enhanced binding syntaxes for Knockout 3+ - * (c) Michael Best - * License: MIT (http://www.opensource.org/licenses/mit-license.php) - * Version 0.5.0 - */ -(function (factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['knockout'], factory); - } else { - // Browser globals - factory(ko); - } -}(function(ko) { - -// Add a preprocess function to a binding handler. -function addBindingPreprocessor(bindingKeyOrHandler, preprocessFn) { - return chainPreprocessor(getOrCreateHandler(bindingKeyOrHandler), 'preprocess', preprocessFn); -} - -// These utility functions are separated out because they're also used by -// preprocessBindingProperty - -// Get the binding handler or create a new, empty one -function getOrCreateHandler(bindingKeyOrHandler) { - return typeof bindingKeyOrHandler === 'object' ? bindingKeyOrHandler : - (ko.getBindingHandler(bindingKeyOrHandler) || (ko.bindingHandlers[bindingKeyOrHandler] = {})); -} -// Add a preprocess function -function chainPreprocessor(obj, prop, fn) { - if (obj[prop]) { - // If the handler already has a preprocess function, chain the new - // one after the existing one. If the previous function in the chain - // returns a falsy value (to remove the binding), the chain ends. This - // method allows each function to modify and return the binding value. - var previousFn = obj[prop]; - obj[prop] = function(value, binding, addBinding) { - value = previousFn.call(this, value, binding, addBinding); - if (value) - return fn.call(this, value, binding, addBinding); - }; - } else { - obj[prop] = fn; - } - return obj; -} - -// Add a preprocessNode function to the binding provider. If a -// function already exists, chain the new one after it. This calls -// each function in the chain until one modifies the node. This -// method allows only one function to modify the node. -function addNodePreprocessor(preprocessFn) { - var provider = ko.bindingProvider.instance; - if (provider.preprocessNode) { - var previousPreprocessFn = provider.preprocessNode; - provider.preprocessNode = function(node) { - var newNodes = previousPreprocessFn.call(this, node); - if (!newNodes) - newNodes = preprocessFn.call(this, node); - return newNodes; - }; - } else { - provider.preprocessNode = preprocessFn; - } -} - -function addBindingHandlerCreator(matchRegex, callbackFn) { - var oldGetHandler = ko.getBindingHandler; - ko.getBindingHandler = function(bindingKey) { - var match; - return oldGetHandler(bindingKey) || ((match = bindingKey.match(matchRegex)) && callbackFn(match, bindingKey)); - }; -} - -// Create shortcuts to commonly used ko functions -var ko_unwrap = ko.unwrap; - -// Create "punches" object and export utility functions -var ko_punches = ko.punches = { - utils: { - addBindingPreprocessor: addBindingPreprocessor, - addNodePreprocessor: addNodePreprocessor, - addBindingHandlerCreator: addBindingHandlerCreator, - - // previous names retained for backwards compitibility - setBindingPreprocessor: addBindingPreprocessor, - setNodePreprocessor: addNodePreprocessor - } -}; - -ko_punches.enableAll = function () { - // Enable interpolation markup - enableInterpolationMarkup(); - enableAttributeInterpolationMarkup(); - - // Enable auto-namspacing of attr, css, event, and style - enableAutoNamespacedSyntax('attr'); - enableAutoNamespacedSyntax('css'); - enableAutoNamespacedSyntax('event'); - enableAutoNamespacedSyntax('style'); - - // Enable filter syntax for text, html, and attr - enableTextFilter('text'); - enableTextFilter('html'); - addDefaultNamespacedBindingPreprocessor('attr', filterPreprocessor); - - // Enable wrapped callbacks for click, submit, event, optionsAfterRender, and template options - enableWrappedCallback('click'); - enableWrappedCallback('submit'); - enableWrappedCallback('optionsAfterRender'); - addDefaultNamespacedBindingPreprocessor('event', wrappedCallbackPreprocessor); - addBindingPropertyPreprocessor('template', 'beforeRemove', wrappedCallbackPreprocessor); - addBindingPropertyPreprocessor('template', 'afterAdd', wrappedCallbackPreprocessor); - addBindingPropertyPreprocessor('template', 'afterRender', wrappedCallbackPreprocessor); -}; -// Convert input in the form of `expression | filter1 | filter2:arg1:arg2` to a function call format -// with filters accessed as ko.filters.filter1, etc. -function filterPreprocessor(input) { - // Check if the input contains any | characters; if not, just return - if (input.indexOf('|') === -1) - return input; - - // Split the input into tokens, in which | and : are individual tokens, quoted strings are ignored, and all tokens are space-trimmed - var tokens = input.match(/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'|\|\||[|:]|[^\s|:"'][^|:"']*[^\s|:"']|[^\s|:"']/g); - if (tokens && tokens.length > 1) { - // Append a line so that we don't need a separate code block to deal with the last item - tokens.push('|'); - input = tokens[0]; - var lastToken, token, inFilters = false, nextIsFilter = false; - for (var i = 1, token; token = tokens[i]; ++i) { - if (token === '|') { - if (inFilters) { - if (lastToken === ':') - input += "undefined"; - input += ')'; - } - nextIsFilter = true; - inFilters = true; - } else { - if (nextIsFilter) { - input = "ko.filters['" + token + "'](" + input; - } else if (inFilters && token === ':') { - if (lastToken === ':') - input += "undefined"; - input += ","; - } else { - input += token; - } - nextIsFilter = false; - } - lastToken = token; - } - } - return input; -} - -// Set the filter preprocessor for a specific binding -function enableTextFilter(bindingKeyOrHandler) { - addBindingPreprocessor(bindingKeyOrHandler, filterPreprocessor); -} - -var filters = {}; - -// Convert value to uppercase -filters.uppercase = function(value) { - return String.prototype.toUpperCase.call(ko_unwrap(value)); -}; - -// Convert value to lowercase -filters.lowercase = function(value) { - return String.prototype.toLowerCase.call(ko_unwrap(value)); -}; - -// Return default value if the input value is empty or null -filters['default'] = function (value, defaultValue) { - value = ko_unwrap(value); - if (typeof value === "function") { - return value; - } - if (typeof value === "string") { - return trim(value) === '' ? defaultValue : value; - } - return value == null || value.length == 0 ? defaultValue : value; -}; - -// Return the value with the search string replaced with the replacement string -filters.replace = function(value, search, replace) { - return String.prototype.replace.call(ko_unwrap(value), search, replace); -}; - -filters.fit = function(value, length, replacement, trimWhere) { - value = ko_unwrap(value); - if (length && ('' + value).length > length) { - replacement = '' + (replacement || '...'); - length = length - replacement.length; - value = '' + value; - switch (trimWhere) { - case 'left': - return replacement + value.slice(-length); - case 'middle': - var leftLen = Math.ceil(length / 2); - return value.substr(0, leftLen) + replacement + value.slice(leftLen-length); - default: - return value.substr(0, length) + replacement; - } - } else { - return value; - } -}; - -// Convert a model object to JSON -filters.json = function(rootObject, space, replacer) { // replacer and space are optional - return ko.toJSON(rootObject, replacer, space); -}; - -// Format a number using the browser's toLocaleString -filters.number = function(value) { - return (+ko_unwrap(value)).toLocaleString(); -}; - -// Export the filters object for general access -ko.filters = filters; - -// Export the preprocessor functions -ko_punches.textFilter = { - preprocessor: filterPreprocessor, - enableForBinding: enableTextFilter -}; -// Support dynamically-created, namespaced bindings. The binding key syntax is -// "namespace.binding". Within a certain namespace, we can dynamically create the -// handler for any binding. This is particularly useful for bindings that work -// the same way, but just set a different named value, such as for element -// attributes or CSS classes. -var namespacedBindingMatch = /([^\.]+)\.(.+)/, namespaceDivider = '.'; -addBindingHandlerCreator(namespacedBindingMatch, function (match, bindingKey) { - var namespace = match[1], - namespaceHandler = ko.bindingHandlers[namespace]; - if (namespaceHandler) { - var bindingName = match[2], - handlerFn = namespaceHandler.getNamespacedHandler || defaultGetNamespacedHandler, - handler = handlerFn.call(namespaceHandler, bindingName, namespace, bindingKey); - ko.bindingHandlers[bindingKey] = handler; - return handler; - } -}); - -// Knockout's built-in bindings "attr", "event", "css" and "style" include the idea of -// namespaces, representing it using a single binding that takes an object map of names -// to values. This default handler translates a binding of "namespacedName: value" -// to "namespace: {name: value}" to automatically support those built-in bindings. -function defaultGetNamespacedHandler(name, namespace, namespacedName) { - var handler = ko.utils.extend({}, this); - function setHandlerFunction(funcName) { - if (handler[funcName]) { - handler[funcName] = function(element, valueAccessor) { - function subValueAccessor() { - var result = {}; - result[name] = valueAccessor(); - return result; - } - var args = Array.prototype.slice.call(arguments, 0); - args[1] = subValueAccessor; - return ko.bindingHandlers[namespace][funcName].apply(this, args); - }; - } - } - // Set new init and update functions that wrap the originals - setHandlerFunction('init'); - setHandlerFunction('update'); - // Clear any preprocess function since preprocessing of the new binding would need to be different - if (handler.preprocess) - handler.preprocess = null; - if (ko.virtualElements.allowedBindings[namespace]) - ko.virtualElements.allowedBindings[namespacedName] = true; - return handler; -} - -// Adds a preprocess function for every generated namespace.x binding. This can -// be called multiple times for the same binding, and the preprocess functions will -// be chained. If the binding has a custom getNamespacedHandler method, make sure that -// it's set before this function is used. -function addDefaultNamespacedBindingPreprocessor(namespace, preprocessFn) { - var handler = ko.getBindingHandler(namespace); - if (handler) { - var previousHandlerFn = handler.getNamespacedHandler || defaultGetNamespacedHandler; - handler.getNamespacedHandler = function() { - return addBindingPreprocessor(previousHandlerFn.apply(this, arguments), preprocessFn); - }; - } -} - -function autoNamespacedPreprocessor(value, binding, addBinding) { - if (value.charAt(0) !== "{") - return value; - - // Handle two-level binding specified as "binding: {key: value}" by parsing inner - // object and converting to "binding.key: value" - var subBindings = ko.expressionRewriting.parseObjectLiteral(value); - ko.utils.arrayForEach(subBindings, function(keyValue) { - addBinding(binding + namespaceDivider + keyValue.key, keyValue.value); - }); -} - -// Set the namespaced preprocessor for a specific binding -function enableAutoNamespacedSyntax(bindingKeyOrHandler) { - addBindingPreprocessor(bindingKeyOrHandler, autoNamespacedPreprocessor); -} - -// Export the preprocessor functions -ko_punches.namespacedBinding = { - defaultGetHandler: defaultGetNamespacedHandler, - setDefaultBindingPreprocessor: addDefaultNamespacedBindingPreprocessor, // for backwards compat. - addDefaultBindingPreprocessor: addDefaultNamespacedBindingPreprocessor, - preprocessor: autoNamespacedPreprocessor, - enableForBinding: enableAutoNamespacedSyntax -}; -// Wrap a callback function in an anonymous function so that it is called with the appropriate -// "this" value. -function wrappedCallbackPreprocessor(val) { - // Matches either an isolated identifier or something ending with a property accessor - if (/^([$_a-z][$\w]*|.+(\.\s*[$_a-z][$\w]*|\[.+\]))$/i.test(val)) { - return 'function(_x,_y,_z){return(' + val + ')(_x,_y,_z);}'; - } else { - return val; - } -} - -// Set the wrappedCallback preprocessor for a specific binding -function enableWrappedCallback(bindingKeyOrHandler) { - addBindingPreprocessor(bindingKeyOrHandler, wrappedCallbackPreprocessor); -} - -// Export the preprocessor functions -ko_punches.wrappedCallback = { - preprocessor: wrappedCallbackPreprocessor, - enableForBinding: enableWrappedCallback -}; -// Attach a preprocess function to a specific property of a binding. This allows you to -// preprocess binding "options" using the same preprocess functions that work for bindings. -function addBindingPropertyPreprocessor(bindingKeyOrHandler, property, preprocessFn) { - var handler = getOrCreateHandler(bindingKeyOrHandler); - if (!handler._propertyPreprocessors) { - // Initialize the binding preprocessor - chainPreprocessor(handler, 'preprocess', propertyPreprocessor); - handler._propertyPreprocessors = {}; - } - // Add the property preprocess function - chainPreprocessor(handler._propertyPreprocessors, property, preprocessFn); -} - -// In order to preprocess a binding property, we have to preprocess the binding itself. -// This preprocess function splits up the binding value and runs each property's preprocess -// function if it's set. -function propertyPreprocessor(value, binding, addBinding) { - if (value.charAt(0) !== "{") - return value; - - var subBindings = ko.expressionRewriting.parseObjectLiteral(value), - resultStrings = [], - propertyPreprocessors = this._propertyPreprocessors || {}; - ko.utils.arrayForEach(subBindings, function(keyValue) { - var prop = keyValue.key, propVal = keyValue.value; - if (propertyPreprocessors[prop]) { - propVal = propertyPreprocessors[prop](propVal, prop, addBinding); - } - if (propVal) { - resultStrings.push("'" + prop + "':" + propVal); - } - }); - return "{" + resultStrings.join(",") + "}"; -} - -// Export the preprocessor functions -ko_punches.preprocessBindingProperty = { - setPreprocessor: addBindingPropertyPreprocessor, // for backwards compat. - addPreprocessor: addBindingPropertyPreprocessor -}; -// Wrap an expression in an anonymous function so that it is called when the event happens -function makeExpressionCallbackPreprocessor(args) { - return function expressionCallbackPreprocessor(val) { - return 'function('+args+'){return(' + val + ');}'; - }; -} - -var eventExpressionPreprocessor = makeExpressionCallbackPreprocessor("$data,$event"); - -// Set the expressionCallback preprocessor for a specific binding -function enableExpressionCallback(bindingKeyOrHandler, args) { - var args = Array.prototype.slice.call(arguments, 1).join(); - addBindingPreprocessor(bindingKeyOrHandler, makeExpressionCallbackPreprocessor(args)); -} - -// Export the preprocessor functions -ko_punches.expressionCallback = { - makePreprocessor: makeExpressionCallbackPreprocessor, - eventPreprocessor: eventExpressionPreprocessor, - enableForBinding: enableExpressionCallback -}; - -// Create an "on" namespace for events to use the expression method -ko.bindingHandlers.on = { - getNamespacedHandler: function(eventName) { - var handler = ko.getBindingHandler('event' + namespaceDivider + eventName); - return addBindingPreprocessor(handler, eventExpressionPreprocessor); - } -}; -// Performance comparison at http://jsperf.com/markup-interpolation-comparison -function parseInterpolationMarkup(textToParse, outerTextCallback, expressionCallback) { - function innerParse(text) { - var innerMatch = text.match(/^([\s\S]*)}}([\s\S]*?)\{\{([\s\S]*)$/); - if (innerMatch) { - innerParse(innerMatch[1]); - outerTextCallback(innerMatch[2]); - expressionCallback(innerMatch[3]); - } else { - expressionCallback(text); - } - } - var outerMatch = textToParse.match(/^([\s\S]*?)\{\{([\s\S]*)}}([\s\S]*)$/); - if (outerMatch) { - outerTextCallback(outerMatch[1]); - innerParse(outerMatch[2]); - outerTextCallback(outerMatch[3]); - } -} - -function trim(string) { - return string == null ? '' : - string.trim ? - string.trim() : - string.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g, ''); -} - -function interpolationMarkupPreprocessor(node) { - // only needs to work with text nodes - if (node.nodeType === 3 && node.nodeValue && node.nodeValue.indexOf('{{') !== -1 && (node.parentNode || {}).nodeName != "TEXTAREA") { - var nodes = []; - function addTextNode(text) { - if (text) - nodes.push(document.createTextNode(text)); - } - function wrapExpr(expressionText) { - if (expressionText) - nodes.push.apply(nodes, ko_punches_interpolationMarkup.wrapExpression(expressionText, node)); - } - parseInterpolationMarkup(node.nodeValue, addTextNode, wrapExpr) - - if (nodes.length) { - if (node.parentNode) { - for (var i = 0, n = nodes.length, parent = node.parentNode; i < n; ++i) { - parent.insertBefore(nodes[i], node); - } - parent.removeChild(node); - } - return nodes; - } - } -} - -if (!ko.virtualElements.allowedBindings.html) { - // Virtual html binding - // SO Question: http://stackoverflow.com/a/15348139 - var overridden = ko.bindingHandlers.html.update; - ko.bindingHandlers.html.update = function (element, valueAccessor) { - if (element.nodeType === 8) { - var html = ko_unwrap(valueAccessor()); - if (html != null) { - var parsedNodes = ko.utils.parseHtmlFragment('' + html); - ko.virtualElements.setDomNodeChildren(element, parsedNodes); - } else { - ko.virtualElements.emptyNode(element); - } - } else { - overridden(element, valueAccessor); - } - }; - ko.virtualElements.allowedBindings.html = true; -} - -function wrapExpression(expressionText, node) { - var ownerDocument = node ? node.ownerDocument : document, - closeComment = true, - binding, - firstChar = expressionText[0], - lastChar = expressionText[expressionText.length - 1], - result = [], - matches; - - if (firstChar === '#') { - if (lastChar === '/') { - binding = expressionText.slice(1, -1); - } else { - binding = expressionText.slice(1); - closeComment = false; - } - if (matches = binding.match(/^([^,"'{}()\/:[\]\s]+)\s+([^\s:].*)/)) { - binding = matches[1] + ':' + matches[2]; - } - } else if (firstChar === '/') { - // replace only with a closing comment - } else if (firstChar === '{' && lastChar === '}') { - binding = "html:" + trim(expressionText.slice(1, -1)); - } else { - binding = "text:" + trim(expressionText); - } - - if (binding) - result.push(ownerDocument.createComment("ko " + binding)); - if (closeComment) - result.push(ownerDocument.createComment("/ko")); - return result; -}; - -function enableInterpolationMarkup() { - addNodePreprocessor(interpolationMarkupPreprocessor); -} - -// Export the preprocessor functions -var ko_punches_interpolationMarkup = ko_punches.interpolationMarkup = { - preprocessor: interpolationMarkupPreprocessor, - enable: enableInterpolationMarkup, - wrapExpression: wrapExpression -}; - - -var dataBind = 'data-bind'; -function attributeInterpolationMarkerPreprocessor(node) { - if (node.nodeType === 1 && node.attributes.length) { - var dataBindAttribute = node.getAttribute(dataBind); - for (var attrs = ko.utils.arrayPushAll([], node.attributes), n = attrs.length, i = 0; i < n; ++i) { - var attr = attrs[i]; - if (attr.specified && attr.name != dataBind && attr.value.indexOf('{{') !== -1) { - var parts = [], attrValue = ''; - function addText(text) { - if (text) - parts.push('"' + text.replace(/"/g, '\\"') + '"'); - } - function addExpr(expressionText) { - if (expressionText) { - attrValue = expressionText; - parts.push('ko.unwrap(' + expressionText + ')'); - } - } - parseInterpolationMarkup(attr.value, addText, addExpr); - - if (parts.length > 1) { - attrValue = '""+' + parts.join('+'); - } - - if (attrValue) { - var attrName = attr.name.toLowerCase(); - var attrBinding = ko_punches_attributeInterpolationMarkup.attributeBinding(attrName, attrValue, node) || attributeBinding(attrName, attrValue, node); - if (!dataBindAttribute) { - dataBindAttribute = attrBinding - } else { - dataBindAttribute += ',' + attrBinding; - } - node.setAttribute(dataBind, dataBindAttribute); - // Using removeAttribute instead of removeAttributeNode because IE clears the - // class if you use removeAttributeNode to remove the id. - node.removeAttribute(attr.name); - } - } - } - } -} - -function attributeBinding(name, value, node) { - if (ko.getBindingHandler(name)) { - return name + ':' + value; - } else { - return 'attr.' + name + ':' + value; - } -} - -function enableAttributeInterpolationMarkup() { - addNodePreprocessor(attributeInterpolationMarkerPreprocessor); -} - -var ko_punches_attributeInterpolationMarkup = ko_punches.attributeInterpolationMarkup = { - preprocessor: attributeInterpolationMarkerPreprocessor, - enable: enableAttributeInterpolationMarkup, - attributeBinding: attributeBinding -}; - - return ko_punches; -})); diff --git a/vendors/knockout-punches/knockout.punches.min.js b/vendors/knockout-punches/knockout.punches.min.js deleted file mode 100644 index 215664da9..000000000 --- a/vendors/knockout-punches/knockout.punches.min.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - Knockout.Punches - Enhanced binding syntaxes for Knockout 3+ - (c) Michael Best - License: MIT (http://www.opensource.org/licenses/mit-license.php) - Version 0.5.0 -*/ -(function(c){"function"===typeof define&&define.amd?define(["knockout"],c):c(ko)})(function(c){function k(a,b){return u(B(a),"preprocess",b)}function B(a){return"object"===typeof a?a:c.getBindingHandler(a)||(c.bindingHandlers[a]={})}function u(a,b,d){if(a[b]){var g=a[b];a[b]=function(a,b,c){if(a=g.call(this,a,b,c))return d.call(this,a,b,c)}}else a[b]=d;return a}function r(a){var b=c.bindingProvider.instance;if(b.preprocessNode){var d=b.preprocessNode;b.preprocessNode=function(b){var c=d.call(this, -b);c||(c=a.call(this,b));return c}}else b.preprocessNode=a}function D(a,b){var d=c.getBindingHandler;c.getBindingHandler=function(g){var c;return d(g)||(c=g.match(a))&&b(c,g)}}function v(a){if(-1===a.indexOf("|"))return a;var b=a.match(/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'|\|\||[|:]|[^\s|:"'][^|:"']*[^\s|:"']|[^\s|:"']/g);if(b&&1b)switch(d=""+(d||"..."),b-=d.length,a=""+a,c){case "left":return d+a.slice(-b);case "middle":return c=Math.ceil(b/ -2),a.substr(0,c)+d+a.slice(c-b);default:return a.substr(0,b)+d}else return a},json:function(a,b,d){return c.toJSON(a,d,b)},number:function(a){return(+l(a)).toLocaleString()}};h.textFilter={preprocessor:v,enableForBinding:w};var F=".";D(/([^\.]+)\.(.+)/,function(a,b){var d=a[1],g=c.bindingHandlers[d];if(g)return d=(g.getNamespacedHandler||x).call(g,a[2],d,b),c.bindingHandlers[b]=d});h.namespacedBinding={defaultGetHandler:x,setDefaultBindingPreprocessor:s,addDefaultBindingPreprocessor:s,preprocessor:E, -enableForBinding:p};h.wrappedCallback={preprocessor:m,enableForBinding:t};h.preprocessBindingProperty={setPreprocessor:q,addPreprocessor:q};var M=y("$data,$event");h.expressionCallback={makePreprocessor:y,eventPreprocessor:M,enableForBinding:function(a,b){b=Array.prototype.slice.call(arguments,1).join();k(a,y(b))}};c.bindingHandlers.on={getNamespacedHandler:function(a){a=c.getBindingHandler("event"+F+a);return k(a,M)}};if(!c.virtualElements.allowedBindings.html){var Q=c.bindingHandlers.html.update; -c.bindingHandlers.html.update=function(a,b){if(8===a.nodeType){var d=l(b());null!=d?(d=c.utils.parseHtmlFragment(""+d),c.virtualElements.setDomNodeChildren(a,d)):c.virtualElements.emptyNode(a)}else Q(a,b)};c.virtualElements.allowedBindings.html=!0}var O=h.interpolationMarkup={preprocessor:H,enable:I,wrapExpression:function(a,b){var d=b?b.ownerDocument:document,c=!0,e,f=a[0],h=a[a.length-1],k=[];if("#"===f){if("/"===h?e=a.slice(1,-1):(e=a.slice(1),c=!1),f=e.match(/^([^,"'{}()\/:[\]\s]+)\s+([^\s:].*)/))e= -f[1]+":"+f[2]}else"/"!==f&&(e="{"===f&&"}"===h?"html:"+z(a.slice(1,-1)):"text:"+z(a));e&&k.push(d.createComment("ko "+e));c&&k.push(d.createComment("/ko"));return k}},A="data-bind",P=h.attributeInterpolationMarkup={preprocessor:J,enable:L,attributeBinding:K};return h});