diff --git a/build/js/tools.js b/build/js/tools.js index e2ede13..5d0ae1e 100644 --- a/build/js/tools.js +++ b/build/js/tools.js @@ -1,41 +1,5 @@ -/** -@author Chris Humboldt - -NOTE -Rocket serves as the "namespace" for all subsequent modules. Rocket modules do -require this toolset so make sure that this library is loaded first. -**/ -// Table of contents -// Defaults -// Variables -// Arrays -// Basic checks -// Classes -// Clone -// Dates -// Development -// Dimensions -// DOM -// Events -// Gets -// Helpers -// ID's -// Inputs -// Overlay -// Random -// Request -// Setup -// State -// Storage -// Strings -// Time -// URL -// Exports -// Bind Rocket object -// Rocket module var Rocket; (function (Rocket) { - // Defaults Rocket.defaults = { extensions: { all: ['png', 'jpg', 'jpeg', 'json', 'gif', 'tif', 'tiff', 'bmp', 'doc', 'docx', 'xls', 'xlsx', 'pdf', 'txt', 'csv'], @@ -77,7 +41,6 @@ var Rocket; type: 'session' } }; - // Variables var rocketMonths = [{ number: '01', name: 'january', @@ -142,24 +105,19 @@ var Rocket; }, list: ['active', 'closed', 'hidden', 'inactive', 'open', 'selected', 'toggled', 'visible'] }; - // Arrays Rocket.array = { clean: function (thisArray) { - // Catch if (!Rocket.is.array(thisArray)) { return false; } ; - // Continue return thisArray.filter(function (value) { return value !== null; }); }, make: function (arValue, isUnique) { var returnArray = []; - // Catch if (!arValue) { return returnArray; } - // Continue var unique = Rocket.helper.setDefault(isUnique, false); if (Rocket.is.array(arValue) && arValue.length > 0) { returnArray = arValue; @@ -171,7 +129,6 @@ var Rocket; returnArray = arValue.split(' '); } else if (Rocket.is.object(arValue)) { - // Try and catch HTMLCollection and NodeList arValue = Array.prototype.slice.call(arValue); if (Rocket.is.array(arValue) && arValue.length > 0) { returnArray = arValue; @@ -180,16 +137,13 @@ var Rocket; return (unique) ? Rocket.array.unique(returnArray) : returnArray; }, unique: function (thisArray) { - // Catch if (!Rocket.is.array(thisArray)) { return false; } ; - // Continue return thisArray.filter(function (value, index, self) { return self.indexOf(value) === index; }); } }; - // Basic checks Rocket.exists = function (check) { return !(typeof check === 'undefined' || check === null || check === false); }; @@ -213,11 +167,6 @@ var Rocket; return (typeof check === 'boolean'); }, browser: function () { - /* - A very basic check to detect if using a browser. - Lifted this directly from the Require.js check. - https://github.com/requirejs/requirejs/blob/master/require.js - */ return !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document); }, color: function (color) { @@ -276,11 +225,9 @@ var Rocket; return regExp.test(check); }, touch: function () { - // Catch if (!Rocket.is.browser() || !window || !window.console) { return false; } - // Continue return 'ontouchstart' in window || 'onmsgesturechange' in window; }, url: function (url, thisRegExp) { @@ -288,7 +235,6 @@ var Rocket; return regExp.test(url); } }; - // Classes Rocket.classes = { add: function (elements, classNames) { var elms = (Rocket.is.string(elements)) ? Rocket.dom.select(elements) : elements; @@ -314,23 +260,17 @@ var Rocket; .replace(/,/g, ' '); }, executeClasses: function (elements, classesAdd, classesRemove) { - // Catch if (!Rocket.exists(elements)) { return false; } - // Continue - // Create elements array var arElements = Rocket.array.make(elements); - // Catch if (arElements.length < 1) { return false; } - // Create classes array var arClassesAdd = Rocket.array.make(classesAdd, true); var arClassesRemove = Rocket.array.make(classesRemove, true); var actionAdd = (arClassesAdd.length > 0) ? true : false; var actionRemove = (arClassesRemove.length > 0) ? true : false; - // Execute for (var i = 0, len = arElements.length; i < len; i++) { if (actionAdd) { Rocket.classes.executeAdd(arElements[i], arClassesAdd); @@ -360,11 +300,9 @@ var Rocket; }, toggle: function (elements, className) { var elms = (Rocket.is.string(elements)) ? Rocket.dom.select(elements) : elements; - // Catch if (!Rocket.exists(elms) || typeof className !== 'string' || Rocket.has.spaces(className)) { return false; } - // Create elements array var arElements = []; if (Rocket.is.element(elms)) { arElements.push(elms); @@ -372,11 +310,9 @@ var Rocket; else if (Rocket.is.array(elms)) { arElements = elms; } - // Catch if (arElements.length < 1) { return false; } - // Execute for (var i = 0, len = arElements.length; i < len; i++) { if (!Rocket.has.class(arElements[i], className)) { Rocket.classes.executeAdd(arElements[i], [className]); @@ -387,23 +323,15 @@ var Rocket; } } }; - // Clone - /* - NOTE - INCOMPLETE! Needs a ton more work and really is not a viable method right now. - */ Rocket.clone = function (original) { return Rocket.helper.parse.json(JSON.stringify(original)); }; - // Dates Rocket.date = { basic: function (thisDate, thisWithTime) { var transDate = (thisDate) ? Rocket.date.transform(thisDate) : new Date(); - // Catch if (!transDate) { return false; } - // Continue var withTime = (Rocket.is.boolean(thisWithTime)) ? thisWithTime : false; var returnValue = ''; var day = Rocket.date.day(transDate.getDate()); @@ -418,7 +346,6 @@ var Rocket; day: function (thisDayVal, thisType) { var thisDay; var type = (Rocket.is.string(thisType)) ? thisType : false; - // Get month if (Rocket.is.number(thisDayVal)) { thisDay = thisDayVal; } @@ -429,14 +356,12 @@ var Rocket; else { thisDay = new Date().getDate(); } - // Validate if (!thisDay) { return false; } else { thisDay = thisDay.toString(); } - // Return if (type === 'long') { return (thisDay.length === 1) ? '0' + thisDay : thisDay; } @@ -446,11 +371,9 @@ var Rocket; }, safe: function (thisDate, thisWithTime) { var newData = (thisDate) ? Rocket.date.transform(thisDate) : new Date(); - // Catch if (!newData) { return false; } - // Continue var withTime = (Rocket.is.boolean(thisWithTime)) ? thisWithTime : false; var returnValue = newData.getFullYear() + '-' + ('0' + (newData.getMonth() + 1)).slice(-2) + '-' + ('0' + newData.getDate()).slice(-2); if (withTime) { @@ -461,7 +384,6 @@ var Rocket; month: function (thisMonthVal, thisType) { var thisMonth; var type = (Rocket.is.string(thisType)) ? thisType : false; - // Get month if (Rocket.is.number(thisMonthVal)) { thisMonth = thisMonthVal; } @@ -472,14 +394,12 @@ var Rocket; else { thisMonth = new Date().getMonth() + 1; } - // Validate if (!thisMonth) { return false; } else { thisMonth = thisMonth.toString(); } - // Return switch (type) { case 'long': thisMonth = (thisMonth.length === 1) ? '0' + thisMonth : thisMonth; @@ -506,7 +426,6 @@ var Rocket; }, toISO: function (thisDate, thisFullDate) { var fullDate = (typeof thisFullDate !== 'undefined') ? thisFullDate : true; - // Spaced dates if (thisDate.indexOf(' ') > -1) { var year = void 0, month = void 0, day = void 0, time_1, returnDate = void 0; var dateSplit = thisDate.split(' '); @@ -540,15 +459,9 @@ var Rocket; } }, transform: function (thisDate) { - /* - NOTE This is not a perfect test. This function will attempt to convert - any string passed into a date. This should really only be used with date - formats that are known to be correct. - */ function fixDateOrder(fixDate, seperator) { return fixDate.split(seperator).reverse().join(seperator); } - // Execute if (Rocket.is.string(thisDate)) { var dateIndexDash = thisDate.indexOf('-'); var dateIndexDot = thisDate.indexOf('.'); @@ -563,9 +476,7 @@ var Rocket; thisDate = fixDateOrder(thisDate, '/'); } } - // Make the date var newDate = (typeof thisDate !== 'undefined') ? new Date(thisDate) : new Date(); - // Fail test if (newDate.toString() == 'Invalid Date') { return false; } @@ -574,7 +485,6 @@ var Rocket; year: function (thisYearVal, thisType) { var thisYear; var type = (Rocket.is.string(thisType)) ? thisType : false; - // Get month if (Rocket.is.number(thisYearVal)) { thisYear = thisYearVal; } @@ -585,14 +495,12 @@ var Rocket; else { thisYear = new Date().getFullYear(); } - // Validate if (!thisYear) { return false; } else { thisYear = thisYear.toString(); } - // Return switch (type) { case 'long': if (thisYear.length < 4) { @@ -616,12 +524,10 @@ var Rocket; return parseInt(thisYear); } }; - // Development Rocket.log = function (text, thisError) { if (Rocket.is.browser() && (!window || !window.console)) { return; } - // Continue if (Rocket.defaults.log) { var error_1 = (Rocket.is.boolean(thisError)) ? thisError : false; if (error_1 && Rocket.is.browser()) { @@ -635,10 +541,8 @@ var Rocket; Rocket.error = function (text) { Rocket.log(text, true); }; - // Dimensions Rocket.dimensions = { getWidthOrHeight: function (elm, type) { - // Catch if (!Rocket.is.browser() || !window || !window.console) { return false; } @@ -648,25 +552,19 @@ var Rocket; if (Rocket.is.string(type) && (type !== 'width' && type !== 'height')) { return false; } - // Continue var retValue; - // Check for window if (elm === window) { type = Rocket.string.uppercase.first(type); retValue = window['inner' + type] || document.documentElement['client' + type] || document.body['client' + type]; } else { - // Check if string selector if (Rocket.is.string(elm)) { elm = Rocket.dom.select(elm); - // Catch if (elm.length < 1) { return false; } - // Continue elm = elm[0]; } - // Continue if (elm.getClientRects().length) { retValue = elm.getBoundingClientRect()[type]; } @@ -683,14 +581,9 @@ var Rocket; return Rocket.dimensions.getWidthOrHeight(elm, 'width'); } }; - // DOM Rocket.dom = { body: (typeof document !== 'undefined') ? document.getElementsByTagName('body')[0] : false, element: function (selector) { - /* - Only a single element is required. The below uses a more performant - code block to complete this action. - */ if (Rocket.is.string(selector)) { switch (Rocket.get.selector.type(selector)) { case 'gebi': @@ -703,9 +596,14 @@ var Rocket; return selector; } else if (Rocket.is.object(selector)) { - selector = Array.prototype.slice.call(selector); - if (Rocket.is.array(selector) && selector.length > 0) { - return selector[0]; + if (selector === window || selector === document) { + return selector; + } + else { + selector = Array.prototype.slice.call(selector); + if (Rocket.is.array(selector) && selector.length > 0) { + return selector[0]; + } } } else { @@ -739,16 +637,7 @@ var Rocket; } }, select: function (selectors) { - /* - NOTE - Get multiple elements. The method assumes that many elements exist - on the DOM with the "selectors". As such an array will ALWAYS be returned. - - Even an ID selector will return an array as the user has requested - this particular method type. It's important to maintain consistency. - */ var returnElms = []; - // String selectors if (Rocket.is.string(selectors)) { returnElms = returnElms.concat(Rocket.dom.selectByString(selectors)); } @@ -766,16 +655,23 @@ var Rocket; returnElms.push(selector); } } - // Check if there is any string selectors to use if (stringSelectors.length > 0) { returnElms = returnElms.concat(Rocket.dom.selectByString(stringSelectors)); } } else if (Rocket.is.object(selectors)) { - selectors = Array.prototype.slice.call(selectors); - if (Rocket.is.array(selectors) && selectors.length > 0) { - returnElms = selectors; + if (selectors === window || selectors === document) { + returnElms = [selectors]; } + else { + selectors = Array.prototype.slice.call(selectors); + if (Rocket.is.array(selectors) && selectors.length > 0) { + returnElms = selectors; + } + } + } + else if (selectors === window || selectors === document) { + returnElms = [selectors]; } return Rocket.array.clean(Rocket.array.unique(returnElms)); }, @@ -783,7 +679,6 @@ var Rocket; var returnElms = []; var selectorSplit = selectors.split(',').map(Rocket.string.trim).filter(function (selector) { return selector.length > 0; }); if (selectorSplit.length > 0) { - // Loop through all the selectors for (var i = 0, len = selectorSplit.length; i < len; i++) { switch (Rocket.get.selector.type(selectorSplit[i])) { case 'gebi': @@ -803,7 +698,6 @@ var Rocket; title: (typeof document !== 'undefined') ? document.getElementsByTagName('title')[0] : false, window: (typeof window !== 'undefined') ? window : false, }; - // Events Rocket.event = { add: function (elms, type, eventHandle) { if (type === void 0) { type = 'click'; } @@ -812,14 +706,11 @@ var Rocket; apply: function (elms, type, eventHandle, eventType) { if (type === void 0) { type = 'click'; } var domElms = Rocket.dom.select(elms); - // Catch if (domElms.length < 1) { return; } - // Continue for (var _i = 0, domElms_1 = domElms; _i < domElms_1.length; _i++) { var elm = domElms_1[_i]; - // Check event type switch (eventType) { case 'add': if (elm.addEventListener) { @@ -851,7 +742,6 @@ var Rocket; Rocket.event.apply(elms, type, eventHandle, 'remove'); } }; - // Gets Rocket.get = { extension: function (file) { return file.split('.').pop().toLowerCase(); @@ -875,7 +765,6 @@ var Rocket; } } }; - // Helpers Rocket.helper = { parse: { json: function (json) { @@ -900,7 +789,6 @@ var Rocket; } } }; - // ID's Rocket.id = { add: function (element, id) { if (Rocket.exists(element)) { @@ -913,7 +801,6 @@ var Rocket; } } }; - // Inputs Rocket.input = { disable: function (selector) { var elements = Rocket.dom.select(selector); @@ -928,7 +815,6 @@ var Rocket; } } }; - // Milliseconds Rocket.milliseconds = { hours: function (hours) { return hours * 60 * 60 * 1000; @@ -940,17 +826,13 @@ var Rocket; return seconds * 1000; } }; - // Overlay Rocket.overlay = { add: function () { - // Catch if (!Rocket.is.browser() || !window || !window.console) { return false; } - // Continue var rocketOverlay = document.createElement('div'); Rocket.id.add(rocketOverlay, rocketPrefix.basic + 'overlay'); - // Styles rocketOverlay.setAttribute('style', '-webkit-transition: all .4s ease-out 0s;-moz-transition: all .4s ease-out 0s;-ms-transition: all .4s ease-out 0s;transition: all .4s ease-out 0s;'); rocketOverlay.style.display = 'block'; rocketOverlay.style.position = 'fixed'; @@ -968,22 +850,18 @@ var Rocket; } }, hide: function () { - // Catch if (!Rocket.is.browser() || !window || !window.console) { return false; } - // Continue var rocketOverlay = Rocket.dom.select('#rocket-overlay')[0]; rocketOverlay.style.visibility = 'hidden'; rocketOverlay.style.opacity = '0'; rocketOverlay.style.filter = 'alpha(opacity=0)'; }, show: function () { - // Catch if (!Rocket.is.browser() || !window || !window.console) { return false; } - // Continue var rocketOverlay = Rocket.dom.select('#rocket-overlay')[0]; setTimeout(function () { rocketOverlay.style.visibility = 'visible'; @@ -992,7 +870,6 @@ var Rocket; }, 50); } }; - // Random Rocket.random = { integer: function (thisMax, thisMin) { var max = (typeof thisMax === 'number') ? thisMax : 10; @@ -1015,14 +892,11 @@ var Rocket; return randomString; } }; - // Request Rocket.request = { run: function (uOptions) { - // Catch if (!Rocket.exists(uOptions) || !Rocket.exists(uOptions.url)) { return false; } - // Continue var options = { url: uOptions.url, async: (Rocket.is.string(uOptions.async)) ? uOptions.async : Rocket.defaults.request.async, @@ -1073,7 +947,6 @@ var Rocket; break; } }; - // Make the request if (options.data && options.dataForce !== 'body' && (options.type === 'GET' || options.type === 'DELETE' || options.dataForce === 'queryString')) { var queryString = ''; for (var key in options.data) { @@ -1084,7 +957,6 @@ var Rocket; options.url = options.url + '?' + Rocket.string.remove.first(queryString); } xhr.open(options.type, options.url, options.async); - // Set headers if (options.headers) { for (var key in options.headers) { if (options.headers.hasOwnProperty(key)) { @@ -1092,7 +964,6 @@ var Rocket; } } } - // Send (with data if need be) if (options.data && options.dataForce !== 'queryString' && (options.type === 'POST' || options.type === 'PUT' || options.type === 'PATCH' || options.dataForce === 'body')) { if (Rocket.is.json(options.data)) { var send = void 0; @@ -1151,22 +1022,16 @@ var Rocket; Rocket.request.run(uOptions); } }; - // Setup function setup() { - // Catch if (!Rocket.is.browser() || !window || !window.console) { return false; } - // Continue - // No touch class if (!Rocket.is.touch() && !Rocket.has.class(Rocket.dom.html, 'rocket-no-touch')) { Rocket.classes.add(Rocket.dom.html, 'rocket-no-touch'); } - // Add overlay Rocket.overlay.add(); } setup(); - // State Rocket.state = { add: function (element, state) { if (!Rocket.exists(element)) { @@ -1205,10 +1070,8 @@ var Rocket; } } }; - // Storage Rocket.storage = { add: function (nameObj, value) { - // Catch if (!Rocket.exists(nameObj)) { return false; } @@ -1220,10 +1083,8 @@ var Rocket; else if (!Rocket.is.object(nameObj) || Rocket.is.array(nameObj)) { return false; } - // Continue var store = Rocket.storage.getStorageEngine(); var storeAdd = {}; - // Transform the string / apply the object if (Rocket.is.string(nameObj)) { storeAdd[nameObj] = value; } @@ -1235,7 +1096,6 @@ var Rocket; store[key] = storeAdd[key]; } } - // Store it switch (Rocket.defaults.storage.type) { case 'local': localStorage.setItem(Rocket.defaults.storage.name, JSON.stringify(store)); @@ -1251,7 +1111,6 @@ var Rocket; sessionStorage.removeItem(Rocket.defaults.storage.name); } ; - // Check for exclusion if (Rocket.is.string(exclusion)) { var exclValue = Rocket.storage.get(exclusion); deleteStorage(); @@ -1262,7 +1121,6 @@ var Rocket; else if (Rocket.is.array(exclusion)) { var newStore = {}; var store = Rocket.storage.getStorageEngine(); - // Build new storage object for (var i = 0, len = exclusion.length; i < len; i++) { var exclusionValue = store[exclusion[i]]; if (Rocket.exists(exclusionValue)) { @@ -1270,7 +1128,6 @@ var Rocket; } } deleteStorage(); - // Create new storage if (Object.keys(newStore).length > 0) { Rocket.storage.add(newStore); } @@ -1284,20 +1141,16 @@ var Rocket; return false; } var store = Rocket.storage.getStorageEngine(); - // Catch if (!Rocket.exists(store[key])) { return false; } - // Continue return store[key]; }, getStorageEngine: function () { - // Catch if (!Rocket.defaults.storage.name) { Rocket.log('ROCKET: You have not set the storage name. Provide a name for [Rocket].defaults.storage.name.', true); return false; } - // Continue var store; switch (Rocket.defaults.storage.type) { case 'local': @@ -1319,11 +1172,9 @@ var Rocket; return false; } var store = Rocket.storage.getStorageEngine(); - // Catch if (!Rocket.exists(store[key])) { return false; } - // Continue delete store[key]; switch (Rocket.defaults.storage.type) { case 'local': @@ -1335,11 +1186,8 @@ var Rocket; } } }; - // Strings Rocket.string = { format: { - // As per Aliceljm - // http://stackoverflow.com/questions/15900485/correct-way-to-convert-size-in-bytes-to-kb-mb-gb-in-javascript bytes: function (bytes, decimals) { if (typeof bytes !== 'number' || bytes == 0) { return '0 Byte'; @@ -1391,26 +1239,21 @@ var Rocket; } } }; - // Time Rocket.time = { basic: function (thisTime) { var transTime = Rocket.date.transform(thisTime); - // Catch if (!transTime) { return false; } - // Continue var hours = Rocket.time.leadingZero(transTime.getHours()); var minutes = Rocket.time.leadingZero(transTime.getMinutes()); return hours + ':' + minutes; }, exact: function (thisTime) { var transTime = Rocket.date.transform(thisTime); - // Catch if (!transTime) { return false; } - // Continue var hours = Rocket.time.leadingZero(transTime.getHours()); var minutes = Rocket.time.leadingZero(transTime.getMinutes()); var seconds = Rocket.time.leadingZero(transTime.getSeconds()); @@ -1419,11 +1262,9 @@ var Rocket; }, full: function (thisTime) { var transTime = Rocket.date.transform(thisTime); - // Catch if (!transTime) { return false; } - // Continue var hours = Rocket.time.leadingZero(transTime.getHours()); var minutes = Rocket.time.leadingZero(transTime.getMinutes()); var seconds = Rocket.time.leadingZero(transTime.getSeconds()); @@ -1431,36 +1272,29 @@ var Rocket; }, hours: function (thisTime) { var transTime = Rocket.date.transform(thisTime); - // Catch if (!transTime) { return false; } - // Continue return Rocket.time.leadingZero(transTime.getHours()); }, minutes: function (thisTime) { var transTime = Rocket.date.transform(thisTime); - // Catch if (!transTime) { return false; } - // Continue return Rocket.time.leadingZero(transTime.getMinutes()); }, seconds: function (thisTime) { var transTime = Rocket.date.transform(thisTime); - // Catch if (!transTime) { return false; } - // Continue return Rocket.time.leadingZero(transTime.getSeconds()); }, leadingZero: function (int) { return ((int < 10) ? '0' : '') + int; } }; - // URL Rocket.url = { all: function () { var windowLocation = window.location; diff --git a/build/ts/tools.ts b/build/ts/tools.ts index f3b4e69..0567738 100755 --- a/build/ts/tools.ts +++ b/build/ts/tools.ts @@ -729,12 +729,16 @@ module Rocket { else if (Rocket.is.element(selector)) { return selector; } - // Try and catch HTMLCollection and NodeList + // Try and catch HTMLCollection and NodeList / window / document else if (is.object(selector)) { - selector = Array.prototype.slice.call(selector); + if (selector === window || selector === document) { + return selector; + } else { + selector = Array.prototype.slice.call(selector); - if (is.array(selector) && selector.length > 0) { - return selector[0]; + if (is.array(selector) && selector.length > 0) { + return selector[0]; + } } } // Fallback @@ -805,13 +809,19 @@ module Rocket { returnElms = returnElms.concat(Rocket.dom.selectByString(stringSelectors)); } } - // Try and catch HTMLCollection and NodeList + // Try and catch HTMLCollection and NodeList / window / document else if (is.object(selectors)) { - selectors = Array.prototype.slice.call(selectors); + if (selectors === window || selectors === document) { + returnElms = [selectors]; + } else { + selectors = Array.prototype.slice.call(selectors); - if (is.array(selectors) && selectors.length > 0) { - returnElms = selectors; + if (is.array(selectors) && selectors.length > 0) { + returnElms = selectors; + } } + } else if (selectors === window || selectors === document) { + returnElms = [selectors]; } return array.clean(array.unique(returnElms)); diff --git a/js/tools.min.js b/js/tools.min.js index a850871..04af5fb 100755 --- a/js/tools.min.js +++ b/js/tools.min.js @@ -1 +1 @@ -var Rocket;!function(e){function t(){return!!(e.is.browser()&&window&&window.console)&&(e.is.touch()||e.has.class(e.dom.html,"rocket-no-touch")||e.classes.add(e.dom.html,"rocket-no-touch"),void e.overlay.add())}e.defaults={extensions:{all:["png","jpg","jpeg","json","gif","tif","tiff","bmp","doc","docx","xls","xlsx","pdf","txt","csv"],images:["jpg","jpeg","gif","tif","tiff","bmp","png"]},log:!0,overlay:{backgroundColor:"rgba(56,56,56,0.6)"},regexp:{colour:/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/,date:/^[0-9]{4}-[0-9]{2}-[0-9]{2}/,email:/([\w\.\-]+)@([\w\.\-]+)\.(\w+)/i,password:/^(?=.*\d).{6,}/,selector:{attribute:/([a-z])+(\[)+([a-z])+(=")+([a-zA-Z\-])+("\])/,tag:/^[a-zA-Z]+$/},time:/([01]\d|2[0-3]):([0-5]\d)/,url:/^(https?:\/\/[^\s]+)/},request:{async:!0,data:!1,dataForce:!1,dataType:"json",headers:!1,onStart:!1,onLoading:!1,onSuccess:!1,onError:!1,onComplete:!1,timeout:!1,type:!1,withCredentials:!1},storage:{name:!1,type:"session"}};var n=[{number:"01",name:"january",nameShort:"jan"},{number:"02",name:"february",nameShort:"feb"},{number:"03",name:"march",nameShort:"mar"},{number:"04",name:"april",nameShort:"apr"},{number:"05",name:"may",nameShort:"may"},{number:"06",name:"june",nameShort:"jun"},{number:"07",name:"july",nameShort:"jul"},{number:"08",name:"august",nameShort:"aug"},{number:"09",name:"september",nameShort:"sep"},{number:"10",name:"october",nameShort:"oct"},{number:"11",name:"november",nameShort:"nov"},{number:"12",name:"december",nameShort:"dec"}],r={basic:"rocket-",state:"_state-"},s={alts:{active:"inactive",closed:"open",hidden:"visible",inactive:"active",open:"closed",visible:"hidden"},list:["active","closed","hidden","inactive","open","selected","toggled","visible"]};e.array={clean:function(t){return!!e.is.array(t)&&t.filter(function(e){return null!==e})},make:function(t,n){var r=[];if(!t)return r;var s=e.helper.setDefault(n,!1);return e.is.array(t)&&t.length>0?r=t:e.is.element(t)?r.push(t):e.is.string(t)?r=t.split(" "):e.is.object(t)&&(t=Array.prototype.slice.call(t),e.is.array(t)&&t.length>0&&(r=t)),s?e.array.unique(r):r},unique:function(t){return!!e.is.array(t)&&t.filter(function(e,t,n){return n.indexOf(e)===t})}},e.exists=function(e){return!("undefined"==typeof e||null===e||e===!1)},e.has={spaces:function(e){return/\s/.test(e)},class:function(e,t){return(" "+e.className+" ").indexOf(" "+t+" ")>-1},extension:function(t,n){var r=e.is.array(n)?n:e.defaults.extensions.all;return r.indexOf(t.split(".").pop().toLowerCase())>-1}},e.is={array:function(e){return"object"==typeof e&&e instanceof Array},boolean:function(e){return"boolean"==typeof e},browser:function(){return!("undefined"==typeof window||"undefined"==typeof navigator||!window.document)},color:function(t){return e.is.colour(t)},colour:function(t){return e.defaults.regexp.colour.test(t)},date:function(t,n){var r=n instanceof RegExp?n:e.defaults.regexp.date;return r.test(t)},element:function(e){return e.nodeType&&1===e.nodeType},email:function(t,n){var r=n instanceof RegExp?n:e.defaults.regexp.email;return r.test(t)},function:function(e){return"function"==typeof e},image:function(t,n){var r=e.is.array(n)?n:e.defaults.extensions.images;return r[t.split(".").pop().toLowerCase()]},integer:function(t){return e.is.number(t)&&parseFloat(t)===parseInt(t)},json:function(e){if("object"!=typeof e)try{JSON.parse(e)}catch(e){return!1}return!0},number:function(e){return"number"==typeof e&&!isNaN(e)},object:function(e){return"object"==typeof e},password:function(t,n){var r=n instanceof RegExp?n:e.defaults.regexp.password;return r.test(t)},string:function(e){return"string"==typeof e},time:function(t,n){var r=n instanceof RegExp?n:e.defaults.regexp.time;return r.test(t)},touch:function(){return!!(e.is.browser()&&window&&window.console)&&("ontouchstart"in window||"onmsgesturechange"in window)},url:function(t,n){var r=n instanceof RegExp?n:e.defaults.regexp.url;return r.test(t)}},e.classes={add:function(t,n){var r=e.is.string(t)?e.dom.select(t):t;e.classes.executeClasses(r,n,!1)},clear:function(t){var n=e.is.string(t)?e.dom.select(t):[t];if(n.length>0)for(var r=0,s=n;r0,u=i.length>0,l=0,c=s.length;l-1){for(var a,i=void 0,o=void 0,u=void 0,l=void 0,c=t.split(" "),f=0,d=c.length;f0)return t[0]}},head:"undefined"!=typeof document&&document.getElementsByTagName("head")[0],html:"undefined"!=typeof document&&document.getElementsByTagName("html")[0],ratio:function(e,t){var n=document.querySelectorAll(e);"undefined"==typeof t&&(t=1);for(var r=n.length-1;r>=0;r--)n[r].style.height=Math.floor(n[r].offsetWidth*t)+"px"},remove:function(t){if(e.exists(t))if(e.is.element(t))t.parentNode.removeChild(t);else if(e.is.string(t))for(var n=e.dom.select(t),r=0,s=n.length;r0&&(n=n.concat(e.dom.selectByString(r)))}else e.is.object(t)&&(t=Array.prototype.slice.call(t),e.is.array(t)&&t.length>0&&(n=t));return e.array.clean(e.array.unique(n))},selectByString:function(t){var n=[],r=t.split(",").map(e.string.trim).filter(function(e){return e.length>0});if(r.length>0)for(var s=0,a=r.length;s-1||e.has.spaces(t)||e.defaults.regexp.selector.attribute.test(t)?n="qsa":t.indexOf("#")>-1?n="gebi":e.defaults.regexp.selector.tag.test(t)&&(n="gebtn"),n}}},e.helper={parse:{json:function(t){return e.is.json(t)?JSON.parse(t):t}},setDefault:function(e,t){return("undefined"!=typeof e||"undefined"!=typeof t)&&("undefined"!=typeof e&&"undefined"==typeof t?e:typeof e==typeof t?e:t)}},e.id={add:function(t,n){e.exists(t)&&t.setAttribute("id",n)},remove:function(t){e.exists(t)&&t.removeAttribute("id")}},e.input={disable:function(t){for(var n=e.dom.select(t),r=0,s=n.length;r=200&&this.status<300?n.onSuccess&&n.onSuccess(e.helper.parse.json(this.responseText),this.status,r.getAllResponseHeaders()):n.onError&&n.onError(e.helper.parse.json(this.responseText),this.status,r.getAllResponseHeaders())}},n.data&&"body"!==n.dataForce&&("GET"===n.type||"DELETE"===n.type||"queryString"===n.dataForce)){var s="";for(var a in n.data)n.data.hasOwnProperty(a)&&(s+="&"+encodeURIComponent(a)+"="+encodeURIComponent(n.data[a]));n.url=n.url+"?"+e.string.remove.first(s)}if(r.open(n.type,n.url,n.async),n.headers)for(var a in n.headers)n.headers.hasOwnProperty(a)&&r.setRequestHeader(a,n.headers[a]);if(!n.data||"queryString"===n.dataForce||"POST"!==n.type&&"PUT"!==n.type&&"PATCH"!==n.type&&"body"!==n.dataForce)r.send();else if(e.is.json(n.data)){var i=void 0;switch(e.string.lowercase.all(n.dataType)){case"form":r.setRequestHeader("Content-type","application/x-www-form-urlencoded");var o="";for(var a in n.data)n.data.hasOwnProperty(a)&&(o+="&"+a+"="+n.data[a]);i=e.string.remove.first(o);break;case"formdata":i=new FormData;for(var a in n.data)n.data.hasOwnProperty(a)&&i.append(a,n.data[a]);break;default:r.setRequestHeader("Content-type","application/json;charset=UTF-8"),i=JSON.stringify(n.data)}r.send(i)}else r.send(n.data)},delete:function(t){t.type="DELETE",e.request.run(t)},get:function(t){t.type="GET",e.request.run(t)},patch:function(t){t.type="PATCH",e.request.run(t)},post:function(t){t.type="POST",e.request.run(t)},put:function(t){t.type="PUT",e.request.run(t)}},t(),e.state={add:function(t,n){if(!e.exists(t))return!1;var a=s.list.slice().map(function(e){return r.state+e}),i=a.splice(a.indexOf(r.state+n),1);e.classes.replace(t,a,i)},clear:function(t){if(!e.exists(t))return!1;var n=s.list.slice().map(function(e){return r.state+e});e.classes.remove(t,n)},toggle:function(t,n,a){if(!e.exists(t))return!1;if(s.list.indexOf(n)>-1){var i=s.alts[n]||!1,o="boolean"==typeof a&&a,u=r.state+n;e.has.class(t,u)?o||i===!1?e.state.clear(t):e.state.add(t,i):e.state.add(t,n)}}},e.storage={add:function(t,n){if(!e.exists(t))return!1;if(e.is.string(t)){if(!e.exists(n))return!1}else if(!e.is.object(t)||e.is.array(t))return!1;var r=e.storage.getStorageEngine(),s={};e.is.string(t)?s[t]=n:s=t;for(var a in s)s.hasOwnProperty(a)&&(r[a]=s[a]);switch(e.defaults.storage.type){case"local":localStorage.setItem(e.defaults.storage.name,JSON.stringify(r));break;case"session":sessionStorage.setItem(e.defaults.storage.name,JSON.stringify(r))}},clear:function(t){function n(){localStorage.removeItem(e.defaults.storage.name),sessionStorage.removeItem(e.defaults.storage.name)}if(e.is.string(t)){var r=e.storage.get(t);n(),r!==!1&&e.storage.add(t,r)}else if(e.is.array(t)){for(var s={},a=e.storage.getStorageEngine(),i=0,o=t.length;i0&&e.storage.add(s)}else n()},get:function(t){if(!e.is.string(t))return!1;var n=e.storage.getStorageEngine();return!!e.exists(n[t])&&n[t]},getStorageEngine:function(){if(!e.defaults.storage.name)return e.log("ROCKET: You have not set the storage name. Provide a name for [Rocket].defaults.storage.name.",!0),!1;var t;switch(e.defaults.storage.type){case"local":t=localStorage.getItem(e.defaults.storage.name);break;case"session":t=sessionStorage.getItem(e.defaults.storage.name)}return t?e.helper.parse.json(t):{}},remove:function(t){if(!e.is.string(t))return!1;var n=e.storage.getStorageEngine();if(!e.exists(n[t]))return!1;switch(delete n[t],e.defaults.storage.type){case"local":localStorage.setItem(e.defaults.storage.name,JSON.stringify(n));break;case"session":sessionStorage.setItem(e.defaults.storage.name,JSON.stringify(n))}}},e.string={format:{bytes:function(e,t){if("number"!=typeof e||0==e)return"0 Byte";var n=1e3,r=t+1||3,s=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],a=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/Math.pow(n,a)).toFixed(r))+" "+s[a]}},lowercase:{all:function(t){return e.is.string(t)?t.toLowerCase():t},first:function(t){return e.is.string(t)?t.charAt(0).toLowerCase()+t.slice(1):t},last:function(t){return e.is.string(t)?t.slice(0,t.length-1)+t.charAt(t.length-1).toLowerCase():t}},remove:{first:function(t){return e.is.string(t)?t.substring(1):t},firstAndLast:function(t){return e.is.string(t)?t.substring(1,t.length-1):t},last:function(t){return e.is.string(t)?t.substring(0,t.length-1):t},spaces:function(t){return e.is.string(t)?t.replace(/ /g,""):t}},trim:function(t){return e.is.string(t)?t.replace(/^ /,"").replace(/ +$/,""):t},uppercase:{all:function(t){return e.is.string(t)?t.toUpperCase():t},first:function(t){return e.is.string(t)?t.charAt(0).toUpperCase()+t.slice(1):t},last:function(t){return e.is.string(t)?t.slice(0,t.length-1)+t.charAt(t.length-1).toUpperCase():t}}},e.time={basic:function(t){var n=e.date.transform(t);if(!n)return!1;var r=e.time.leadingZero(n.getHours()),s=e.time.leadingZero(n.getMinutes());return r+":"+s},exact:function(t){var n=e.date.transform(t);if(!n)return!1;var r=e.time.leadingZero(n.getHours()),s=e.time.leadingZero(n.getMinutes()),a=e.time.leadingZero(n.getSeconds()),i=e.time.leadingZero(n.getMilliseconds());return r+":"+s+":"+a+":"+i},full:function(t){var n=e.date.transform(t);if(!n)return!1;var r=e.time.leadingZero(n.getHours()),s=e.time.leadingZero(n.getMinutes()),a=e.time.leadingZero(n.getSeconds());return r+":"+s+":"+a},hours:function(t){var n=e.date.transform(t);return!!n&&e.time.leadingZero(n.getHours())},minutes:function(t){var n=e.date.transform(t);return!!n&&e.time.leadingZero(n.getMinutes())},seconds:function(t){var n=e.date.transform(t);return!!n&&e.time.leadingZero(n.getSeconds())},leadingZero:function(e){return(e<10?"0":"")+e}},e.url={all:function(){var e=window.location,t=e.href,n=t.split("#")[0],r=e.hash.substring(1),s=e.host,a=e.protocol+"//",i="";i=document.getElementsByTagName("base").length>0?document.getElementsByTagName("base")[0].href:a+s;for(var o=e.pathname,u=[],l=o.split("/"),c=0,f=l.length;c0?r=t:e.is.element(t)?r.push(t):e.is.string(t)?r=t.split(" "):e.is.object(t)&&(t=Array.prototype.slice.call(t),e.is.array(t)&&t.length>0&&(r=t)),s?e.array.unique(r):r},unique:function(t){return!!e.is.array(t)&&t.filter(function(e,t,n){return n.indexOf(e)===t})}},e.exists=function(e){return!("undefined"==typeof e||null===e||e===!1)},e.has={spaces:function(e){return/\s/.test(e)},class:function(e,t){return(" "+e.className+" ").indexOf(" "+t+" ")>-1},extension:function(t,n){var r=e.is.array(n)?n:e.defaults.extensions.all;return r.indexOf(t.split(".").pop().toLowerCase())>-1}},e.is={array:function(e){return"object"==typeof e&&e instanceof Array},boolean:function(e){return"boolean"==typeof e},browser:function(){return!("undefined"==typeof window||"undefined"==typeof navigator||!window.document)},color:function(t){return e.is.colour(t)},colour:function(t){return e.defaults.regexp.colour.test(t)},date:function(t,n){var r=n instanceof RegExp?n:e.defaults.regexp.date;return r.test(t)},element:function(e){return e.nodeType&&1===e.nodeType},email:function(t,n){var r=n instanceof RegExp?n:e.defaults.regexp.email;return r.test(t)},function:function(e){return"function"==typeof e},image:function(t,n){var r=e.is.array(n)?n:e.defaults.extensions.images;return r[t.split(".").pop().toLowerCase()]},integer:function(t){return e.is.number(t)&&parseFloat(t)===parseInt(t)},json:function(e){if("object"!=typeof e)try{JSON.parse(e)}catch(e){return!1}return!0},number:function(e){return"number"==typeof e&&!isNaN(e)},object:function(e){return"object"==typeof e},password:function(t,n){var r=n instanceof RegExp?n:e.defaults.regexp.password;return r.test(t)},string:function(e){return"string"==typeof e},time:function(t,n){var r=n instanceof RegExp?n:e.defaults.regexp.time;return r.test(t)},touch:function(){return!!(e.is.browser()&&window&&window.console)&&("ontouchstart"in window||"onmsgesturechange"in window)},url:function(t,n){var r=n instanceof RegExp?n:e.defaults.regexp.url;return r.test(t)}},e.classes={add:function(t,n){var r=e.is.string(t)?e.dom.select(t):t;e.classes.executeClasses(r,n,!1)},clear:function(t){var n=e.is.string(t)?e.dom.select(t):[t];if(n.length>0)for(var r=0,s=n;r0,u=i.length>0,l=0,c=s.length;l-1){for(var a,i=void 0,o=void 0,u=void 0,l=void 0,c=t.split(" "),d=0,f=c.length;d0)return t[0]}},head:"undefined"!=typeof document&&document.getElementsByTagName("head")[0],html:"undefined"!=typeof document&&document.getElementsByTagName("html")[0],ratio:function(e,t){var n=document.querySelectorAll(e);"undefined"==typeof t&&(t=1);for(var r=n.length-1;r>=0;r--)n[r].style.height=Math.floor(n[r].offsetWidth*t)+"px"},remove:function(t){if(e.exists(t))if(e.is.element(t))t.parentNode.removeChild(t);else if(e.is.string(t))for(var n=e.dom.select(t),r=0,s=n.length;r0&&(n=n.concat(e.dom.selectByString(r)))}else e.is.object(t)?t===window||t===document?n=[t]:(t=Array.prototype.slice.call(t),e.is.array(t)&&t.length>0&&(n=t)):t!==window&&t!==document||(n=[t]);return e.array.clean(e.array.unique(n))},selectByString:function(t){var n=[],r=t.split(",").map(e.string.trim).filter(function(e){return e.length>0});if(r.length>0)for(var s=0,a=r.length;s-1||e.has.spaces(t)||e.defaults.regexp.selector.attribute.test(t)?n="qsa":t.indexOf("#")>-1?n="gebi":e.defaults.regexp.selector.tag.test(t)&&(n="gebtn"),n}}},e.helper={parse:{json:function(t){return e.is.json(t)?JSON.parse(t):t}},setDefault:function(e,t){return("undefined"!=typeof e||"undefined"!=typeof t)&&("undefined"!=typeof e&&"undefined"==typeof t?e:typeof e==typeof t?e:t)}},e.id={add:function(t,n){e.exists(t)&&t.setAttribute("id",n)},remove:function(t){e.exists(t)&&t.removeAttribute("id")}},e.input={disable:function(t){for(var n=e.dom.select(t),r=0,s=n.length;r=200&&this.status<300?n.onSuccess&&n.onSuccess(e.helper.parse.json(this.responseText),this.status,r.getAllResponseHeaders()):n.onError&&n.onError(e.helper.parse.json(this.responseText),this.status,r.getAllResponseHeaders())}},n.data&&"body"!==n.dataForce&&("GET"===n.type||"DELETE"===n.type||"queryString"===n.dataForce)){var s="";for(var a in n.data)n.data.hasOwnProperty(a)&&(s+="&"+encodeURIComponent(a)+"="+encodeURIComponent(n.data[a]));n.url=n.url+"?"+e.string.remove.first(s)}if(r.open(n.type,n.url,n.async),n.headers)for(var a in n.headers)n.headers.hasOwnProperty(a)&&r.setRequestHeader(a,n.headers[a]);if(!n.data||"queryString"===n.dataForce||"POST"!==n.type&&"PUT"!==n.type&&"PATCH"!==n.type&&"body"!==n.dataForce)r.send();else if(e.is.json(n.data)){var i=void 0;switch(e.string.lowercase.all(n.dataType)){case"form":r.setRequestHeader("Content-type","application/x-www-form-urlencoded");var o="";for(var a in n.data)n.data.hasOwnProperty(a)&&(o+="&"+a+"="+n.data[a]);i=e.string.remove.first(o);break;case"formdata":i=new FormData;for(var a in n.data)n.data.hasOwnProperty(a)&&i.append(a,n.data[a]);break;default:r.setRequestHeader("Content-type","application/json;charset=UTF-8"),i=JSON.stringify(n.data)}r.send(i)}else r.send(n.data)},delete:function(t){t.type="DELETE",e.request.run(t)},get:function(t){t.type="GET",e.request.run(t)},patch:function(t){t.type="PATCH",e.request.run(t)},post:function(t){t.type="POST",e.request.run(t)},put:function(t){t.type="PUT",e.request.run(t)}},t(),e.state={add:function(t,n){if(!e.exists(t))return!1;var a=s.list.slice().map(function(e){return r.state+e}),i=a.splice(a.indexOf(r.state+n),1);e.classes.replace(t,a,i)},clear:function(t){if(!e.exists(t))return!1;var n=s.list.slice().map(function(e){return r.state+e});e.classes.remove(t,n)},toggle:function(t,n,a){if(!e.exists(t))return!1;if(s.list.indexOf(n)>-1){var i=s.alts[n]||!1,o="boolean"==typeof a&&a,u=r.state+n;e.has.class(t,u)?o||i===!1?e.state.clear(t):e.state.add(t,i):e.state.add(t,n)}}},e.storage={add:function(t,n){if(!e.exists(t))return!1;if(e.is.string(t)){if(!e.exists(n))return!1}else if(!e.is.object(t)||e.is.array(t))return!1;var r=e.storage.getStorageEngine(),s={};e.is.string(t)?s[t]=n:s=t;for(var a in s)s.hasOwnProperty(a)&&(r[a]=s[a]);switch(e.defaults.storage.type){case"local":localStorage.setItem(e.defaults.storage.name,JSON.stringify(r));break;case"session":sessionStorage.setItem(e.defaults.storage.name,JSON.stringify(r))}},clear:function(t){function n(){localStorage.removeItem(e.defaults.storage.name),sessionStorage.removeItem(e.defaults.storage.name)}if(e.is.string(t)){var r=e.storage.get(t);n(),r!==!1&&e.storage.add(t,r)}else if(e.is.array(t)){for(var s={},a=e.storage.getStorageEngine(),i=0,o=t.length;i0&&e.storage.add(s)}else n()},get:function(t){if(!e.is.string(t))return!1;var n=e.storage.getStorageEngine();return!!e.exists(n[t])&&n[t]},getStorageEngine:function(){if(!e.defaults.storage.name)return e.log("ROCKET: You have not set the storage name. Provide a name for [Rocket].defaults.storage.name.",!0),!1;var t;switch(e.defaults.storage.type){case"local":t=localStorage.getItem(e.defaults.storage.name);break;case"session":t=sessionStorage.getItem(e.defaults.storage.name)}return t?e.helper.parse.json(t):{}},remove:function(t){if(!e.is.string(t))return!1;var n=e.storage.getStorageEngine();if(!e.exists(n[t]))return!1;switch(delete n[t],e.defaults.storage.type){case"local":localStorage.setItem(e.defaults.storage.name,JSON.stringify(n));break;case"session":sessionStorage.setItem(e.defaults.storage.name,JSON.stringify(n))}}},e.string={format:{bytes:function(e,t){if("number"!=typeof e||0==e)return"0 Byte";var n=1e3,r=t+1||3,s=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],a=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/Math.pow(n,a)).toFixed(r))+" "+s[a]}},lowercase:{all:function(t){return e.is.string(t)?t.toLowerCase():t},first:function(t){return e.is.string(t)?t.charAt(0).toLowerCase()+t.slice(1):t},last:function(t){return e.is.string(t)?t.slice(0,t.length-1)+t.charAt(t.length-1).toLowerCase():t}},remove:{first:function(t){return e.is.string(t)?t.substring(1):t},firstAndLast:function(t){return e.is.string(t)?t.substring(1,t.length-1):t},last:function(t){return e.is.string(t)?t.substring(0,t.length-1):t},spaces:function(t){return e.is.string(t)?t.replace(/ /g,""):t}},trim:function(t){return e.is.string(t)?t.replace(/^ /,"").replace(/ +$/,""):t},uppercase:{all:function(t){return e.is.string(t)?t.toUpperCase():t},first:function(t){return e.is.string(t)?t.charAt(0).toUpperCase()+t.slice(1):t},last:function(t){return e.is.string(t)?t.slice(0,t.length-1)+t.charAt(t.length-1).toUpperCase():t}}},e.time={basic:function(t){var n=e.date.transform(t);if(!n)return!1;var r=e.time.leadingZero(n.getHours()),s=e.time.leadingZero(n.getMinutes());return r+":"+s},exact:function(t){var n=e.date.transform(t);if(!n)return!1;var r=e.time.leadingZero(n.getHours()),s=e.time.leadingZero(n.getMinutes()),a=e.time.leadingZero(n.getSeconds()),i=e.time.leadingZero(n.getMilliseconds());return r+":"+s+":"+a+":"+i},full:function(t){var n=e.date.transform(t);if(!n)return!1;var r=e.time.leadingZero(n.getHours()),s=e.time.leadingZero(n.getMinutes()),a=e.time.leadingZero(n.getSeconds());return r+":"+s+":"+a},hours:function(t){var n=e.date.transform(t);return!!n&&e.time.leadingZero(n.getHours())},minutes:function(t){var n=e.date.transform(t);return!!n&&e.time.leadingZero(n.getMinutes())},seconds:function(t){var n=e.date.transform(t);return!!n&&e.time.leadingZero(n.getSeconds())},leadingZero:function(e){return(e<10?"0":"")+e}},e.url={all:function(){var e=window.location,t=e.href,n=t.split("#")[0],r=e.hash.substring(1),s=e.host,a=e.protocol+"//",i="";i=document.getElementsByTagName("base").length>0?document.getElementsByTagName("base")[0].href:a+s;for(var o=e.pathname,u=[],l=o.split("/"),c=0,d=l.length;c