UNPKG

automizy-js

Version:

Automizy widget collection

84 lines 3.21 kB
define([], function () { $A.getBasicFunctionsString = function (module) { var module = module || false; if (module === false) return false; var module = module.toLowerCase(module); var Module = module.charAt(0).toUpperCase() + module.slice(1);; return "\ var p = "+Module+".prototype\n\ p.create = function (func) {\n\ if (typeof func === 'function') {\n\ this.d.create = func;\n\ }else{\n\ return this.d.create(this, this.d.$widget);\n\ }\n\ return this;\n\ };\n\ p.skin = function (skin) {\n\ if (typeof skin !== 'undefined') {\n\ this.d.skin = skin;\n\ this.d.$widget.removeClassPrefix('automizy-skin-');\n\ this.d.$widget.addClass('automizy-skin-' + skin);\n\ return this;\n\ }\n\ return this.d.skin;\n\ };\n\ p.draw = p.drawTo = function ($target) {\n\ var $target = $target || $('body');\n\ this.d.$widget.appendTo($target);\n\ this.d.has"+Module+" = true;\n\ this.show();\n\ this.d.create(this, this.d.$widget);\n\ return this;\n\ };\n\ p.show = function () {\n\ $A.setWindowScroll(false, this.d.id);\n\ this.d.$widget.show().ashow();\n\ return this;\n\ };\n\ p.hide = function () {\n\ $A.setWindowScroll(true, this.id());\n\ this.d.$widget.hide().ahide();\n\ return this;\n\ };\n\ p.remove = function () {\n\ this.draw().d.$widget[0].parentElement.removeChild(this.d.$widget[0]);\n\ $A.setWindowScroll(true, this.id());\n\ delete $A.d."+module+"s[this.id()];\n\ return true;\n\ };\n\ p.id = function(id){\n\ if (typeof id === 'number' || typeof id === 'string') {\n\ $A.d."+module+"s.renameProperty(this.d.id, id);\n\ this.d.$widget.attr('id', id);\n\ this.d.id = id;\n\ return this;\n\ }\n\ return this.d.id;\n\ };\n\ $A.m."+Module+" = "+Module+";\n\ $A.new"+Module+" = function (obj) {\n\ var t = new "+Module+"(obj);\n\ $A.d."+module+"s[t.id()] = t;\n\ return t;\n\ };\n\ $A.get"+Module+" = function (id) {\n\ return $A.d."+module+"s[id];\n\ };\n\ $A.getAll"+Module+" = function () {\n\ return $A.d."+module+"s;\n\ };\n\ $A.remove"+Module+" = function (id) {\n\ var elem = $A.get"+Module+"(id) || {};\n\ if(typeof elem.remove !== 'undefined')return elem.remove();\n\ return true;\n\ };\n\ $A.removeAll"+Module+" = function () {\n\ for (var i in $A.getAll"+Module+"()){\n\ $A.remove"+Module+"(i);\n\ }\n\ return true;\n\ };"; }; });