application-prototype
Version:
Application builder - prototype
1,368 lines (1,314 loc) • 113 kB
JavaScript
/* jshint -W002 */
/* jshint -W032 */
/* jshint -W027 */
/* jshint -W086 */
var slDOMEvents_cache = {};
/**
* @interface ExtensionsPrototype
*/
module.exports =
((function () {
var _public = {};
/**
* @var {object} fn
* @memberof ExtensionsPrototype
* @property {ExtensionsPrototype.WindowFunctions} window
* @property {ExtensionsPrototype.MouseFunctions} mouse
* @property {(ExtensionsPrototype.getRandId_1|ExtensionsPrototype.getRandId_2)} getRandId
*/
_public.fn = {};
/**
* @typedef {object} WindowFunctions
* @memberof ExtensionsPrototype
* @property {object} sizeLimit
* @property {ExtensionsPrototype.windowSizeCache} sizeLimit.min
* @property {ExtensionsPrototype.windowSizeCache} sizeLimit.max
* @property {number} [refreshRate=200] how often to recalculate window size
* @property {ExtensionsPrototype.windowSizeActive} sizeActive
* @property {ExtensionsPrototype.windowSize} size
*/
_public.fn.window = {};
/**
* @typedef {object} MouseFunctions
* @memberof ExtensionsPrototype
* @property {MouseEvent} event
* @property {ExtensionsPrototype.MousePosition} position
* @property {object} config
* @property {boolean} config.tracking
*/
_public.fn.mouse = {};
/**
* @var {object} object
* @property {(ExtensionsPrototype.ObjectExtend_1|ExtensionsPrototype.ObjectExtend_2)} extend
* @memberof ExtensionsPrototype
*/
_public.object = {};
/**
* @var {object} string
* @memberof ExtensionsPrototype
*/
_public.string = {};
if (typeof(window) === "undefined") {
//@ts-ignore
window = {};
// console.warn("Not a Browser Space, window doesn't exist");
}
if (typeof(document) === "undefined") {
document = undefined;
// console.warn("Not a Browser Space, document not found");
}
if (typeof(navigator) === "undefined") {
//@ts-ignore
navigator = { userAgent: "Node Server" };
// console.warn("Not a Browser Space, navigator not found");
}
;((function (window) {
//@ts-ignore
window.URL = (window.URL || window.webkitURL || {});
//@ts-ignore
window.createObjectURL = (window.URL || window.webkitURL || {}).createObjectURL || function(){};
//@ts-ignore
window.MutationObserver = window.MutationObserver
//@ts-ignore
|| window.WebKitMutationObserver
//@ts-ignore
|| window.MozMutationObserver;
//@ts-ignore
window.RTCPeerConnection = window.RTCPeerConnection || window.webkitRTCPeerConnection || window.mozRTCPeerConnection;
})(window));
/**
* addEventListener window document Element
*/
/* jshint -W033 */
/* jshint -W061 */
var er;
try {
//@ts-ignore
if (document) eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(5(){1(!8.3.6){2 g=[];2 h=5(a,b){2 c=4;2 d=5(e){e.A=e.q;e.B=c;1(b.r){b.r(e)}9{b.C(c,e)}};1(a=="s"){2 f=5(e){1(j.t=="u"){d(e)}};j.v("w",f);g.x({k:4,l:a,m:b,7:f});1(j.t=="u"){2 e=D E();e.q=F;f(e)}}9{4.v("y"+a,d);g.x({k:4,l:a,m:b,7:d})}};2 i=5(a,b){2 c=0;G(c<g.H){2 d=g[c];1(d.k==4&&d.l==a&&d.m==b){1(a=="s"){4.z("w",d.7)}9{4.z("y"+a,d.7)}I}++c}};8.3.6=h;8.3.n=i;1(o){o.3.6=h;o.3.n=i}1(p){p.3.6=h;p.3.n=i}}})();',45,45,'|if|var|prototype|this|function|addEventListener|wrapper|Element|else||||||||||document|object|type|listener|removeEventListener|HTMLDocument|Window|srcElement|handleEvent|DOMContentLoaded|readyState|complete|attachEvent|onreadystatechange|push|on|detachEvent|target|currentTarget|call|new|Event|window|while|length|break'.split('|'),0,{}))
} catch (er) { console.warn("[warn]", er) }
/**
* @var {any} WindowExtend
* @memberof ExtensionsPrototype
* @example
* window.addEvent(elem, type, handler);
* window.removeEvent(elem, type, handlerId);
*
* window.addEventListener(eventName, function (event) {});
*/
try {
//@ts-ignore
if (document) eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(0(){4(h.i){5.7=0(a,b,c,d){a.i(b,c,!!d);3 c};5.8=0(a,b,c,d){a.o(b,c,!!d);3 9}}j 4(h.k){5.7=0(a,b,c){b="6"+b;f d=0(){3 c.l(a,m)};a.k(b,d);3 d};5.8=0(a,b,c){b="6"+b;a.p(b,c);3 9}}j{5.7=0(b,c,d){c="6"+c;b.2=b.2||{};4(!b.2[c]){b.2[c]={n:1};b[c]=0(){q(f a r e){4(e.s(a)){4(t e[a]=="0"){e[a].l(u,m)}}}}}f e=b.2[c],g=e.n++;e[g]=d;3 g};5.8=0(a,b,c){b="6"+b;4(a.2&&a.2[b]&&a.2[b][c])a.2[b][c]=v;3 9}}})();',32,32,'function||memoize|return|if|window|on|addEvent|removeEvent|true||||||var|id|document|addEventListener|else|attachEvent|apply|arguments|counter|removeEventListener|detachEvent|for|in|hasOwnProperty|typeof|this|undefined'.split('|'),0,{}));
} catch (er) { console.warn("[warn]", er) }
/* jshint +W033 */
/* jshint +W061 */
var getRandId = ((function() {
var getRandId_k = 0;
return function(x, b) {
var r = (getRandId_k++) + '' + new Date().valueOf() + '' + Math.floor(Math.random() * 1000000000);
if (x === true || b === true) r = parseInt(r).toString(36);
return ((x && x !== true) ? x : '') + r;
};
})());
/**
* @callback getRandId_1
* @memberof ExtensionsPrototype
* @param {string} prefix
* @param {boolean} minimize
*/
/**
* @callback getRandId_2
* @memberof ExtensionsPrototype
* @param {boolean} minimize
*/
_public.fn.getRandId = getRandId;
/** window size detection */
((function () {
var getWindowSize_limit = {
min : {
w : false,
h : false
},
max : {
w : false,
h : false
}
};
var getWindowSize_fRaw = function(){ return {w:800,h:600}; };
if (document)
((function(){
if(typeof(window.innerWidth)=='number') {
getWindowSize_fRaw = function(o){
if(typeof(o) == "object" && ('window' in o)) return { w: o.window.innerWidth,h:o.window.innerHeight };
return { w: window.innerWidth,h:window.innerHeight };
};
} else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
getWindowSize_fRaw = function(o){
if(typeof(o) == "object" && ('document' in o)) return { w: o.document.documentElement.clientWidth,h: o.document.documentElement.clientHeight };
return { w: document.documentElement.clientWidth,h: document.documentElement.clientHeight };
};
} else if(document.body && (document.body.clientWidth || document.body.clientHeight)){/*IE 4 compatible*/
getWindowSize_fRaw = function(o){
if(typeof(o) == "object" && ('document' in o)) return { w: o.document.body.clientWidth, h: o.document.body.clientHeight };
return { w: document.body.clientWidth, h: document.body.clientHeight };
};
} else if(parseInt(navigator.appVersion)>3) {
if(navigator.appName=="Netscape") {
getWindowSize_fRaw = function(o){
if(typeof(o) == "object" || !('window' in o)) return { w: o.window.innerWidth, h: o.window.innerHeight};
return { w: window.innerWidth, h: window.innerHeight};
};
}
if(navigator.appName.indexOf("Microsoft")!=-1) {
getWindowSize_fRaw = function(o){
if(typeof(o) == "object" && ('document' in o)) return { w: o.document.body.offsetWidth, h : o.document.body.offsetHeight };
return { w : document.body.offsetWidth, h : document.body.offsetHeight };
};
}
}
})());
var getWindowSize_f = function () {
var size = getWindowSize_fRaw();
if (getWindowSize_limit.min.w !== false) {
size.w = Math.max( size.w, getWindowSize_limit.min.w );
}
if (getWindowSize_limit.min.h !== false) {
size.h = Math.max( size.h, getWindowSize_limit.min.h );
}
if (getWindowSize_limit.max.w !== false) {
size.w = Math.min( size.w, getWindowSize_limit.max.w );
}
if (getWindowSize_limit.max.h !== false) {
size.h = Math.min( size.h, getWindowSize_limit.max.h );
}
return size;
};
_public.fn.window.sizeLimit = getWindowSize_limit;
_public.fn.window.refreshRate = 200;
var _timer_active = 0;
var _cache_active = getWindowSize_f();
var _timer_raw = 0;
var _cache_raw = getWindowSize_fRaw();
/**
* @typedef {object} windowSizeCache
* @memberof ExtensionsPrototype
* @property {number} w
* @property {number} h
*/
/**
* @callback windowSizeActive
* @memberof ExtensionsPrototype
* @property {boolean} refreshed
* @returns {ExtensionsPrototype.windowSizeCache}
*/
_public.fn.window.sizeActive = function (refreshed) {
var t = new Date().valueOf();
if (refreshed || _timer_active < (t - _public.fn.window.refreshRate)) {
_timer_active = t;
_cache_active = getWindowSize_f();
}
return _cache_active;
};
/**
* @callback windowSize
* @memberof ExtensionsPrototype
* @property {boolean} refreshed
* @returns {ExtensionsPrototype.windowSizeCache}
*/
_public.fn.window.size = function (refreshed) {
var t = new Date().valueOf();
if (refreshed || _timer_raw < (t - _public.fn.window.refreshRate)) {
_timer_raw = t;
_cache_raw = getWindowSize_fRaw();
}
return _cache_raw;
};
})());
/** window mousemove event and mouse position */
if (document)
((function () {
var MouseMove = {
config: {}
};
MouseMove.config.tracking = true;
MouseMove.event = {
pageX : 0,
pageY : 0
};
document.addEventListener("mousemove", function (e) {
if (MouseMove.config.tracking) {
MouseMove.event = e;
}
});
var getMousePosXY = false;
((function(){
if(document.layers) {
getMousePosXY = function(e,o){ if(!e) e = MouseMove.event;
if(!o) o = {};var doc = ('document' in o) ? o.document : window;var win = ('window' in o) ? o.window : window;
return {x: e.pageX, y: e.pageY, xmax: win.innerWidth+win.pageXOffset, ymax: win.innerHeight+win.pageYOffset};
};
} if(document.all){
getMousePosXY = function(e,o){ if(!e) e = MouseMove.event;
if(!o) o = {};var doc = ('document' in o) ? o.document : window;var win = ('window' in o) ? o.window : window;
return {x: win.event.x+doc.body.scrollLeft, y: win.event.y+doc.body.scrollTop, xmax: doc.body.clientWidth+doc.body.scrollLeft, ymax: doc.body.clientHeight+doc.body.scrollTop};
};
} else if(document.getElementById){
getMousePosXY = function(e,o){ if(!e) e = MouseMove.event;
if(!o) o = {};var doc = ('document' in o) ? o.document : window;var win = ('window' in o) ? o.window : window;
return {x: e.pageX, y: e.pageY, xmax: win.innerWidth+win.pageXOffset, ymax: win.innerHeight+win.pageYOffset};
};
}
})());
/**
* @typedef {object} MousePositionCache
* @memberof ExtensionsPrototype
* @property {number} x
* @property {number} y
* @property {number} xmax
* @property {number} ymax
*/
/**
* @callback MousePosition
* @memberof ExtensionsPrototype
* @param {MouseEvent} [eventMouseMove]
* @param {object} [context]
* @param {object} [context.window]
* @param {object} [context.document]
* @returns {ExtensionsPrototype.MousePositionCache}
*/
MouseMove.position = function (eventMouseMove, windowOrDocumentObject) {
return getMousePosXY(eventMouseMove, windowOrDocumentObject);
};
_public.fn.mouse = MouseMove;
})());
/**
* @callback ObjectExtend_1
* @memberof ExtensionsPrototype
* @param {object} object
* @param {object} options
* @param {any} options.value
* @param {boolean} [options.readonly=false]
* @param {boolean} [options.visible=false]
* @param {boolean} [options.config=false]
*/
/**
* @callback ObjectExtend_2
* @memberof ExtensionsPrototype
* @param {object} object
* @param {object} options
* @param {function():void} [options.get]
* @param {function(any):void} [options.set]
* @param {boolean} [options.visible=false]
* @param {boolean} [options.config=false]
*/
_public.object.extend = function(obj,o) {
// key
// get | set | value
// visible : true
// readonly : false
// config : true
if('value' in o) {
Object.defineProperty(obj, o.key, {value : o.value,
writable : ('readonly' in o ? ( !o.readonly ) : true),
enumerable : ('visible' in o ? o.visible : true),
configurable : ('config' in o ? o.config : true)});
} else {
Object.defineProperty(obj, o.key, {
get : ('get' in o ? o.get : function(){ return null; }),
set : ('set' in o ? o.set : function(val){ }),
// writable : ('readonly' in o ? ( !o.readonly ) : true),
enumerable : ('visible' in o ? o.visible : true),
configurable : ('config' in o ? o.config : true)});
}
};
/**
* Attr data object
*/
if (document)
((function () {
/**
* @interface HTMLElement
*/
/**
* @memberof HTMLElement#
* @var {object} attrdata object for storing custom variables
*/;
/**
* @memberof HTMLElement#
* @var {object} attrdatastore
*/;
_public.object.extend(HTMLElement.prototype, {
key : "attrdata",
get :
/**
* @private
* @this {HTMLElement}
*/
function () {
if (typeof(this.attrdatastore) === "undefined") {
this.attrdatastore = {};
var attr = this.attributes;
var i, er;
for (i=0;i<attr.length;i++) {
if (attr[i].name.match(/^attr\-/)) {
this.attrdatastore[attr[i].name.replace(/^attr\-/, '').replace(/-./g, function (m) {
return m.charAt(1).toUpperCase();
})] = attr[i].value;
} else if (attr[i].name.match(/^attrb\-/)) {
try {
this.attrdatastore[attr[i].name.replace(/^attrb\-/, '').replace(/-./g, function (m) {
return m.charAt(1).toUpperCase();
})] = JSON.parse(attr[i].value);
} catch (er) {}
} else if (attr[i].name.match(/^attrf\-/)) {
try {
this.attrdatastore[attr[i].name.replace(/^attrf\-/, '').replace(/-./g, function (m) {
return m.charAt(1).toUpperCase();
})] = new Function("return ( " + attr[i].value + " );").bind(this)();
} catch (er) {}
} else if (attr[i].name.match(/^data\-/)) {
if (typeof(this.attrdatastore.__dataset === "undefined")) {
this.attrdatastore.__dataset = {};
}
this.attrdatastore.__dataset[attr[i].name.replace(/^data\-/, '').replace(/-./g, function (m) {
return m.charAt(1).toUpperCase();
})] = attr[i].value;
}
}
}
return this.attrdatastore;
},
set : function (o) {
if (o && typeof(o) === "object") {
var i;
var store = this.attrdata;
for (i in o) {
store[i] = o[i];
}
}
},
visible : true,
readonly: true,
configurable : false
});
})());
_public.object.merge = function() {
if(typeof(arguments[0]) == "object") {
var i,j,k;for(i=1;i<arguments.length;i++)
if(typeof(arguments[i]) == "object")
for(j in arguments[i])
if( arguments[i][j] === null ) {
if(j in arguments[0]) try {
delete arguments[0][j];
} catch(k) {}
} else {
arguments[0][j] = arguments[i][j];
}
return arguments[0];
}
return arguments[0];
};
((function () {
var objEncodeURL = function(o,k, encodeURIKeys) {
var r = [],i;
if(!k) k = "";
if(Array.isArray(o) && k) {
for( i=0; i<o.length; i++ )
r.push(
objEncodeURL(
o[i],
""+k+(
encodeURIKeys ? encodeURIComponent("["+i+"]") : ("[" + i + "]")
)
),
encodeURIKeys
);
} else if( typeof(o) == "object" ) {
for( i in o )
r.push(
objEncodeURL(
o[i], "" + k + (
encodeURIKeys ? encodeURIComponent(
( k ? "[" : "" )+i+( k ? "]" : "" )
) : (
( k ? "[" : "" )+i+( k ? "]" : "" )
)
),
encodeURIKeys
)
);
} else if( k ) {
return ""+k+"="+encodeURIComponent(o);
}
return r.join('&');
};
_public.object.encodeURL = objEncodeURL;
})());
// Return a boolean value telling whether // the first argument is an Array object.
if(!Array.isArray) {
Array.isArray = function (vArg) {
return Object.prototype.toString.call(vArg) === "[object Array]";
};
}
if (!String.isString) {
String.isString = function () {if(arguments[0] === null) return false;if(typeof(arguments[0]) == 'string') return true;if(typeof(arguments[0])== 'object'){var criterion=arguments[0].constructor.toString().match(/string/i);return (criterion !== null);}return false;};
}
var slDOMset=function(v){
var p = _();
var set = [];
var config = {
unique : true
};
var methods = {
config : function (k, v) {
if (typeof(v) === "undefined") {
if (typeof(k) !== "string")
return null;
return ( typeof(config[k]) === "undefined" ? null : config[k] );
} else {
if (typeof(k) !== "string")
return methods;
if (typeof(config[k]) !== "undefined" && typeof(config[k]) === typeof(v)) {
config[k] = v;
}
return methods;
}
},
unique : function () {
set = set.filter(function (v, k, arr) { return arr.indexOf(v) === k; });
return methods;
},
set : function (v) {
var config_unique = this.config("unique");
var i, arr;
if (typeof(v) === "string") {
v = document.querySelectorAll(v);
arr = [];
for (i=0;i<v.length;i++) {
if (!config_unique || arr.indexOf(v[i]) === -1) {
arr.push(v[i]);
}
}
set = arr;
} else if (v && typeof(v) === "object") {
if (v.length) {
arr = [];
for (i=0;i<v.length;i++) {
if (!config_unique || arr.indexOf(v[i]) === -1) {
arr.push(v[i]);
}
}
set = arr;
}
}
return methods;
},
add : function () {
var config_unique = this.config("unique");
var i;
for (i=0;i<arguments.length;i++) {
if (Array.isArray(arguments[i])) {
methods.add.apply(methods, arguments[i]);
} else if (typeof(arguments[i]) === "object") {
if (!config_unique || set.indexOf(arguments[i]) === -1) {
set.push(arguments[i]);
}
} else if (typeof(arguments[i]) === "string") {
methods.add.apply(methods, document.querySelectorAll(arguments[i]));
}
}
return methods;
},
env : function () {
return p.env;
},
get : function (k) {
if (typeof(k) === "number") {
return (set[k] || null);
}
return set;
},
eq : function (k) {
if (set.length > k) {
set = [set[k]];
} else {
set = [];
}
return methods;
},
find : function (s) {
var config_unique = this.config("unique");
var ret = [];
set.forEach(function (node) {
p.E(node).q(s).forEach(function (child) {
if (!config_unique || ret.indexOf(child) === -1) {
ret.push(child);
}
});
});
set = ret;
return methods;
},
filter : function (callback) {
set = set.filter(function (node, k) {
return (callback(node, k, set, p) || false);
});
return methods;
},
each : function (callback) {
set.forEach(function (node, k) {
return (callback(node, k, set, p) || false);
});
return methods;
},
map : function (callback) {
set = set.map(function (node, k) {
return (callback(node, k, set, p) || false);
}).filter(function (node) {
return ( node !== false );
});
return methods;
},
attr : function (v) {
var node;
if (arguments.length === 0) {
node = this.get(0);
return ( node !== null ? (node.attributes || []) : [] );
} else if (arguments.length === 1 && typeof(v) === "string") {
node = this.get(0);
return ( node !== null ? p.E(node)._('-'+v) : null );
} else {
set.forEach(function (node) {
p.E(node).v.apply(p, arguments);
});
return methods;
}
}
};
["toFunction", "x" ].forEach(function (method) {
methods[method] = function () {
var args = arguments;
var res_set = set.map(function (node) {
var er, ret = node, res = null;
try {
p.E(node);
ret = p[method].apply(p, args);
} catch(er) {
ret = null;
}
return ret;
});
return methods;
};
});
["sClass", "c" ].forEach(function (method) {
methods[method] = function () {
var args = arguments;
var res_set = set.map(function (node) {
var er, ret = node, res = null;
try {
p.E(node);
ret = p[method].apply(p, args);
} catch(er) {
ret = null;
}
return ret;
});
if ((args[1] || "") === "?") {
return ( res_set[0] || null );
}
return methods;
};
});
[ "g_wh", "r", "pagePXY", "PXY", "eventsCache", "in_e", "i", "is_free", "is_focused", "is_inview", "is_visible" ].forEach(function (method) {
methods[method] = function () {
var args = arguments;
var res_set = set.map(function (node) {
var er, ret = node, res = null;
try {
p.E(node);
ret = p[method].apply(p, args);
} catch(er) {
ret = null;
}
return ret;
});
if (args[0] === true) {
return res_set;
}
if (res_set.length) {
return res_set[0];
}
return null;
};
});
[ "on", "off", "opacity", "a2D", "triger", "setVar", "T", "setStyle", "setStyleSPEED", "F", "f", "o", "removeFromDOM", "free", "d", "D", "clearE", "delE", "setVar", "setObjVar", "setObjProto", "V", "v", "p", "adEto", "putBfto", "putAfto", "putBf", "putAf", "Et", "Bt", "At", "pB", "pA", "addE", "addB", "addT", "e", "b", "t", "getTagsByQuery", "getTags", "s", "q", "nextTo", "backTo", "nUP", "nChild", "getParentN", "copyE", "getParentTag", "getByTag", "getByQuery", "getById", "N", "B", "U", "C", "P", "X", "p", "S", "Q", "I" ].forEach(function (method) {
methods[method] = function () {
var config_unique = this.config("unique");
var args = arguments;
set = set.map(function (node) {
var er, ret = node;
try {
p.E(node);
p[method].apply(p, args);
ret = p._();
} catch(er) {
ret = null;
}
return ret;
}).map(function (node) {
if (Array.isArray(node)) {
node.forEach(function (n) {
if (!config_unique || set.indexOf(n) === -1) {
set.push(n);
}
});
return null;
} else {
return node;
}
}).filter(function (node) {
return !!node;
});
return methods;
};
});
if (v) {
methods.set(v);
}
return methods;
};
var __ = function (v) { return new slDOMset(v || false); };
/**
* @type {slDOM}
* @private
*/
var slDOM=function(a,b){
if(!a) a = null; if(!b) b = null;
if(a){this.newE=slDOMlib.newE(a);var e;try{switch(typeof(b)){case "function":((b)(this,a,this.newE));break;}}catch(e){}} else {this.newE=b;}
this.env = slDOMlib.env;
this.__ = function(b){return ( b ? document : (this.newE ? this.newE : document)); };
this._i = function(i,n){return ((n + (i % n))%n); };
this.a2D=slDOMlib.animate_2D;
this.opacity = slDOMlib.opacity;
this.setE=slDOMlib.setE;
this.sClass=slDOMlib.sClass;
this.setArg=slDOMlib.setArg;
this.adEto=slDOMlib.adEto;
this.putBfto=slDOMlib.putBfto;
this.putAfto=slDOMlib.putAfto;
this.putBf=slDOMlib.putBf;
this.putAf=slDOMlib.putAf;
this.addE=slDOMlib.addE;
this.addB=slDOMlib.addB;
this.addT=slDOMlib.addT;
this.nextTo=slDOMlib.nextTo;
this.backTo=slDOMlib.backTo;
this.nUP=slDOMlib.nUP;
this.nChild=slDOMlib.nChild; /*-2 array -1 last 0 first*/
this.getParentN=slDOMlib.getParentN;
this.clearE=slDOMlib.clearE;
this.delE=slDOMlib.delE;
this.copyE=slDOMlib.copyE;
this.getParentTag=slDOMlib.getParentTag;
this.getByTag=slDOMlib.getByTag;
this.getByQuery=slDOMlib.getByQuery;
this.getById=slDOMlib.getById;
this.getTags=slDOMlib.getTags;
this.getTagsByQuery=slDOMlib.getTagsByQuery;
this.triger=slDOMlib.triger;
this.getE=slDOMlib.getE;
this.setStyle=slDOMlib.setStyleSPEED;
this.setVar=slDOMlib.setVar;
this.setObjVar=slDOMlib.setObjVar;
this.setStyleSPEED=slDOMlib.setStyleSPEED;
this.pagePXY=slDOMlib.pagePosXY;
this.in_e=slDOMlib.in_e;
this.g_wh=slDOMlib.g_wh;
this.getLIST=slDOMlib.getLIST;
this.toFunction=slDOMlib.toFunction;
this.removeFromDOM = slDOMlib.removeFromDOM;
this.o=slDOMlib.opacity;
this.E=slDOMlib.setE;
this.c=slDOMlib.sClass;
this.attrs = slDOMlib.attrs;
this.A=slDOMlib.setArg;
this.Et=slDOMlib.adEto;
this.Bt=slDOMlib.putBfto;
this.At=slDOMlib.putAfto;
this.pB=slDOMlib.putBf;
this.pA=slDOMlib.putAf;
this.e=slDOMlib.addE;
this.b=slDOMlib.addB;
this.t=slDOMlib.addT;
this.N=slDOMlib.nextTo;
this.B=slDOMlib.backTo;
this.U=slDOMlib.nUP;
this.C=slDOMlib.nChild; /*-2 array -1 last 0 first*/
this.P=slDOMlib.getParentN;
this.d=slDOMlib.clearE;
this.D=slDOMlib.delE;
this.X=slDOMlib.copyE;
this.PT=slDOMlib.getParentTag;
this.S=slDOMlib.getByTag;
this.Q=slDOMlib.getByQuery;
this.I=slDOMlib.getById;
this.s=slDOMlib.getTags;
this.q=slDOMlib.getTagsByQuery;
this.T=slDOMlib.triger;
this._=slDOMlib.getE;
this.$=slDOMlib.getLIST;
this.F=slDOMlib.setStyleSPEED;
this.f=slDOMlib.setStyle;
this.L=slDOMlib.getLIST;
this.V=slDOMlib.setVar;
this.v=slDOMlib.setObjVar;
this.p=slDOMlib.setObjProto;
this.PXY=slDOMlib.pagePosXY;
this.i=slDOMlib.in_e;
this.r=slDOMlib.g_wh;
this.x=slDOMlib.toFunction;
this.free = slDOMlib.removeFromDOM;
this.is_free = slDOMlib.is_free;
this.is_focused = slDOMlib.is_focused;
this.is_inview = slDOMlib.elementInViewport;
this.is_visible = slDOMlib.elementIsVisible;
this._normalizeCssValues = slDOMlib._normalizeCssValues;
this.on = slDOMlib.on;
this.off = slDOMlib.off;
this.eventsCache = slDOMlib.eventsCache;
return this;
};
var _=function(a,b){return new slDOM(a,b);};
/* jshint -W033 */
/* jshint -W041 */
slDOMlib={
env : (function () {var gecko = /gecko\/\d/i.test(navigator.userAgent); var old_ie = /MSIE \d/.test(navigator.userAgent);var ie_lt8 = old_ie && (document.documentMode == null || document.documentMode < 8);var ie_lt9 = old_ie && (document.documentMode == null || document.documentMode < 9);var ie_gt10 = /Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent);var ie = old_ie || ie_gt10;var webkit = /WebKit\//.test(navigator.userAgent);var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(navigator.userAgent);var chrome = /Chrome\//.test(navigator.userAgent);var opera = /Opera\//.test(navigator.userAgent);var firefox = /Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent);var safari = /Apple Computer/.test(navigator.vendor);var khtml = /KHTML\//.test(navigator.userAgent);var mac_geLion = /Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent);var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent);var phantom = /PhantomJS/.test(navigator.userAgent);var ios = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);/* This is woefully incomplete. Suggestions for alternative methods welcome. */var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent);var mac = ios || /Mac/.test(navigator.platform);var windows = /win/i.test(navigator.platform);var opera_version = opera && navigator.userAgent.match(/Version\/(\d*\.\d*)/);if (opera_version) opera_version = Number(opera_version[1]);if (opera_version && opera_version >= 15) { opera = false; webkit = true; };var android = /Android/.test(navigator.userAgent); var android_version = (parseFloat((navigator.userAgent.match(/Android[^\d\.\;]+([\d\.]+)/) || [])[1] || 0) || false);/* Some browsers use the wrong event properties to signal cmd/ctrl on OS X */var flipCtrlCmd = mac && (qtwebkit || opera && (opera_version == null || opera_version < 12.11));var captureMiddleClick = gecko || (ie && !ie_lt9);return { "gecko" : gecko, "old_ie" : old_ie,"ie_lt8" : ie_lt8,"ie_lt9" : ie_lt9,"ie_gt10" : ie_gt10,"ie" : ie,"webkit" : webkit,"qtwebkit" : qtwebkit,"chrome" : chrome,"opera" : opera,"firefox" : firefox,"safari" : safari,"khtml" : khtml,"mac_geLion" : mac_geLion,"mac_geMountainLion" : mac_geMountainLion,"phantom" : phantom,"ios" : ios,"mobile" : mobile,"mac" : mac,"windows" : windows,"opera_version" : opera_version,"flipCtrlCmd" : flipCtrlCmd,"captureMiddleClick" : captureMiddleClick, "android" : android, "android_version" : android_version };})(),
/* jshint +W033 */
/* jshint +W041 */
is_focused : function() { return ( document.activeElement == this.newE ); },
is_free : function() { return !this.newE.parentElement; },
elementInViewport : function(allnode) { var el = this.newE; var top = el.offsetTop; var left = el.offsetLeft; var width = el.offsetWidth; var height = el.offsetHeight; while(el.offsetParent) { el = el.offsetParent; top += el.offsetTop; left += el.offsetLeft; }
return ( allnode ? ( top >= window.pageYOffset && left >= window.pageXOffset && (top + height) <= (window.pageYOffset + window.innerHeight) && (left + width) <= (window.pageXOffset + window.innerWidth) ) : ( top < (window.pageYOffset + window.innerHeight) && left < (window.pageXOffset + window.innerWidth) && (top + height) > window.pageYOffset && (left + width) > window.pageXOffset ) ); },
elementIsVisible : function() {
var el = this.newE; var eap, rect = el.getBoundingClientRect(), docEl = document.documentElement, vWidth = window.innerWidth || docEl.clientWidth, vHeight = window.innerHeight || docEl.clientHeight, efp = function (x, y) { return document.elementFromPoint(x, y); }, contains = "contains" in el ? "contains" : "compareDocumentPosition", has = contains == "contains" ? 1 : 0x10;
/* Return false if it's not in the viewport */
if( rect.right < 0 || rect.bottom < 0 || rect.left > vWidth || rect.top > vHeight )
return false;
/* Return true if any of its four corners are visible */
return ( (eap = efp(rect.left, rect.top)) == el || el[contains](eap) == has || (eap = efp(rect.right, rect.top)) == el || el[contains](eap) == has || (eap = efp(rect.right, rect.bottom)) == el || el[contains](eap) == has || (eap = efp(rect.left, rect.bottom)) == el || el[contains](eap) == has );
},
removeFromDOM:function(){
if(this.newE.parentElement)
this.newE.parentElement.removeChild(this.newE);
return this;
},
toFunction:function(f,v){
var e;if(!v) v = {};var p_node = this.newE;
if(typeof(f) == "function")try{
(f)(this.newE,v,this);
} catch(e) {
console.error('To Function Error: ',e);
}
this.newE = p_node;
return this;
},
opacity:function(t){var e;try{var t1=Math.floor(t*100);t=t1/100;this.newE.style.opacity = t;this.newE.opacity = t;this.newE.style.KhtmlOpacity = t;this.newE.style.MsFilter = "progid:DXImageTransform.Microsoft.Alpha(Opacity="+t1+")";this.newE.style.filter = "alpha(opacity="+t1+")";}catch(e){return this;}return this;},
setE:function(t) {if(typeof(t) == "string"){this.newE = document.createElement(t);} else {this.newE=t;} return this;},
in_e:function(t){var i = this.newE;if(!t) t = document.body;while(i){if(i === t) return true;i = i.parentNode;} return false;},
newE:function(t) {var e;try{return document.createElement(t);}catch(e){return false;}},
sClass:function(t,m,k) {var s = (this.newE.className || '');
if (typeof(t) === "string") {
if (t.match(/[\s\n\t]+/)) {
t = t.split(/[\s\n\t]+/).filter(function (item) {
return item;
});
if (t.length === 0)
return this;
}
}
switch(m){
case '+':if(Array.isArray(t)) { t.forEach(function(v) {s = s.add_Class(v);}); this.newE.className = s;} else { this.newE.className = s.add_Class(t);}
break;
case '-':if(Array.isArray(t)) { t.forEach(function(v) {s = s.del_Class(v);}); this.newE.className = s;} else { this.newE.className = s.del_Class(t); }
break;
case '~': if(!Array.isArray(t)) { this.newE.className = s.fnd_Class(t) ? s.del_Class(t) : s.add_Class(t); } else {
this.newE.className = s.del_Class(t[0]).add_Class(t[1]); } break;
case '?':
if(!this.newE.className) {
return false;
}
return s.fnd_Class(t);
break;
case '@':
k = (parseInt(k, 10) || 0);
var root = this;
var node = this.newE;
if (k >= 0) {
root.sClass(t,'+');
setTimeout(function () {
var e = root.newE;
root.setE(node).sClass(t,'-').setE(e);
}, k);
} else {
root.sClass(t,'-');
setTimeout(function () {
var e = root.newE;
root.setE(node).sClass(t,'+').setE(e);
}, k);
}
break;
default:
this.newE.className=( Array.isArray(t) ? t.join(' ') : t);
break;} return this;},
setArg:function(t){if(typeof(t)==="string"){k=arguments;}else{k=t;};var i;for(i=0;i<k.length;i+=2)if(k[i+1])this.newE[k[i]]=k[i+1];return this;},
attrs : function(prefix){
var i,o = {};var a = this.newE.attributes;
for(i=0;i<a.length;i++)
if(!prefix || a[i].name.indexOf(prefix) === 0)
o[a[i].name] = a[i].value;
return o;
},
adEto:function(t){t.appendChild(this.newE);return this;},
putBfto:function(t){t.parentNode.insertBefore(this.newE,t);return this;},
putAfto:function(t){if(t.nextSibling){t.parentNode.insertBefore(this.newE,t.nextSibling);}else{t.parentNode.appendChild(this.newE);};return this;},
putBf:function(t,f,j){var e;try{if(!f)f='';
switch(f){case '_':this.newE.parentNode.insertBefore(t,this.newE);this.newE = t;break;
case '~':t=document.createElement(t);this.newE.parentNode.insertBefore(t,this.newE);this.newE = t;break;
default :this.newE.parentNode.insertBefore(t,this.newE);break;};
if(j)switch(typeof(j)){
case "function":((j)(this,t,this.newE));break;
}}catch(e){};return this;},
putAf:function(t){var t0=this.newE.cloneNode(true);this.newE.parentNode.insertBefore(t0,this.newE);this.newE.parentNode.insertBefore(t,this.newE);this.newE.parentNode.removeChild(this.newE);this.newE=t0;return this;},
addE:function(t,f,j){var e;try{if(!f)f='';
switch(f){
case '_':this.newE.appendChild(t);this.newE = t;break;
case '~':t=document.createElement(t);this.newE.appendChild(t);this.newE = t;break;
default :this.newE.appendChild(t);break;
};
if(j)switch(typeof(j)){
case "function":((j)(this,t,this.newE));break;
}
}catch(e){};return this;},
addB:function(t,f,j){
if(this.newE.childNodes.length){
var e;try{if(!f)f='';
switch(f){
case '~':t=document.createElement(t);
case '_':this.newE.insertBefore(t,this.newE.childNodes[0]);this.newE = t;break;
default :this.newE.insertBefore(t,this.newE.childNodes[0]);break;
};
if(j)switch(typeof(j)){
case "function":((j)(this,t,this.newE));break;
}
}catch(e){};return this;
} else {
return this.addE(t,f,j);
};
},
addT:function(t){if(typeof(t)!="undefined")this.newE.appendChild(document.createTextNode(t));return this;},
nextTo:function(t) {var i;if(!t)t=1;for(i=0;i<t;i++)this.newE=this.newE.nextSibling;return this;},
backTo:function(t) {var i;if(!t)t=1;for(i=0;i<t;i++)this.newE=this.newE.previousSibling;return this;},
triger:function(t) {
var e, evt;
try{
if(document.createEvent) {
evt = document.createEvent("HTMLEvents");
if (evt.initEvent) {
evt.initEvent(t, true, true );/*bubbling,cancelable*/
}
return !((this.newE).dispatchEvent(evt));
}
if (window.Event) {
evt = new Event(
t,
{
bubbles: true,
cancelable: true
}
);
return !((this.newE).dispatchEvent(evt));
}
if (document.createEventObject) {
evt = document.createEventObject();
return ((this.newE).fireEvent('on'+t, evt));
}
} catch(e) {
return 0;
}
},
nUP:function(){this.newE=this.newE.parentNode;return this;},
nChild:function(t){if(!t)t=0;if(t==-4){if(this.newE.childNodes.length)if(this.newE.childNodes[this.newE.childNodes.length-1]) this.newE = this.newE.childNodes[this.newE.childNodes.length-1];}else if(t==-3){return this.newE.childNodes;}else if(t==-2){this.newE=this.newE.childNodes;} else if(t==-1){this.newE=this.newE.lastChild;} else {this.newE=this.newE.childNodes[t];};return this;},
getParentN:function(t){if(!t)t=1;var i;for(i=0;i<t;i++)if(this.newE.parentNode)this.newE=this.newE.parentNode;return this;},
clearE:function(){var e;try{while(this.newE.childNodes[0])this.newE.removeChild(this.newE.childNodes[0]);}catch(e){};return this;},
delE:function(){var e;try{this.newE.parentNode.removeChild(this.newE);}catch(e){};return true;},
copyE:function(t){this.newE=this.newE.cloneNode(true);return this;},
getParentTag:function(t, force){var i = getParentByTagName(this.newE,t.toLowerCase());if(i || force) this.newE = i || null;return this;},
getByTag:function(t,i,a,c){if(!i)i=0;var r=this.__(a).getElementsByTagName(t);if(c && !r[this._i(i,r.length)]) return false;this.newE=r[this._i(i,r.length)];return this;},
getByQuery:function(t,i,a,c){if(!i)i=0;var r=(this.__(a)[i === 0 ? 'querySelector' : 'querySelectorAll'])(t);if(i===0){if(c && !r) return false;this.newE = r;return this;};if(c && !r[this._i(i,r.length)]) return false;this.newE=r[this._i(i,r.length)];return this;},
getById:function(t){var e;try{this.newE=document.getElementById(t);}catch(e){};return this;},
getTags:function(t,a){if(!t) return this;
if(arguments.length > 1 && typeof(a) == "string"){var i,r=[],k=arguments;for(i=0;i<k.length;i++)if(typeof(k[1]) == "string"){r.push(this.__(a).getElementsByTagName(k[i]));};return r;};return [].slice.apply(this.__(a).getElementsByTagName(t));
},
getTagsByQuery:function(t,a){if(!t) return this;
if(arguments.length > 1 && typeof(a) == "string") {var i,r=[],k=arguments;for(i=0;i<k.length;i++)if(typeof(k[1]) == "string"){r.push(this.__(a).querySelectorAll(k[i]));};return r;};return [].slice.apply(this.__(a).querySelectorAll(t));
},
getLIST:function(o,a,f,v){
if(!a)a=0;
var p_node = this.newE;
var p_root = ( a ? document : p_node );
if(typeof(o) == 'string') {
var i,L = p_root.querySelectorAll(o);
for(i=0;i<L.length;i++) ((f)(L[i],p_node,i,v ? v : {},false,this,L));
this.newE = p_node;
return this;
}
if(!('tags' in o))o.tags = {};
if(!('func' in o))o.func = function(e,p_node,k_index,o_vars,tag,p){};
if(!('vars' in o))o.vars = {};
if(typeof(o.func) != "function") o.func = function(e,p_node,k_index,o_vars,tag,p){};
if(!('sele' in o))o.sele = function(){return true;};
var j,i,n,L,e,f;
for(i in o.tags){
f = false;L = p_root.getElementsByTagName(i);
if(typeof(o.tags[i]) == "function") f=true;
for(j=0;j<L.length;j++)try{if(((o.sele)(L[j]))){if(f){((o.tags[i])(L[j],p_node,j,o.vars,i,this));};((o.func)(L[j],p_node,j,o.vars,i,this));}}catch(e){}
};
this.newE = p_node;
return this;
},
getE:function(t) {if(t)switch(t){
case '.tag': return (this.newE.tagName ? this.newE.tagName : (this.newE.nodeName ? this.newE.nodeName : '')).toLowerCase(); break;
case '.html': return this.newE.innerHTML; break;
case '.text': return (this.newE.innerText || this.newE.textContent); break;
default :
var e;
switch(t.substr(0,1)) {
case '-':
return this.newE.getAttribute(t.substr(1));
break;
case '!': // remove if exist
try {
this.newE.removeAttribute(t.substr(1));
} catch(e) {};
return this;
break;
};
break;
};return this.newE;},
setStyle:function(){var j,i,e,r={},l={
borderRadius:{WebkitBorderRadius:false,MozBorderRadius:false,borderRadius:false},
boxShadow:{WebkitBoxShadow:false,MozBoxShadow:false,boxShadow:false},
transform:{OTransform:false,MozTransform:false,WebkitTransform:false,MsTransform:false,transform:false},
transformOrigin:{OTransformOrigin:false,MsTransformOrigin:false,MozTransformOrigin:false,WebkitTransformOrigin:false,transformOrigin:false}
};
var n,t;for(n=0;n<arguments.length;n++) {
t = arguments[n];
for(i in t)if(i in l){
if(typeof(l[i]) == "function") {
((l[i])(i,t[i],this));
} else {
for(j in l[i])
this.newE.style[j] = slDOMlib._normalizeCssValues(j,(typeof(l[i][j]) == "function" ? ((l[i][j])(i,t[i],this)) : (l[i][j] !== false ? l[i][j] : t[i])));
}
}else{this.newE.style[i]=t[i];};}
return this;},
setVar:function(t){var o=this.newE;var j,e=o,i,k=arguments,v_check = true;for(i=0;i<k.length;i++)if(typeof(k[i])=="string"){if (k[i] === "style") {i++;if(k[i]) {this.E(e).F(k[i]);}} else { e=e[k[i]]; }}else for(j in k[i])
if( v_check ) {
var b = false;
switch(j) {
case 'innerHTML':
b = ((""+e[j]).fromHtml() != (""+k[i][j]).fromHtml());
break;
default:
b = (e[j] !== k[i][j]);
break;
};
if(b) e[j]=k[i][j];
if (["type"].indexOf(j) !== -1 && (e instanceof Element)) {
e.setAttribute(j, k[i][j]);
}
} else { e[j]=k[i][j];};this.newE=o;return this;},
setObjVar:function(t){var m,j,i,k=arguments,v_check = true;
for(i=0;i<k.length;i++)if(typeof(k[i])=="object") {
for(j in k[i])try{if(k[i][j] == null){ this.newE.removeAttribute(j);
} else {if( !v_check || this.newE.getAttribute(j) !== ""+k[i][j] ) this.newE.setAttribute(j, k[i][j]) }}catch(m){};
} else {
switch(k[i]) {
case 'check-enabled':
v_check = true;
break;
case 'check-disabled':
v_check = false;
break;
};
};
return this;
},
setObjProto:function(t){var m,j,i,k=arguments;for(i=0;i<k.length;i++)if(typeof(k[i])=="object")
for(j in k[i])try{if(k[i][j] == null){
if('prototype' in this.newE) {
if(j in this.newE.prototype) delete this.newE.prototype[j];
} else if('__proto__' in this.newE) {
if(j in this.newE.__proto__) delete this.newE.__proto__[j];
}
} else {
if('prototype' in this.newE) {
this.newE.prototype[j] = k[i][j]
} else if('__proto__' in this.newE) {
this.newE.__proto__[j] = k[i][j];
}
}
}catch(m){};
return this;
},
_updateCssPoperty : function(node,cssPoperty,cssValue,check) {
if( !check ) {
node.style[cssPoperty] = cssValue;
} else {
var n = 'csscache-'+cssPoperty;
if( node.getAttribute(n) != cssValue ) {
node.setAttribute(n,cssValue);
node.style[cssPoperty] = cssValue;
}
};
return true;
},
setStyleSPEED:function(t,v_check) {
var i,e;for(i in t)try{ slDOMlib._updateCssPoperty(this.newE,i,slDOMlib._normalizeCssValues(i,t[i]),v_check ? true : false); }catch(e){};return this;},
_normalizeCssValues_px : {
height:1,maxHeight:1,minHeight:1,
width:1,maxWidth:1,minWidth:1,
top:1,right:1,bottom:1,left:1,
margin:1,padding:1,
border:1,borderRadius:1,borderLeft:1,borderRight:1,borderTop:1,borderBottom:1,
fontSize:1
},
_normalizeCssValues: function(a,v){
if(v == 'inherit')
return v;
if(a in slDOMlib._normalizeCssValues_px) {
if(typeof(v) == "number") return v + "px";
if(typeof(v) == "string") {
if(v.match(/^\d+$/)) return v + "px";
return v.replace(/(^|[\s\,])(\d+)(?=[\s\,]|$)/g,'$1$2px');
/*.replace(/(^|[^\x23a-z])(\d+)([\s\,]|$)/g,'$1$2px$3');*/
/* return v.replace(/^(\d+)([\s\,])/g,'$1px$2').replace(/([^\x23a-z])(\d+)([\s\,\)])$/gi,'$1$2px$3'); */
}
}
return v;
},
pagePosXY:function(){var k,e=this.newE, b = false;try{if(typeof(e.offsetParent)!='undefined'){for(var posX=0,posY=0;e;e=e.offsetParent){posX+=e.offsetLeft;posY+=e.offsetTop;};e=this.newE;for(;e;e=e.parentElement) if (b) { posY -= (e.scrollTop || 0);posX -= (e.scrollLeft || 0);} else { b = true; };return {x:posX,y:posY};}else{return {x:e.x,y:e.y};}}catch(k){return {x:0,y:0}}},
g_wh:function(){var e = this.newE;var r = {};r.h = e.innerHeight ? e.innerHeight : (e.clientHeight ? e.clientHeight : (e.offsetHeight ? e.offsetHeight : (e.scrollHeight ? e.scrollHeight : 1)));r.w = e.innerWidth ? e.innerWidth : (e.clientWidth ? e.clientWidth : (e.offsetWidth ? e.offsetWidth : (e.scrollWidth ? e.scrollWidth : 1)));return r;},
animate_2D : function(obj){
var e, unit;try{
var s='',i,j,v,r = ['transform','OTransform','MsTransform','MozTransform','WebkitTransform'];
var d = {skew:[0,0],scale:[1,1],translate:[0,0],rotate:0,rotateY:0,rotateX:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,translateZ:0,matrix:[1,0,0,1,0,0]}
for(i=0;i<r.length;i++) if(r[i] in this.newE.style) s = this.newE.style[r[i]];
for(i in obj){
switch(i){
case 'rotate': case 'rotateY': case 'rotateX': case 'rotateZ':
case 'scaleX': case 'scaleY':
case 'skewX': case 'skewY': case 'skewZ':
case 'translateX': case 'translateY': case 'translateZ':
eval('v = s.match(/'+i+'\\s*\\(\\s*([\\-0-9\\.]+)\\s*([a-z\\x25]*)\\)/);');
if (i.match(/^(skew|rotate)/)) {
unit = 'deg';
} else if (i.match(/^translate/)) {
unit = 'px';
} else {
unit = '';
}
if(v == null) {
v = d[i];
} else {
if (i.match(/^translate/) && v[2].match(/^([a-z]{2}|\x25)$/)) {
unit = v[2];
}
v = Math.floor(parseFloat(v[1])*10)/10;
};
if (typeof(obj[i]) === "string") {
j = obj[i].match(/([a-z]{2}|\x25)$/g)
if (i.match(/^translate/) && j) {
if (j && j[0] !== unit) {
unit = j[0];
v = d[i];
}
}
if(obj[i].subs(0,1) in {'+':'','-':''}){
v += parseFloat(obj[i]);
} else {
v = parseFloat(obj[i]);
}
} else {
v = parseFloat(obj[i]);
};
v = (typeof(v) == "number" ? v : 0);
eval('s = s.replace(/'+i+'\\s*\\(.*?\\)/gi,"")');
s+=' '+i+'('+v+''+unit+')';
break;
case 'skew': case 'translate': case 'scale':
if(!Array.isArray(obj[i])) if(i == 'scale'){ v = [obj[i],obj[i]];obj[i] = v; } else { break; };
if(obj[i].length < 2) break;
eval('v = s.match(/'+i+'\\s*\\(\\s*([\\-0-9\\.]+)\\s*[a-z]*\\s*\\,\\s*([\\-0-9\\.]+)\\s*[a-z\\x25]*\\s*\\)/);');
if(v == null) { v = d[i];
} else { j = [];
j[1] = Math.floor(parseFloat(v[1])*10)/10;
j[2] = Math.floor(parseFloat(v[2])*10)/10;
v = [j[1],j[2]];
};
for(j=0;j<v.length;j++){
if(typeof(obj[i][j]) == "string"){
if(obj[i][j].subs(0,1) in {'+':'','-':''}) {
v[j] += parseFloat(obj[i][j]);
} else {
v[j] -= parseFloat(obj[i][j]);
}
} else {
v[j] = parseFloat(obj[i][j]);
};
v[j] = (typeof(v[j]) == "number" ? v[j] : 0);
};
eval('s = s.replace(/'+i+'\\s*\\(.*?\\)/gi,"")');
s+=' '+i+'('+v[0]+''+(i in {skew:1} ? 'deg' : '')+','+v[1]+''+(i in {skew:1} ? 'deg' : '')+')';
break;
case 'matrix':
if(!Array.isArray(obj[i])) break;
if(obj[i].length < 6) break;
eval('v = s.match(/'+i+'\\s*\\(\\s*([\\-0-9\\.]+)\\s*[a-z]*\\s*\\,\\s*([\\-0-9\\.]+)\\s*[a-z]*\\s*,\\s*([\\-0-9\\.]+)\\s*[a-z]*\\s*,\\s*([\\-0-9\\.]+)\\s*[a-z]*\\s*,\\s*([\\-0-9\\.]+)\\s*[a-z]*\\s*,\\s*([\\-0-9\\.]+)\\s*[a-z]*\\s*\\)/);');
if(v == null) { v = d[i];
} else { j = [];
j[1] = Math.floor(parseFloat(v[1])*10)/10;
j[2] = Math.floor(parseFloat(v[2])*10)/10;
j[3] = Math.floor(parseFloat(v[3])*10)/10;
j[4] = Math.floor(parseFloat(v[4])*10)/10;
j[5] = Math.floor(parseFloat(v[5])*10)/10;
j[6] = Math.floor(parseFloat(v[6])*10)/10;
v = [j[1],j[2],j[3],j[4],j[5],j[6]];
};
for(j=0;j<v.length;j++)
if(typeof(obj[i][j]) == "string") if(obj[i][j].subs(0,1) in {'+':'','-':''}){
v[j] += parseFloat(obj[i][j]);
} else {
v[j] -= parseFloat(obj[i][j]);
v[j] = (typeof(v[j]) == "number" ? v[j] : '');
};
eval('s = s.replace(/'+i+'\\s*\\(.*?\\)/gi,"")');
s+=' '+i+'('+v.join(',')+')';
break;
};
};
for(i=0;i<r.length;i++) if(r[i] in this.newE.style) this.newE.style[r[i]] = s;
} catch(e){return this;}; return this; },
"eventsCache" : function () {
return slDOMEvents_cache;
},
"on" : function(eventName, handler, handlerAlias) {
var eventsCache = this.eventsCache();
if (!(eventName in eventsCache)) {
eventsCache[eventName] = {};
}
if (!handlerAlias) {
handlerAlias = getRandId("event-handler-"+eventName+"-");
}
var handlerId = addEvent(this.newE, eventName, handler);
if (!(handlerAlias in eventsCache[eventName])) {
eventsCache[eventName][handlerAlias] = [];
}
eventsCache[eventName][handlerAlias].push({
node : this.newE,
handlerId : handlerId
});
return this;
},
"off" : function(eventType, handlerAlias, fromAll) {
var eventsCache = this.eventsCache();
var eventName;
for (eventName in eventsCache) {
if (eventType && eventType !== eventName) {
continue;
}
if (!handlerAlias) {
var i;
if (fromAll) {
for (i in eventsCache[eventName]) {
eventsCache[eventName][i].forEach(function (group) {
var er;
try {
removeEvent(group.node, eventName, group.handlerId);
} catch(er) {
console.warn("Error removing Event ",eventName,"[",handlerAlias,"] from ", group);
}
});
delete eventsCache[eventName][i];
}
} else {
var node = this.newE;
for (i in eventsCache[eventName]) {
eventsCache[eventName][i] = eventsCache[eventName][i].filter(function (group) {
if (group.node === node) {
var er;
try {
removeEvent(group.node, eventName, group.handlerId);
} catch(er) {
console.warn("Error removing Event ",eventName,"[",handlerAlias,"] from ", group);
}
return false;
}
return true;
});
}
}
} else if (handlerAlias in eventsCache[eventName]) {
if (fromAll) {
eventsCache[eventName][handlerAlias].forEach(function (group) {
var er;
try {
removeEvent(group.node, eventName, group.handlerId);
} catch(er) {
console.warn("Error removing Event ",eventName,"[",handlerAlias,"] from ", group);
}
});
delete eventsCache[eventName][handlerAlias];
} else {
var node = this.newE;
eventsCache[eventName][handlerAlias] = eventsCache[eventName][handlerAlias].filter(function (group) {
if (group.node === node) {
var er;
try {
removeEvent(group.node, eventName, group.handlerId);
} catch(er) {
console.warn("Error removing Event ",eventName,"[",handlerAlias,"] from ", group);
}
return false;
}
return true;
});
}
}
}
return this;
}
};
function getParentByTagName(obj, tag){if (!(obj && obj.parentNode)) return null; var obj_parent = obj.parentNode;if (!obj_parent) return obj;if (obj_parent.tagName && obj_parent.tagName.toLowerCase() == tag) return obj_parent;else return getParentByTagName(obj_parent, tag);}
_public._ = _;
_public.__ = __;
if (document)
((function () {
_public.fn.mouse.touchEventsAsClicks = true;
var eventsList = ["touchmove", "touchstart", "touchend", "touchleave"];
var p = _();
/**
* @private
* @param {TouchEvent} evt
*/
var handler = function (evt) {
if (_public.fn.mouse.touchEventsAsClicks) {
// if (!p.env.mobile) {
// evt.preventDefault();
// }
var newEvt;
if (document.createEvent) {
if (evt.touches.length > 1 || (evt.type == "touchend" && evt.touches.length > 0))
return;
newEvt = document.createEvent("MouseEvents");
var even