-
Notifications
You must be signed in to change notification settings - Fork 0
/
prototypejs_adapter.min.js
16 lines (16 loc) · 4.54 KB
/
prototypejs_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 d=Object.getOwnPropertyDescriptor(b,c);d&&Object.defineProperty(a,c,d)}else a[c]=b[c];a.superClass_=b.prototype};var Adapter,PrototypeAdapter;
Adapter=function(){var a=function(){};a.prototype.bind=function(b,a,d,e){};a.prototype.off=function(b,a,d){};a.prototype.fire=function(b,a,d){};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,d){};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(d){return b}};a.prototype._adapter_name="Adapter";return a}.call(this);
PrototypeAdapter=function(){var a=function(){var b=Adapter.call(this)||this;b.__handlers=[];return b};$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,d,e){b=null===a?$(document).on(d,e):"object"===typeof a&&1===a.nodeType?$(a).on(d,e):$(b).on(d,a,e);this.__handlers.push({selector:a,event_name:d,fun:e,
handler:b})};a.prototype.off=function(b,a,d){var c;var f=this.__handlers;var g=0;for(c=f.length;g<c;g++){var h=f[g];h.selector===b&&h.event_name===a&&h.fun.toString===d.toString&&h.handler.stop()}};a.prototype.fire=function(b,a,d){for(var c=[],f=2;f<arguments.length;++f)c[f-2]=arguments[f];$(b).fire(a,c)};a.prototype.get_properties=function(b,a){for(var c=[],e=1;e<arguments.length;++e)c[e-1]=arguments[e];var f=Event.element(b);var g=this;return c.flatten().inject([],function(b,a){b.push(g.get_attr(f,
a));return b})};a.prototype.get_attr=function(b,a){b=this._get_element_from_selector(b);var c=b.readAttribute(a);return null!=c?"checked"===a||"selected"===a?"false"===c?!1:!0:c:b[a]};a.prototype.set_attr=function(b,a,d){return this._get_element_from_selector(b).writeAttribute(a,d)};a.prototype.swap=function(b,a){var c=this._get_element_from_selector(b);var e=c.tagName;"INPUT"===e||"TEXTAREA"===e||"SELECT"===e?(c.setValue(""),c.clear(),c.setValue(a)):this._get_element_from_selector(b).update(a)};
a.prototype.append=function(b,a){this._get_element_from_selector(b).insert({bottom:a})};a.prototype.prepend=function(b,a){this._get_element_from_selector(b).insert({top:a})};a.prototype.clear=function(a){a=this._get_element_from_selector(a);var b=a.tagName;$w("INPUT TEXTAREA").include(b)?a.clear():a.update("")};a.prototype.text=function(a){a=this._get_element_from_selector(a);var b=a.tagName;return"INPUT"===b||"TEXTAREA"===b||"SELECT"===b?a.getValue():a.innerText?a.innerText:a.textContent};a.prototype._adapter_name=
"PrototypeJs";return a}.call(this);