-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvanillajs_adapter.min.js
16 lines (16 loc) · 4.52 KB
/
vanillajs_adapter.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/*
Sirius.js v1.3.3
(c) 2014-2020 fntz
license: MIT
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):$jscomp.arrayIterator(a)};$jscomp.arrayFromIterator=function(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c};
$jscomp.arrayFromIterable=function(a){return a instanceof Array?a:$jscomp.arrayFromIterator($jscomp.makeIterator(a))};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.objectCreate=$jscomp.ASSUME_ES5||"function"==typeof Object.create?Object.create:function(a){var b=function(){};b.prototype=a;return new b};$jscomp.underscoreProtoCanBeSet=function(){var a={a:!0},b={};try{return b.__proto__=a,b.a}catch(c){}return!1};
$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null;
$jscomp.inherits=function(a,b){a.prototype=$jscomp.objectCreate(b.prototype);a.prototype.constructor=a;if($jscomp.setPrototypeOf){var c=$jscomp.setPrototypeOf;c(a,b)}else for(c in b)if("prototype"!=c)if(Object.defineProperties){var e=Object.getOwnPropertyDescriptor(b,c);e&&Object.defineProperty(a,c,e)}else a[c]=b[c];a.superClass_=b.prototype};var Adapter,VanillaJsAdapter;
Adapter=function(){var a=function(){};a.prototype.bind=function(b,a,e,g){};a.prototype.off=function(b,a,e){};a.prototype.fire=function(b,a,e){};a.prototype.get_properties=function(b,a){};a.prototype.get_attr=function(b,a){};a.prototype.swap=function(b,a){};a.prototype.append=function(b,a){};a.prototype.prepend=function(b,a){};a.prototype.clear=function(b){};a.prototype.set_attr=function(b,a,e){};a.prototype.all=function(b){return"object"===typeof b&&1===b.nodeType||9===b.nodeType?b:document.querySelectorAll(b)};
a.prototype.get=function(b){return document.querySelector(b)};a.prototype.as_string=function(b){if(b===document)return"document";if("[object String]"===Object.prototype.toString.call(b))return b;try{if(Array.isArray(b)&&1<b.size){var a=b.map(function(b){return b.tagName+"."+b.className});return a.slice(0,3).join(", ")}return b.tagName+"."+id}catch(e){return b}};a.prototype._adapter_name="Adapter";return a}.call(this);
VanillaJsAdapter=function(){var a=function(){return Adapter.apply(this,arguments)||this};$jscomp.inherits(a,Adapter);a.prototype._get_element_from_selector=function(b){if("object"===typeof b&&1===b.nodeType)return b;var a=this.all(b);if(0===a.length)throw Error("Selector `"+b+"` not found");return a[0]};a.prototype.bind=function(b,a,e,g){var c,f;if(null===a||a===b)b.addEventListener(e,g);else if("object"===typeof a&&1===a.nodeType)a.addEventListener(e,g);else for(b=this.all(a),a=c=0,f=b.length;0<=
f?0<=c&&c<f:0>=c&&c>f;a=0<=f?++c:--c)b.item(a).addEventListener(e,g)};a.prototype.off=function(b,a,e){var c,d;b=this.all(b);var f=c=0;for(d=b.length;0<=d?0<=c&&c<d:0>=c&&c>d;f=0<=d?++c:--c)b.item(f).removeEventListener(a,e)};a.prototype.fire=function(b,a,e){for(var c=[],d=2;d<arguments.length;++d)c[d-2]=arguments[d];d=document.createEvent("CustomEvent");d.initCustomEvent(a,!1,!0,c);document.dispatchEvent(d)};a.prototype.get_properties=function(b,a){var c;b=b.target;var g=[];var d=0;for(c=a.length;d<
c;d++){var f=a[d];g.push(this.get_attr(b,f))}return g};a.prototype.get_attr=function(b,a){b=this._get_element_from_selector(b);var c=b.getAttribute(a);return null!=c?"checked"===a||"selected"===a?"false"===c?!1:!0:c:b[a]};a.prototype.swap=function(b,a){b=this._get_element_from_selector(b);var c=b.tagName;"INPUT"===c||"TEXTAREA"===c||"SELECT"===c?b.value=a:b.textContent=a};a.prototype.set_attr=function(b,a,e){this._get_element_from_selector(b).setAttribute(a,e)};a.prototype.append=function(b,a){b=
this._get_element_from_selector(b);b.textContent+=a};a.prototype.prepend=function(b,a){b=this._get_element_from_selector(b);b.textContent=a+b.textContent};a.prototype.clear=function(b){b=this._get_element_from_selector(b);var a=b.tagName;"INPUT"===a||"TEXTAREA"===a?b.value="":b.textContent=""};a.prototype.text=function(b){b=this._get_element_from_selector(b);var a=b.tagName;return"INPUT"===a||"TEXTAREA"===a||"SELECT"===a?b.value:b.innerText?b.innerText:b.textContent};a.prototype._adapter_name="VanillaJs";
return a}.call(this);