@travlrcom/uikit
Version:
TRAVLR UiKit
1,646 lines (1,383 loc) • 143 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else {
var a = factory();
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(window, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 5);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**
****************************************************
*** ******* ****** ****
*** ****** ****** *****
*********** ************** ****** ******
*********** ************* ****** *******
*********** ************ ****** ********
*********** *********** ****** *********
*********** ********** ****** **********
*********** ********* ****** ***********
*********** ******** ****** ************
*********** ******* ****** *************
*********** ****** ****** **************
****************************************************
* --------------------------------------------------
* Travlr UiKit: errorMessageHandler.js
* By Travlr Team
* --------------------------------------------------
*/
// const
var NAME = 'errorMessageHandler'; // Error Messages
var ErrorMessageDefault = [{
ERROR_ID: 0,
ERROR_MESSAGE: 'Error id found'
}, {
ERROR_ID: 1,
ERROR_MESSAGE: 'Config must be an object'
}, {
ERROR_ID: 2,
ERROR_MESSAGE: 'Error message not found'
}, {
ERROR_ID: 3,
ERROR_MESSAGE: 'Error message must be an collection'
}];
var ErrorMessageHandler =
/*#__PURE__*/
function () {
function ErrorMessageHandler(config) {
_classCallCheck(this, ErrorMessageHandler);
if (_typeof(config) !== 'object') throw new Error(this.getErrorMessages(1));
if (typeof config.errorId !== 'number' || config.errorId === '') throw new Error(this.getErrorMessages(0));
if (!Array.isArray(config.errorMessages)) throw new Error(this.getErrorMessages(3));
this._config = config;
this.init();
}
_createClass(ErrorMessageHandler, [{
key: "init",
value: function init() {
throw new Error(this.getErrorMessages(this._config.errorId, this._config.errorMessages));
}
}, {
key: "getErrorMessages",
value: function getErrorMessages(errorId, errorMessages) {
errorMessages = typeof errorMessages === 'undefined' ? ErrorMessageDefault : errorMessages;
return errorMessages.filter(function (item) {
return item.ERROR_ID === errorId;
}).map(function (item) {
return item.ERROR_MESSAGE;
});
}
}]);
return ErrorMessageHandler;
}();
var _default = ErrorMessageHandler;
exports.default = _default;
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _errorMessageHandler = _interopRequireDefault(__webpack_require__(0));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
// const
var NAME = 'attributeHandler';
var ErrorMessages = [{
ERROR_ID: 0,
ERROR_MESSAGE: 'Config must be an object'
}];
var ConfigErrorMessage = {
errorId: 0,
errorMessages: ErrorMessages
};
var AttributeHandler =
/*#__PURE__*/
function () {
function AttributeHandler(config) {
_classCallCheck(this, AttributeHandler);
if (_typeof(config) !== 'object') {
var ConfigError = Object.assign({}, ConfigErrorMessage, {
errorId: 0
});
new _errorMessageHandler.default(ConfigError);
}
this._config = config;
this._element = this._config.element ? this._config.element : null;
this._attributeName = this._config.attributeName ? this._config.attributeName : null;
this._attributeValue = this._config.attributeValue;
}
_createClass(AttributeHandler, [{
key: "getAttribute",
value: function getAttribute() {
return this._element !== null && this._attributeName !== null ? this._element.getAttribute(this._attributeName) : null;
}
}, {
key: "setAttribute",
value: function setAttribute() {
this._element !== null && this._attributeName !== null ? this._element.setAttribute(this._attributeName, this._attributeValue) : null;
}
}, {
key: "removeAttribute",
value: function removeAttribute() {
this._element !== null && this._attributeName !== null ? this._element.removeAttribute(this._attributeName) : null;
}
}]);
return AttributeHandler;
}();
var _default = AttributeHandler;
exports.default = _default;
/***/ }),
/* 2 */
/***/ (function(module, exports) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**
****************************************************
*** ******* ****** ****
*** ****** ****** *****
*********** ************** ****** ******
*********** ************* ****** *******
*********** ************ ****** ********
*********** *********** ****** *********
*********** ********** ****** **********
*********** ********* ****** ***********
*********** ******** ****** ************
*********** ******* ****** *************
*********** ****** ****** **************
****************************************************
* --------------------------------------------------
* Travlr UiKit: booleanParse.js
* By Travlr Team
* --------------------------------------------------
*/
// const
var NAME = 'booleanParse';
var BooleanParse =
/*#__PURE__*/
function () {
function BooleanParse(value) {
_classCallCheck(this, BooleanParse);
this._pattern = /^(?:f(?:alse)?|no?|0+)$/i;
this._value = value;
this._valueParse = false;
this.init();
}
_createClass(BooleanParse, [{
key: "init",
value: function init() {
this._valueParse = !this._pattern.test(this._value) && !!this._value;
}
}]);
return BooleanParse;
}();
var BooleanParseInit = function BooleanParseInit(value) {
var data = new BooleanParse(value);
var result = data._valueParse;
return result;
};
var _default = BooleanParseInit;
exports.default = _default;
/***/ }),
/* 3 */
/***/ (function(module, exports) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**
****************************************************
*** ******* ****** ****
*** ****** ****** *****
*********** ************** ****** ******
*********** ************* ****** *******
*********** ************ ****** ********
*********** *********** ****** *********
*********** ********** ****** **********
*********** ********* ****** ***********
*********** ******** ****** ************
*********** ******* ****** *************
*********** ****** ****** **************
****************************************************
* --------------------------------------------------
* Travlr UiKit: eventHandler.js
* By Travlr Team
* --------------------------------------------------
*/
// const
var NAME = 'eventHandler';
var EventHandler =
/*#__PURE__*/
function () {
function EventHandler(config) {
_classCallCheck(this, EventHandler);
this._config = config;
this._type = config.type;
this._eventName = config.eventName;
this._element = config.element;
this._action = config.action;
this.init();
}
_createClass(EventHandler, [{
key: "init",
value: function init() {
if (this._type === 'add') {
this.addEvent();
} else if (this._type === 'trigger') {
this.triggerEvent();
} else {
return;
}
}
}, {
key: "addEvent",
value: function addEvent() {
if (this._eventName && typeof this._action === 'function') {
// Create the event
new Event(this._eventName); // Add event listener
this._element.addEventListener(this._eventName, this._action);
}
}
}, {
key: "triggerEvent",
value: function triggerEvent() {
if (this._eventName) {
// Dispatch/Trigger/Fire the event
this._element.dispatchEvent(new Event(this._eventName));
}
}
}]);
return EventHandler;
}();
window.$TravlrEvent = function (config) {
new EventHandler(config);
};
var _default = EventHandler;
exports.default = _default;
/***/ }),
/* 4 */
/***/ (function(module, exports) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**
****************************************************
*** ******* ****** ****
*** ****** ****** *****
*********** ************** ****** ******
*********** ************* ****** *******
*********** ************ ****** ********
*********** *********** ****** *********
*********** ********** ****** **********
*********** ********* ****** ***********
*********** ******** ****** ************
*********** ******* ****** *************
*********** ****** ****** **************
****************************************************
* --------------------------------------------------
* Travlr UiKit: callbackHandler.js
* By Travlr Team
* --------------------------------------------------
*/
// const
var NAME = 'callbackHandler';
var CallbackHandler =
/*#__PURE__*/
function () {
function CallbackHandler(config) {
_classCallCheck(this, CallbackHandler);
this._config = config;
this._callback = config.callback;
this._params = config.params;
this.init();
}
_createClass(CallbackHandler, [{
key: "init",
value: function init() {
if (this._callback && typeof this._callback === 'function') {
this._callback(this._params);
}
}
}]);
return CallbackHandler;
}();
var _default = CallbackHandler;
exports.default = _default;
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(6);
__webpack_require__(7);
module.exports = __webpack_require__(16);
/***/ }),
/* 6 */
/***/ (function(module, exports) {
if (window.NodeList && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = Array.prototype.forEach;
}
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__( 8 );
__webpack_require__( 9 );
__webpack_require__( 10 );
__webpack_require__( 11 );
__webpack_require__( 12 );
__webpack_require__( 13 );
__webpack_require__( 14 );
__webpack_require__( 15 );
/***/ }),
/* 8 */
/***/ (function(module, exports) {
(function () {
if (typeof window.Element === "undefined" || "classList" in document.documentElement) return;
var prototype = Array.prototype,
push = prototype.push,
splice = prototype.splice,
join = prototype.join;
function DOMTokenList(el) {
this.el = el;
// The className needs to be trimmed and split on whitespace
// to retrieve a list of classes.
var classes = el.className.replace(/^\s+|\s+$/g,'').split(/\s+/);
for (var i = 0; i < classes.length; i++) {
push.call(this, classes[i]);
}
};
DOMTokenList.prototype = {
add: function(token) {
if(this.contains(token)) return;
push.call(this, token);
this.el.className = this.toString();
},
contains: function(token) {
return this.el.className.indexOf(token) != -1;
},
item: function(index) {
return this[index] || null;
},
remove: function(token) {
if (!this.contains(token)) return;
for (var i = 0; i < this.length; i++) {
if (this[i] == token) break;
}
splice.call(this, i, 1);
this.el.className = this.toString();
},
toString: function() {
return join.call(this, ' ');
},
toggle: function(token) {
if (!this.contains(token)) {
this.add(token);
} else {
this.remove(token);
}
return this.contains(token);
}
};
window.DOMTokenList = DOMTokenList;
function defineElementGetter (obj, prop, getter) {
if (Object.defineProperty) {
Object.defineProperty(obj, prop,{
get : getter
});
} else {
obj.__defineGetter__(prop, getter);
}
}
defineElementGetter(Element.prototype, 'classList', function () {
return new DOMTokenList(this);
});
})();
/***/ }),
/* 9 */
/***/ (function(module, exports) {
(function () {
var forEach = [].forEach,
regex = /^data-(.+)/,
dashChar = /\-([a-z])/ig,
el = document.createElement('div'),
mutationSupported = false,
match
;
function detectMutation() {
mutationSupported = true;
this.removeEventListener('DOMAttrModified', detectMutation, false);
}
function toCamelCase(s) {
return s.replace(dashChar, function (m,l) { return l.toUpperCase(); });
}
function updateDataset() {
var dataset = {};
forEach.call(this.attributes, function(attr) {
if (match = attr.name.match(regex))
dataset[toCamelCase(match[1])] = attr.value;
});
return dataset;
}
// only add support if the browser doesn't support data-* natively
if (el.dataset != undefined) return;
el.addEventListener('DOMAttrModified', detectMutation, false);
el.setAttribute('foo', 'bar');
function defineElementGetter (obj, prop, getter) {
if (Object.defineProperty) {
Object.defineProperty(obj, prop,{
get : getter
});
} else {
obj.__defineGetter__(prop, getter);
}
}
defineElementGetter(Element.prototype, 'dataset', mutationSupported
? function () {
if (!this._datasetCache) {
this._datasetCache = updateDataset.call(this);
}
return this._datasetCache;
}
: updateDataset
);
document.addEventListener('DOMAttrModified', function (event) {
delete event.target._datasetCache;
}, false);
})();
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
;(function (global) {
if ("EventSource" in global) return;
var reTrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g;
var EventSource = function (url) {
var eventsource = this,
interval = 500, // polling interval
lastEventId = null,
cache = '';
if (!url || typeof url != 'string') {
throw new SyntaxError('Not enough arguments');
}
this.URL = url;
this.readyState = this.CONNECTING;
this._pollTimer = null;
this._xhr = null;
function pollAgain(interval) {
eventsource._pollTimer = setTimeout(function () {
poll.call(eventsource);
}, interval);
}
function poll() {
try { // force hiding of the error message... insane?
if (eventsource.readyState == eventsource.CLOSED) return;
// NOTE: IE7 and upwards support
var xhr = new XMLHttpRequest();
xhr.open('GET', eventsource.URL, true);
xhr.setRequestHeader('Accept', 'text/event-stream');
xhr.setRequestHeader('Cache-Control', 'no-cache');
// we must make use of this on the server side if we're working with Android - because they don't trigger
// readychange until the server connection is closed
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
if (lastEventId != null) xhr.setRequestHeader('Last-Event-ID', lastEventId);
cache = '';
xhr.timeout = 50000;
xhr.onreadystatechange = function () {
if (this.readyState == 3 || (this.readyState == 4 && this.status == 200)) {
// on success
if (eventsource.readyState == eventsource.CONNECTING) {
eventsource.readyState = eventsource.OPEN;
eventsource.dispatchEvent('open', { type: 'open' });
}
var responseText = '';
try {
responseText = this.responseText || '';
} catch (e) {}
// process this.responseText
var parts = responseText.substr(cache.length).split("\n"),
eventType = 'message',
data = [],
i = 0,
line = '';
cache = responseText;
// TODO handle 'event' (for buffer name), retry
for (; i < parts.length; i++) {
line = parts[i].replace(reTrim, '');
if (line.indexOf('event') == 0) {
eventType = line.replace(/event:?\s*/, '');
} else if (line.indexOf('retry') == 0) {
var retry = parseInt(line.replace(/retry:?\s*/, ''));
if(!isNaN(retry)) { interval = retry; }
} else if (line.indexOf('data') == 0) {
data.push(line.replace(/data:?\s*/, ''));
} else if (line.indexOf('id:') == 0) {
lastEventId = line.replace(/id:?\s*/, '');
} else if (line.indexOf('id') == 0) { // this resets the id
lastEventId = null;
} else if (line == '') {
if (data.length) {
var event = new MessageEvent(data.join('\n'), eventsource.url, lastEventId);
eventsource.dispatchEvent(eventType, event);
data = [];
eventType = 'message';
}
}
}
if (this.readyState == 4) pollAgain(interval);
// don't need to poll again, because we're long-loading
} else if (eventsource.readyState !== eventsource.CLOSED) {
if (this.readyState == 4) { // and some other status
// dispatch error
eventsource.readyState = eventsource.CONNECTING;
eventsource.dispatchEvent('error', { type: 'error' });
pollAgain(interval);
} else if (this.readyState == 0) { // likely aborted
pollAgain(interval);
} else {
}
}
};
xhr.send();
setTimeout(function () {
if (true) xhr.abort();
}, xhr.timeout);
eventsource._xhr = xhr;
} catch (e) { // in an attempt to silence the errors
eventsource.dispatchEvent('error', { type: 'error', data: e.message }); // ???
}
};
poll(); // init now
};
EventSource.prototype = {
close: function () {
// closes the connection - disabling the polling
this.readyState = this.CLOSED;
clearInterval(this._pollTimer);
this._xhr.abort();
},
CONNECTING: 0,
OPEN: 1,
CLOSED: 2,
dispatchEvent: function (type, event) {
var handlers = this['_' + type + 'Handlers'];
if (handlers) {
for (var i = 0; i < handlers.length; i++) {
handlers[i].call(this, event);
}
}
if (this['on' + type]) {
this['on' + type].call(this, event);
}
},
addEventListener: function (type, handler) {
if (!this['_' + type + 'Handlers']) {
this['_' + type + 'Handlers'] = [];
}
this['_' + type + 'Handlers'].push(handler);
},
removeEventListener: function (type, handler) {
var handlers = this['_' + type + 'Handlers'];
if (!handlers) {
return;
}
for (var i = handlers.length - 1; i >= 0; --i) {
if (handlers[i] === handler) {
handlers.splice(i, 1);
break;
}
}
},
onerror: null,
onmessage: null,
onopen: null,
readyState: 0,
URL: ''
};
var MessageEvent = function (data, origin, lastEventId) {
this.data = data;
this.origin = origin;
this.lastEventId = lastEventId || '';
};
MessageEvent.prototype = {
data: null,
type: 'message',
lastEventId: '',
origin: ''
};
if ('module' in global) module.exports = EventSource;
global.EventSource = EventSource;
})(this);
/***/ }),
/* 11 */
/***/ (function(module, exports) {
(function () {
// setup for detection
var form = document.createElement('form'),
input = document.createElement('input'),
body = document.body,
id = 'f' + +new Date,
inputTargetSupported = false;
// insert into DOM, work out if it's supported
form.setAttribute('id', id);
input.setAttribute('form', id);
body.appendChild(form);
body.appendChild(input);
inputTargetSupported = input.form !== null;
body.removeChild(form);
body.removeChild(input);
// if not, hook click handlers to all existing submit elements
function click(event) {
event = event || window.event;
// http://www.quirksmode.org/js/events_properties.html#target
var target = event.target || event.srcElement;
if (target.nodeType === 3) target = target.parentNode;
if (target.nodeName === 'INPUT' && target.type === 'submit' && target.form === null) {
form = document.getElementById(target.getAttribute('form'));
var clone = target.cloneNode(true);
clone.style.display = 'none';
form.appendChild(clone);
clone.click(); // doing this because form.submit won't fire handles the way I want
form.removeChild(clone);
}
}
if (!inputTargetSupported) {
body.addEventListener ? body.addEventListener('click', click, false) : body.attachEvent('onclick', click);
}
})();
/***/ }),
/* 12 */
/***/ (function(module, exports) {
// Working demo: http://jsbin.com/ozusa6/2/
(function () {
function triggerEvent(type) {
var event = document.createEvent('HTMLEvents');
event.initEvent(type, true, true);
event.eventName = type;
(document.body || window).dispatchEvent(event);
}
function testConnection() {
// make sync-ajax request
var xhr = new XMLHttpRequest();
// phone home
xhr.open('HEAD', '/', false); // async=false
try {
xhr.send();
onLine = true;
} catch (e) {
// throws NETWORK_ERR when disconnected
onLine = false;
}
return onLine;
}
var onLine = true,
lastOnLineStatus = true;
// note: this doesn't allow us to define a getter in Safari
navigator.__defineGetter__("onLine", testConnection);
testConnection();
if (onLine === false) {
lastOnLineStatus = false;
// trigger offline event
triggerEvent('offline');
}
setInterval(function () {
testConnection();
if (onLine !== lastOnLineStatus) {
triggerEvent(onLine ? 'online' : 'offline');
lastOnLineStatus = onLine;
}
}, 5000); // 5 seconds, made up - can't find docs to suggest interval time
})();
/***/ }),
/* 13 */
/***/ (function(module, exports) {
/**
* This was from a proposal that James Edwards / Brothercake had during
* 2011 Highland Fling - to use select elements as a starting point for
* the range element - so it's a pretty darn good fit, I put this together
* during his Q&A. In the end I needed to lift the detection code from
* Modernizr - which credit really goes to @miketaylr.
* My code starts from "if (bool) {"
*
* This code is looking for <select type="range"> and will progressively
* enhance to a input[type=range] copying much of the attributes across.
*/
!function () {
var rangeTest = document.createElement('input'),
smile = ':)';
rangeTest.setAttribute('type', 'range');
var bool = rangeTest.type !== 'text';
if (bool) {
rangeTest.style.cssText = 'position:absolute;visibility:hidden;';
rangeTest.value = smile;
if (rangeTest.style.WebkitAppearance !== undefined ) {
document.body.appendChild(rangeTest);
defaultView = document.defaultView;
// Safari 2-4 allows the smiley as a value, despite making a slider
bool = defaultView.getComputedStyle &&
defaultView.getComputedStyle(rangeTest, null).WebkitAppearance !== 'textfield' &&
// Mobile android web browser has false positive, so must
// check the height to see if the widget is actually there.
(rangeTest.offsetHeight !== 0);
document.body.removeChild(rangeTest);
}
} else {
bool = rangeTest.value == smile;
}
// if the input[range] is natively supported, then upgrade the <select type="range">
// into a range element.
if (bool) {
function firstChild(el, nodeName) {
nodeName = nodeName.toUpperCase();
if (el.firstChild.nodeName === nodeName) {
return el.firstChild;
} else {
return el.firstChild.nextSibling;
}
}
function lastChild(el, nodeName) {
nodeName = nodeName.toUpperCase();
if (el.lastChild.nodeName === nodeName) {
return el.lastChild;
} else {
return el.lastChild.previousSibling;
}
}
var selects = document.getElementsByTagName('select'),
i = 0;
for (; i < selects.length; i++) {
if (selects[i].getAttribute('data-type') == 'range') (function (select) {
var range = document.createElement('input'),
parent = select.parentNode;
range.setAttribute('type', 'range');
// works with the select element removed from the DOM
select = parent.replaceChild(range, select);
range.autofocus = select.autofocus;
range.disabled = select.disabled;
range.autocomplete = select.autocomplete; // eh? how would this even work?
range.className = select.className;
range.id = select.id;
range.style = select.style;
range.tabindex = select.tabindex;
range.title = select.title;
range.min = firstChild(select, 'option').value;
range.max = lastChild(select, 'option').value;
range.value = select.value;
range.name = select.name;
// Add step support
if ( select.getAttribute('data-type-range-step') ) {
range.step = select.getAttribute('data-type-range-step');
}
// yeah, this is filth, but it's because getElementsByTagName is
// a live DOM collection, so when we removed the select element
// the selects object reduced in length. Freaky, eh?
i--;
})(selects[i]);
}
}
}();
/***/ }),
/* 14 */
/***/ (function(module, exports) {
if (!sessionStorage && JSON) {
sessionStorage = (function () {
var data = window.name ? JSON.parse(window.name) : {};
return {
clear: function () {
data = {};
window.name = '';
},
getItem: function (key) {
return data[key] === undefined ? null : data[key];
},
removeItem: function (key) {
delete data[key];
window.name = JSON.stringify(data);
},
setItem: function (key, value) {
data[key] = value;
window.name = JSON.stringify(data);
}
};
})();
}
/***/ }),
/* 15 */
/***/ (function(module, exports) {
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
} else {
expires = "";
}
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
var nameEQ = name + "=",
ca = document.cookie.split(';'),
i, c;
for (i=0; i < ca.length; i++) {
c = ca[i];
while (c.charAt(0)==' ') {
c = c.substring(1,c.length);
}
if (c.indexOf(nameEQ) == 0) {
return c.substring(nameEQ.length,c.length);
}
}
return null;
}
function setData(data) {
data = JSON.stringify(data);
if (type == 'session') {
window.name = data;
} else {
createCookie('localStorage', data, 365);
}
}
function clearData() {
if (type == 'session') {
window.name = '';
} else {
createCookie('localStorage', '', 365);
}
}
function getData() {
var data = type == 'session' ? window.name : readCookie('localStorage');
return data ? JSON.parse(data) : {};
}
// initialise if there's already data
var data = getData();
return {
length: 0,
clear: function () {
data = {};
this.length = 0;
clearData();
},
getItem: function (key) {
return data[key] === undefined ? null : data[key];
},
key: function (i) {
// not perfect, but works
var ctr = 0;
for (var k in data) {
if (ctr == i) return k;
else ctr++;
}
return null;
},
removeItem: function (key) {
delete data[key];
this.length--;
setData(data);
},
setItem: function (key, value) {
data[key] = value+''; // forces the value to a string
this.length++;
setData(data);
}
};
};
if (typeof window.localStorage == 'undefined') window.localStorage = new Storage('local');
if (typeof window.sessionStorage == 'undefined') window.sessionStorage = new Storage('session');
})();
/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
__webpack_require__(17); // Travlr Uikit Default
// Will import all components Javascript of TravlrUikit
__webpack_require__(18); // Example For Customize TravlrUikit
// import Button from './js/button'
// import Modal from './js/modal'
// import TravlrUikit from './travlruikit'
// new TravlrUikit({
// button: Button,
// modal: Modal
// })
var _default = {//
};
exports.default = _default;
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
__webpack_require__(19);
var _js = _interopRequireDefault(__webpack_require__(21));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
if (typeof window.$TravlrSelector === 'undefined') {
throw new Error('TravlrUikit requires Sizzle js. Sizzle must be include before TravlrUikit Javascript.');
} // Const
var NAME = 'TravlrUikit';
var TravlrUikit = function TravlrUikit(config) {
_classCallCheck(this, TravlrUikit);
this._config = config;
if (this._config) {
window[NAME] = this._config;
} else {
window[NAME] = _js.default;
}
}; // Default Initialize
new TravlrUikit(); // Feel free to customize Travlr Uikit Parts
var _default = TravlrUikit;
exports.default = _default;
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
var _sizzle = _interopRequireDefault(__webpack_require__(20));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
****************************************************
*** ******* ****** ****
*** ****** ****** *****
*********** ************** ****** ******
*********** ************* ****** *******
*********** ************ ****** ********
*********** *********** ****** *********
*********** ********** ****** **********
*********** ********* ****** ***********
*********** ******** ****** ************
*********** ******* ****** *************
*********** ****** ****** **************
****************************************************
* --------------------------------------------------
* Travlr UiKit: querySelector.js
* By Travlr Team
* --------------------------------------------------
*/
window.$TravlrSelector = _sizzle.default;
/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;/*!
* Sizzle CSS Selector Engine v2.3.4
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://js.foundation/
*
* Date: 2019-04-08
*/
(function( window ) {
var i,
support,
Expr,
getText,
isXML,
tokenize,
compile,
select,
outermostContext,
sortInput,
hasDuplicate,
// Local document vars
setDocument,
document,
docElem,
documentIsHTML,
rbuggyQSA,
rbuggyMatches,
matches,
contains,
// Instance-specific data
expando = "sizzle" + 1 * new Date(),
preferredDoc = window.document,
dirruns = 0,
done = 0,
classCache = createCache(),
tokenCache = createCache(),
compilerCache = createCache(),
nonnativeSelectorCache = createCache(),
sortOrder = function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
}
return 0;
},
// Instance methods
hasOwn = ({}).hasOwnProperty,
arr = [],
pop = arr.pop,
push_native = arr.push,
push = arr.push,
slice = arr.slice,
// Use a stripped-down indexOf as it's faster than native
// https://jsperf.com/thor-indexof-vs-for/5
indexOf = function( list, elem ) {
var i = 0,
len = list.length;
for ( ; i < len; i++ ) {
if ( list[i] === elem ) {
return i;
}
}
return -1;
},
booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
// Regular expressions
// http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
// Operator (capture 2)
"*([*^$|!~]?=)" + whitespace +
// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
"*\\]",
pseudos = ":(" + identifier + ")(?:\\((" +
// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
// 1. quoted (capture 3; capture 4 or capture 5)
"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
// 2. simple (capture 6)
"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
// 3. anything else (capture 2)
".*" +
")\\)|)",
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rwhitespace = new RegExp( whitespace + "+", "g" ),
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
rdescend = new RegExp( whitespace + "|>" ),
rpseudo = new RegExp( pseudos ),
ridentifier = new RegExp( "^" + identifier + "$" ),
matchExpr = {
"ID": new RegExp( "^#(" + identifier + ")" ),
"CLASS": new RegExp( "^\\.(" + identifier + ")" ),
"TAG": new RegExp( "^(" + identifier + "|[*])" ),
"ATTR": new RegExp( "^" + attributes ),
"PSEUDO": new RegExp( "^" + pseudos ),
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
// For use in libraries implementing .is()
// We use this for POS matching in `select`
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
},
rhtml = /HTML$/i,
rinputs = /^(?:input|select|textarea|button)$/i,
rheader = /^h\d$/i,
rnative = /^[^{]+\{\s*\[native \w/,
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
rsibling = /[+~]/,
// CSS escapes
// http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
funescape = function( _, escaped, escapedWhitespace ) {
var high = "0x" + escaped - 0x10000;
// NaN means non-codepoint
// Support: Firefox<24
// Workaround erroneous numeric interpretation of +"0x"
return high !== high || escapedWhitespace ?
escaped :
high < 0 ?
// BMP codepoint
String.fromCharCode( high + 0x10000 ) :
// Supplemental Plane codepoint (surrogate pair)
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
},
// CSS string/identifier serialization
// https://drafts.csswg.org/cssom/#common-serializing-idioms
rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
fcssescape = function( ch, asCodePoint ) {
if ( asCodePoint ) {
// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
if ( ch === "\0" ) {
return "\uFFFD";
}
// Control characters and (dependent upon position) numbers get escaped as code points
return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
}
// Other potentially-special ASCII characters get backslash-escaped
return "\\" + ch;
},
// Used for iframes
// See setDocument()
// Removing the function wrapper causes a "Permission Denied"
// error in IE
unloadHandler = function() {
setDocument();
},
inDisabledFieldset = addCombinator(
function( elem ) {
return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
},
{ dir: "parentNode", next: "legend" }
);
// Optimize for push.apply( _, NodeList )
try {
push.apply(
(arr = slice.call( preferredDoc.childNodes )),
preferredDoc.childNodes
);
// Support: Android<4.0
// Detect silently failing push.apply
arr[ preferredDoc.childNodes.length ].nodeType;
} catch ( e ) {
push = { apply: arr.length ?
// Leverage slice if possible
function( target, els ) {
push_native.apply( target, slice.call(els) );
} :
// Support: IE<9
// Otherwise append directly
function( target, els ) {
var j = target.length,
i = 0;
// Can't trust NodeList.length
while ( (target[j++] = els[i++]) ) {}
target.length = j - 1;
}
};
}
function Sizzle( selector, context, results, seed ) {
var m, i, elem, nid, match, groups, newSelector,
newContext = context && context.ownerDocument,
// nodeType defaults to 9, since context defaults to document
nodeType = context ? context.nodeType : 9;
results = results || [];
// Return early from calls with invalid selector or context
if ( typeof selector !== "string" || !selector ||
nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
return results;
}
// Try to shortcut find operations (as opposed to filters) in HTML documents
if ( !seed ) {
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
setDocument( context );
}
context = context || document;
if ( documentIsHTML ) {
// If the selector is sufficiently simple, try using a "get*By*" DOM method
// (excepting DocumentFragment context, where the methods don't exist)
if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
// ID selector
if ( (m = match[1]) ) {
// Document context
if ( nodeType === 9 ) {
if ( (elem = context.getElementById( m )) ) {
// Support: IE, Opera, Webkit
// TODO: identify versions
// getElementById can match elements by name instead of ID
if ( elem.id === m ) {
results.push( elem );
return results;
}
} else {
return results;
}
// Element context
} else {
// Support: IE, Opera, Webkit
// TODO: identify versions
// getElementById can match elements by name instead of ID
if ( newContext && (elem = newContext.getElementById( m )) &&
contains( context, elem ) &&
elem.id === m ) {
results.push( elem );
return results;
}
}
// Type selector
} else if ( match[2] ) {
push.apply( results, context.getElementsByTagName( selector ) );
return results;
// Class selector
} else if ( (m = match[3]) && support.getElementsByClassName &&
context.getElementsByClassName ) {
push.apply( results, context.getElementsByClassName( m ) );
return results;
}
}
// Take advantage of querySelectorAll
if ( support.qsa &&
!nonnativeSelectorCache[ selector + " " ] &&
(!rbuggyQSA || !rbuggyQSA.test( selector )) &&
// Support: IE 8 only
// Exclude object elements
(nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
newSelector = selector;
newContext = context;
// qSA considers elements outside a scoping root when evaluating child or
// descendant combinators, which is not what we want.
// In such cases, we work around the behavior by prefixing every selector in the
// list with an ID selector referencing the scope context.
// Thanks to Andrew Dupont for this technique.
if ( nodeType === 1 && rdescend.test( selector ) ) {
// Capture the context ID, setting it first if necessary
if ( (nid = context.getAttribute( "id" )) ) {
nid = nid.replace( rcssescape, fcssescape );
} else {
context.setAttribute( "id", (nid = expando) );
}
// Prefix every selector in the list
groups = tokenize( selector );
i = groups.length;
while ( i-- ) {
groups[i] = "#" + nid + " " + toSelector( groups[i] );
}
newSelector = groups.join( "," );
// Expand context for sibling selectors
newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
context;
}
try {
push.apply( results,
newContext.querySelectorAll( newSelector )
);
return results;
} catch ( qsaError ) {
nonnativeSelectorCache( selector, true );
} finally {
if ( nid === expando ) {
context.removeAttribute( "id" );
}
}
}
}
}
// All others
return select( selector.replace( rtrim, "$1" ), context, results, seed );
}
/**
* Create key-value caches of limited size
* @returns {function(string, object)} Returns the Object data after storing it on itself with
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
* deleting the oldest entry
*/
function createCache() {
var keys = [];
function