/*! * lea - A tiny JavaScript framework for modern browsers (and developers) * Author: Sébastien Decamme * Version: v2.2.4 * Url: https://github.com/Shakup/lea.js * License(s): MIT */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.lea=t():e.lea=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(5),i=r(o),a=n(6),u=r(a),s=n(2),c=r(s),l=n(3),f=r(l),d=n(4),h=r(d),p=function(e){var t=arguments.length<=1||void 0===arguments[1]?document:arguments[1];return new i["default"](e,t)};Object.assign(p,u["default"]),p.cookie=c["default"],p.device=f["default"],p.isMobile=function(){return!p.device("desktop")},p.ajax=function(e){return new h["default"](e)},p.get=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return p.ajax(Object.assign(t,{method:"GET",url:e}))},p.post=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return p.ajax(Object.assign(n,{method:"POST",data:t,url:e}))},t["default"]=p,e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={get:function(e){return e?decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null:null},set:function(e,t,n,r,o,i){if(!e||/^(?:expires|max\-age|path|domain|secure)$/i.test(e))return!1;var a="";if(n)switch(n.constructor){case Number:a=n===1/0?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age="+n;break;case String:a="; expires="+n;break;case Date:a="; expires="+n.toUTCString()}return document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(t)+a+(o?"; domain="+o:"")+(r?"; path="+r:"")+(i?"; secure":""),!0},remove:function(e,t,n){return this.exists(e)?(document.cookie=encodeURIComponent(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"+(n?"; domain="+n:"")+(t?"; path="+t:""),!0):!1},exists:function(e){return e?new RegExp("(?:^|;\\s*)"+encodeURIComponent(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(document.cookie):!1},keys:function(){for(var e=document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g,"").split(/\s*(?:\=[^;]*)?;\s*/),t=e.length,n=0;t>n;n++)e[n]=decodeURIComponent(e[n]);return e}},e.exports=t["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){var t=navigator.userAgent.toLowerCase(),n=function(){return/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(t)?"tablet":/(mobi|ipod|phone|blackberry|opera mini|fennec|minimo|symbian|psp|nintendo ds|archos|skyfire|puffin|blazer|bolt|gobrowser|iris|maemo|semc|teashark|uzard)/.test(t)?"phone":"desktop"}();return e?n===e:n},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n-1?JSON.parse(this.responseText):this.responseText,i.options.onComplete(t,i.transport)}else i.options.onError(i.transport)},this.transport.withCredentials=this.options.withCredentials,this.transport.open(this.options.method,this.options.url,this.options.async),this.options.sendRequestHeaders&&(this.transport.setRequestHeader("X-Requested-With","XMLHttpRequest"),u["default"].parse(this.options.headers,function(e,n){t.transport.setRequestHeader(e,n)}),this.transport.setRequestHeader("Content-Type",this.options.contentType)),Object.keys(this.options.data).length&&u["default"].parse(this.options.data,function(e,n){t.parameters.length&&(t.parameters+="&"),t.parameters+=encodeURIComponent(e)+"="+encodeURIComponent(n)}),this.options.send&&this.send(),this}return i(e,[{key:"always",value:function(e){return this.options.always=e,this}},{key:"change",value:function(e){return this.options.onChange=e,this}},{key:"then",value:function(e){return this.options.onComplete=e,this}},{key:"catch",value:function(e){return this.options.onError=e,this}},{key:"send",value:function(){var e=arguments.length<=0||void 0===arguments[0]?null:arguments[0];return this.transport.send(this.parameters.length?this.parameters:e),this}},{key:"abort",value:function(){return this.transport.abort(),this}}]),e}();t["default"]=s,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;nr;r++)n[r]=arguments[r];return n.forEach(function(t){e.each(function(e){return e.classList.add(t)})}),this}},{key:"removeClass",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return n.forEach(function(t){e.each(function(e){return e.classList.remove(t)})}),this}},{key:"hasClass",value:function(){var e=arguments.length<=0||void 0===arguments[0]?"":arguments[0],t=!0;return this.each(function(n){return n.classList.contains(e)?void 0:(t=!1,!1)}),t}},{key:"toggleClass",value:function(){var e=arguments.length<=0||void 0===arguments[0]?"":arguments[0];return this.each(function(t){return t.classList.toggle(e)}),this}},{key:"show",value:function(){var e=arguments.length<=0||void 0===arguments[0]?"block":arguments[0];return this.each(function(t){return t.style.display=e}),this}},{key:"hide",value:function(){return this.each(function(e){return e.style.display="none"}),this}},{key:"toggle",value:function(){var e=arguments.length<=0||void 0===arguments[0]?"block":arguments[0];return this.each(function(t){var n=(0,u["default"])(t).style("display");t.style.display="none"==n?e:"none"}),this}},{key:"html",value:function(e){return e?(this.each(function(t){return t.innerHTML=e}),this):this.get(0).innerHTML}},{key:"on",value:function(e,t){var n=e.split(" ");return this.each(function(e){n.forEach(function(n){return e.addEventListener(n,t,!1)})}),this}},{key:"off",value:function(e,t){var n=e.split(" ");return this.each(function(e){n.forEach(function(n){return e.removeEventListener(n,t,!1)})}),this}},{key:"delegate",value:function(e,t,n){var r=t.split(" ");return this.each(function(t){r.forEach(function(r){t.addEventListener(r,function(t){(0,u["default"])(t.target).is(e)&&n.call(t.target,r)},!1)})}),this}},{key:"trigger",value:function(e){var t=document.createEvent("HTMLEvents");return t.initEvent(e,!0,!0),this.each(function(e){return e.dispatchEvent(t)}),this}},{key:"click",value:function(e){return this.on("click",e)}},{key:"focus",value:function(){return this.elements[0].focus(),this}},{key:"select",value:function(){var e=this.elements[0];return"setSelectionRange"in e&&((0,u["default"])(e).is(":focus")||e.focus(),e.setSelectionRange(0,e.value.length)),this}},{key:"attr",value:function(e,t){return void 0!==t?(this.each(function(n){return n.setAttribute(e,t)}),this):this.elements[0].getAttribute(e)}},{key:"removeAttr",value:function(e){return this.each(function(t){return t.removeAttribute(e)}),this}},{key:"data",value:function(e,t){return void 0!==t?(this.each(function(n){return n.dataset[e]=t}),this):this.get(0).dataset[e]}},{key:"removeData",value:function(e){var t=this;return this.each(function(){return delete t.dataset[e]}),this}},{key:"append",value:function(e){return this.each(function(t){if("node"==u["default"].type(e))t.appendChild(e);else{var n=u["default"].str2Node(e);n.forEach(function(e){return t.appendChild(e)})}}),this}},{key:"prepend",value:function(e){return this.each(function(t){if("node"==u["default"].type(e))t.insertBefore(e,t.firstChild);else{var n=u["default"].str2Node(e);n.forEach(function(e){return t.insertBefore(e,t.firstChild)})}}),this}},{key:"before",value:function(e){return this.each(function(t){return t.insertAdjacentHTML("beforebegin",e)}),this}},{key:"after",value:function(e){return this.each(function(t){return t.insertAdjacentHTML("afterend",e)}),this}},{key:"remove",value:function(){return this.each(function(e){return e.parentNode.removeChild(e)}),this}},{key:"parent",value:function(e){var t=[];return this.each(function(n){var r=n.parentNode;if(r){if(void 0!==e)for(;r&&r.tagName.toLowerCase()!=e.toLowerCase();)r=r.parentNode;t.push(r)}}),(0,u["default"])(t)}},{key:"find",value:function(e){var t=[];return this.each(function(n){t=t.concat(Array.from(n.querySelectorAll(e)))}),(0,u["default"])(t)}},{key:"prev",value:function(){var e=[];return this.each(function(t){var n=t.previousElementSibling;n&&e.push(n)}),(0,u["default"])(e)}},{key:"next",value:function t(){var t=[];return this.each(function(e){var n=e.nextElementSibling;n&&t.push(n)}),(0,u["default"])(t)}},{key:"clear",value:function(){return this.each(function(e){return e.innerHTML=""}),this}},{key:"is",value:function(){var e=arguments.length<=0||void 0===arguments[0]?"":arguments[0],t=!0,n=function(t){return(t.matches||t.matchesSelector||t.msMatchesSelector||t.webkitMatchesSelector).call(t,e)};return this.each(function(e){return n(e)?void 0:(t=!1,!1)}),t}},{key:"scroll",value:function(){if(!this.length)return{top:0,left:0};var e=this.elements[0];return e==document||e==window?{top:window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,left:window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0}:void 0}},{key:"offset",value:function(){var e=this.elements[0],t=e.getBoundingClientRect(),n=(0,u["default"])(document).scroll();return{top:t.top+n.top,left:t.left+n.left}}},{key:"position",value:function(){var e=this.elements[0].getBoundingClientRect();return{top:e.top,left:e.left}}},{key:"replaceWith",value:function(){var e=arguments.length<=0||void 0===arguments[0]?"":arguments[0];return this.each(function(t){return t.outerHTML=e}),this}},{key:"serialize",value:function(){var e=this.elements[0],t={},n=void 0,r=void 0;return"form"!==e.nodeName.toLowerCase()?t:(Array.from(e.elements).forEach(function(o,i){if(o.name&&-1==["file","button","reset","submit"].indexOf(o.type))if("select-multiple"==o.type)for(n=e.elements[i].options.length,r=0;n>r;r++)o.options[r].selected&&(t[o.name]=o.options[r].value);else("checkbox"!=o.type&&"radio"!=o.type||o.checked)&&(t[o.name]=o.value)}),t)}},{key:"submit",value:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=this.elements[0];return"form"!==t.nodeName.toLowerCase()?!1:(e=u["default"].extend({method:t.method||"GET",data:(0,u["default"])(t).serialize()},e),u["default"].ajax(t.action||"#",e))}},{key:"val",value:function(){var e=arguments.length<=0||void 0===arguments[0]?null:arguments[0];return e?(this.each(function(t){return t.value=e}),this):this.get(0).value||""}},{key:"style",value:function(e,t){function n(e){if(!e)return"";if(e.match(/^rgba\(0\,\s?0\,\s?0\,\s?0\)$/g))return"transparent";var t=u["default"].rgb2Hex(e);return t?t:e}var r=this,o=u["default"].type(e);return"string"!=o||t?("string"==o&&"string"==u["default"].type(t)&&this.each(function(n){return n.style[u["default"].prefix(e)]=t}),"object"!=o||t||!function(){var t={};Object.keys(e).forEach(function(n){return t[u["default"].prefix(u["default"].kebabcase(n))]=e[n]}),r.each(function(e){Object.keys(t).forEach(function(n){return e.style[n]=t[n]})})}(),this):n(window.getComputedStyle(this.get(0))[u["default"].prefix(e)])}}]),e}();t["default"]=s,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},i=n(1),a=r(i);t["default"]={parse:function(e,t,n){Object.keys(e).forEach(function(r){t.call(n||e,r,e[r])})},extend:function(e){e||(e={});for(var t=1;t: \x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?: <\/\1>|)$/i,n=t.exec(e),r=void 0;if(n){var o=document.createElement("div");o.innerHTML=e,r=o.children}else{var i=(new DOMParser).parseFromString(e,"text/html");r=i.body.children}return Array.from(r)},debounce:function(e,t){var n=void 0;return function(){var r=arguments,o=this;clearTimeout(n),n=setTimeout(function(){return e.apply(o,r)},t)}},throttle:function(e,t){var n=void 0,r=void 0;return function(){var o=this,i=+new Date,a=arguments;n&&n+t>i?(clearTimeout(r),r=setTimeout(function(){n=i,e.apply(o,a)},t)):(n=i,e.apply(o,a))}},slugify:function(e){e=e.replace(/^\s+|\s+$/g,"").toLowerCase();for(var t="àáäâèéëêìíïîòóöôùúüûñç·/_,:;",n="aaaaeeeeiiiioooouuuunc------",r=0,o=t.length;o>r;r++)e=e.replace(new RegExp(t.charAt(r),"g"),n.charAt(r));return e=e.replace(/\./g,"-").replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")},camelcase:function(e){return a["default"].lcFirst(a["default"].slugify(e).replace(/(?:^|\-)(\w)/g,function(e,t){return t?t.toUpperCase():""}))},kebabcase:function(e){return a["default"].slugify(e).replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,function(e){return"-"+e.toLowerCase()})},ucFirst:function(e){return e.charAt(0).toUpperCase()+e.slice(1)},lcFirst:function(e){return e.charAt(0).toLowerCase()+e.slice(1)},rgb2Hex:function(e){return e=e.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),e&&4==e.length?"#"+("0"+parseInt(e[1],10).toString(16)).slice(-2)+("0"+parseInt(e[2],10).toString(16)).slice(-2)+("0"+parseInt(e[3],10).toString(16)).slice(-2):""},lpad:function(e,t){var n=arguments.length<=2||void 0===arguments[2]?" ":arguments[2];return e+="",e.length>=t?e:new Array(t-e.length+1).join(n)+e},rpad:function(e,t){var n=arguments.length<=2||void 0===arguments[2]?" ":arguments[2];return e+="",e.length>=t?e:e+new Array(t-e.length+1).join(n)},prefix:function(e){var t=document.body?document.body.style:document.createElement("div").style,n=["moz","Moz","webkit","Webkit","ms","o"],r=this.camelcase(e);return r in t?r:(e=this.ucFirst(r),n.some(function(n){return n+e in t?(r=n+e,!0):!1}),r)}},e.exports=t["default"]}])}); //# sourceMappingURL=lea.js.map