Comparing version 1.7.0 to 1.7.1
# Change Log | ||
## Dom7 v1.7.1 - Released on September 2, 2017 | ||
* Removed `$.getTranslate` method | ||
* Imporved logic of `$.extend` method | ||
* New `dom7.modular.js` version for custom es imports, e.g. `import { $, Methods, Ajax } from 'dom7.modular.js'` | ||
## Dom7 v1.7.0 - Released on August 30, 2017 | ||
@@ -4,0 +9,0 @@ * New `.forEach((element, index))` method |
1018
dist/dom7.js
/** | ||
* Dom7 1.7.0 | ||
* Dom7 1.7.1 | ||
* Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API | ||
@@ -12,3 +12,3 @@ * http://framework7.io/docs/dom.html | ||
* | ||
* Released on: August 30, 2017 | ||
* Released on: September 2, 2017 | ||
*/ | ||
@@ -86,2 +86,19 @@ (function (global, factory) { | ||
$$1.use = function use() { | ||
var args = [], len = arguments.length; | ||
while ( len-- ) args[ len ] = arguments[ len ]; | ||
args.forEach(function (methods) { | ||
var isUtils = '__utils' in methods; | ||
Object.keys(methods).forEach(function (methodName) { | ||
if (methodName === '__utils') { return; } | ||
if (isUtils) { | ||
$$1[methodName] = methods[methodName]; | ||
} else { | ||
$$1.fn[methodName] = methods[methodName]; | ||
} | ||
}); | ||
}); | ||
}; | ||
function parseUrlQuery(url) { | ||
@@ -203,42 +220,2 @@ var query = {}; | ||
} | ||
function getTranslate(el, axis) { | ||
if ( axis === void 0 ) axis = 'x'; | ||
var curStyle = window.getComputedStyle(el, null); | ||
var matrix; | ||
var curTransform; | ||
var transformMatrix; | ||
if (window.WebKitCSSMatrix) { | ||
curTransform = curStyle.transform || curStyle.webkitTransform; | ||
if (curTransform.split(',').length > 6) { | ||
curTransform = curTransform.split(', ').map(function (a) { return a.replace(',', '.'); }).join(', '); | ||
} | ||
// Some old versions of Webkit choke when 'none' is passed; pass | ||
// empty string instead in this case | ||
transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform); | ||
} else { | ||
transformMatrix = curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,'); | ||
matrix = transformMatrix.toString().split(','); | ||
} | ||
if (axis === 'x') { | ||
// Latest Chrome and webkits Fix | ||
if (window.WebKitCSSMatrix) { curTransform = transformMatrix.m41; } | ||
// Crazy IE10 Matrix | ||
else if (matrix.length === 16) { curTransform = parseFloat(matrix[12]); } | ||
// Normal Browsers | ||
else { curTransform = parseFloat(matrix[4]); } | ||
} | ||
if (axis === 'y') { | ||
// Latest Chrome and webkits Fix | ||
if (window.WebKitCSSMatrix) { curTransform = transformMatrix.m42; } | ||
// Crazy IE10 Matrix | ||
else if (matrix.length === 16) { curTransform = parseFloat(matrix[13]); } | ||
// Normal Browsers | ||
else { curTransform = parseFloat(matrix[5]); } | ||
} | ||
return curTransform || 0; | ||
} | ||
function requestAnimationFrame(callback) { | ||
@@ -254,2 +231,5 @@ if (window.requestAnimationFrame) { return window.requestAnimationFrame(callback); } | ||
} | ||
function isObject(o) { | ||
return typeof o === 'object' && o !== null && o.constructor && o.constructor === Object; | ||
} | ||
function extend() { | ||
@@ -268,4 +248,7 @@ var args = [], len$1 = arguments.length; | ||
if (desc !== undefined && desc.enumerable) { | ||
if (typeof to[nextKey] === 'object' && typeof nextSource[nextKey] === 'object') { | ||
if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) { | ||
extend(to[nextKey], nextSource[nextKey]); | ||
} else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) { | ||
to[nextKey] = {}; | ||
extend(to[nextKey], nextSource[nextKey]); | ||
} else { | ||
@@ -280,4 +263,4 @@ to[nextKey] = nextSource[nextKey]; | ||
} | ||
var Utils = { | ||
__utils: true, | ||
parseUrlQuery: parseUrlQuery, | ||
@@ -292,3 +275,2 @@ parseQuery: parseUrlQuery, | ||
dataset: dataset, | ||
getTranslate: getTranslate, | ||
requestAnimationFrame: requestAnimationFrame, | ||
@@ -299,463 +281,2 @@ cancelAnimationFrame: cancelAnimationFrame, | ||
// Global Ajax Setup | ||
var globalAjaxOptions = {}; | ||
function ajaxSetup(options) { | ||
if (options.type && !options.method) { options.method = options.type; } | ||
each(options, function (optionName, optionValue) { | ||
globalAjaxOptions[optionName] = optionValue; | ||
}); | ||
} | ||
// JSONP Requests | ||
var jsonpRequests = 0; | ||
// Ajax | ||
function ajax(options) { | ||
var defaults = { | ||
method: 'GET', | ||
data: false, | ||
async: true, | ||
cache: true, | ||
user: '', | ||
password: '', | ||
headers: {}, | ||
xhrFields: {}, | ||
statusCode: {}, | ||
processData: true, | ||
dataType: 'text', | ||
contentType: 'application/x-www-form-urlencoded', | ||
timeout: 0, | ||
}; | ||
var callbacks = ['beforeSend', 'error', 'complete', 'success', 'statusCode']; | ||
// For jQuery guys | ||
if (options.type) { options.method = options.type; } | ||
// Global options | ||
var globals = globalAjaxOptions; | ||
// Merge global and defaults | ||
each(globals, function (globalOptionName, globalOptionValue) { | ||
if (callbacks.indexOf(globalOptionName) < 0) { defaults[globalOptionName] = globalOptionValue; } | ||
}); | ||
// Function to run XHR callbacks and events | ||
function fireAjaxCallback(eventName, eventData, callbackName) { | ||
var a = arguments; | ||
if (eventName) { $$1(document).trigger(eventName, eventData); } | ||
if (callbackName) { | ||
// Global callback | ||
if (callbackName in globals) { globals[callbackName](a[3], a[4], a[5], a[6]); } | ||
// Options callback | ||
if (options[callbackName]) { options[callbackName](a[3], a[4], a[5], a[6]); } | ||
} | ||
} | ||
// Merge options and defaults | ||
each(defaults, function (prop, defaultValue) { | ||
if (!(prop in options)) { options[prop] = defaultValue; } | ||
}); | ||
// Default URL | ||
if (!options.url) { | ||
options.url = window.location.toString(); | ||
} | ||
// Parameters Prefix | ||
var paramsPrefix = options.url.indexOf('?') >= 0 ? '&' : '?'; | ||
// UC method | ||
var method = options.method.toUpperCase(); | ||
// Data to modify GET URL | ||
if ((method === 'GET' || method === 'HEAD' || method === 'OPTIONS' || method === 'DELETE') && options.data) { | ||
var stringData; | ||
if (typeof options.data === 'string') { | ||
// Should be key=value string | ||
if (options.data.indexOf('?') >= 0) { stringData = options.data.split('?')[1]; } | ||
else { stringData = options.data; } | ||
} else { | ||
// Should be key=value object | ||
stringData = serializeObject(options.data); | ||
} | ||
if (stringData.length) { | ||
options.url += paramsPrefix + stringData; | ||
if (paramsPrefix === '?') { paramsPrefix = '&'; } | ||
} | ||
} | ||
// JSONP | ||
if (options.dataType === 'json' && options.url.indexOf('callback=') >= 0) { | ||
var callbackName = "f7jsonp_" + (Date.now() + ((jsonpRequests += 1))); | ||
var abortTimeout; | ||
var callbackSplit = options.url.split('callback='); | ||
var requestUrl = (callbackSplit[0]) + "callback=" + callbackName; | ||
if (callbackSplit[1].indexOf('&') >= 0) { | ||
var addVars = callbackSplit[1].split('&').filter(function (el) { return el.indexOf('=') > 0; }).join('&'); | ||
if (addVars.length > 0) { requestUrl += "&" + addVars; } | ||
} | ||
// Create script | ||
var script = document.createElement('script'); | ||
script.type = 'text/javascript'; | ||
script.onerror = function onerror() { | ||
clearTimeout(abortTimeout); | ||
fireAjaxCallback(undefined, undefined, 'error', null, 'scripterror'); | ||
fireAjaxCallback('ajaxComplete ajax:complete', { scripterror: true }, 'complete', null, 'scripterror'); | ||
}; | ||
script.src = requestUrl; | ||
// Handler | ||
window[callbackName] = function jsonpCallback(data) { | ||
clearTimeout(abortTimeout); | ||
fireAjaxCallback(undefined, undefined, 'success', data); | ||
script.parentNode.removeChild(script); | ||
script = null; | ||
delete window[callbackName]; | ||
}; | ||
document.querySelector('head').appendChild(script); | ||
if (options.timeout > 0) { | ||
abortTimeout = setTimeout(function () { | ||
script.parentNode.removeChild(script); | ||
script = null; | ||
fireAjaxCallback(undefined, undefined, 'error', null, 'timeout'); | ||
}, options.timeout); | ||
} | ||
return; | ||
} | ||
// Cache for GET/HEAD requests | ||
if (method === 'GET' || method === 'HEAD' || method === 'OPTIONS' || method === 'DELETE') { | ||
if (options.cache === false) { | ||
options.url += paramsPrefix + "_nocache" + (Date.now()); | ||
} | ||
} | ||
// Create XHR | ||
var xhr = new XMLHttpRequest(); | ||
// Save Request URL | ||
xhr.requestUrl = options.url; | ||
xhr.requestParameters = options; | ||
// Open XHR | ||
xhr.open(method, options.url, options.async, options.user, options.password); | ||
// Create POST Data | ||
var postData = null; | ||
if ((method === 'POST' || method === 'PUT' || method === 'PATCH') && options.data) { | ||
if (options.processData) { | ||
var postDataInstances = [ArrayBuffer, Blob, Document, FormData]; | ||
// Post Data | ||
if (postDataInstances.indexOf(options.data.constructor) >= 0) { | ||
postData = options.data; | ||
} else { | ||
// POST Headers | ||
var boundary = "---------------------------" + (Date.now().toString(16)); | ||
if (options.contentType === 'multipart/form-data') { | ||
xhr.setRequestHeader('Content-Type', ("multipart/form-data; boundary=" + boundary)); | ||
} else { | ||
xhr.setRequestHeader('Content-Type', options.contentType); | ||
} | ||
postData = ''; | ||
var data = serializeObject(options.data); | ||
if (options.contentType === 'multipart/form-data') { | ||
data = data.split('&'); | ||
var newData = []; | ||
for (var i = 0; i < data.length; i += 1) { | ||
newData.push(("Content-Disposition: form-data; name=\"" + (data[i].split('=')[0]) + "\"\r\n\r\n" + (data[i].split('=')[1]) + "\r\n")); | ||
} | ||
postData = "--" + boundary + "\r\n" + (newData.join(("--" + boundary + "\r\n"))) + "--" + boundary + "--\r\n"; | ||
} else { | ||
postData = data; | ||
} | ||
} | ||
} else { | ||
postData = options.data; | ||
} | ||
} | ||
// Additional headers | ||
if (options.headers) { | ||
each(options.headers, function (headerName, headerCallback) { | ||
xhr.setRequestHeader(headerName, headerCallback); | ||
}); | ||
} | ||
// Check for crossDomain | ||
if (typeof options.crossDomain === 'undefined') { | ||
options.crossDomain = /^([\w-]+:)?\/\/([^\/]+)/.test(options.url) && RegExp.$2 !== window.location.host; | ||
} | ||
if (!options.crossDomain) { | ||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); | ||
} | ||
if (options.xhrFields) { | ||
each(options.xhrFields, function (fieldName, fieldValue) { | ||
xhr[fieldName] = fieldValue; | ||
}); | ||
} | ||
var xhrTimeout; | ||
// Handle XHR | ||
xhr.onload = function onload(e) { | ||
if (xhrTimeout) { clearTimeout(xhrTimeout); } | ||
if ((xhr.status >= 200 && xhr.status < 300) || xhr.status === 0) { | ||
var responseData; | ||
if (options.dataType === 'json') { | ||
try { | ||
responseData = JSON.parse(xhr.responseText); | ||
fireAjaxCallback('ajaxSuccess ajax:success', { xhr: xhr }, 'success', responseData, xhr.status, xhr); | ||
} catch (err) { | ||
fireAjaxCallback('ajaxError ajax:error', { xhr: xhr, parseerror: true }, 'error', xhr, 'parseerror'); | ||
} | ||
} else { | ||
responseData = xhr.responseType === 'text' || xhr.responseType === '' ? xhr.responseText : xhr.response; | ||
fireAjaxCallback('ajaxSuccess ajax:success', { xhr: xhr }, 'success', responseData, xhr.status, xhr); | ||
} | ||
} else { | ||
fireAjaxCallback('ajaxError ajax:error', { xhr: xhr }, 'error', xhr, xhr.status); | ||
} | ||
if (options.statusCode) { | ||
if (globals.statusCode && globals.statusCode[xhr.status]) { globals.statusCode[xhr.status](xhr); } | ||
if (options.statusCode[xhr.status]) { options.statusCode[xhr.status](xhr); } | ||
} | ||
fireAjaxCallback('ajaxComplete ajax:complete', { xhr: xhr }, 'complete', xhr, xhr.status); | ||
}; | ||
xhr.onerror = function onerror(e) { | ||
if (xhrTimeout) { clearTimeout(xhrTimeout); } | ||
fireAjaxCallback('ajaxError ajax:error', { xhr: xhr }, 'error', xhr, xhr.status); | ||
fireAjaxCallback('ajaxComplete ajax:complete', { xhr: xhr, error: true }, 'complete', xhr, 'error'); | ||
}; | ||
// Ajax start callback | ||
fireAjaxCallback('ajaxStart ajax:start', { xhr: xhr }, 'start', xhr); | ||
fireAjaxCallback(undefined, undefined, 'beforeSend', xhr); | ||
// Timeout | ||
if (options.timeout > 0) { | ||
xhr.onabort = function onabort() { | ||
if (xhrTimeout) { clearTimeout(xhrTimeout); } | ||
}; | ||
xhrTimeout = setTimeout(function () { | ||
xhr.abort(); | ||
fireAjaxCallback('ajaxError ajax:error', { xhr: xhr, timeout: true }, 'error', xhr, 'timeout'); | ||
fireAjaxCallback('ajaxComplete ajax:complete', { xhr: xhr, timeout: true }, 'complete', xhr, 'timeout'); | ||
}, options.timeout); | ||
} | ||
// Send XHR | ||
xhr.send(postData); | ||
// Return XHR object | ||
return xhr; | ||
} | ||
function ajaxShortcut(method) { | ||
var args = [], len = arguments.length - 1; | ||
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; | ||
var url; | ||
var data; | ||
var success; | ||
var error; | ||
var dataType; | ||
if (typeof args[1] === 'function') { | ||
var assign; | ||
(assign = args, url = assign[0], success = assign[1], error = assign[2], dataType = assign[3]); | ||
} else { | ||
var assign$1; | ||
(assign$1 = args, url = assign$1[0], data = assign$1[1], success = assign$1[2], error = assign$1[3], dataType = assign$1[4]); | ||
} | ||
[success, error].forEach(function (callback) { | ||
if (typeof callback === 'string') { | ||
dataType = callback; | ||
if (callback === success) { success = undefined; } | ||
else { error = undefined; } | ||
} | ||
}); | ||
dataType = dataType || (method === 'getJSON' ? 'json' : undefined); | ||
return ajax({ | ||
url: url, | ||
method: method === 'post' ? 'POST' : 'GET', | ||
data: data, | ||
success: success, | ||
error: error, | ||
dataType: dataType, | ||
}); | ||
} | ||
function get() { | ||
var args = [], len = arguments.length; | ||
while ( len-- ) args[ len ] = arguments[ len ]; | ||
args.unshift('get'); | ||
return ajaxShortcut.apply(this, args); | ||
} | ||
function post() { | ||
var args = [], len = arguments.length; | ||
while ( len-- ) args[ len ] = arguments[ len ]; | ||
args.unshift('post'); | ||
return ajaxShortcut.apply(this, args); | ||
} | ||
function getJSON() { | ||
var args = [], len = arguments.length; | ||
while ( len-- ) args[ len ] = arguments[ len ]; | ||
args.unshift('getJSON'); | ||
return ajaxShortcut.apply(this, args); | ||
} | ||
var Ajax = Object.freeze({ | ||
ajaxSetup: ajaxSetup, | ||
ajax: ajax, | ||
get: get, | ||
post: post, | ||
getJSON: getJSON | ||
}); | ||
var Scroll = { | ||
scrollTo: function scrollTo() { | ||
var args = [], len = arguments.length; | ||
while ( len-- ) args[ len ] = arguments[ len ]; | ||
var left = args[0]; | ||
var top = args[1]; | ||
var duration = args[2]; | ||
var easing = args[3]; | ||
var callback = args[4]; | ||
if (args.length === 4 && typeof easing === 'function') { | ||
callback = easing; | ||
var assign; | ||
(assign = args, left = assign[0], top = assign[1], duration = assign[2], callback = assign[3], easing = assign[4]); | ||
} | ||
if (typeof easing === 'undefined') { easing = 'swing'; } | ||
return this.each(function animate() { | ||
var el = this; | ||
var currentTop; | ||
var currentLeft; | ||
var maxTop; | ||
var maxLeft; | ||
var newTop; | ||
var newLeft; | ||
var scrollTop; | ||
var scrollLeft; | ||
var animateTop = top > 0 || top === 0; | ||
var animateLeft = left > 0 || left === 0; | ||
if (typeof easing === 'undefined') { | ||
easing = 'swing'; | ||
} | ||
if (animateTop) { | ||
currentTop = el.scrollTop; | ||
if (!duration) { | ||
el.scrollTop = top; | ||
} | ||
} | ||
if (animateLeft) { | ||
currentLeft = el.scrollLeft; | ||
if (!duration) { | ||
el.scrollLeft = left; | ||
} | ||
} | ||
if (!duration) { return; } | ||
if (animateTop) { | ||
maxTop = el.scrollHeight - el.offsetHeight; | ||
newTop = Math.max(Math.min(top, maxTop), 0); | ||
} | ||
if (animateLeft) { | ||
maxLeft = el.scrollWidth - el.offsetWidth; | ||
newLeft = Math.max(Math.min(left, maxLeft), 0); | ||
} | ||
var startTime = null; | ||
if (animateTop && newTop === currentTop) { animateTop = false; } | ||
if (animateLeft && newLeft === currentLeft) { animateLeft = false; } | ||
function render(time) { | ||
if ( time === void 0 ) time = new Date().getTime(); | ||
if (startTime === null) { | ||
startTime = time; | ||
} | ||
var progress = Math.max(Math.min((time - startTime) / duration, 1), 0); | ||
var easeProgress = easing === 'linear' ? progress : (0.5 - (Math.cos(progress * Math.PI) / 2)); | ||
var done; | ||
if (animateTop) { scrollTop = currentTop + (easeProgress * (newTop - currentTop)); } | ||
if (animateLeft) { scrollLeft = currentLeft + (easeProgress * (newLeft - currentLeft)); } | ||
if (animateTop && newTop > currentTop && scrollTop >= newTop) { | ||
el.scrollTop = newTop; | ||
done = true; | ||
} | ||
if (animateTop && newTop < currentTop && scrollTop <= newTop) { | ||
el.scrollTop = newTop; | ||
done = true; | ||
} | ||
if (animateLeft && newLeft > currentLeft && scrollLeft >= newLeft) { | ||
el.scrollLeft = newLeft; | ||
done = true; | ||
} | ||
if (animateLeft && newLeft < currentLeft && scrollLeft <= newLeft) { | ||
el.scrollLeft = newLeft; | ||
done = true; | ||
} | ||
if (done) { | ||
if (callback) { callback(); } | ||
return; | ||
} | ||
if (animateTop) { el.scrollTop = scrollTop; } | ||
if (animateLeft) { el.scrollLeft = scrollLeft; } | ||
requestAnimationFrame(render); | ||
} | ||
requestAnimationFrame(render); | ||
}); | ||
}, | ||
// scrollTop(top, duration, easing, callback) { | ||
scrollTop: function scrollTop() { | ||
var args = [], len = arguments.length; | ||
while ( len-- ) args[ len ] = arguments[ len ]; | ||
var top = args[0]; | ||
var duration = args[1]; | ||
var easing = args[2]; | ||
var callback = args[3]; | ||
if (args.length === 3 && typeof easing === 'function') { | ||
var assign; | ||
(assign = args, top = assign[0], duration = assign[1], callback = assign[2], easing = assign[3]); | ||
} | ||
var dom = this; | ||
if (typeof top === 'undefined') { | ||
if (dom.length > 0) { return dom[0].scrollTop; } | ||
return null; | ||
} | ||
return dom.scrollTo(undefined, top, duration, easing, callback); | ||
}, | ||
scrollLeft: function scrollLeft() { | ||
var args = [], len = arguments.length; | ||
while ( len-- ) args[ len ] = arguments[ len ]; | ||
var left = args[0]; | ||
var duration = args[1]; | ||
var easing = args[2]; | ||
var callback = args[3]; | ||
if (args.length === 3 && typeof easing === 'function') { | ||
var assign; | ||
(assign = args, left = assign[0], duration = assign[1], callback = assign[2], easing = assign[3]); | ||
} | ||
var dom = this; | ||
if (typeof left === 'undefined') { | ||
if (dom.length > 0) { return dom[0].scrollLeft; } | ||
return null; | ||
} | ||
return dom.scrollTo(left, undefined, duration, easing, callback); | ||
}, | ||
}; | ||
var Methods = { | ||
@@ -1146,3 +667,4 @@ // Classes and attributes | ||
function fireCallBack(e) { | ||
callback(e); | ||
if (e.target !== this) { return; } | ||
callback.call(this, e); | ||
for (i = 0; i < events.length; i += 1) { | ||
@@ -1687,2 +1209,138 @@ dom.off(events[i], fireCallBack); | ||
var Scroll = { | ||
scrollTo: function scrollTo() { | ||
var args = [], len = arguments.length; | ||
while ( len-- ) args[ len ] = arguments[ len ]; | ||
var left = args[0]; | ||
var top = args[1]; | ||
var duration = args[2]; | ||
var easing = args[3]; | ||
var callback = args[4]; | ||
if (args.length === 4 && typeof easing === 'function') { | ||
callback = easing; | ||
var assign; | ||
(assign = args, left = assign[0], top = assign[1], duration = assign[2], callback = assign[3], easing = assign[4]); | ||
} | ||
if (typeof easing === 'undefined') { easing = 'swing'; } | ||
return this.each(function animate() { | ||
var el = this; | ||
var currentTop; | ||
var currentLeft; | ||
var maxTop; | ||
var maxLeft; | ||
var newTop; | ||
var newLeft; | ||
var scrollTop; | ||
var scrollLeft; | ||
var animateTop = top > 0 || top === 0; | ||
var animateLeft = left > 0 || left === 0; | ||
if (typeof easing === 'undefined') { | ||
easing = 'swing'; | ||
} | ||
if (animateTop) { | ||
currentTop = el.scrollTop; | ||
if (!duration) { | ||
el.scrollTop = top; | ||
} | ||
} | ||
if (animateLeft) { | ||
currentLeft = el.scrollLeft; | ||
if (!duration) { | ||
el.scrollLeft = left; | ||
} | ||
} | ||
if (!duration) { return; } | ||
if (animateTop) { | ||
maxTop = el.scrollHeight - el.offsetHeight; | ||
newTop = Math.max(Math.min(top, maxTop), 0); | ||
} | ||
if (animateLeft) { | ||
maxLeft = el.scrollWidth - el.offsetWidth; | ||
newLeft = Math.max(Math.min(left, maxLeft), 0); | ||
} | ||
var startTime = null; | ||
if (animateTop && newTop === currentTop) { animateTop = false; } | ||
if (animateLeft && newLeft === currentLeft) { animateLeft = false; } | ||
function render(time) { | ||
if ( time === void 0 ) time = new Date().getTime(); | ||
if (startTime === null) { | ||
startTime = time; | ||
} | ||
var progress = Math.max(Math.min((time - startTime) / duration, 1), 0); | ||
var easeProgress = easing === 'linear' ? progress : (0.5 - (Math.cos(progress * Math.PI) / 2)); | ||
var done; | ||
if (animateTop) { scrollTop = currentTop + (easeProgress * (newTop - currentTop)); } | ||
if (animateLeft) { scrollLeft = currentLeft + (easeProgress * (newLeft - currentLeft)); } | ||
if (animateTop && newTop > currentTop && scrollTop >= newTop) { | ||
el.scrollTop = newTop; | ||
done = true; | ||
} | ||
if (animateTop && newTop < currentTop && scrollTop <= newTop) { | ||
el.scrollTop = newTop; | ||
done = true; | ||
} | ||
if (animateLeft && newLeft > currentLeft && scrollLeft >= newLeft) { | ||
el.scrollLeft = newLeft; | ||
done = true; | ||
} | ||
if (animateLeft && newLeft < currentLeft && scrollLeft <= newLeft) { | ||
el.scrollLeft = newLeft; | ||
done = true; | ||
} | ||
if (done) { | ||
if (callback) { callback(); } | ||
return; | ||
} | ||
if (animateTop) { el.scrollTop = scrollTop; } | ||
if (animateLeft) { el.scrollLeft = scrollLeft; } | ||
requestAnimationFrame(render); | ||
} | ||
requestAnimationFrame(render); | ||
}); | ||
}, | ||
// scrollTop(top, duration, easing, callback) { | ||
scrollTop: function scrollTop() { | ||
var args = [], len = arguments.length; | ||
while ( len-- ) args[ len ] = arguments[ len ]; | ||
var top = args[0]; | ||
var duration = args[1]; | ||
var easing = args[2]; | ||
var callback = args[3]; | ||
if (args.length === 3 && typeof easing === 'function') { | ||
var assign; | ||
(assign = args, top = assign[0], duration = assign[1], callback = assign[2], easing = assign[3]); | ||
} | ||
var dom = this; | ||
if (typeof top === 'undefined') { | ||
if (dom.length > 0) { return dom[0].scrollTop; } | ||
return null; | ||
} | ||
return dom.scrollTo(undefined, top, duration, easing, callback); | ||
}, | ||
scrollLeft: function scrollLeft() { | ||
var args = [], len = arguments.length; | ||
while ( len-- ) args[ len ] = arguments[ len ]; | ||
var left = args[0]; | ||
var duration = args[1]; | ||
var easing = args[2]; | ||
var callback = args[3]; | ||
if (args.length === 3 && typeof easing === 'function') { | ||
var assign; | ||
(assign = args, left = assign[0], duration = assign[1], callback = assign[2], easing = assign[3]); | ||
} | ||
var dom = this; | ||
if (typeof left === 'undefined') { | ||
if (dom.length > 0) { return dom[0].scrollLeft; } | ||
return null; | ||
} | ||
return dom.scrollTo(left, undefined, duration, easing, callback); | ||
}, | ||
}; | ||
function animate(initialProps, initialParams) { | ||
@@ -1875,37 +1533,335 @@ var els = this; | ||
var Animate = { | ||
animate: animate, | ||
stop: stop, | ||
}; | ||
// Global Ajax Setup | ||
var globalAjaxOptions = {}; | ||
function ajaxSetup(options) { | ||
if (options.type && !options.method) { options.method = options.type; } | ||
each(options, function (optionName, optionValue) { | ||
globalAjaxOptions[optionName] = optionValue; | ||
}); | ||
} | ||
// JSONP Requests | ||
var jsonpRequests = 0; | ||
var Animate = Object.freeze({ | ||
animate: animate, | ||
stop: stop | ||
}); | ||
// Ajax | ||
function ajax(options) { | ||
var defaults = { | ||
method: 'GET', | ||
data: false, | ||
async: true, | ||
cache: true, | ||
user: '', | ||
password: '', | ||
headers: {}, | ||
xhrFields: {}, | ||
statusCode: {}, | ||
processData: true, | ||
dataType: 'text', | ||
contentType: 'application/x-www-form-urlencoded', | ||
timeout: 0, | ||
}; | ||
var callbacks = ['beforeSend', 'error', 'complete', 'success', 'statusCode']; | ||
// Utils & Helpers | ||
Object.keys(Utils).forEach(function (key) { | ||
$$1[key] = Utils[key]; | ||
}); | ||
// For jQuery guys | ||
if (options.type) { options.method = options.type; } | ||
// Methods | ||
Object.keys(Methods).forEach(function (key) { | ||
$$1.fn[key] = Methods[key]; | ||
}); | ||
// Global options | ||
var globals = globalAjaxOptions; | ||
// Scroll | ||
Object.keys(Scroll).forEach(function (key) { | ||
$$1.fn[key] = Scroll[key]; | ||
}); | ||
// Merge global and defaults | ||
each(globals, function (globalOptionName, globalOptionValue) { | ||
if (callbacks.indexOf(globalOptionName) < 0) { defaults[globalOptionName] = globalOptionValue; } | ||
}); | ||
// Animate | ||
Object.keys(Animate).forEach(function (key) { | ||
$$1.fn[key] = Animate[key]; | ||
}); | ||
// Function to run XHR callbacks and events | ||
function fireAjaxCallback(eventName, eventData, callbackName) { | ||
var a = arguments; | ||
if (eventName) { $$1(document).trigger(eventName, eventData); } | ||
if (callbackName) { | ||
// Global callback | ||
if (callbackName in globals) { globals[callbackName](a[3], a[4], a[5], a[6]); } | ||
// Options callback | ||
if (options[callbackName]) { options[callbackName](a[3], a[4], a[5], a[6]); } | ||
} | ||
} | ||
// Ajax | ||
Object.keys(Ajax).forEach(function (key) { | ||
$$1[key] = Ajax[key]; | ||
}); | ||
// Merge options and defaults | ||
each(defaults, function (prop, defaultValue) { | ||
if (!(prop in options)) { options[prop] = defaultValue; } | ||
}); | ||
// Default URL | ||
if (!options.url) { | ||
options.url = window.location.toString(); | ||
} | ||
// Parameters Prefix | ||
var paramsPrefix = options.url.indexOf('?') >= 0 ? '&' : '?'; | ||
// UC method | ||
var method = options.method.toUpperCase(); | ||
// Data to modify GET URL | ||
if ((method === 'GET' || method === 'HEAD' || method === 'OPTIONS' || method === 'DELETE') && options.data) { | ||
var stringData; | ||
if (typeof options.data === 'string') { | ||
// Should be key=value string | ||
if (options.data.indexOf('?') >= 0) { stringData = options.data.split('?')[1]; } | ||
else { stringData = options.data; } | ||
} else { | ||
// Should be key=value object | ||
stringData = serializeObject(options.data); | ||
} | ||
if (stringData.length) { | ||
options.url += paramsPrefix + stringData; | ||
if (paramsPrefix === '?') { paramsPrefix = '&'; } | ||
} | ||
} | ||
// JSONP | ||
if (options.dataType === 'json' && options.url.indexOf('callback=') >= 0) { | ||
var callbackName = "f7jsonp_" + (Date.now() + ((jsonpRequests += 1))); | ||
var abortTimeout; | ||
var callbackSplit = options.url.split('callback='); | ||
var requestUrl = (callbackSplit[0]) + "callback=" + callbackName; | ||
if (callbackSplit[1].indexOf('&') >= 0) { | ||
var addVars = callbackSplit[1].split('&').filter(function (el) { return el.indexOf('=') > 0; }).join('&'); | ||
if (addVars.length > 0) { requestUrl += "&" + addVars; } | ||
} | ||
// Create script | ||
var script = document.createElement('script'); | ||
script.type = 'text/javascript'; | ||
script.onerror = function onerror() { | ||
clearTimeout(abortTimeout); | ||
fireAjaxCallback(undefined, undefined, 'error', null, 'scripterror'); | ||
fireAjaxCallback('ajaxComplete ajax:complete', { scripterror: true }, 'complete', null, 'scripterror'); | ||
}; | ||
script.src = requestUrl; | ||
// Handler | ||
window[callbackName] = function jsonpCallback(data) { | ||
clearTimeout(abortTimeout); | ||
fireAjaxCallback(undefined, undefined, 'success', data); | ||
script.parentNode.removeChild(script); | ||
script = null; | ||
delete window[callbackName]; | ||
}; | ||
document.querySelector('head').appendChild(script); | ||
if (options.timeout > 0) { | ||
abortTimeout = setTimeout(function () { | ||
script.parentNode.removeChild(script); | ||
script = null; | ||
fireAjaxCallback(undefined, undefined, 'error', null, 'timeout'); | ||
}, options.timeout); | ||
} | ||
return; | ||
} | ||
// Cache for GET/HEAD requests | ||
if (method === 'GET' || method === 'HEAD' || method === 'OPTIONS' || method === 'DELETE') { | ||
if (options.cache === false) { | ||
options.url += paramsPrefix + "_nocache" + (Date.now()); | ||
} | ||
} | ||
// Create XHR | ||
var xhr = new XMLHttpRequest(); | ||
// Save Request URL | ||
xhr.requestUrl = options.url; | ||
xhr.requestParameters = options; | ||
// Open XHR | ||
xhr.open(method, options.url, options.async, options.user, options.password); | ||
// Create POST Data | ||
var postData = null; | ||
if ((method === 'POST' || method === 'PUT' || method === 'PATCH') && options.data) { | ||
if (options.processData) { | ||
var postDataInstances = [ArrayBuffer, Blob, Document, FormData]; | ||
// Post Data | ||
if (postDataInstances.indexOf(options.data.constructor) >= 0) { | ||
postData = options.data; | ||
} else { | ||
// POST Headers | ||
var boundary = "---------------------------" + (Date.now().toString(16)); | ||
if (options.contentType === 'multipart/form-data') { | ||
xhr.setRequestHeader('Content-Type', ("multipart/form-data; boundary=" + boundary)); | ||
} else { | ||
xhr.setRequestHeader('Content-Type', options.contentType); | ||
} | ||
postData = ''; | ||
var data = serializeObject(options.data); | ||
if (options.contentType === 'multipart/form-data') { | ||
data = data.split('&'); | ||
var newData = []; | ||
for (var i = 0; i < data.length; i += 1) { | ||
newData.push(("Content-Disposition: form-data; name=\"" + (data[i].split('=')[0]) + "\"\r\n\r\n" + (data[i].split('=')[1]) + "\r\n")); | ||
} | ||
postData = "--" + boundary + "\r\n" + (newData.join(("--" + boundary + "\r\n"))) + "--" + boundary + "--\r\n"; | ||
} else { | ||
postData = data; | ||
} | ||
} | ||
} else { | ||
postData = options.data; | ||
} | ||
} | ||
// Additional headers | ||
if (options.headers) { | ||
each(options.headers, function (headerName, headerCallback) { | ||
xhr.setRequestHeader(headerName, headerCallback); | ||
}); | ||
} | ||
// Check for crossDomain | ||
if (typeof options.crossDomain === 'undefined') { | ||
options.crossDomain = /^([\w-]+:)?\/\/([^\/]+)/.test(options.url) && RegExp.$2 !== window.location.host; | ||
} | ||
if (!options.crossDomain) { | ||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); | ||
} | ||
if (options.xhrFields) { | ||
each(options.xhrFields, function (fieldName, fieldValue) { | ||
xhr[fieldName] = fieldValue; | ||
}); | ||
} | ||
var xhrTimeout; | ||
// Handle XHR | ||
xhr.onload = function onload(e) { | ||
if (xhrTimeout) { clearTimeout(xhrTimeout); } | ||
if ((xhr.status >= 200 && xhr.status < 300) || xhr.status === 0) { | ||
var responseData; | ||
if (options.dataType === 'json') { | ||
try { | ||
responseData = JSON.parse(xhr.responseText); | ||
fireAjaxCallback('ajaxSuccess ajax:success', { xhr: xhr }, 'success', responseData, xhr.status, xhr); | ||
} catch (err) { | ||
fireAjaxCallback('ajaxError ajax:error', { xhr: xhr, parseerror: true }, 'error', xhr, 'parseerror'); | ||
} | ||
} else { | ||
responseData = xhr.responseType === 'text' || xhr.responseType === '' ? xhr.responseText : xhr.response; | ||
fireAjaxCallback('ajaxSuccess ajax:success', { xhr: xhr }, 'success', responseData, xhr.status, xhr); | ||
} | ||
} else { | ||
fireAjaxCallback('ajaxError ajax:error', { xhr: xhr }, 'error', xhr, xhr.status); | ||
} | ||
if (options.statusCode) { | ||
if (globals.statusCode && globals.statusCode[xhr.status]) { globals.statusCode[xhr.status](xhr); } | ||
if (options.statusCode[xhr.status]) { options.statusCode[xhr.status](xhr); } | ||
} | ||
fireAjaxCallback('ajaxComplete ajax:complete', { xhr: xhr }, 'complete', xhr, xhr.status); | ||
}; | ||
xhr.onerror = function onerror(e) { | ||
if (xhrTimeout) { clearTimeout(xhrTimeout); } | ||
fireAjaxCallback('ajaxError ajax:error', { xhr: xhr }, 'error', xhr, xhr.status); | ||
fireAjaxCallback('ajaxComplete ajax:complete', { xhr: xhr, error: true }, 'complete', xhr, 'error'); | ||
}; | ||
// Ajax start callback | ||
fireAjaxCallback('ajaxStart ajax:start', { xhr: xhr }, 'start', xhr); | ||
fireAjaxCallback(undefined, undefined, 'beforeSend', xhr); | ||
// Timeout | ||
if (options.timeout > 0) { | ||
xhr.onabort = function onabort() { | ||
if (xhrTimeout) { clearTimeout(xhrTimeout); } | ||
}; | ||
xhrTimeout = setTimeout(function () { | ||
xhr.abort(); | ||
fireAjaxCallback('ajaxError ajax:error', { xhr: xhr, timeout: true }, 'error', xhr, 'timeout'); | ||
fireAjaxCallback('ajaxComplete ajax:complete', { xhr: xhr, timeout: true }, 'complete', xhr, 'timeout'); | ||
}, options.timeout); | ||
} | ||
// Send XHR | ||
xhr.send(postData); | ||
// Return XHR object | ||
return xhr; | ||
} | ||
function ajaxShortcut(method) { | ||
var args = [], len = arguments.length - 1; | ||
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ]; | ||
var url; | ||
var data; | ||
var success; | ||
var error; | ||
var dataType; | ||
if (typeof args[1] === 'function') { | ||
var assign; | ||
(assign = args, url = assign[0], success = assign[1], error = assign[2], dataType = assign[3]); | ||
} else { | ||
var assign$1; | ||
(assign$1 = args, url = assign$1[0], data = assign$1[1], success = assign$1[2], error = assign$1[3], dataType = assign$1[4]); | ||
} | ||
[success, error].forEach(function (callback) { | ||
if (typeof callback === 'string') { | ||
dataType = callback; | ||
if (callback === success) { success = undefined; } | ||
else { error = undefined; } | ||
} | ||
}); | ||
dataType = dataType || (method === 'getJSON' ? 'json' : undefined); | ||
return ajax({ | ||
url: url, | ||
method: method === 'post' ? 'POST' : 'GET', | ||
data: data, | ||
success: success, | ||
error: error, | ||
dataType: dataType, | ||
}); | ||
} | ||
function get() { | ||
var args = [], len = arguments.length; | ||
while ( len-- ) args[ len ] = arguments[ len ]; | ||
args.unshift('get'); | ||
return ajaxShortcut.apply(this, args); | ||
} | ||
function post() { | ||
var args = [], len = arguments.length; | ||
while ( len-- ) args[ len ] = arguments[ len ]; | ||
args.unshift('post'); | ||
return ajaxShortcut.apply(this, args); | ||
} | ||
function getJSON() { | ||
var args = [], len = arguments.length; | ||
while ( len-- ) args[ len ] = arguments[ len ]; | ||
args.unshift('getJSON'); | ||
return ajaxShortcut.apply(this, args); | ||
} | ||
var Ajax = { | ||
__utils: true, | ||
ajaxSetup: ajaxSetup, | ||
ajax: ajax, | ||
get: get, | ||
post: post, | ||
getJSON: getJSON, | ||
}; | ||
// Utils & Helpers | ||
$$1.use(Utils, Methods, Scroll, Animate, Ajax); | ||
return $$1; | ||
}))); |
/** | ||
* Dom7 1.7.0 | ||
* Dom7 1.7.1 | ||
* Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API | ||
@@ -12,4 +12,4 @@ * http://framework7.io/docs/dom.html | ||
* | ||
* Released on: August 30, 2017 | ||
*/!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Dom7=e()}(this,function(){"use strict";function t(t,e){var n=[],r=0;if(t&&!e&&t instanceof x)return t;if(t)if("string"==typeof t){var i,o,s=t.trim();if(s.indexOf("<")>=0&&s.indexOf(">")>=0){var a="div";for(0===s.indexOf("<li")&&(a="ul"),0===s.indexOf("<tr")&&(a="tbody"),0!==s.indexOf("<td")&&0!==s.indexOf("<th")||(a="tr"),0===s.indexOf("<tbody")&&(a="table"),0===s.indexOf("<option")&&(a="select"),o=document.createElement(a),o.innerHTML=s,r=0;r<o.childNodes.length;r+=1)n.push(o.childNodes[r])}else for(i=e||"#"!==t[0]||t.match(/[ .<>:~]/)?(e||document).querySelectorAll(t.trim()):[document.getElementById(t.trim().split("#")[1])],r=0;r<i.length;r+=1)i[r]&&n.push(i[r])}else if(t.nodeType||t===window||t===document)n.push(t);else if(t.length>0&&t[0].nodeType)for(r=0;r<t.length;r+=1)n.push(t[r]);return new x(n)}function e(t){var e,n,r,i,o={},s=t||window.location.href;if("string"==typeof s&&s.length)for(s=s.indexOf("?")>-1?s.replace(/\S*\?/,""):"",n=s.split("&").filter(function(t){return""!==t}),i=n.length,e=0;e<i;e+=1)r=n[e].replace(/#\S+/g,"").split("="),o[decodeURIComponent(r[0])]=void 0===r[1]?void 0:decodeURIComponent(r[1])||"";return o}function n(t){return Array.isArray(t)}function r(t,e){if("object"==typeof t&&e)if(Array.isArray(t)||t instanceof x){for(var n=0;n<t.length;n+=1)if(!1===e(n,t[n]))return}else for(var r in t)if(t.hasOwnProperty(r)&&!1===e(r,t[r]))return}function i(t){for(var e=[],n=0;n<t.length;n+=1)-1===e.indexOf(t[n])&&e.push(t[n]);return e}function o(t,e){function n(t){if(e.length>0){for(var n="",r=0;r<e.length;r+=1)n+=0===r?e[r]:"["+encodeURIComponent(e[r])+"]";return n+"["+encodeURIComponent(t)+"]"}return encodeURIComponent(t)}function r(t){return encodeURIComponent(t)}if(void 0===e&&(e=[]),"string"==typeof t)return t;var i,s=[];return Object.keys(t).forEach(function(a){var l;if(Array.isArray(t[a])){l=[];for(var u=0;u<t[a].length;u+=1)Array.isArray(t[a][u])||"object"!=typeof t[a][u]?l.push(n(a)+"[]="+r(t[a][u])):(i=e.slice(),i.push(a),i.push(String(u)),l.push(o(t[a][u],i)));l.length>0&&s.push(l.join("&"))}else null===t[a]||""===t[a]?s.push(n(a)+"="):"object"==typeof t[a]?(i=e.slice(),i.push(a),""!==(l=o(t[a],i))&&s.push(l)):void 0!==t[a]&&""!==t[a]?s.push(n(a)+"="+r(t[a])):""===t[a]&&s.push(n(a))}),s.join("&")}function s(t){return t.toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()})}function a(e){return t(e).dataset()}function l(t,e){void 0===e&&(e="x");var n,r,i,o=window.getComputedStyle(t,null);return window.WebKitCSSMatrix?(r=o.transform||o.webkitTransform,r.split(",").length>6&&(r=r.split(", ").map(function(t){return t.replace(",",".")}).join(", ")),i=new window.WebKitCSSMatrix("none"===r?"":r)):(i=o.transform||o.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),n=i.toString().split(",")),"x"===e&&(r=window.WebKitCSSMatrix?i.m41:16===n.length?parseFloat(n[12]):parseFloat(n[4])),"y"===e&&(r=window.WebKitCSSMatrix?i.m42:16===n.length?parseFloat(n[13]):parseFloat(n[5])),r||0}function u(t){return window.requestAnimationFrame?window.requestAnimationFrame(t):window.webkitRequestAnimationFrame?window.webkitRequestAnimationFrame(t):window.setTimeout(t,1e3/60)}function f(t){return window.cancelAnimationFrame?window.cancelAnimationFrame(t):window.webkitCancelAnimationFrame?window.webkitCancelAnimationFrame(t):window.clearTimeout(t)}function h(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];for(var n=Object(t[0]),r=1;r<t.length;r+=1){var i=t[r];if(void 0!==i&&null!==i)for(var o=Object.keys(Object(i)),s=0,a=o.length;s<a;s+=1){var l=o[s],u=Object.getOwnPropertyDescriptor(i,l);void 0!==u&&u.enumerable&&("object"==typeof n[l]&&"object"==typeof i[l]?h(n[l],i[l]):n[l]=i[l])}}return n}function c(t){t.type&&!t.method&&(t.method=t.type),r(t,function(t,e){E[t]=e})}function d(e){function n(n,r,i){var o=arguments;n&&t(document).trigger(n,r),i&&(i in a&&a[i](o[3],o[4],o[5],o[6]),e[i]&&e[i](o[3],o[4],o[5],o[6]))}var i={method:"GET",data:!1,async:!0,cache:!0,user:"",password:"",headers:{},xhrFields:{},statusCode:{},processData:!0,dataType:"text",contentType:"application/x-www-form-urlencoded",timeout:0},s=["beforeSend","error","complete","success","statusCode"];e.type&&(e.method=e.type);var a=E;r(a,function(t,e){s.indexOf(t)<0&&(i[t]=e)}),r(i,function(t,n){t in e||(e[t]=n)}),e.url||(e.url=window.location.toString());var l=e.url.indexOf("?")>=0?"&":"?",u=e.method.toUpperCase();if(("GET"===u||"HEAD"===u||"OPTIONS"===u||"DELETE"===u)&&e.data){var f;f="string"==typeof e.data?e.data.indexOf("?")>=0?e.data.split("?")[1]:e.data:o(e.data),f.length&&(e.url+=l+f,"?"===l&&(l="&"))}if("json"===e.dataType&&e.url.indexOf("callback=")>=0){var h,c="f7jsonp_"+(Date.now()+(T+=1)),d=e.url.split("callback="),p=d[0]+"callback="+c;if(d[1].indexOf("&")>=0){var v=d[1].split("&").filter(function(t){return t.indexOf("=")>0}).join("&");v.length>0&&(p+="&"+v)}var m=document.createElement("script");return m.type="text/javascript",m.onerror=function(){clearTimeout(h),n(void 0,void 0,"error",null,"scripterror"),n("ajaxComplete ajax:complete",{scripterror:!0},"complete",null,"scripterror")},m.src=p,window[c]=function(t){clearTimeout(h),n(void 0,void 0,"success",t),m.parentNode.removeChild(m),m=null,delete window[c]},document.querySelector("head").appendChild(m),void(e.timeout>0&&(h=setTimeout(function(){m.parentNode.removeChild(m),m=null,n(void 0,void 0,"error",null,"timeout")},e.timeout)))}"GET"!==u&&"HEAD"!==u&&"OPTIONS"!==u&&"DELETE"!==u||!1===e.cache&&(e.url+=l+"_nocache"+Date.now());var g=new XMLHttpRequest;g.requestUrl=e.url,g.requestParameters=e,g.open(u,e.url,e.async,e.user,e.password);var y=null;if(("POST"===u||"PUT"===u||"PATCH"===u)&&e.data)if(e.processData){var w=[ArrayBuffer,Blob,Document,FormData];if(w.indexOf(e.data.constructor)>=0)y=e.data;else{var x="---------------------------"+Date.now().toString(16);"multipart/form-data"===e.contentType?g.setRequestHeader("Content-Type","multipart/form-data; boundary="+x):g.setRequestHeader("Content-Type",e.contentType),y="";var b=o(e.data);if("multipart/form-data"===e.contentType){b=b.split("&");for(var L=[],S=0;S<b.length;S+=1)L.push('Content-Disposition: form-data; name="'+b[S].split("=")[0]+'"\r\n\r\n'+b[S].split("=")[1]+"\r\n");y="--"+x+"\r\n"+L.join("--"+x+"\r\n")+"--"+x+"--\r\n"}else y=b}}else y=e.data;e.headers&&r(e.headers,function(t,e){g.setRequestHeader(t,e)}),void 0===e.crossDomain&&(e.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(e.url)&&RegExp.$2!==window.location.host),e.crossDomain||g.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.xhrFields&&r(e.xhrFields,function(t,e){g[t]=e});var C;return g.onload=function(t){if(C&&clearTimeout(C),g.status>=200&&g.status<300||0===g.status){var r;if("json"===e.dataType)try{r=JSON.parse(g.responseText),n("ajaxSuccess ajax:success",{xhr:g},"success",r,g.status,g)}catch(t){n("ajaxError ajax:error",{xhr:g,parseerror:!0},"error",g,"parseerror")}else r="text"===g.responseType||""===g.responseType?g.responseText:g.response,n("ajaxSuccess ajax:success",{xhr:g},"success",r,g.status,g)}else n("ajaxError ajax:error",{xhr:g},"error",g,g.status);e.statusCode&&(a.statusCode&&a.statusCode[g.status]&&a.statusCode[g.status](g),e.statusCode[g.status]&&e.statusCode[g.status](g)),n("ajaxComplete ajax:complete",{xhr:g},"complete",g,g.status)},g.onerror=function(t){C&&clearTimeout(C),n("ajaxError ajax:error",{xhr:g},"error",g,g.status),n("ajaxComplete ajax:complete",{xhr:g,error:!0},"complete",g,"error")},n("ajaxStart ajax:start",{xhr:g},"start",g),n(void 0,void 0,"beforeSend",g),e.timeout>0&&(g.onabort=function(){C&&clearTimeout(C)},C=setTimeout(function(){g.abort(),n("ajaxError ajax:error",{xhr:g,timeout:!0},"error",g,"timeout"),n("ajaxComplete ajax:complete",{xhr:g,timeout:!0},"complete",g,"timeout")},e.timeout)),g.send(y),g}function p(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];var r,i,o,s,a;if("function"==typeof e[1]){var l;l=e,r=l[0],o=l[1],s=l[2],a=l[3]}else{var u;u=e,r=u[0],i=u[1],o=u[2],s=u[3],a=u[4]}return[o,s].forEach(function(t){"string"==typeof t&&(a=t,t===o?o=void 0:s=void 0)}),a=a||("getJSON"===t?"json":void 0),d({url:r,method:"post"===t?"POST":"GET",data:i,success:o,error:s,dataType:a})}function v(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return t.unshift("get"),p.apply(this,t)}function m(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return t.unshift("post"),p.apply(this,t)}function g(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return t.unshift("getJSON"),p.apply(this,t)}function y(e,n){var r=this,i={props:t.extend({},e),params:t.extend({duration:300,easing:"swing"},n),elements:r,animating:!1,que:[],easingProgress:function(t,e){return"swing"===t?.5-Math.cos(e*Math.PI)/2:"function"==typeof t?t(e):e},stop:function(){i.frameId&&f(i.frameId),i.animating=!1,i.elements.each(function(t,e){delete e.dom7AnimateInstance}),i.que=[]},done:function(t){if(i.animating=!1,i.elements.each(function(t,e){delete e.dom7AnimateInstance}),t&&t(r),i.que.length>0){var e=i.que.shift();i.animate(e[0],e[1])}},animate:function(t,e){function n(){s=(new Date).getTime();var d,p;c||(c=!0,e.begin&&e.begin(r)),null===l&&(l=s),e.progress&&e.progress(r,Math.max(Math.min((s-l)/e.duration,1),0),l+e.duration-s<0?0:l+e.duration-s,l),o.forEach(function(n){var r=n;a||r.done||Object.keys(t).forEach(function(n){if(!a&&!r.done){d=Math.max(Math.min((s-l)/e.duration,1),0),p=i.easingProgress(e.easing,d);var u=r[n],c=u.initialValue,v=u.finalValue,m=u.unit;r[n].currentValue=c+p*(v-c);var g=r[n].currentValue;if((v>c&&g>=v||v<c&&g<=v)&&(r.container.style[n]=v+m,h+=1,h===Object.keys(t).length&&(r.done=!0,f+=1),f===o.length&&(a=!0)),a)return void i.done(e.complete);r.container.style[n]=g+m}})}),a||(i.frameId=u(n))}if(i.animating)return i.que.push([t,e]),i;var o=[];i.elements.each(function(e,n){var r,s,a,l,u;n.dom7AnimateInstance||(i.elements[e].dom7AnimateInstance=i),o[e]={container:n},Object.keys(t).forEach(function(i){r=window.getComputedStyle(n,null).getPropertyValue(i).replace(",","."),s=parseFloat(r),a=r.replace(s,""),l=parseFloat(t[i]),u=t[i]+a,o[e][i]={initialFullValue:r,initialValue:s,unit:a,finalValue:l,finalFullValue:u,currentValue:s}})});var s,a,l=null,f=0,h=0,c=!1;return i.animating=!0,i.frameId=u(n),i}};if(0===i.elements.length)return r;for(var o,s=0;s<i.elements.length;s+=1)i.elements[s].dom7AnimateInstance?o=i.elements[s].dom7AnimateInstance:i.elements[s].dom7AnimateInstance=i;return o||(o=i),"stop"===e?o.stop():o.animate(i.props,i.params),r}function w(){for(var t=this,e=0;e<t.length;e+=1)t[e].dom7AnimateInstance&&t[e].dom7AnimateInstance.stop()}var x=function(t){for(var e=this,n=0;n<t.length;n+=1)e[n]=t[n];return e.length=t.length,this};t.fn=x.prototype,t.Class=x;for(var b={parseUrlQuery:e,parseQuery:e,isArray:n,each:r,unique:i,serializeObject:o,param:o,toCamelCase:s,dataset:a,getTranslate:l,requestAnimationFrame:u,cancelAnimationFrame:f,extend:h},E={},T=0,L=Object.freeze({ajaxSetup:c,ajax:d,get:v,post:m,getJSON:g}),S={scrollTo:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=t[0],r=t[1],i=t[2],o=t[3],s=t[4];if(4===t.length&&"function"==typeof o){s=o;var a;a=t,n=a[0],r=a[1],i=a[2],s=a[3],o=a[4]}return void 0===o&&(o="swing"),this.each(function(){function t(n){void 0===n&&(n=(new Date).getTime()),null===y&&(y=n);var r,l=Math.max(Math.min((n-y)/i,1),0),f="linear"===o?l:.5-Math.cos(l*Math.PI)/2;if(m&&(d=e+f*(h-e)),g&&(p=a+f*(c-a)),m&&h>e&&d>=h&&(v.scrollTop=h,r=!0),m&&h<e&&d<=h&&(v.scrollTop=h,r=!0),g&&c>a&&p>=c&&(v.scrollLeft=c,r=!0),g&&c<a&&p<=c&&(v.scrollLeft=c,r=!0),r)return void(s&&s());m&&(v.scrollTop=d),g&&(v.scrollLeft=p),u(t)}var e,a,l,f,h,c,d,p,v=this,m=r>0||0===r,g=n>0||0===n;if(void 0===o&&(o="swing"),m&&(e=v.scrollTop,i||(v.scrollTop=r)),g&&(a=v.scrollLeft,i||(v.scrollLeft=n)),i){m&&(l=v.scrollHeight-v.offsetHeight,h=Math.max(Math.min(r,l),0)),g&&(f=v.scrollWidth-v.offsetWidth,c=Math.max(Math.min(n,f),0));var y=null;m&&h===e&&(m=!1),g&&c===a&&(g=!1),u(t)}})},scrollTop:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=t[0],r=t[1],i=t[2],o=t[3];if(3===t.length&&"function"==typeof i){var s;s=t,n=s[0],r=s[1],o=s[2],i=s[3]}var a=this;return void 0===n?a.length>0?a[0].scrollTop:null:a.scrollTo(void 0,n,r,i,o)},scrollLeft:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=t[0],r=t[1],i=t[2],o=t[3];if(3===t.length&&"function"==typeof i){var s;s=t,n=s[0],r=s[1],o=s[2],i=s[3]}var a=this;return void 0===n?a.length>0?a[0].scrollLeft:null:a.scrollTo(n,void 0,r,i,o)}},C=({addClass:function(t){var e=this;if(void 0===t)return this;for(var n=t.split(" "),r=0;r<n.length;r+=1)for(var i=0;i<this.length;i+=1)void 0!==e[i].classList&&e[i].classList.add(n[r]);return this},removeClass:function(t){for(var e=this,n=t.split(" "),r=0;r<n.length;r+=1)for(var i=0;i<this.length;i+=1)void 0!==e[i].classList&&e[i].classList.remove(n[r]);return this},hasClass:function(t){return!!this[0]&&this[0].classList.contains(t)},toggleClass:function(t){for(var e=this,n=t.split(" "),r=0;r<n.length;r+=1)for(var i=0;i<this.length;i+=1)void 0!==e[i].classList&&e[i].classList.toggle(n[r]);return this},attr:function(t,e){var n=arguments,r=this;if(1!==arguments.length||"string"!=typeof t){for(var i=0;i<this.length;i+=1)if(2===n.length)r[i].setAttribute(t,e);else for(var o in t)r[i][o]=t[o],r[i].setAttribute(o,t[o]);return this}if(this[0])return this[0].getAttribute(t)},removeAttr:function(t){for(var e=this,n=0;n<this.length;n+=1)e[n].removeAttribute(t);return this},prop:function(t,e){var n=arguments,r=this;if(1!==arguments.length||"string"!=typeof t){for(var i=0;i<this.length;i+=1)if(2===n.length)r[i][t]=e;else for(var o in t)r[i][o]=t[o];return this}if(this[0])return this[0][t]},data:function(t,e){var n,r=this;if(void 0!==e){for(var i=0;i<this.length;i+=1)n=r[i],n.dom7ElementDataStorage||(n.dom7ElementDataStorage={}),n.dom7ElementDataStorage[t]=e;return this}if(n=this[0]){if(n.dom7ElementDataStorage&&t in n.dom7ElementDataStorage)return n.dom7ElementDataStorage[t];var o=n.getAttribute("data-"+t);if(o)return o}else;},removeData:function(t){for(var e=this,n=0;n<this.length;n+=1){var r=e[n];r.dom7ElementDataStorage&&r.dom7ElementDataStorage[t]&&(r.dom7ElementDataStorage[t]=null,delete r.dom7ElementDataStorage[t])}},dataset:function(){var t=this[0];if(t){var e={};if(t.dataset)for(var n in t.dataset)e[n]=t.dataset[n];else for(var r=0;r<t.attributes.length;r+=1){var i=t.attributes[r];i.name.indexOf("data-")>=0&&(e[s(i.name.split("data-")[1])]=i.value)}for(var o in e)"false"===e[o]?e[o]=!1:"true"===e[o]?e[o]=!0:parseFloat(e[o])===1*e[o]&&(e[o]*=1);return e}},val:function(t){var e=this;{if(void 0!==t){for(var n=0;n<this.length;n+=1)e[n].value=t;return this}if(this[0]){if(this[0].multiple&&"select"===this[0].nodeName.toLowerCase()){for(var r=[],i=0;i<this[0].selectedOptions.length;i+=1)r.push(e[0].selectedOptions[i].value);return r}return this[0].value}}},transform:function(t){for(var e=this,n=0;n<this.length;n+=1){var r=e[n].style;r.webkitTransform=t,r.transform=t}return this},transition:function(t){var e=this;"string"!=typeof t&&(t+="ms");for(var n=0;n<this.length;n+=1){var r=e[n].style;r.webkitTransitionDuration=t,r.transitionDuration=t}return this},on:function(){function e(e){var n=e.target;if(n){var r=e.target.dom7EventData||[];if(r.unshift(e),t(n).is(s))a.apply(n,r);else for(var i=t(n).parents(),o=0;o<i.length;o+=1)t(i[o]).is(s)&&a.apply(i[o],r)}}function n(t){var e=t&&t.target?t.target.dom7EventData||[]:[];e.unshift(t),a.apply(this,e)}for(var r=this,i=[],o=arguments.length;o--;)i[o]=arguments[o];var s,a,l=i[0],u=!1;"function"==typeof i[1]?(s=!1,a=i[1],u=i[2]):(s=i[1],a=i[2],u=i[3]);for(var f,h=l.split(" "),c=0;c<this.length;c+=1){var d=r[c];if(s)for(f=0;f<h.length;f+=1)d.dom7LiveListeners||(d.dom7LiveListeners=[]),d.dom7LiveListeners.push({type:l,listener:a,proxyListener:e}),d.addEventListener(h[f],e,u);else for(f=0;f<h.length;f+=1)d.dom7Listeners||(d.dom7Listeners=[]),d.dom7Listeners.push({type:l,listener:a,proxyListener:n}),d.addEventListener(h[f],n,u)}return this},off:function(){for(var t=this,e=[],n=arguments.length;n--;)e[n]=arguments[n];var r,i,o=e[0],s=!1;"function"==typeof e[1]?(r=!1,i=e[1],s=e[2]):(r=e[1],i=e[2],s=e[3]);for(var a=o.split(" "),l=0;l<a.length;l+=1)for(var u=0;u<this.length;u+=1){var f=t[u];if(r){if(f.dom7LiveListeners)for(var h=0;h<f.dom7LiveListeners.length;h+=1)i?f.dom7LiveListeners[h].listener===i&&f.removeEventListener(a[l],f.dom7LiveListeners[h].proxyListener,s):f.dom7LiveListeners[h].type===a[l]&&f.removeEventListener(a[l],f.dom7LiveListeners[h].proxyListener,s)}else if(f.dom7Listeners)for(var c=0;c<f.dom7Listeners.length;c+=1)i?f.dom7Listeners[c].listener===i&&f.removeEventListener(a[l],f.dom7Listeners[c].proxyListener,s):f.dom7Listeners[c].type===a[l]&&f.removeEventListener(a[l],f.dom7Listeners[c].proxyListener,s)}return this},once:function(t,e,n,r){function i(s){var a=s.target.dom7EventData||[];n.apply(this,a),o.off(t,e,i,r)}var o=this;return"function"==typeof e&&(n=arguments[1],r=arguments[2],e=!1),o.on(t,e,i,r)},trigger:function(){for(var t=this,e=[],n=arguments.length;n--;)e[n]=arguments[n];for(var r=e[0].split(" "),i=e[1],o=0;o<r.length;o+=1)for(var s=0;s<this.length;s+=1){var a=void 0;try{a=new window.CustomEvent(r[o],{detail:i,bubbles:!0,cancelable:!0})}catch(t){a=document.createEvent("Event"),a.initEvent(r[o],!0,!0),a.detail=i}t[s].dom7EventData=e.filter(function(t,e){return e>0}),t[s].dispatchEvent(a),t[s].dom7EventData=[],delete t[s].dom7EventData}return this},transitionEnd:function(t){function e(o){if(o.target===this)for(t.call(this,o),n=0;n<r.length;n+=1)i.off(r[n],e)}var n,r=["webkitTransitionEnd","transitionend"],i=this;if(t)for(n=0;n<r.length;n+=1)i.on(r[n],e);return this},animationEnd:function(t){function e(o){for(t(o),n=0;n<r.length;n+=1)i.off(r[n],e)}var n,r=["webkitAnimationEnd","animationend"],i=this;if(t)for(n=0;n<r.length;n+=1)i.on(r[n],e);return this},width:function(){return this[0]===window?window.innerWidth:this.length>0?parseFloat(this.css("width")):null},outerWidth:function(t){if(this.length>0){if(t){var e=this.styles();return this[0].offsetWidth+parseFloat(e.getPropertyValue("margin-right"))+parseFloat(e.getPropertyValue("margin-left"))}return this[0].offsetWidth}return null},height:function(){return this[0]===window?window.innerHeight:this.length>0?parseFloat(this.css("height")):null},outerHeight:function(t){if(this.length>0){if(t){var e=this.styles();return this[0].offsetHeight+parseFloat(e.getPropertyValue("margin-top"))+parseFloat(e.getPropertyValue("margin-bottom"))}return this[0].offsetHeight}return null},offset:function(){if(this.length>0){var t=this[0],e=t.getBoundingClientRect(),n=document.body,r=t.clientTop||n.clientTop||0,i=t.clientLeft||n.clientLeft||0,o=t===window?window.scrollY:t.scrollTop,s=t===window?window.scrollX:t.scrollLeft;return{top:e.top+o-r,left:e.left+s-i}}return null},hide:function(){for(var t=this,e=0;e<this.length;e+=1)t[e].style.display="none";return this},show:function(){for(var t=this,e=0;e<this.length;e+=1)t[e].style.display="block";return this},styles:function(){if(this[0])return window.getComputedStyle(this[0],null)},css:function(t,e){var n,r=this;if(1===arguments.length){if("string"!=typeof t){for(n=0;n<this.length;n+=1)for(var i in t)r[n].style[i]=t[i];return this}if(this[0])return window.getComputedStyle(this[0],null).getPropertyValue(t)}if(2===arguments.length&&"string"==typeof t){for(n=0;n<this.length;n+=1)r[n].style[t]=e;return this}return this},toArray:function(){for(var t=this,e=[],n=0;n<this.length;n+=1)e.push(t[n]);return e},each:function(t){var e=this;if(!t)return this;for(var n=0;n<this.length;n+=1)if(!1===t.call(e[n],n,e[n]))return e;return this},forEach:function(t){var e=this;if(!t)return this;for(var n=0;n<this.length;n+=1)if(!1===t.call(e[n],e[n],n))return e;return this},filter:function(t){for(var e=[],n=this,r=0;r<n.length;r+=1)t.call(n[r],r,n[r])&&e.push(n[r]);return new x(e)},map:function(t){for(var e=[],n=this,r=0;r<n.length;r+=1)e.push(t.call(n[r],r,n[r]));return new x(e)},html:function(t){var e=this;if(void 0===t)return this[0]?this[0].innerHTML:void 0;for(var n=0;n<this.length;n+=1)e[n].innerHTML=t;return this},text:function(t){var e=this;if(void 0===t)return this[0]?this[0].textContent.trim():null;for(var n=0;n<this.length;n+=1)e[n].textContent=t;return this},is:function(e){var n,r,i=this[0];if(!i||void 0===e)return!1;if("string"==typeof e){if(i.matches)return i.matches(e);if(i.webkitMatchesSelector)return i.webkitMatchesSelector(e);if(i.msMatchesSelector)return i.msMatchesSelector(e);for(n=t(e),r=0;r<n.length;r+=1)if(n[r]===i)return!0;return!1}if(e===document)return i===document;if(e===window)return i===window;if(e.nodeType||e instanceof x){for(n=e.nodeType?[e]:e,r=0;r<n.length;r+=1)if(n[r]===i)return!0;return!1}return!1},indexOf:function(t){for(var e=this,n=0;n<this.length;n+=1)if(e[n]===t)return n},index:function(){var t,e=this[0];if(e){for(t=0;null!==(e=e.previousSibling);)1===e.nodeType&&(t+=1);return t}},eq:function(t){if(void 0===t)return this;var e,n=this.length;return t>n-1?new x([]):t<0?(e=n+t,new x(e<0?[]:[this[e]])):new x([this[t]])},append:function(){for(var t=this,e=[],n=arguments.length;n--;)e[n]=arguments[n];for(var r,i=0;i<e.length;i+=1){r=e[i];for(var o=0;o<this.length;o+=1)if("string"==typeof r){var s=document.createElement("div");for(s.innerHTML=r;s.firstChild;)t[o].appendChild(s.firstChild)}else if(r instanceof x)for(var a=0;a<r.length;a+=1)t[o].appendChild(r[a]);else t[o].appendChild(r)}return this},appendTo:function(e){return t(e).append(this),this},prepend:function(t){var e,n,r=this;for(e=0;e<this.length;e+=1)if("string"==typeof t){var i=document.createElement("div");for(i.innerHTML=t,n=i.childNodes.length-1;n>=0;n-=1)r[e].insertBefore(i.childNodes[n],r[e].childNodes[0])}else if(t instanceof x)for(n=0;n<t.length;n+=1)r[e].insertBefore(t[n],r[e].childNodes[0]);else r[e].insertBefore(t,r[e].childNodes[0]);return this},prependTo:function(e){return t(e).prepend(this),this},insertBefore:function(e){for(var n=this,r=t(e),i=0;i<this.length;i+=1)if(1===r.length)r[0].parentNode.insertBefore(n[i],r[0]);else if(r.length>1)for(var o=0;o<r.length;o+=1)r[o].parentNode.insertBefore(n[i].cloneNode(!0),r[o])},insertAfter:function(e){for(var n=this,r=t(e),i=0;i<this.length;i+=1)if(1===r.length)r[0].parentNode.insertBefore(n[i],r[0].nextSibling);else if(r.length>1)for(var o=0;o<r.length;o+=1)r[o].parentNode.insertBefore(n[i].cloneNode(!0),r[o].nextSibling)},next:function(e){return new x(this.length>0?e?this[0].nextElementSibling&&t(this[0].nextElementSibling).is(e)?[this[0].nextElementSibling]:[]:this[0].nextElementSibling?[this[0].nextElementSibling]:[]:[])},nextAll:function(e){var n=[],r=this[0];if(!r)return new x([]);for(;r.nextElementSibling;){var i=r.nextElementSibling;e?t(i).is(e)&&n.push(i):n.push(i),r=i}return new x(n)},prev:function(e){if(this.length>0){var n=this[0];return new x(e?n.previousElementSibling&&t(n.previousElementSibling).is(e)?[n.previousElementSibling]:[]:n.previousElementSibling?[n.previousElementSibling]:[])}return new x([])},prevAll:function(e){var n=[],r=this[0];if(!r)return new x([]);for(;r.previousElementSibling;){var i=r.previousElementSibling;e?t(i).is(e)&&n.push(i):n.push(i),r=i}return new x(n)},siblings:function(t){return this.nextAll(t).add(this.prevAll(t))},parent:function(e){for(var n=this,r=[],o=0;o<this.length;o+=1)null!==n[o].parentNode&&(e?t(n[o].parentNode).is(e)&&r.push(n[o].parentNode):r.push(n[o].parentNode));return t(i(r))},parents:function(e){for(var n=this,r=[],o=0;o<this.length;o+=1)for(var s=n[o].parentNode;s;)e?t(s).is(e)&&r.push(s):r.push(s),s=s.parentNode;return t(i(r))},closest:function(t){var e=this;return void 0===t?new x([]):(e.is(t)||(e=e.parents(t).eq(0)),e)},find:function(t){for(var e=this,n=[],r=0;r<this.length;r+=1)for(var i=e[r].querySelectorAll(t),o=0;o<i.length;o+=1)n.push(i[o]);return new x(n)},children:function(e){for(var n=this,r=[],o=0;o<this.length;o+=1)for(var s=n[o].childNodes,a=0;a<s.length;a+=1)e?1===s[a].nodeType&&t(s[a]).is(e)&&r.push(s[a]):1===s[a].nodeType&&r.push(s[a]);return new x(i(r))},remove:function(){for(var t=this,e=0;e<this.length;e+=1)t[e].parentNode&&t[e].parentNode.removeChild(t[e]);return this},detach:function(){return this.remove()},add:function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var r,i,o=this;for(r=0;r<e.length;r+=1){var s=t(e[r]);for(i=0;i<s.length;i+=1)o[o.length]=s[i],o.length+=1}return o},empty:function(){for(var t=this,e=0;e<this.length;e+=1){var n=t[e];if(1===n.nodeType){for(var r=0;r<n.childNodes.length;r+=1)n.childNodes[r].parentNode&&n.childNodes[r].parentNode.removeChild(n.childNodes[r]);n.textContent=""}}return this}}),j="click blur focus focusin focusout keyup keydown keypress submit change mousedown mousemove mouseup mouseenter mouseleave mouseout mouseover touchstart touchend touchmove resize scroll".split(" "),O="resize scroll".split(" "),A=0;A<j.length;A+=1)!function(e){C[e]=function(n,r,i){var o=this;if(void 0===n){for(var s=0;s<this.length;s+=1)O.indexOf(e)<0&&(e in o[s]?o[s][e]():t(o[s]).trigger(e));return this}return this.on(e,n,r,i)}}(j[A]);var D=Object.freeze({animate:y,stop:w});return Object.keys(b).forEach(function(e){t[e]=b[e]}),Object.keys(C).forEach(function(e){t.fn[e]=C[e]}),Object.keys(S).forEach(function(e){t.fn[e]=S[e]}),Object.keys(D).forEach(function(e){t.fn[e]=D[e]}),Object.keys(L).forEach(function(e){t[e]=L[e]}),t}); | ||
* Released on: September 2, 2017 | ||
*/!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Dom7=e()}(this,function(){"use strict";function t(t,e){var n=[],r=0;if(t&&!e&&t instanceof x)return t;if(t)if("string"==typeof t){var i,o,s=t.trim();if(s.indexOf("<")>=0&&s.indexOf(">")>=0){var a="div";for(0===s.indexOf("<li")&&(a="ul"),0===s.indexOf("<tr")&&(a="tbody"),0!==s.indexOf("<td")&&0!==s.indexOf("<th")||(a="tr"),0===s.indexOf("<tbody")&&(a="table"),0===s.indexOf("<option")&&(a="select"),o=document.createElement(a),o.innerHTML=s,r=0;r<o.childNodes.length;r+=1)n.push(o.childNodes[r])}else for(i=e||"#"!==t[0]||t.match(/[ .<>:~]/)?(e||document).querySelectorAll(t.trim()):[document.getElementById(t.trim().split("#")[1])],r=0;r<i.length;r+=1)i[r]&&n.push(i[r])}else if(t.nodeType||t===window||t===document)n.push(t);else if(t.length>0&&t[0].nodeType)for(r=0;r<t.length;r+=1)n.push(t[r]);return new x(n)}function e(t){var e,n,r,i,o={},s=t||window.location.href;if("string"==typeof s&&s.length)for(s=s.indexOf("?")>-1?s.replace(/\S*\?/,""):"",n=s.split("&").filter(function(t){return""!==t}),i=n.length,e=0;e<i;e+=1)r=n[e].replace(/#\S+/g,"").split("="),o[decodeURIComponent(r[0])]=void 0===r[1]?void 0:decodeURIComponent(r[1])||"";return o}function n(t){return Array.isArray(t)}function r(t,e){if("object"==typeof t&&e)if(Array.isArray(t)||t instanceof x){for(var n=0;n<t.length;n+=1)if(!1===e(n,t[n]))return}else for(var r in t)if(t.hasOwnProperty(r)&&!1===e(r,t[r]))return}function i(t){for(var e=[],n=0;n<t.length;n+=1)-1===e.indexOf(t[n])&&e.push(t[n]);return e}function o(t,e){function n(t){if(e.length>0){for(var n="",r=0;r<e.length;r+=1)n+=0===r?e[r]:"["+encodeURIComponent(e[r])+"]";return n+"["+encodeURIComponent(t)+"]"}return encodeURIComponent(t)}function r(t){return encodeURIComponent(t)}if(void 0===e&&(e=[]),"string"==typeof t)return t;var i,s=[];return Object.keys(t).forEach(function(a){var l;if(Array.isArray(t[a])){l=[];for(var u=0;u<t[a].length;u+=1)Array.isArray(t[a][u])||"object"!=typeof t[a][u]?l.push(n(a)+"[]="+r(t[a][u])):(i=e.slice(),i.push(a),i.push(String(u)),l.push(o(t[a][u],i)));l.length>0&&s.push(l.join("&"))}else null===t[a]||""===t[a]?s.push(n(a)+"="):"object"==typeof t[a]?(i=e.slice(),i.push(a),""!==(l=o(t[a],i))&&s.push(l)):void 0!==t[a]&&""!==t[a]?s.push(n(a)+"="+r(t[a])):""===t[a]&&s.push(n(a))}),s.join("&")}function s(t){return t.toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()})}function a(e){return t(e).dataset()}function l(t){return window.requestAnimationFrame?window.requestAnimationFrame(t):window.webkitRequestAnimationFrame?window.webkitRequestAnimationFrame(t):window.setTimeout(t,1e3/60)}function u(t){return window.cancelAnimationFrame?window.cancelAnimationFrame(t):window.webkitCancelAnimationFrame?window.webkitCancelAnimationFrame(t):window.clearTimeout(t)}function f(t){return"object"==typeof t&&null!==t&&t.constructor&&t.constructor===Object}function h(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];for(var n=Object(t[0]),r=1;r<t.length;r+=1){var i=t[r];if(void 0!==i&&null!==i)for(var o=Object.keys(Object(i)),s=0,a=o.length;s<a;s+=1){var l=o[s],u=Object.getOwnPropertyDescriptor(i,l);void 0!==u&&u.enumerable&&(f(n[l])&&f(i[l])?h(n[l],i[l]):!f(n[l])&&f(i[l])?(n[l]={},h(n[l],i[l])):n[l]=i[l])}}return n}function c(e,n){var r=this,i={props:t.extend({},e),params:t.extend({duration:300,easing:"swing"},n),elements:r,animating:!1,que:[],easingProgress:function(t,e){return"swing"===t?.5-Math.cos(e*Math.PI)/2:"function"==typeof t?t(e):e},stop:function(){i.frameId&&u(i.frameId),i.animating=!1,i.elements.each(function(t,e){delete e.dom7AnimateInstance}),i.que=[]},done:function(t){if(i.animating=!1,i.elements.each(function(t,e){delete e.dom7AnimateInstance}),t&&t(r),i.que.length>0){var e=i.que.shift();i.animate(e[0],e[1])}},animate:function(t,e){function n(){s=(new Date).getTime();var d,p;c||(c=!0,e.begin&&e.begin(r)),null===u&&(u=s),e.progress&&e.progress(r,Math.max(Math.min((s-u)/e.duration,1),0),u+e.duration-s<0?0:u+e.duration-s,u),o.forEach(function(n){var r=n;a||r.done||Object.keys(t).forEach(function(n){if(!a&&!r.done){d=Math.max(Math.min((s-u)/e.duration,1),0),p=i.easingProgress(e.easing,d);var l=r[n],c=l.initialValue,v=l.finalValue,m=l.unit;r[n].currentValue=c+p*(v-c);var g=r[n].currentValue;if((v>c&&g>=v||v<c&&g<=v)&&(r.container.style[n]=v+m,h+=1,h===Object.keys(t).length&&(r.done=!0,f+=1),f===o.length&&(a=!0)),a)return void i.done(e.complete);r.container.style[n]=g+m}})}),a||(i.frameId=l(n))}if(i.animating)return i.que.push([t,e]),i;var o=[];i.elements.each(function(e,n){var r,s,a,l,u;n.dom7AnimateInstance||(i.elements[e].dom7AnimateInstance=i),o[e]={container:n},Object.keys(t).forEach(function(i){r=window.getComputedStyle(n,null).getPropertyValue(i).replace(",","."),s=parseFloat(r),a=r.replace(s,""),l=parseFloat(t[i]),u=t[i]+a,o[e][i]={initialFullValue:r,initialValue:s,unit:a,finalValue:l,finalFullValue:u,currentValue:s}})});var s,a,u=null,f=0,h=0,c=!1;return i.animating=!0,i.frameId=l(n),i}};if(0===i.elements.length)return r;for(var o,s=0;s<i.elements.length;s+=1)i.elements[s].dom7AnimateInstance?o=i.elements[s].dom7AnimateInstance:i.elements[s].dom7AnimateInstance=i;return o||(o=i),"stop"===e?o.stop():o.animate(i.props,i.params),r}function d(){for(var t=this,e=0;e<t.length;e+=1)t[e].dom7AnimateInstance&&t[e].dom7AnimateInstance.stop()}function p(t){t.type&&!t.method&&(t.method=t.type),r(t,function(t,e){A[t]=e})}function v(e){function n(n,r,i){var o=arguments;n&&t(document).trigger(n,r),i&&(i in a&&a[i](o[3],o[4],o[5],o[6]),e[i]&&e[i](o[3],o[4],o[5],o[6]))}var i={method:"GET",data:!1,async:!0,cache:!0,user:"",password:"",headers:{},xhrFields:{},statusCode:{},processData:!0,dataType:"text",contentType:"application/x-www-form-urlencoded",timeout:0},s=["beforeSend","error","complete","success","statusCode"];e.type&&(e.method=e.type);var a=A;r(a,function(t,e){s.indexOf(t)<0&&(i[t]=e)}),r(i,function(t,n){t in e||(e[t]=n)}),e.url||(e.url=window.location.toString());var l=e.url.indexOf("?")>=0?"&":"?",u=e.method.toUpperCase();if(("GET"===u||"HEAD"===u||"OPTIONS"===u||"DELETE"===u)&&e.data){var f;f="string"==typeof e.data?e.data.indexOf("?")>=0?e.data.split("?")[1]:e.data:o(e.data),f.length&&(e.url+=l+f,"?"===l&&(l="&"))}if("json"===e.dataType&&e.url.indexOf("callback=")>=0){var h,c="f7jsonp_"+(Date.now()+(O+=1)),d=e.url.split("callback="),p=d[0]+"callback="+c;if(d[1].indexOf("&")>=0){var v=d[1].split("&").filter(function(t){return t.indexOf("=")>0}).join("&");v.length>0&&(p+="&"+v)}var m=document.createElement("script");return m.type="text/javascript",m.onerror=function(){clearTimeout(h),n(void 0,void 0,"error",null,"scripterror"),n("ajaxComplete ajax:complete",{scripterror:!0},"complete",null,"scripterror")},m.src=p,window[c]=function(t){clearTimeout(h),n(void 0,void 0,"success",t),m.parentNode.removeChild(m),m=null,delete window[c]},document.querySelector("head").appendChild(m),void(e.timeout>0&&(h=setTimeout(function(){m.parentNode.removeChild(m),m=null,n(void 0,void 0,"error",null,"timeout")},e.timeout)))}"GET"!==u&&"HEAD"!==u&&"OPTIONS"!==u&&"DELETE"!==u||!1===e.cache&&(e.url+=l+"_nocache"+Date.now());var g=new XMLHttpRequest;g.requestUrl=e.url,g.requestParameters=e,g.open(u,e.url,e.async,e.user,e.password);var y=null;if(("POST"===u||"PUT"===u||"PATCH"===u)&&e.data)if(e.processData){var w=[ArrayBuffer,Blob,Document,FormData];if(w.indexOf(e.data.constructor)>=0)y=e.data;else{var x="---------------------------"+Date.now().toString(16);"multipart/form-data"===e.contentType?g.setRequestHeader("Content-Type","multipart/form-data; boundary="+x):g.setRequestHeader("Content-Type",e.contentType),y="";var b=o(e.data);if("multipart/form-data"===e.contentType){b=b.split("&");for(var E=[],T=0;T<b.length;T+=1)E.push('Content-Disposition: form-data; name="'+b[T].split("=")[0]+'"\r\n\r\n'+b[T].split("=")[1]+"\r\n");y="--"+x+"\r\n"+E.join("--"+x+"\r\n")+"--"+x+"--\r\n"}else y=b}}else y=e.data;e.headers&&r(e.headers,function(t,e){g.setRequestHeader(t,e)}),void 0===e.crossDomain&&(e.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(e.url)&&RegExp.$2!==window.location.host),e.crossDomain||g.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.xhrFields&&r(e.xhrFields,function(t,e){g[t]=e});var L;return g.onload=function(t){if(L&&clearTimeout(L),g.status>=200&&g.status<300||0===g.status){var r;if("json"===e.dataType)try{r=JSON.parse(g.responseText),n("ajaxSuccess ajax:success",{xhr:g},"success",r,g.status,g)}catch(t){n("ajaxError ajax:error",{xhr:g,parseerror:!0},"error",g,"parseerror")}else r="text"===g.responseType||""===g.responseType?g.responseText:g.response,n("ajaxSuccess ajax:success",{xhr:g},"success",r,g.status,g)}else n("ajaxError ajax:error",{xhr:g},"error",g,g.status);e.statusCode&&(a.statusCode&&a.statusCode[g.status]&&a.statusCode[g.status](g),e.statusCode[g.status]&&e.statusCode[g.status](g)),n("ajaxComplete ajax:complete",{xhr:g},"complete",g,g.status)},g.onerror=function(t){L&&clearTimeout(L),n("ajaxError ajax:error",{xhr:g},"error",g,g.status),n("ajaxComplete ajax:complete",{xhr:g,error:!0},"complete",g,"error")},n("ajaxStart ajax:start",{xhr:g},"start",g),n(void 0,void 0,"beforeSend",g),e.timeout>0&&(g.onabort=function(){L&&clearTimeout(L)},L=setTimeout(function(){g.abort(),n("ajaxError ajax:error",{xhr:g,timeout:!0},"error",g,"timeout"),n("ajaxComplete ajax:complete",{xhr:g,timeout:!0},"complete",g,"timeout")},e.timeout)),g.send(y),g}function m(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];var r,i,o,s,a;if("function"==typeof e[1]){var l;l=e,r=l[0],o=l[1],s=l[2],a=l[3]}else{var u;u=e,r=u[0],i=u[1],o=u[2],s=u[3],a=u[4]}return[o,s].forEach(function(t){"string"==typeof t&&(a=t,t===o?o=void 0:s=void 0)}),a=a||("getJSON"===t?"json":void 0),v({url:r,method:"post"===t?"POST":"GET",data:i,success:o,error:s,dataType:a})}function g(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return t.unshift("get"),m.apply(this,t)}function y(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return t.unshift("post"),m.apply(this,t)}function w(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return t.unshift("getJSON"),m.apply(this,t)}var x=function(t){for(var e=this,n=0;n<t.length;n+=1)e[n]=t[n];return e.length=t.length,this};t.fn=x.prototype,t.Class=x,t.use=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];e.forEach(function(e){var n="__utils"in e;Object.keys(e).forEach(function(r){"__utils"!==r&&(n?t[r]=e[r]:t.fn[r]=e[r])})})};for(var b={__utils:!0,parseUrlQuery:e,parseQuery:e,isArray:n,each:r,unique:i,serializeObject:o,param:o,toCamelCase:s,dataset:a,requestAnimationFrame:l,cancelAnimationFrame:u,extend:h},E=({addClass:function(t){var e=this;if(void 0===t)return this;for(var n=t.split(" "),r=0;r<n.length;r+=1)for(var i=0;i<this.length;i+=1)void 0!==e[i].classList&&e[i].classList.add(n[r]);return this},removeClass:function(t){for(var e=this,n=t.split(" "),r=0;r<n.length;r+=1)for(var i=0;i<this.length;i+=1)void 0!==e[i].classList&&e[i].classList.remove(n[r]);return this},hasClass:function(t){return!!this[0]&&this[0].classList.contains(t)},toggleClass:function(t){for(var e=this,n=t.split(" "),r=0;r<n.length;r+=1)for(var i=0;i<this.length;i+=1)void 0!==e[i].classList&&e[i].classList.toggle(n[r]);return this},attr:function(t,e){var n=arguments,r=this;if(1!==arguments.length||"string"!=typeof t){for(var i=0;i<this.length;i+=1)if(2===n.length)r[i].setAttribute(t,e);else for(var o in t)r[i][o]=t[o],r[i].setAttribute(o,t[o]);return this}if(this[0])return this[0].getAttribute(t)},removeAttr:function(t){for(var e=this,n=0;n<this.length;n+=1)e[n].removeAttribute(t);return this},prop:function(t,e){var n=arguments,r=this;if(1!==arguments.length||"string"!=typeof t){for(var i=0;i<this.length;i+=1)if(2===n.length)r[i][t]=e;else for(var o in t)r[i][o]=t[o];return this}if(this[0])return this[0][t]},data:function(t,e){var n,r=this;if(void 0!==e){for(var i=0;i<this.length;i+=1)n=r[i],n.dom7ElementDataStorage||(n.dom7ElementDataStorage={}),n.dom7ElementDataStorage[t]=e;return this}if(n=this[0]){if(n.dom7ElementDataStorage&&t in n.dom7ElementDataStorage)return n.dom7ElementDataStorage[t];var o=n.getAttribute("data-"+t);if(o)return o}else;},removeData:function(t){for(var e=this,n=0;n<this.length;n+=1){var r=e[n];r.dom7ElementDataStorage&&r.dom7ElementDataStorage[t]&&(r.dom7ElementDataStorage[t]=null,delete r.dom7ElementDataStorage[t])}},dataset:function(){var t=this[0];if(t){var e={};if(t.dataset)for(var n in t.dataset)e[n]=t.dataset[n];else for(var r=0;r<t.attributes.length;r+=1){var i=t.attributes[r];i.name.indexOf("data-")>=0&&(e[s(i.name.split("data-")[1])]=i.value)}for(var o in e)"false"===e[o]?e[o]=!1:"true"===e[o]?e[o]=!0:parseFloat(e[o])===1*e[o]&&(e[o]*=1);return e}},val:function(t){var e=this;{if(void 0!==t){for(var n=0;n<this.length;n+=1)e[n].value=t;return this}if(this[0]){if(this[0].multiple&&"select"===this[0].nodeName.toLowerCase()){for(var r=[],i=0;i<this[0].selectedOptions.length;i+=1)r.push(e[0].selectedOptions[i].value);return r}return this[0].value}}},transform:function(t){for(var e=this,n=0;n<this.length;n+=1){var r=e[n].style;r.webkitTransform=t,r.transform=t}return this},transition:function(t){var e=this;"string"!=typeof t&&(t+="ms");for(var n=0;n<this.length;n+=1){var r=e[n].style;r.webkitTransitionDuration=t,r.transitionDuration=t}return this},on:function(){function e(e){var n=e.target;if(n){var r=e.target.dom7EventData||[];if(r.unshift(e),t(n).is(s))a.apply(n,r);else for(var i=t(n).parents(),o=0;o<i.length;o+=1)t(i[o]).is(s)&&a.apply(i[o],r)}}function n(t){var e=t&&t.target?t.target.dom7EventData||[]:[];e.unshift(t),a.apply(this,e)}for(var r=this,i=[],o=arguments.length;o--;)i[o]=arguments[o];var s,a,l=i[0],u=!1;"function"==typeof i[1]?(s=!1,a=i[1],u=i[2]):(s=i[1],a=i[2],u=i[3]);for(var f,h=l.split(" "),c=0;c<this.length;c+=1){var d=r[c];if(s)for(f=0;f<h.length;f+=1)d.dom7LiveListeners||(d.dom7LiveListeners=[]),d.dom7LiveListeners.push({type:l,listener:a,proxyListener:e}),d.addEventListener(h[f],e,u);else for(f=0;f<h.length;f+=1)d.dom7Listeners||(d.dom7Listeners=[]),d.dom7Listeners.push({type:l,listener:a,proxyListener:n}),d.addEventListener(h[f],n,u)}return this},off:function(){for(var t=this,e=[],n=arguments.length;n--;)e[n]=arguments[n];var r,i,o=e[0],s=!1;"function"==typeof e[1]?(r=!1,i=e[1],s=e[2]):(r=e[1],i=e[2],s=e[3]);for(var a=o.split(" "),l=0;l<a.length;l+=1)for(var u=0;u<this.length;u+=1){var f=t[u];if(r){if(f.dom7LiveListeners)for(var h=0;h<f.dom7LiveListeners.length;h+=1)i?f.dom7LiveListeners[h].listener===i&&f.removeEventListener(a[l],f.dom7LiveListeners[h].proxyListener,s):f.dom7LiveListeners[h].type===a[l]&&f.removeEventListener(a[l],f.dom7LiveListeners[h].proxyListener,s)}else if(f.dom7Listeners)for(var c=0;c<f.dom7Listeners.length;c+=1)i?f.dom7Listeners[c].listener===i&&f.removeEventListener(a[l],f.dom7Listeners[c].proxyListener,s):f.dom7Listeners[c].type===a[l]&&f.removeEventListener(a[l],f.dom7Listeners[c].proxyListener,s)}return this},once:function(t,e,n,r){function i(s){var a=s.target.dom7EventData||[];n.apply(this,a),o.off(t,e,i,r)}var o=this;return"function"==typeof e&&(n=arguments[1],r=arguments[2],e=!1),o.on(t,e,i,r)},trigger:function(){for(var t=this,e=[],n=arguments.length;n--;)e[n]=arguments[n];for(var r=e[0].split(" "),i=e[1],o=0;o<r.length;o+=1)for(var s=0;s<this.length;s+=1){var a=void 0;try{a=new window.CustomEvent(r[o],{detail:i,bubbles:!0,cancelable:!0})}catch(t){a=document.createEvent("Event"),a.initEvent(r[o],!0,!0),a.detail=i}t[s].dom7EventData=e.filter(function(t,e){return e>0}),t[s].dispatchEvent(a),t[s].dom7EventData=[],delete t[s].dom7EventData}return this},transitionEnd:function(t){function e(o){if(o.target===this)for(t.call(this,o),n=0;n<r.length;n+=1)i.off(r[n],e)}var n,r=["webkitTransitionEnd","transitionend"],i=this;if(t)for(n=0;n<r.length;n+=1)i.on(r[n],e);return this},animationEnd:function(t){function e(o){if(o.target===this)for(t.call(this,o),n=0;n<r.length;n+=1)i.off(r[n],e)}var n,r=["webkitAnimationEnd","animationend"],i=this;if(t)for(n=0;n<r.length;n+=1)i.on(r[n],e);return this},width:function(){return this[0]===window?window.innerWidth:this.length>0?parseFloat(this.css("width")):null},outerWidth:function(t){if(this.length>0){if(t){var e=this.styles();return this[0].offsetWidth+parseFloat(e.getPropertyValue("margin-right"))+parseFloat(e.getPropertyValue("margin-left"))}return this[0].offsetWidth}return null},height:function(){return this[0]===window?window.innerHeight:this.length>0?parseFloat(this.css("height")):null},outerHeight:function(t){if(this.length>0){if(t){var e=this.styles();return this[0].offsetHeight+parseFloat(e.getPropertyValue("margin-top"))+parseFloat(e.getPropertyValue("margin-bottom"))}return this[0].offsetHeight}return null},offset:function(){if(this.length>0){var t=this[0],e=t.getBoundingClientRect(),n=document.body,r=t.clientTop||n.clientTop||0,i=t.clientLeft||n.clientLeft||0,o=t===window?window.scrollY:t.scrollTop,s=t===window?window.scrollX:t.scrollLeft;return{top:e.top+o-r,left:e.left+s-i}}return null},hide:function(){for(var t=this,e=0;e<this.length;e+=1)t[e].style.display="none";return this},show:function(){for(var t=this,e=0;e<this.length;e+=1)t[e].style.display="block";return this},styles:function(){if(this[0])return window.getComputedStyle(this[0],null)},css:function(t,e){var n,r=this;if(1===arguments.length){if("string"!=typeof t){for(n=0;n<this.length;n+=1)for(var i in t)r[n].style[i]=t[i];return this}if(this[0])return window.getComputedStyle(this[0],null).getPropertyValue(t)}if(2===arguments.length&&"string"==typeof t){for(n=0;n<this.length;n+=1)r[n].style[t]=e;return this}return this},toArray:function(){for(var t=this,e=[],n=0;n<this.length;n+=1)e.push(t[n]);return e},each:function(t){var e=this;if(!t)return this;for(var n=0;n<this.length;n+=1)if(!1===t.call(e[n],n,e[n]))return e;return this},forEach:function(t){var e=this;if(!t)return this;for(var n=0;n<this.length;n+=1)if(!1===t.call(e[n],e[n],n))return e;return this},filter:function(t){for(var e=[],n=this,r=0;r<n.length;r+=1)t.call(n[r],r,n[r])&&e.push(n[r]);return new x(e)},map:function(t){for(var e=[],n=this,r=0;r<n.length;r+=1)e.push(t.call(n[r],r,n[r]));return new x(e)},html:function(t){var e=this;if(void 0===t)return this[0]?this[0].innerHTML:void 0;for(var n=0;n<this.length;n+=1)e[n].innerHTML=t;return this},text:function(t){var e=this;if(void 0===t)return this[0]?this[0].textContent.trim():null;for(var n=0;n<this.length;n+=1)e[n].textContent=t;return this},is:function(e){var n,r,i=this[0];if(!i||void 0===e)return!1;if("string"==typeof e){if(i.matches)return i.matches(e);if(i.webkitMatchesSelector)return i.webkitMatchesSelector(e);if(i.msMatchesSelector)return i.msMatchesSelector(e);for(n=t(e),r=0;r<n.length;r+=1)if(n[r]===i)return!0;return!1}if(e===document)return i===document;if(e===window)return i===window;if(e.nodeType||e instanceof x){for(n=e.nodeType?[e]:e,r=0;r<n.length;r+=1)if(n[r]===i)return!0;return!1}return!1},indexOf:function(t){for(var e=this,n=0;n<this.length;n+=1)if(e[n]===t)return n},index:function(){var t,e=this[0];if(e){for(t=0;null!==(e=e.previousSibling);)1===e.nodeType&&(t+=1);return t}},eq:function(t){if(void 0===t)return this;var e,n=this.length;return t>n-1?new x([]):t<0?(e=n+t,new x(e<0?[]:[this[e]])):new x([this[t]])},append:function(){for(var t=this,e=[],n=arguments.length;n--;)e[n]=arguments[n];for(var r,i=0;i<e.length;i+=1){r=e[i];for(var o=0;o<this.length;o+=1)if("string"==typeof r){var s=document.createElement("div");for(s.innerHTML=r;s.firstChild;)t[o].appendChild(s.firstChild)}else if(r instanceof x)for(var a=0;a<r.length;a+=1)t[o].appendChild(r[a]);else t[o].appendChild(r)}return this},appendTo:function(e){return t(e).append(this),this},prepend:function(t){var e,n,r=this;for(e=0;e<this.length;e+=1)if("string"==typeof t){var i=document.createElement("div");for(i.innerHTML=t,n=i.childNodes.length-1;n>=0;n-=1)r[e].insertBefore(i.childNodes[n],r[e].childNodes[0])}else if(t instanceof x)for(n=0;n<t.length;n+=1)r[e].insertBefore(t[n],r[e].childNodes[0]);else r[e].insertBefore(t,r[e].childNodes[0]);return this},prependTo:function(e){return t(e).prepend(this),this},insertBefore:function(e){for(var n=this,r=t(e),i=0;i<this.length;i+=1)if(1===r.length)r[0].parentNode.insertBefore(n[i],r[0]);else if(r.length>1)for(var o=0;o<r.length;o+=1)r[o].parentNode.insertBefore(n[i].cloneNode(!0),r[o])},insertAfter:function(e){for(var n=this,r=t(e),i=0;i<this.length;i+=1)if(1===r.length)r[0].parentNode.insertBefore(n[i],r[0].nextSibling);else if(r.length>1)for(var o=0;o<r.length;o+=1)r[o].parentNode.insertBefore(n[i].cloneNode(!0),r[o].nextSibling)},next:function(e){return new x(this.length>0?e?this[0].nextElementSibling&&t(this[0].nextElementSibling).is(e)?[this[0].nextElementSibling]:[]:this[0].nextElementSibling?[this[0].nextElementSibling]:[]:[])},nextAll:function(e){var n=[],r=this[0];if(!r)return new x([]);for(;r.nextElementSibling;){var i=r.nextElementSibling;e?t(i).is(e)&&n.push(i):n.push(i),r=i}return new x(n)},prev:function(e){if(this.length>0){var n=this[0];return new x(e?n.previousElementSibling&&t(n.previousElementSibling).is(e)?[n.previousElementSibling]:[]:n.previousElementSibling?[n.previousElementSibling]:[])}return new x([])},prevAll:function(e){var n=[],r=this[0];if(!r)return new x([]);for(;r.previousElementSibling;){var i=r.previousElementSibling;e?t(i).is(e)&&n.push(i):n.push(i),r=i}return new x(n)},siblings:function(t){return this.nextAll(t).add(this.prevAll(t))},parent:function(e){for(var n=this,r=[],o=0;o<this.length;o+=1)null!==n[o].parentNode&&(e?t(n[o].parentNode).is(e)&&r.push(n[o].parentNode):r.push(n[o].parentNode));return t(i(r))},parents:function(e){for(var n=this,r=[],o=0;o<this.length;o+=1)for(var s=n[o].parentNode;s;)e?t(s).is(e)&&r.push(s):r.push(s),s=s.parentNode;return t(i(r))},closest:function(t){var e=this;return void 0===t?new x([]):(e.is(t)||(e=e.parents(t).eq(0)),e)},find:function(t){for(var e=this,n=[],r=0;r<this.length;r+=1)for(var i=e[r].querySelectorAll(t),o=0;o<i.length;o+=1)n.push(i[o]);return new x(n)},children:function(e){for(var n=this,r=[],o=0;o<this.length;o+=1)for(var s=n[o].childNodes,a=0;a<s.length;a+=1)e?1===s[a].nodeType&&t(s[a]).is(e)&&r.push(s[a]):1===s[a].nodeType&&r.push(s[a]);return new x(i(r))},remove:function(){for(var t=this,e=0;e<this.length;e+=1)t[e].parentNode&&t[e].parentNode.removeChild(t[e]);return this},detach:function(){return this.remove()},add:function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var r,i,o=this;for(r=0;r<e.length;r+=1){var s=t(e[r]);for(i=0;i<s.length;i+=1)o[o.length]=s[i],o.length+=1}return o},empty:function(){for(var t=this,e=0;e<this.length;e+=1){var n=t[e];if(1===n.nodeType){for(var r=0;r<n.childNodes.length;r+=1)n.childNodes[r].parentNode&&n.childNodes[r].parentNode.removeChild(n.childNodes[r]);n.textContent=""}}return this}}),T="click blur focus focusin focusout keyup keydown keypress submit change mousedown mousemove mouseup mouseenter mouseleave mouseout mouseover touchstart touchend touchmove resize scroll".split(" "),L="resize scroll".split(" "),S=0;S<T.length;S+=1)!function(e){E[e]=function(n,r,i){var o=this;if(void 0===n){for(var s=0;s<this.length;s+=1)L.indexOf(e)<0&&(e in o[s]?o[s][e]():t(o[s]).trigger(e));return this}return this.on(e,n,r,i)}}(T[S]);var C={scrollTo:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=t[0],r=t[1],i=t[2],o=t[3],s=t[4];if(4===t.length&&"function"==typeof o){s=o;var a;a=t,n=a[0],r=a[1],i=a[2],s=a[3],o=a[4]}return void 0===o&&(o="swing"),this.each(function(){function t(n){void 0===n&&(n=(new Date).getTime()),null===y&&(y=n);var r,u=Math.max(Math.min((n-y)/i,1),0),f="linear"===o?u:.5-Math.cos(u*Math.PI)/2;if(m&&(d=e+f*(h-e)),g&&(p=a+f*(c-a)),m&&h>e&&d>=h&&(v.scrollTop=h,r=!0),m&&h<e&&d<=h&&(v.scrollTop=h,r=!0),g&&c>a&&p>=c&&(v.scrollLeft=c,r=!0),g&&c<a&&p<=c&&(v.scrollLeft=c,r=!0),r)return void(s&&s());m&&(v.scrollTop=d),g&&(v.scrollLeft=p),l(t)}var e,a,u,f,h,c,d,p,v=this,m=r>0||0===r,g=n>0||0===n;if(void 0===o&&(o="swing"),m&&(e=v.scrollTop,i||(v.scrollTop=r)),g&&(a=v.scrollLeft,i||(v.scrollLeft=n)),i){m&&(u=v.scrollHeight-v.offsetHeight,h=Math.max(Math.min(r,u),0)),g&&(f=v.scrollWidth-v.offsetWidth,c=Math.max(Math.min(n,f),0));var y=null;m&&h===e&&(m=!1),g&&c===a&&(g=!1),l(t)}})},scrollTop:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=t[0],r=t[1],i=t[2],o=t[3];if(3===t.length&&"function"==typeof i){var s;s=t,n=s[0],r=s[1],o=s[2],i=s[3]}var a=this;return void 0===n?a.length>0?a[0].scrollTop:null:a.scrollTo(void 0,n,r,i,o)},scrollLeft:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=t[0],r=t[1],i=t[2],o=t[3];if(3===t.length&&"function"==typeof i){var s;s=t,n=s[0],r=s[1],o=s[2],i=s[3]}var a=this;return void 0===n?a.length>0?a[0].scrollLeft:null:a.scrollTo(n,void 0,r,i,o)}},j={animate:c,stop:d},A={},O=0,D={__utils:!0,ajaxSetup:p,ajax:v,get:g,post:y,getJSON:w};return t.use(b,E,C,j,D),t}); | ||
//# sourceMappingURL=dom7.min.js.map |
/** | ||
* Dom7 1.7.0 | ||
* Dom7 1.7.1 | ||
* Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API | ||
@@ -12,3 +12,3 @@ * http://framework7.io/docs/dom.html | ||
* | ||
* Released on: August 30, 2017 | ||
* Released on: September 2, 2017 | ||
*/ | ||
@@ -82,2 +82,16 @@ class Dom7 { | ||
$$1.use = function use(...args) { | ||
args.forEach((methods) => { | ||
const isUtils = '__utils' in methods; | ||
Object.keys(methods).forEach((methodName) => { | ||
if (methodName === '__utils') return; | ||
if (isUtils) { | ||
$$1[methodName] = methods[methodName]; | ||
} else { | ||
$$1.fn[methodName] = methods[methodName]; | ||
} | ||
}); | ||
}); | ||
}; | ||
function parseUrlQuery(url) { | ||
@@ -197,40 +211,2 @@ const query = {}; | ||
} | ||
function getTranslate(el, axis = 'x') { | ||
const curStyle = window.getComputedStyle(el, null); | ||
let matrix; | ||
let curTransform; | ||
let transformMatrix; | ||
if (window.WebKitCSSMatrix) { | ||
curTransform = curStyle.transform || curStyle.webkitTransform; | ||
if (curTransform.split(',').length > 6) { | ||
curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', '); | ||
} | ||
// Some old versions of Webkit choke when 'none' is passed; pass | ||
// empty string instead in this case | ||
transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform); | ||
} else { | ||
transformMatrix = curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,'); | ||
matrix = transformMatrix.toString().split(','); | ||
} | ||
if (axis === 'x') { | ||
// Latest Chrome and webkits Fix | ||
if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41; | ||
// Crazy IE10 Matrix | ||
else if (matrix.length === 16) curTransform = parseFloat(matrix[12]); | ||
// Normal Browsers | ||
else curTransform = parseFloat(matrix[4]); | ||
} | ||
if (axis === 'y') { | ||
// Latest Chrome and webkits Fix | ||
if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42; | ||
// Crazy IE10 Matrix | ||
else if (matrix.length === 16) curTransform = parseFloat(matrix[13]); | ||
// Normal Browsers | ||
else curTransform = parseFloat(matrix[5]); | ||
} | ||
return curTransform || 0; | ||
} | ||
function requestAnimationFrame(callback) { | ||
@@ -246,2 +222,5 @@ if (window.requestAnimationFrame) return window.requestAnimationFrame(callback); | ||
} | ||
function isObject(o) { | ||
return typeof o === 'object' && o !== null && o.constructor && o.constructor === Object; | ||
} | ||
function extend(...args) { | ||
@@ -257,4 +236,7 @@ const to = Object(args[0]); | ||
if (desc !== undefined && desc.enumerable) { | ||
if (typeof to[nextKey] === 'object' && typeof nextSource[nextKey] === 'object') { | ||
if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) { | ||
extend(to[nextKey], nextSource[nextKey]); | ||
} else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) { | ||
to[nextKey] = {}; | ||
extend(to[nextKey], nextSource[nextKey]); | ||
} else { | ||
@@ -269,4 +251,4 @@ to[nextKey] = nextSource[nextKey]; | ||
} | ||
const Utils = { | ||
__utils: true, | ||
parseUrlQuery, | ||
@@ -281,3 +263,2 @@ parseQuery: parseUrlQuery, | ||
dataset, | ||
getTranslate, | ||
requestAnimationFrame, | ||
@@ -288,425 +269,2 @@ cancelAnimationFrame, | ||
// Global Ajax Setup | ||
const globalAjaxOptions = {}; | ||
function ajaxSetup(options) { | ||
if (options.type && !options.method) options.method = options.type; | ||
each(options, (optionName, optionValue) => { | ||
globalAjaxOptions[optionName] = optionValue; | ||
}); | ||
} | ||
// JSONP Requests | ||
let jsonpRequests = 0; | ||
// Ajax | ||
function ajax(options) { | ||
const defaults = { | ||
method: 'GET', | ||
data: false, | ||
async: true, | ||
cache: true, | ||
user: '', | ||
password: '', | ||
headers: {}, | ||
xhrFields: {}, | ||
statusCode: {}, | ||
processData: true, | ||
dataType: 'text', | ||
contentType: 'application/x-www-form-urlencoded', | ||
timeout: 0, | ||
}; | ||
const callbacks = ['beforeSend', 'error', 'complete', 'success', 'statusCode']; | ||
// For jQuery guys | ||
if (options.type) options.method = options.type; | ||
// Global options | ||
const globals = globalAjaxOptions; | ||
// Merge global and defaults | ||
each(globals, (globalOptionName, globalOptionValue) => { | ||
if (callbacks.indexOf(globalOptionName) < 0) defaults[globalOptionName] = globalOptionValue; | ||
}); | ||
// Function to run XHR callbacks and events | ||
function fireAjaxCallback(eventName, eventData, callbackName) { | ||
const a = arguments; | ||
if (eventName) $$1(document).trigger(eventName, eventData); | ||
if (callbackName) { | ||
// Global callback | ||
if (callbackName in globals) globals[callbackName](a[3], a[4], a[5], a[6]); | ||
// Options callback | ||
if (options[callbackName]) options[callbackName](a[3], a[4], a[5], a[6]); | ||
} | ||
} | ||
// Merge options and defaults | ||
each(defaults, (prop, defaultValue) => { | ||
if (!(prop in options)) options[prop] = defaultValue; | ||
}); | ||
// Default URL | ||
if (!options.url) { | ||
options.url = window.location.toString(); | ||
} | ||
// Parameters Prefix | ||
let paramsPrefix = options.url.indexOf('?') >= 0 ? '&' : '?'; | ||
// UC method | ||
const method = options.method.toUpperCase(); | ||
// Data to modify GET URL | ||
if ((method === 'GET' || method === 'HEAD' || method === 'OPTIONS' || method === 'DELETE') && options.data) { | ||
let stringData; | ||
if (typeof options.data === 'string') { | ||
// Should be key=value string | ||
if (options.data.indexOf('?') >= 0) stringData = options.data.split('?')[1]; | ||
else stringData = options.data; | ||
} else { | ||
// Should be key=value object | ||
stringData = serializeObject(options.data); | ||
} | ||
if (stringData.length) { | ||
options.url += paramsPrefix + stringData; | ||
if (paramsPrefix === '?') paramsPrefix = '&'; | ||
} | ||
} | ||
// JSONP | ||
if (options.dataType === 'json' && options.url.indexOf('callback=') >= 0) { | ||
const callbackName = `f7jsonp_${Date.now() + ((jsonpRequests += 1))}`; | ||
let abortTimeout; | ||
const callbackSplit = options.url.split('callback='); | ||
let requestUrl = `${callbackSplit[0]}callback=${callbackName}`; | ||
if (callbackSplit[1].indexOf('&') >= 0) { | ||
const addVars = callbackSplit[1].split('&').filter((el) => el.indexOf('=') > 0).join('&'); | ||
if (addVars.length > 0) requestUrl += `&${addVars}`; | ||
} | ||
// Create script | ||
let script = document.createElement('script'); | ||
script.type = 'text/javascript'; | ||
script.onerror = function onerror() { | ||
clearTimeout(abortTimeout); | ||
fireAjaxCallback(undefined, undefined, 'error', null, 'scripterror'); | ||
fireAjaxCallback('ajaxComplete ajax:complete', { scripterror: true }, 'complete', null, 'scripterror'); | ||
}; | ||
script.src = requestUrl; | ||
// Handler | ||
window[callbackName] = function jsonpCallback(data) { | ||
clearTimeout(abortTimeout); | ||
fireAjaxCallback(undefined, undefined, 'success', data); | ||
script.parentNode.removeChild(script); | ||
script = null; | ||
delete window[callbackName]; | ||
}; | ||
document.querySelector('head').appendChild(script); | ||
if (options.timeout > 0) { | ||
abortTimeout = setTimeout(() => { | ||
script.parentNode.removeChild(script); | ||
script = null; | ||
fireAjaxCallback(undefined, undefined, 'error', null, 'timeout'); | ||
}, options.timeout); | ||
} | ||
return; | ||
} | ||
// Cache for GET/HEAD requests | ||
if (method === 'GET' || method === 'HEAD' || method === 'OPTIONS' || method === 'DELETE') { | ||
if (options.cache === false) { | ||
options.url += `${paramsPrefix}_nocache${Date.now()}`; | ||
} | ||
} | ||
// Create XHR | ||
const xhr = new XMLHttpRequest(); | ||
// Save Request URL | ||
xhr.requestUrl = options.url; | ||
xhr.requestParameters = options; | ||
// Open XHR | ||
xhr.open(method, options.url, options.async, options.user, options.password); | ||
// Create POST Data | ||
let postData = null; | ||
if ((method === 'POST' || method === 'PUT' || method === 'PATCH') && options.data) { | ||
if (options.processData) { | ||
const postDataInstances = [ArrayBuffer, Blob, Document, FormData]; | ||
// Post Data | ||
if (postDataInstances.indexOf(options.data.constructor) >= 0) { | ||
postData = options.data; | ||
} else { | ||
// POST Headers | ||
let boundary = `---------------------------${Date.now().toString(16)}`; | ||
if (options.contentType === 'multipart/form-data') { | ||
xhr.setRequestHeader('Content-Type', `multipart/form-data; boundary=${boundary}`); | ||
} else { | ||
xhr.setRequestHeader('Content-Type', options.contentType); | ||
} | ||
postData = ''; | ||
let data = serializeObject(options.data); | ||
if (options.contentType === 'multipart/form-data') { | ||
data = data.split('&'); | ||
const newData = []; | ||
for (let i = 0; i < data.length; i += 1) { | ||
newData.push(`Content-Disposition: form-data; name="${data[i].split('=')[0]}"\r\n\r\n${data[i].split('=')[1]}\r\n`); | ||
} | ||
postData = `--${boundary}\r\n${newData.join(`--${boundary}\r\n`)}--${boundary}--\r\n`; | ||
} else { | ||
postData = data; | ||
} | ||
} | ||
} else { | ||
postData = options.data; | ||
} | ||
} | ||
// Additional headers | ||
if (options.headers) { | ||
each(options.headers, (headerName, headerCallback) => { | ||
xhr.setRequestHeader(headerName, headerCallback); | ||
}); | ||
} | ||
// Check for crossDomain | ||
if (typeof options.crossDomain === 'undefined') { | ||
options.crossDomain = /^([\w-]+:)?\/\/([^\/]+)/.test(options.url) && RegExp.$2 !== window.location.host; | ||
} | ||
if (!options.crossDomain) { | ||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); | ||
} | ||
if (options.xhrFields) { | ||
each(options.xhrFields, (fieldName, fieldValue) => { | ||
xhr[fieldName] = fieldValue; | ||
}); | ||
} | ||
let xhrTimeout; | ||
// Handle XHR | ||
xhr.onload = function onload(e) { | ||
if (xhrTimeout) clearTimeout(xhrTimeout); | ||
if ((xhr.status >= 200 && xhr.status < 300) || xhr.status === 0) { | ||
let responseData; | ||
if (options.dataType === 'json') { | ||
try { | ||
responseData = JSON.parse(xhr.responseText); | ||
fireAjaxCallback('ajaxSuccess ajax:success', { xhr }, 'success', responseData, xhr.status, xhr); | ||
} catch (err) { | ||
fireAjaxCallback('ajaxError ajax:error', { xhr, parseerror: true }, 'error', xhr, 'parseerror'); | ||
} | ||
} else { | ||
responseData = xhr.responseType === 'text' || xhr.responseType === '' ? xhr.responseText : xhr.response; | ||
fireAjaxCallback('ajaxSuccess ajax:success', { xhr }, 'success', responseData, xhr.status, xhr); | ||
} | ||
} else { | ||
fireAjaxCallback('ajaxError ajax:error', { xhr }, 'error', xhr, xhr.status); | ||
} | ||
if (options.statusCode) { | ||
if (globals.statusCode && globals.statusCode[xhr.status]) globals.statusCode[xhr.status](xhr); | ||
if (options.statusCode[xhr.status]) options.statusCode[xhr.status](xhr); | ||
} | ||
fireAjaxCallback('ajaxComplete ajax:complete', { xhr }, 'complete', xhr, xhr.status); | ||
}; | ||
xhr.onerror = function onerror(e) { | ||
if (xhrTimeout) clearTimeout(xhrTimeout); | ||
fireAjaxCallback('ajaxError ajax:error', { xhr }, 'error', xhr, xhr.status); | ||
fireAjaxCallback('ajaxComplete ajax:complete', { xhr, error: true }, 'complete', xhr, 'error'); | ||
}; | ||
// Ajax start callback | ||
fireAjaxCallback('ajaxStart ajax:start', { xhr }, 'start', xhr); | ||
fireAjaxCallback(undefined, undefined, 'beforeSend', xhr); | ||
// Timeout | ||
if (options.timeout > 0) { | ||
xhr.onabort = function onabort() { | ||
if (xhrTimeout) clearTimeout(xhrTimeout); | ||
}; | ||
xhrTimeout = setTimeout(() => { | ||
xhr.abort(); | ||
fireAjaxCallback('ajaxError ajax:error', { xhr, timeout: true }, 'error', xhr, 'timeout'); | ||
fireAjaxCallback('ajaxComplete ajax:complete', { xhr, timeout: true }, 'complete', xhr, 'timeout'); | ||
}, options.timeout); | ||
} | ||
// Send XHR | ||
xhr.send(postData); | ||
// Return XHR object | ||
return xhr; | ||
} | ||
function ajaxShortcut(method, ...args) { | ||
let url; | ||
let data; | ||
let success; | ||
let error; | ||
let dataType; | ||
if (typeof args[1] === 'function') { | ||
[url, success, error, dataType] = args; | ||
} else { | ||
[url, data, success, error, dataType] = args; | ||
} | ||
[success, error].forEach((callback) => { | ||
if (typeof callback === 'string') { | ||
dataType = callback; | ||
if (callback === success) success = undefined; | ||
else error = undefined; | ||
} | ||
}); | ||
dataType = dataType || (method === 'getJSON' ? 'json' : undefined); | ||
return ajax({ | ||
url, | ||
method: method === 'post' ? 'POST' : 'GET', | ||
data, | ||
success, | ||
error, | ||
dataType, | ||
}); | ||
} | ||
function get(...args) { | ||
args.unshift('get'); | ||
return ajaxShortcut.apply(this, args); | ||
} | ||
function post(...args) { | ||
args.unshift('post'); | ||
return ajaxShortcut.apply(this, args); | ||
} | ||
function getJSON(...args) { | ||
args.unshift('getJSON'); | ||
return ajaxShortcut.apply(this, args); | ||
} | ||
var Ajax = Object.freeze({ | ||
ajaxSetup: ajaxSetup, | ||
ajax: ajax, | ||
get: get, | ||
post: post, | ||
getJSON: getJSON | ||
}); | ||
const Scroll = { | ||
scrollTo(...args) { | ||
let [left, top, duration, easing, callback] = args; | ||
if (args.length === 4 && typeof easing === 'function') { | ||
callback = easing; | ||
[left, top, duration, callback, easing] = args; | ||
} | ||
if (typeof easing === 'undefined') easing = 'swing'; | ||
return this.each(function animate() { | ||
const el = this; | ||
let currentTop; | ||
let currentLeft; | ||
let maxTop; | ||
let maxLeft; | ||
let newTop; | ||
let newLeft; | ||
let scrollTop; | ||
let scrollLeft; | ||
let animateTop = top > 0 || top === 0; | ||
let animateLeft = left > 0 || left === 0; | ||
if (typeof easing === 'undefined') { | ||
easing = 'swing'; | ||
} | ||
if (animateTop) { | ||
currentTop = el.scrollTop; | ||
if (!duration) { | ||
el.scrollTop = top; | ||
} | ||
} | ||
if (animateLeft) { | ||
currentLeft = el.scrollLeft; | ||
if (!duration) { | ||
el.scrollLeft = left; | ||
} | ||
} | ||
if (!duration) return; | ||
if (animateTop) { | ||
maxTop = el.scrollHeight - el.offsetHeight; | ||
newTop = Math.max(Math.min(top, maxTop), 0); | ||
} | ||
if (animateLeft) { | ||
maxLeft = el.scrollWidth - el.offsetWidth; | ||
newLeft = Math.max(Math.min(left, maxLeft), 0); | ||
} | ||
let startTime = null; | ||
if (animateTop && newTop === currentTop) animateTop = false; | ||
if (animateLeft && newLeft === currentLeft) animateLeft = false; | ||
function render(time = new Date().getTime()) { | ||
if (startTime === null) { | ||
startTime = time; | ||
} | ||
const progress = Math.max(Math.min((time - startTime) / duration, 1), 0); | ||
const easeProgress = easing === 'linear' ? progress : (0.5 - (Math.cos(progress * Math.PI) / 2)); | ||
let done; | ||
if (animateTop) scrollTop = currentTop + (easeProgress * (newTop - currentTop)); | ||
if (animateLeft) scrollLeft = currentLeft + (easeProgress * (newLeft - currentLeft)); | ||
if (animateTop && newTop > currentTop && scrollTop >= newTop) { | ||
el.scrollTop = newTop; | ||
done = true; | ||
} | ||
if (animateTop && newTop < currentTop && scrollTop <= newTop) { | ||
el.scrollTop = newTop; | ||
done = true; | ||
} | ||
if (animateLeft && newLeft > currentLeft && scrollLeft >= newLeft) { | ||
el.scrollLeft = newLeft; | ||
done = true; | ||
} | ||
if (animateLeft && newLeft < currentLeft && scrollLeft <= newLeft) { | ||
el.scrollLeft = newLeft; | ||
done = true; | ||
} | ||
if (done) { | ||
if (callback) callback(); | ||
return; | ||
} | ||
if (animateTop) el.scrollTop = scrollTop; | ||
if (animateLeft) el.scrollLeft = scrollLeft; | ||
requestAnimationFrame(render); | ||
} | ||
requestAnimationFrame(render); | ||
}); | ||
}, | ||
// scrollTop(top, duration, easing, callback) { | ||
scrollTop(...args) { | ||
let [top, duration, easing, callback] = args; | ||
if (args.length === 3 && typeof easing === 'function') { | ||
[top, duration, callback, easing] = args; | ||
} | ||
const dom = this; | ||
if (typeof top === 'undefined') { | ||
if (dom.length > 0) return dom[0].scrollTop; | ||
return null; | ||
} | ||
return dom.scrollTo(undefined, top, duration, easing, callback); | ||
}, | ||
scrollLeft(...args) { | ||
let [left, duration, easing, callback] = args; | ||
if (args.length === 3 && typeof easing === 'function') { | ||
[left, duration, callback, easing] = args; | ||
} | ||
const dom = this; | ||
if (typeof left === 'undefined') { | ||
if (dom.length > 0) return dom[0].scrollLeft; | ||
return null; | ||
} | ||
return dom.scrollTo(left, undefined, duration, easing, callback); | ||
}, | ||
}; | ||
const Methods = { | ||
@@ -1061,3 +619,4 @@ // Classes and attributes | ||
function fireCallBack(e) { | ||
callback(e); | ||
if (e.target !== this) return; | ||
callback.call(this, e); | ||
for (i = 0; i < events.length; i += 1) { | ||
@@ -1557,2 +1116,114 @@ dom.off(events[i], fireCallBack); | ||
const Scroll = { | ||
scrollTo(...args) { | ||
let [left, top, duration, easing, callback] = args; | ||
if (args.length === 4 && typeof easing === 'function') { | ||
callback = easing; | ||
[left, top, duration, callback, easing] = args; | ||
} | ||
if (typeof easing === 'undefined') easing = 'swing'; | ||
return this.each(function animate() { | ||
const el = this; | ||
let currentTop; | ||
let currentLeft; | ||
let maxTop; | ||
let maxLeft; | ||
let newTop; | ||
let newLeft; | ||
let scrollTop; | ||
let scrollLeft; | ||
let animateTop = top > 0 || top === 0; | ||
let animateLeft = left > 0 || left === 0; | ||
if (typeof easing === 'undefined') { | ||
easing = 'swing'; | ||
} | ||
if (animateTop) { | ||
currentTop = el.scrollTop; | ||
if (!duration) { | ||
el.scrollTop = top; | ||
} | ||
} | ||
if (animateLeft) { | ||
currentLeft = el.scrollLeft; | ||
if (!duration) { | ||
el.scrollLeft = left; | ||
} | ||
} | ||
if (!duration) return; | ||
if (animateTop) { | ||
maxTop = el.scrollHeight - el.offsetHeight; | ||
newTop = Math.max(Math.min(top, maxTop), 0); | ||
} | ||
if (animateLeft) { | ||
maxLeft = el.scrollWidth - el.offsetWidth; | ||
newLeft = Math.max(Math.min(left, maxLeft), 0); | ||
} | ||
let startTime = null; | ||
if (animateTop && newTop === currentTop) animateTop = false; | ||
if (animateLeft && newLeft === currentLeft) animateLeft = false; | ||
function render(time = new Date().getTime()) { | ||
if (startTime === null) { | ||
startTime = time; | ||
} | ||
const progress = Math.max(Math.min((time - startTime) / duration, 1), 0); | ||
const easeProgress = easing === 'linear' ? progress : (0.5 - (Math.cos(progress * Math.PI) / 2)); | ||
let done; | ||
if (animateTop) scrollTop = currentTop + (easeProgress * (newTop - currentTop)); | ||
if (animateLeft) scrollLeft = currentLeft + (easeProgress * (newLeft - currentLeft)); | ||
if (animateTop && newTop > currentTop && scrollTop >= newTop) { | ||
el.scrollTop = newTop; | ||
done = true; | ||
} | ||
if (animateTop && newTop < currentTop && scrollTop <= newTop) { | ||
el.scrollTop = newTop; | ||
done = true; | ||
} | ||
if (animateLeft && newLeft > currentLeft && scrollLeft >= newLeft) { | ||
el.scrollLeft = newLeft; | ||
done = true; | ||
} | ||
if (animateLeft && newLeft < currentLeft && scrollLeft <= newLeft) { | ||
el.scrollLeft = newLeft; | ||
done = true; | ||
} | ||
if (done) { | ||
if (callback) callback(); | ||
return; | ||
} | ||
if (animateTop) el.scrollTop = scrollTop; | ||
if (animateLeft) el.scrollLeft = scrollLeft; | ||
requestAnimationFrame(render); | ||
} | ||
requestAnimationFrame(render); | ||
}); | ||
}, | ||
// scrollTop(top, duration, easing, callback) { | ||
scrollTop(...args) { | ||
let [top, duration, easing, callback] = args; | ||
if (args.length === 3 && typeof easing === 'function') { | ||
[top, duration, callback, easing] = args; | ||
} | ||
const dom = this; | ||
if (typeof top === 'undefined') { | ||
if (dom.length > 0) return dom[0].scrollTop; | ||
return null; | ||
} | ||
return dom.scrollTo(undefined, top, duration, easing, callback); | ||
}, | ||
scrollLeft(...args) { | ||
let [left, duration, easing, callback] = args; | ||
if (args.length === 3 && typeof easing === 'function') { | ||
[left, duration, callback, easing] = args; | ||
} | ||
const dom = this; | ||
if (typeof left === 'undefined') { | ||
if (dom.length > 0) return dom[0].scrollLeft; | ||
return null; | ||
} | ||
return dom.scrollTo(left, undefined, duration, easing, callback); | ||
}, | ||
}; | ||
function animate(initialProps, initialParams) { | ||
@@ -1742,35 +1413,319 @@ const els = this; | ||
const Animate = { | ||
animate, | ||
stop, | ||
}; | ||
// Global Ajax Setup | ||
const globalAjaxOptions = {}; | ||
function ajaxSetup(options) { | ||
if (options.type && !options.method) options.method = options.type; | ||
each(options, (optionName, optionValue) => { | ||
globalAjaxOptions[optionName] = optionValue; | ||
}); | ||
} | ||
// JSONP Requests | ||
let jsonpRequests = 0; | ||
var Animate = Object.freeze({ | ||
animate: animate, | ||
stop: stop | ||
}); | ||
// Ajax | ||
function ajax(options) { | ||
const defaults = { | ||
method: 'GET', | ||
data: false, | ||
async: true, | ||
cache: true, | ||
user: '', | ||
password: '', | ||
headers: {}, | ||
xhrFields: {}, | ||
statusCode: {}, | ||
processData: true, | ||
dataType: 'text', | ||
contentType: 'application/x-www-form-urlencoded', | ||
timeout: 0, | ||
}; | ||
const callbacks = ['beforeSend', 'error', 'complete', 'success', 'statusCode']; | ||
// Utils & Helpers | ||
Object.keys(Utils).forEach((key) => { | ||
$$1[key] = Utils[key]; | ||
}); | ||
// For jQuery guys | ||
if (options.type) options.method = options.type; | ||
// Methods | ||
Object.keys(Methods).forEach((key) => { | ||
$$1.fn[key] = Methods[key]; | ||
}); | ||
// Global options | ||
const globals = globalAjaxOptions; | ||
// Scroll | ||
Object.keys(Scroll).forEach((key) => { | ||
$$1.fn[key] = Scroll[key]; | ||
}); | ||
// Merge global and defaults | ||
each(globals, (globalOptionName, globalOptionValue) => { | ||
if (callbacks.indexOf(globalOptionName) < 0) defaults[globalOptionName] = globalOptionValue; | ||
}); | ||
// Animate | ||
Object.keys(Animate).forEach((key) => { | ||
$$1.fn[key] = Animate[key]; | ||
}); | ||
// Function to run XHR callbacks and events | ||
function fireAjaxCallback(eventName, eventData, callbackName) { | ||
const a = arguments; | ||
if (eventName) $$1(document).trigger(eventName, eventData); | ||
if (callbackName) { | ||
// Global callback | ||
if (callbackName in globals) globals[callbackName](a[3], a[4], a[5], a[6]); | ||
// Options callback | ||
if (options[callbackName]) options[callbackName](a[3], a[4], a[5], a[6]); | ||
} | ||
} | ||
// Ajax | ||
Object.keys(Ajax).forEach((key) => { | ||
$$1[key] = Ajax[key]; | ||
}); | ||
// Merge options and defaults | ||
each(defaults, (prop, defaultValue) => { | ||
if (!(prop in options)) options[prop] = defaultValue; | ||
}); | ||
// Default URL | ||
if (!options.url) { | ||
options.url = window.location.toString(); | ||
} | ||
// Parameters Prefix | ||
let paramsPrefix = options.url.indexOf('?') >= 0 ? '&' : '?'; | ||
// UC method | ||
const method = options.method.toUpperCase(); | ||
// Data to modify GET URL | ||
if ((method === 'GET' || method === 'HEAD' || method === 'OPTIONS' || method === 'DELETE') && options.data) { | ||
let stringData; | ||
if (typeof options.data === 'string') { | ||
// Should be key=value string | ||
if (options.data.indexOf('?') >= 0) stringData = options.data.split('?')[1]; | ||
else stringData = options.data; | ||
} else { | ||
// Should be key=value object | ||
stringData = serializeObject(options.data); | ||
} | ||
if (stringData.length) { | ||
options.url += paramsPrefix + stringData; | ||
if (paramsPrefix === '?') paramsPrefix = '&'; | ||
} | ||
} | ||
// JSONP | ||
if (options.dataType === 'json' && options.url.indexOf('callback=') >= 0) { | ||
const callbackName = `f7jsonp_${Date.now() + ((jsonpRequests += 1))}`; | ||
let abortTimeout; | ||
const callbackSplit = options.url.split('callback='); | ||
let requestUrl = `${callbackSplit[0]}callback=${callbackName}`; | ||
if (callbackSplit[1].indexOf('&') >= 0) { | ||
const addVars = callbackSplit[1].split('&').filter((el) => el.indexOf('=') > 0).join('&'); | ||
if (addVars.length > 0) requestUrl += `&${addVars}`; | ||
} | ||
// Create script | ||
let script = document.createElement('script'); | ||
script.type = 'text/javascript'; | ||
script.onerror = function onerror() { | ||
clearTimeout(abortTimeout); | ||
fireAjaxCallback(undefined, undefined, 'error', null, 'scripterror'); | ||
fireAjaxCallback('ajaxComplete ajax:complete', { scripterror: true }, 'complete', null, 'scripterror'); | ||
}; | ||
script.src = requestUrl; | ||
// Handler | ||
window[callbackName] = function jsonpCallback(data) { | ||
clearTimeout(abortTimeout); | ||
fireAjaxCallback(undefined, undefined, 'success', data); | ||
script.parentNode.removeChild(script); | ||
script = null; | ||
delete window[callbackName]; | ||
}; | ||
document.querySelector('head').appendChild(script); | ||
if (options.timeout > 0) { | ||
abortTimeout = setTimeout(() => { | ||
script.parentNode.removeChild(script); | ||
script = null; | ||
fireAjaxCallback(undefined, undefined, 'error', null, 'timeout'); | ||
}, options.timeout); | ||
} | ||
return; | ||
} | ||
// Cache for GET/HEAD requests | ||
if (method === 'GET' || method === 'HEAD' || method === 'OPTIONS' || method === 'DELETE') { | ||
if (options.cache === false) { | ||
options.url += `${paramsPrefix}_nocache${Date.now()}`; | ||
} | ||
} | ||
// Create XHR | ||
const xhr = new XMLHttpRequest(); | ||
// Save Request URL | ||
xhr.requestUrl = options.url; | ||
xhr.requestParameters = options; | ||
// Open XHR | ||
xhr.open(method, options.url, options.async, options.user, options.password); | ||
// Create POST Data | ||
let postData = null; | ||
if ((method === 'POST' || method === 'PUT' || method === 'PATCH') && options.data) { | ||
if (options.processData) { | ||
const postDataInstances = [ArrayBuffer, Blob, Document, FormData]; | ||
// Post Data | ||
if (postDataInstances.indexOf(options.data.constructor) >= 0) { | ||
postData = options.data; | ||
} else { | ||
// POST Headers | ||
let boundary = `---------------------------${Date.now().toString(16)}`; | ||
if (options.contentType === 'multipart/form-data') { | ||
xhr.setRequestHeader('Content-Type', `multipart/form-data; boundary=${boundary}`); | ||
} else { | ||
xhr.setRequestHeader('Content-Type', options.contentType); | ||
} | ||
postData = ''; | ||
let data = serializeObject(options.data); | ||
if (options.contentType === 'multipart/form-data') { | ||
data = data.split('&'); | ||
const newData = []; | ||
for (let i = 0; i < data.length; i += 1) { | ||
newData.push(`Content-Disposition: form-data; name="${data[i].split('=')[0]}"\r\n\r\n${data[i].split('=')[1]}\r\n`); | ||
} | ||
postData = `--${boundary}\r\n${newData.join(`--${boundary}\r\n`)}--${boundary}--\r\n`; | ||
} else { | ||
postData = data; | ||
} | ||
} | ||
} else { | ||
postData = options.data; | ||
} | ||
} | ||
// Additional headers | ||
if (options.headers) { | ||
each(options.headers, (headerName, headerCallback) => { | ||
xhr.setRequestHeader(headerName, headerCallback); | ||
}); | ||
} | ||
// Check for crossDomain | ||
if (typeof options.crossDomain === 'undefined') { | ||
options.crossDomain = /^([\w-]+:)?\/\/([^\/]+)/.test(options.url) && RegExp.$2 !== window.location.host; | ||
} | ||
if (!options.crossDomain) { | ||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); | ||
} | ||
if (options.xhrFields) { | ||
each(options.xhrFields, (fieldName, fieldValue) => { | ||
xhr[fieldName] = fieldValue; | ||
}); | ||
} | ||
let xhrTimeout; | ||
// Handle XHR | ||
xhr.onload = function onload(e) { | ||
if (xhrTimeout) clearTimeout(xhrTimeout); | ||
if ((xhr.status >= 200 && xhr.status < 300) || xhr.status === 0) { | ||
let responseData; | ||
if (options.dataType === 'json') { | ||
try { | ||
responseData = JSON.parse(xhr.responseText); | ||
fireAjaxCallback('ajaxSuccess ajax:success', { xhr }, 'success', responseData, xhr.status, xhr); | ||
} catch (err) { | ||
fireAjaxCallback('ajaxError ajax:error', { xhr, parseerror: true }, 'error', xhr, 'parseerror'); | ||
} | ||
} else { | ||
responseData = xhr.responseType === 'text' || xhr.responseType === '' ? xhr.responseText : xhr.response; | ||
fireAjaxCallback('ajaxSuccess ajax:success', { xhr }, 'success', responseData, xhr.status, xhr); | ||
} | ||
} else { | ||
fireAjaxCallback('ajaxError ajax:error', { xhr }, 'error', xhr, xhr.status); | ||
} | ||
if (options.statusCode) { | ||
if (globals.statusCode && globals.statusCode[xhr.status]) globals.statusCode[xhr.status](xhr); | ||
if (options.statusCode[xhr.status]) options.statusCode[xhr.status](xhr); | ||
} | ||
fireAjaxCallback('ajaxComplete ajax:complete', { xhr }, 'complete', xhr, xhr.status); | ||
}; | ||
xhr.onerror = function onerror(e) { | ||
if (xhrTimeout) clearTimeout(xhrTimeout); | ||
fireAjaxCallback('ajaxError ajax:error', { xhr }, 'error', xhr, xhr.status); | ||
fireAjaxCallback('ajaxComplete ajax:complete', { xhr, error: true }, 'complete', xhr, 'error'); | ||
}; | ||
// Ajax start callback | ||
fireAjaxCallback('ajaxStart ajax:start', { xhr }, 'start', xhr); | ||
fireAjaxCallback(undefined, undefined, 'beforeSend', xhr); | ||
// Timeout | ||
if (options.timeout > 0) { | ||
xhr.onabort = function onabort() { | ||
if (xhrTimeout) clearTimeout(xhrTimeout); | ||
}; | ||
xhrTimeout = setTimeout(() => { | ||
xhr.abort(); | ||
fireAjaxCallback('ajaxError ajax:error', { xhr, timeout: true }, 'error', xhr, 'timeout'); | ||
fireAjaxCallback('ajaxComplete ajax:complete', { xhr, timeout: true }, 'complete', xhr, 'timeout'); | ||
}, options.timeout); | ||
} | ||
// Send XHR | ||
xhr.send(postData); | ||
// Return XHR object | ||
return xhr; | ||
} | ||
function ajaxShortcut(method, ...args) { | ||
let url; | ||
let data; | ||
let success; | ||
let error; | ||
let dataType; | ||
if (typeof args[1] === 'function') { | ||
[url, success, error, dataType] = args; | ||
} else { | ||
[url, data, success, error, dataType] = args; | ||
} | ||
[success, error].forEach((callback) => { | ||
if (typeof callback === 'string') { | ||
dataType = callback; | ||
if (callback === success) success = undefined; | ||
else error = undefined; | ||
} | ||
}); | ||
dataType = dataType || (method === 'getJSON' ? 'json' : undefined); | ||
return ajax({ | ||
url, | ||
method: method === 'post' ? 'POST' : 'GET', | ||
data, | ||
success, | ||
error, | ||
dataType, | ||
}); | ||
} | ||
function get(...args) { | ||
args.unshift('get'); | ||
return ajaxShortcut.apply(this, args); | ||
} | ||
function post(...args) { | ||
args.unshift('post'); | ||
return ajaxShortcut.apply(this, args); | ||
} | ||
function getJSON(...args) { | ||
args.unshift('getJSON'); | ||
return ajaxShortcut.apply(this, args); | ||
} | ||
const Ajax = { | ||
__utils: true, | ||
ajaxSetup, | ||
ajax, | ||
get, | ||
post, | ||
getJSON, | ||
}; | ||
// Utils & Helpers | ||
$$1.use(Utils, Methods, Scroll, Animate, Ajax); | ||
export default $$1; |
@@ -73,2 +73,3 @@ const gulp = require('gulp'); | ||
const env = process.env.NODE_ENV || 'development'; | ||
let cbs = 0; | ||
rollup({ | ||
@@ -87,4 +88,21 @@ entry: './src/dom7.js', | ||
.on('end', () => { | ||
if (cb) cb(); | ||
cbs += 1; | ||
if (cb && cbs === 2) cb(); | ||
}); | ||
rollup({ | ||
entry: './src/dom7.modular.js', | ||
format: 'es', | ||
moduleName: 'Dom7', | ||
useStrict: true, | ||
sourceMap: env === 'development', | ||
banner, | ||
}) | ||
.pipe(source('dom7.js', './src')) | ||
.pipe(buffer()) | ||
.pipe(rename('dom7.modular.js')) | ||
.pipe(gulp.dest(`./${env === 'development' ? 'build' : 'dist'}/`)) | ||
.on('end', () => { | ||
cbs += 1; | ||
if (cb && cbs === 2) cb(); | ||
}); | ||
} | ||
@@ -91,0 +109,0 @@ |
{ | ||
"name": "dom7", | ||
"version": "1.7.0", | ||
"version": "1.7.1", | ||
"description": "Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API", | ||
@@ -12,3 +12,3 @@ "main": "dist/dom7.js", | ||
"dev": "NODE_ENV=development gulp build && NODE_ENV=development gulp demo && gulp server", | ||
"prod": "NODE_ENV=production gulp demo && gulp server", | ||
"prod": "NODE_ENV=production gulp demo && NODE_ENV=production gulp server", | ||
"test": "npm run build-dev" | ||
@@ -15,0 +15,0 @@ }, |
14
src/$.js
@@ -57,2 +57,16 @@ import Dom7 from './dom7-class'; | ||
$.use = function use(...args) { | ||
args.forEach((methods) => { | ||
const isUtils = '__utils' in methods; | ||
Object.keys(methods).forEach((methodName) => { | ||
if (methodName === '__utils') return; | ||
if (isUtils) { | ||
$[methodName] = methods[methodName]; | ||
} else { | ||
$.fn[methodName] = methods[methodName]; | ||
} | ||
}); | ||
}); | ||
}; | ||
export default $; |
@@ -304,2 +304,12 @@ import $ from './$'; | ||
const Ajax = { | ||
__utils: true, | ||
ajaxSetup, | ||
ajax, | ||
get, | ||
post, | ||
getJSON, | ||
}; | ||
export { ajaxSetup, ajax, get, post, getJSON }; | ||
export default Ajax; |
@@ -188,2 +188,8 @@ import $ from './$'; | ||
const Animate = { | ||
animate, | ||
stop, | ||
}; | ||
export { animate, stop }; | ||
export default Animate; |
import $ from './$'; | ||
import Utils from './utils'; | ||
import * as Ajax from './ajax'; | ||
import Methods from './methods'; | ||
import Scroll from './scroll'; | ||
import Methods from './methods'; | ||
import * as Animate from './animate'; | ||
import Animate from './animate'; | ||
import Ajax from './ajax'; | ||
// Utils & Helpers | ||
Object.keys(Utils).forEach((key) => { | ||
$[key] = Utils[key]; | ||
}); | ||
$.use(Utils, Methods, Scroll, Animate, Ajax); | ||
// Methods | ||
Object.keys(Methods).forEach((key) => { | ||
$.fn[key] = Methods[key]; | ||
}); | ||
// Scroll | ||
Object.keys(Scroll).forEach((key) => { | ||
$.fn[key] = Scroll[key]; | ||
}); | ||
// Animate | ||
Object.keys(Animate).forEach((key) => { | ||
$.fn[key] = Animate[key]; | ||
}); | ||
// Ajax | ||
Object.keys(Ajax).forEach((key) => { | ||
$[key] = Ajax[key]; | ||
}); | ||
// Export | ||
export default $; |
@@ -354,3 +354,4 @@ import Dom7 from './dom7-class'; | ||
function fireCallBack(e) { | ||
callback(e); | ||
if (e.target !== this) return; | ||
callback.call(this, e); | ||
for (i = 0; i < events.length; i += 1) { | ||
@@ -357,0 +358,0 @@ dom.off(events[i], fireCallBack); |
@@ -118,40 +118,2 @@ import Dom7 from './dom7-class'; | ||
} | ||
function getTranslate(el, axis = 'x') { | ||
const curStyle = window.getComputedStyle(el, null); | ||
let matrix; | ||
let curTransform; | ||
let transformMatrix; | ||
if (window.WebKitCSSMatrix) { | ||
curTransform = curStyle.transform || curStyle.webkitTransform; | ||
if (curTransform.split(',').length > 6) { | ||
curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', '); | ||
} | ||
// Some old versions of Webkit choke when 'none' is passed; pass | ||
// empty string instead in this case | ||
transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform); | ||
} else { | ||
transformMatrix = curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,'); | ||
matrix = transformMatrix.toString().split(','); | ||
} | ||
if (axis === 'x') { | ||
// Latest Chrome and webkits Fix | ||
if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41; | ||
// Crazy IE10 Matrix | ||
else if (matrix.length === 16) curTransform = parseFloat(matrix[12]); | ||
// Normal Browsers | ||
else curTransform = parseFloat(matrix[4]); | ||
} | ||
if (axis === 'y') { | ||
// Latest Chrome and webkits Fix | ||
if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42; | ||
// Crazy IE10 Matrix | ||
else if (matrix.length === 16) curTransform = parseFloat(matrix[13]); | ||
// Normal Browsers | ||
else curTransform = parseFloat(matrix[5]); | ||
} | ||
return curTransform || 0; | ||
} | ||
function requestAnimationFrame(callback) { | ||
@@ -167,2 +129,5 @@ if (window.requestAnimationFrame) return window.requestAnimationFrame(callback); | ||
} | ||
function isObject(o) { | ||
return typeof o === 'object' && o !== null && o.constructor && o.constructor === Object; | ||
} | ||
function extend(...args) { | ||
@@ -178,4 +143,7 @@ const to = Object(args[0]); | ||
if (desc !== undefined && desc.enumerable) { | ||
if (typeof to[nextKey] === 'object' && typeof nextSource[nextKey] === 'object') { | ||
if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) { | ||
extend(to[nextKey], nextSource[nextKey]); | ||
} else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) { | ||
to[nextKey] = {}; | ||
extend(to[nextKey], nextSource[nextKey]); | ||
} else { | ||
@@ -190,4 +158,4 @@ to[nextKey] = nextSource[nextKey]; | ||
} | ||
const Utils = { | ||
__utils: true, | ||
parseUrlQuery, | ||
@@ -202,3 +170,2 @@ parseQuery: parseUrlQuery, | ||
dataset, | ||
getTranslate, | ||
requestAnimationFrame, | ||
@@ -217,3 +184,2 @@ cancelAnimationFrame, | ||
dataset, | ||
getTranslate, | ||
requestAnimationFrame, | ||
@@ -220,0 +186,0 @@ cancelAnimationFrame, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
341429
22
6928