WM App Object

This is the app class which is created under the WM version 4.x script

当前为 2014-12-11 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/6895/27766/WM%20App%20Object.js

  1. // ==UserScript==
  2. // @name WM App Object
  3. // @namespace MerricksdadWMAppObject
  4. // @description This is the app class which is created under the WM version 4.x script
  5. // @license http://creativecommons.org/licenses/by-nc-nd/3.0/us/
  6. // @version 4.0.0.0
  7. // @copyright Charlie Ewing except where noted
  8. // ==/UserScript==
  9.  
  10. //this script requires some functions in the WM Common Library
  11. //this script needs access to a pre-defined JSON object
  12.  
  13.  
  14. (function(){
  15.  
  16. var checkBox=function(l,d,c,n){return ({type:"checkbox",label:l,"default":d||false,kids:c,newitem:n});}
  17. var hidden=function(l,d,c){return ({type:"hidden",label:l,"default":d,kids:c});}
  18. var optionBlock=function(l,c,hideSelectAll,n){hideSelectAll=hideSelectAll||false;return ({type:"optionblock",label:l,kids:c,hideSelectAll:hideSelectAll,newitem:n});}
  19. var separator=function(l,s,c,hideSelectAll){hideSelectAll=hideSelectAll||false; return ({type:"separator",label:l,section:s,kids:c}); }
  20. var section=function(l,c){return ({type:"section",label:l,kids:c});}
  21. var tabSection=function(l,c){return ({type:"tab",label:l,kids:c});}
  22. var inputBox=function(l,d,n){return ({type:"float",label:l,"default":(d||0),newitem:n});}
  23. var textArea=function(l,d,n){return ({type:"textarea",label:l,"default":(d||0),newitem:n});}
  24. var colorBox=function(l,d,n){return ({type:"colorbox",label:l,"default":(d||"black"),newitem:n});}
  25. var button=function(l,s){return ({type:"button",label:l,script:s});}
  26. var anchor=function(l,u,t){return ({type:"link",label:l,href:u,title:(t||'')});}
  27.  
  28. //***************************************************************************************************************************************
  29. //***** App Class
  30. //***************************************************************************************************************************************
  31. WM.App = function(params){try{
  32. this.objType="app";
  33. var self=this;
  34. //expected: id, name, namespace, icon
  35. params=params||{};
  36.  
  37. //create the masterswitch
  38. var testms=WM.quickOpts.masterSwitch[params.appID];
  39. WM.quickOpts.masterSwitch[params.appID]=(testms==null||testms=="undefined")?true:testms;
  40.  
  41. //set defaults
  42. this._enabled=WM.quickOpts.masterSwitch[params.appID]||false;
  43. this._paused=false;
  44. this.tests={};
  45. this.typesPaused=[];
  46. this.pausedTypesListNodes={};
  47. this._acceptCount=0;
  48. this._failCount=0;
  49. this.node=null;
  50. this.expanded=false;
  51. this.kids=[]; //contains additional filtered apps
  52. //setup config for this sidekick
  53. this.opts = {};
  54. this.config = new Config({
  55. storageName:"settings_"+params.appID+"_"+(WM.quickOpts.useGlobalSettings?"global":WM.currentUser.profile),
  56. onSave:WM.onSave,
  57. title:"FB Wall Manager "+WM.version+(WM.quickOpts.useGlobalSettings?" (!! Global Settings !!)":""),
  58. logo:createElement("span",{}[
  59. createElement("img",{className:"logo",src:"",textContent:"v"+WM.version}),
  60. createElement("text","v"+WM.version)
  61. ]),
  62. css:(
  63. WM.console.dynamicIcons()+
  64. jsForms.globalStyle()
  65. ),
  66. settings:{
  67. btn_useGlobal:{
  68. type:"button",
  69. label:"Use Global Settings",
  70. title:"Switch to using a global storage for settings. Those settings can then be used by other accounts (not browser profiles).",
  71. script:function(){
  72. if (WM.quickOpts.useGlobalSettings||false) {
  73. //already using global settings
  74. return;
  75. }
  76. if (confirm("Switch to using global (shared) settings?")){
  77. WM.quickOpts.useGlobalSettings=true;
  78. WM.saveQuickOpts();
  79. this.config.title = "FB Wall Manager "+WM.version+" (!! Global Settings !!))";
  80. this.config.storageName = "settings_"+params.appID+"_global";
  81. this.config.values=this.config.read();
  82. this.config.configure();
  83. this.config.reload();
  84. }
  85. },
  86. },
  87. btn_useOwnProfile:{
  88. type:"button",
  89. label:"Use Profile Settings",
  90. title:"Switch to using your own profile storage for settings.",
  91. script:function(){
  92. if (!(WM.quickOpts.useGlobalSettings||false)) {
  93. //already using profile settings
  94. return;
  95. }
  96. if (confirm("Switch to using your own profile settings?")){
  97. WM.quickOpts.useGlobalSettings=false;
  98. WM.saveQuickOpts();
  99. this.config.title = "FB Wall Manager "+WM.version;
  100. this.config.storageName = "settings_"+params.appID+"_"+WM.currentUser.profile;
  101. this.config.values=this.config.read();
  102. this.config.configure();
  103. this.config.reload();
  104. }
  105. },
  106. },
  107. },
  108. });
  109. //setup user defined accept texts
  110. try{
  111. if (WM.quickOpts.userDefinedTypes) {
  112. this.userDefinedTypes=WM.quickOpts.userDefinedTypes[params.appID]||{};
  113. } else {
  114. WM.quickOpts.userDefinedTypes={};
  115. WM.quickOpts.userDefinedTypes[params.appID]={};
  116. WM.saveQuickOpts();
  117. }
  118. }catch(e){log("WM.App.init: userDefinedTypes: "+e);}
  119.  
  120. //use passed params
  121. for (var p in params) this[p]=params[p];
  122.  
  123. //enable/disable all sidekick functions
  124. this.enable=function(){try{this.enabled=true;}catch(e){log("WM.App.enable: "+e);}};
  125. this.disable=function(){try{this.enabled=false;}catch(e){log("WM.App.disable: "+e);}};
  126. this.toggle=function(){try{this.enabled=!this.enabled;}catch(e){log("WM.App.toggle: "+e);}};
  127.  
  128. //pause collection for this app
  129. this.pause=function(){try{this.paused=true;}catch(e){log("WM.App.pause: "+e);}}
  130. this.unPause=function(){try{this.paused=false;}catch(e){log("WM.App.unPause: "+e);}}
  131.  
  132. //user defined types
  133. this.addUDT=function(params,drawOnly){try{
  134. //validate params or ask for input
  135. if (!exists(params) || !params.id) {
  136. params=params||{};
  137. var udtname=prompt("Enter the text name of the bonus type you wish to make (ie 'Horse')\n","");
  138. var udtid=this.appID+udtname.noSpaces().toLowerCase();
  139. udtid=prompt("OK, your type will read as '"+udtname+"'.\nNow modify this bonus type code to suit your needs.\n\nTip: You should prefix this code with the appID '"+this.appID+"', but it is not required.\nTip: Most sidekicks use lowercase and no spaces, but again, this is not a requirement.\n", udtid);
  140. if (udtid.trim()){
  141. params.id=udtid.trim();
  142. params.name=udtname;
  143. } else {
  144. alert("You supplied a blank user defined type ID. No type was created.");
  145. return false;
  146. }
  147. }
  148. if (!drawOnly){
  149. this.userDefinedTypes[params.id]=params.name;
  150. WM.quickOpts.userDefinedTypes[this.appID]=this.userDefinedTypes;
  151. WM.saveQuickOpts();
  152. }
  153. //draw the udt node
  154. if (this.udtNode){
  155. this.udtNode.appendChild(
  156. createElement("div",{className:"listItem"},[
  157. createElement("label",{textContent:params.id+" : "}),
  158. createElement("input",{value:params.name,title:"The display name of this type, used wherever bonus types are identified or selected.", onchange:function(){
  159. self.userDefinedTypes[params.id]=this.value;
  160. WM.quickOpts.userDefinedTypes[self.appID]=self.userDefinedTypes;
  161. WM.saveQuickOpts();
  162. }}),
  163. createElement("div",{className:"littleButton oddOrange", title:"Remove User-Defined Type"},[
  164. createElement("img",{className:"resourceIcon trash" +WM.opts.littleButtonSize,onclick:function(){
  165. var ask=WM.opts.appsConfirmDeleteUDT;
  166. if (!ask || (ask && confirm("Delete User Defined Type?"))) {
  167. delete self.userDefinedTypes[params.id];
  168. WM.quickOpts.userDefinedTypes[self.appID]=self.userDefinedTypes;
  169. WM.saveQuickOpts();
  170. remove (this.parentNode.parentNode);
  171. }
  172. }})
  173. ]),
  174. (this.accText[params.id]||null)?createElement("span",{title:"The type id you created exactly matches one provided by the sidekick for this app. If you did not intend to overwrite that bonus's display text, you may wish to create another type id and destroy this one.",style:"color:red;",textContent:"Overwrites a sidekick-provided bonus type id."}):null,
  175. ])
  176. );
  177. }
  178. }catch(e){log("WM.App.addUDT: "+e);}}
  179.  
  180. //unpause all bonus types for this app
  181. this.unpauseAllTypes=function(){try{
  182. for (var i=this.typesPaused.length-1;i>=0;i--){
  183. WM.unPauseByType(this,this.typesPaused[i]);
  184. }
  185. }catch(e){log("WM.App.unpauseAllTypes: "+e);}};
  186.  
  187.  
  188. //mass set priority for entire app post collection
  189. this.setPriority=function(n){try{
  190. for (var p in WM.posts) {
  191. var post=WM.posts[p];
  192. if (post.app==this) post.setPriority(n);
  193. }
  194. }catch(e){log("WM.App.setPriority: "+e);}};
  195.  
  196. //mass set priority for all posts of type
  197. this.setPriorityByType=function(w,n){try{
  198. for (var p in WM.posts) {
  199. var post=WM.posts[p];
  200. if (post.app==this && post.which==w) post.setPriority(n);
  201. }
  202. }catch(e){log("WM.App.setPriorityByType: "+e);}};
  203. //reset accept/fail counters
  204. this.resetCounter=function(){try{
  205. this.acceptCount=0;
  206. this.failCount=0;
  207. }catch(e){log("WM.App.resetCounter: "+e);}};
  208.  
  209. //reset all config options for this app
  210. //except those outside the standard branch (dontsteal,blockautolike,etc.)
  211. this.resetConfig=function(){try{
  212. var ask=WM.opts.configConfirmRestore;
  213. if (!ask || (ask && confirm("Restore sidekick settings to defaults?"))) {
  214. this.config.configure({reset:true});
  215. this.config.save();
  216. }
  217. }catch(e){log("WM.App.resetConfig: "+e);}};
  218. //fetch posts only for this app
  219. //normally used for initial fetching only
  220. this.fetchPosts=function(){try{
  221. WM.fetch({bypassPause:true, apps:this});
  222. }catch(e){log("WM.App.fetchPosts: "+e);}};
  223.  
  224. this.fetchNewer=function(){try{
  225. WM.fetch({
  226. newer:true,
  227. apps:this,
  228. bypassPause:true,
  229. bypassAppDisabled:true
  230. });
  231. }catch(e){log("WM.App.fetchNewer: "+e);}};
  232.  
  233. this.fetchOlder=function(){try{
  234. WM.fetch({
  235. older:true,
  236. apps:this,
  237. bypassPause:true,
  238. bypassAppDisabled:true
  239. });
  240. }catch(e){log("WM.App.fetchOlder: "+e);}};
  241.  
  242. //get a list of posts for this app from the global posts list
  243. this.__defineGetter__("posts",function(){try{
  244. return matchByParam(WM.posts,"app",this,"object");
  245. }catch(e){log("WM.App.getPosts: "+e);}});
  246. //detect if this sidekick said it was chrome compatible
  247. this.__defineGetter__("isVer3",function(){try{
  248. return this.flags.postMessageCompatible || this.flags.worksInChrome;
  249. }catch(e){log("WM.App.isVer3: "+e);}});
  250.  
  251. //detect if is paused
  252. this.__defineGetter__("paused",function(){try{
  253. return this._paused;
  254. }catch(e){log("WM.App.paused: "+e);}});
  255. this.__defineSetter__("paused",function(v){try{
  256. this._paused=v;
  257. //update the sidekick page button graphics
  258. var btn=this.pauseButtonNode;
  259. if (btn) {
  260. var btnSize=WM.opts.littleButtonSize;
  261. with (btn.parentNode)
  262. className=className.swapWordB(this._paused,"oddGreen","oddOrange");
  263. with (btn)
  264. className=className.swapWordB(this._paused,"playRight"+btnSize,"pause"+btnSize);
  265. }
  266. //do events
  267. if (this._paused) WM.rulesManager.doEvent("onAppPaused",this);
  268. else WM.rulesManager.doEvent("onAppUnpaused",this);
  269. }catch(e){log("WM.App.paused: "+e);}});
  270. //detect if is enabled
  271. this.__defineGetter__("enabled",function(){try{
  272. return this._enabled;
  273. }catch(e){log("WM.App.enabled: "+e);}});
  274. this.__defineSetter__("enabled",function(v){try{
  275. this._enabled=v;
  276. //update the WM.quickOpts
  277. WM.quickOpts.masterSwitch[this.appID]=this._enabled;
  278. WM.saveQuickOpts();
  279. //update the sidekick page graphics
  280. if (this.toggleNode) this.toggleNode.checked=this._enabled;
  281. if (this.node) with (this.node){
  282. className=className.swapWordB(this._enabled,"enabled","disabled");
  283. }
  284. //do events
  285. if (this._enabled) WM.rulesManager.doEvent("onAppEnabled",this);
  286. else WM.rulesManager.doEvent("onAppDisabled",this);
  287. }catch(e){log("WM.App.enabled: "+e);}});
  288. this.__defineGetter__("acceptCount",function(){try{
  289. return this._acceptCount;
  290. }catch(e){log("WM.App.acceptCount: "+e);}});
  291. this.__defineSetter__("acceptCount",function(v){try{
  292. this._acceptCount=v;
  293. if (this.acceptCounterNode) this.acceptCounterNode.textContent=v;
  294. }catch(e){log("WM.App.acceptCount: "+e);}});
  295. this.__defineGetter__("failCount",function(){try{
  296. return this._failCount;
  297. }catch(e){log("WM.App.failCount: "+e);}});
  298. this.__defineSetter__("failCount",function(v){try{
  299. this._failCount=v;
  300. if (this.failCounterNode) this.failCounterNode.textContent=v;
  301. }catch(e){log("WM.App.failCount: "+e);}});
  302.  
  303. this.__defineGetter__("totalCount",function(){try{
  304. return this._failCount+this._acceptCount;
  305. }catch(e){log("WM.App.totalCount: "+e);}});
  306.  
  307. //detect if this app is bundled with another app
  308. //return the main app in this bundle
  309. this.__defineGetter__("synApp",function(){try{
  310. return this.parent||this;
  311. }catch(e){log("WM.App.synApp: "+e);}});
  312. this.toggleContent=function(){try{
  313. this.expanded=!this.expanded;
  314. var btnSize=WM.opts.littleButtonSize;
  315. with (this.contentNode)
  316. className=className.swapWordB(this.expanded,"expanded","collapsed");
  317. with (this.toggleImgNode)
  318. className=className.swapWordB(this.expanded,"treeCollapse"+btnSize,"treeExpand"+btnSize);
  319. }catch(e){log("WM.App.toggleContent: "+e);}};
  320.  
  321. this.showConfig=function(){try{
  322. this.config.open();
  323. }catch(e){log("WM.App.showConfig: "+e);}};
  324.  
  325. this.disableOpt=function(w){try{
  326. this.opts[w]=false;
  327. this.config.set(w,false);
  328. this.config.save();
  329. }catch(e){log("WM.App.disableOpt: "+e);}};
  330.  
  331. this.enableOpt=function(w){try{
  332. this.opts[w]=true;
  333. this.config.set(w,true);
  334. this.config.save();
  335. }catch(e){log("WM.App.enableOpt: "+e);}};
  336. //add menu elements
  337. try{
  338. /* no longer used in WM3
  339. if (this.menu) {
  340. //prefix all menu elements with the appID
  341. this.menu=WM.dock.fixMenu(this.menu,this.appID);
  342. //append this app's menu settings
  343. this.settingsBranch=WM.config.append({branch:"wmtab_games",data:this.menu});
  344. }
  345. //prefix all test returns with the appID
  346. WM.dock.fixTests(this.tests,this);
  347. //prefix all accept text id's with the appID
  348. WM.dock.fixAcceptTexts(this);
  349. */
  350. //new method
  351. if (this.menu) this.config.append({data:this.menu});
  352. //I should really move these into the sidekick realm
  353. var data={};
  354. data["dynamic"+this.appID]=checkBox(this.name+" ("+this.appID+")",true);
  355. WM.config.append({branch:"enableDynamic",data:data});
  356.  
  357. data={}; data[this.appID+"dontsteal"]=checkBox(this.name);
  358. WM.config.append({branch:"dontstealBlock",data:data});
  359. data={}; data["hide"+this.appID]=checkBox(this.name);
  360. WM.config.append({branch:"filterapps",data:data});
  361. data={}; data["nolike"+this.appID]=checkBox(this.name);
  362. WM.config.append({branch:"blockautolikebygame",data:data});
  363. } catch(e) {log("WM.App.init:addMenuElements: "+e);};
  364. //draw to #sidekickList (WM.console.sidekickNode)
  365. try{
  366. WM.console.sidekickNode.appendChild(
  367. this.node=createElement("div",{className:"listItem "+((this.enabled)?"enabled":"disabled")},[
  368. createElement("div",{className:"line"},[
  369. createElement("div",{className:"littleButton",title:"Toggle Content",onclick:function(){self.toggleContent();}},[
  370. this.toggleImgNode=createElement("img",{className:"resourceIcon "+(this.expanded?"treeCollapse"+WM.opts.littleButtonSize:"treeExpand"+WM.opts.littleButtonSize)}),
  371. ]),
  372. this.toggleNode=createElement("input",{type:"checkbox",checked:this.enabled,onchange:function(){
  373. self.enabled=this.checked;
  374. with (self.node) className=className.toggleWordB(!this.checked,"disabled");
  375. }}),
  376. (this.icon)?createElement("img",{className:"icon crisp", src:this.icon,style:"width: 32px;vertical-align: middle"}):null,
  377. createElement("label",{textContent: this.name}),
  378. //toolbox
  379. createElement("div",{className:"littleButton odd"+(this.paused?"Green":"Orange"), title:"Pause/Unpause"},[
  380. this.pauseButtonNode=createElement("img",{className:"resourceIcon "+(this.paused?"playRight":"pause")+WM.opts.littleButtonSize,onclick:function(){self.paused=!self.paused;}})]),
  381. createElement("div",{className:"littleButton oddBlue", title:"Reset config for this app"},[
  382. createElement("img",{className:"resourceIcon uncheckAll"+WM.opts.littleButtonSize,onclick:function(){self.resetConfig();}})]),
  383. createElement("div",{className:"littleButton oddBlue", title:"Fetch Newer Posts"},[
  384. createElement("img",{className:"resourceIcon rssUpRight"+WM.opts.littleButtonSize,onclick:function(){self.fetchNewer();}})]),
  385. createElement("div",{className:"littleButton", title:"Fetch Older Posts"},[
  386. createElement("img",{className:"resourceIcon rssDownLeft" +WM.opts.littleButtonSize,onclick:function(){self.fetchOlder();}})]),
  387. //new sidekick config button
  388. this.configButton=createElement("button",{textContent:"Options", onclick:function(){self.config.open();}}),
  389. ]),
  390. this.contentNode=createElement("div",{className:"subsection "+(this.expanded?"expanded":"collapsed")},[
  391. createElement("div",{className:"line"},[
  392. createElement("label",{textContent:"App ID:"}),
  393. createElement("span",{textContent:this.appID}),
  394. ]),
  395. createElement("div",{className:"line"},[
  396. createElement("label",{textContent:"Support Provided By:"}),
  397. (this.desc)?createElement("span",{textContent: this.desc}):null, //provided in sidekick block
  398. ]),
  399. createElement("div",{className:"line"},[
  400. createElement("label",{textContent:"Sidekick Help Link:"}),
  401. (this.helpLink)?createElement("a",{href:this.helpLink,textContent:this.helpLink}):null, //provided in sidekick block
  402. ]),
  403. //browsers supported
  404. createElement("div",{className:"line"},[
  405. createElement("label",{textContent:"Browsers Supported:",style:"vertical-align:top;"}),
  406. createElement("img",{className:"resourceIcon firefox16", style:"display:inline-block;",title:"FireFox"}),
  407. (this.isVer3)?createElement("img",{className:"resourceIcon chrome16", style:"display:inline-block;",title:"Google Chrome"}):null,
  408. ]),
  409. //types paused subbox
  410. createElement("div",{className:"line"},[
  411. createElement("label",{textContent:"Types Paused:",title:"This is a list of bonus types that are currently paused for this app."}),
  412. createElement("div",{className:"littleButton oddGreen",onclick:function(){self.unpauseAllTypes();},title:"Unpause all types by this app."},[
  413. createElement("img",{className:"resourceIcon playRight"+WM.opts.littleButtonSize}),
  414. ]),
  415. this.typesPausedNode=createElement("div",{className:"subsection"}),
  416. ]),
  417. //attached apps
  418. createElement("div",{className:"line"},[
  419. createElement("label",{textContent:"Attached Apps:",title:"Additional apps filtered and processed by this sidekick."}),
  420. this.filtersNode=createElement("div",{className:"subsection"}),
  421. ]),
  422. //helpers subbox
  423. createElement("div",{className:"line"},[
  424. createElement("label",{textContent:"Helpers:",title:"Sidekick helpers"}),
  425. this.helpersNode=createElement("div",{className:"subsection"}),
  426. ]),
  427. //user defined types subbox
  428. createElement("div",{className:"line"},[
  429. createElement("label",{textContent:"User-Defined Types:",title:"User Defined Types ('which')"}),
  430. createElement("div",{className:"littleButton oddGreen",onclick:function(){self.addUDT();},title:"Add New User Defined Type"},[
  431. createElement("img",{className:"resourceIcon plus"+WM.opts.littleButtonSize}),
  432. ]),
  433. this.udtNode=createElement("div",{className:"subsection"}),
  434. ]),
  435. ]),
  436. ])
  437. );
  438. }catch(e){log("WM.App.init:addSidekickElement: "+e);};
  439. //create feed filters for this app
  440. try{
  441. var feeds=WM.feedManager.feeds;
  442. for (var f=0,len=feeds.length;f<len;f++){
  443. feeds[f].addFilter({id:"app_"+this.appID});
  444. }
  445. }catch(e){log("WM.App.init:createFeedFilters: ")+e;}
  446.  
  447. //draw to collection filter coolbar
  448. try{
  449. //create game filter buttons on the WM.console
  450. var coolBar = WM.console.collectTabControl;
  451. if (coolBar) {
  452. //add a tab for this filter
  453. var tab = coolBar.addTab({
  454. text:(this.name||""),
  455. image:(this.icon||null),
  456. appFilter:this.appID,
  457. onSelect:WM.setAppFilter,
  458. selected:(WM.quickOpts.filterApp==this.appID),
  459. });
  460. this.collectionTabNode=tab.buttonNode;
  461. //force the image to have the 'crisp' drawing style
  462. tab.buttonNode.childNodes[0].className="icon crisp";
  463. //add accept/fail counters
  464. this.failCount=0;
  465. this.acceptCount=0;
  466. tab.buttonNode.insertBefore(
  467. createElement("div",{className:"accFailBlock"},[
  468. this.failCounterNode=createElement("span",{className:"fail",textContent:"0"}),
  469. this.acceptCounterNode=createElement("span",{className:"accept",textContent:"0"}),
  470. ])
  471. , tab.textNode);
  472. }
  473. } catch(e) {log("WM.App.init:addConsoleElement: "+e);};
  474. //show additional filtered apps
  475. try{
  476. if (isArrayAndNotEmpty(this.addFilters)) {
  477. for (var f,filt;(filt=this.addFilters[f]);f++){
  478. //create an app object for this filter
  479. filt.parent=this;
  480. this.kids.push(new WM.App(filt));
  481. if (this.filtersNode) this.filtersNode.appendChild(
  482. createElement("div",{className:"line"},[
  483. createElement("img",{className:"icon crisp", src:filt.icon||null}),
  484. createElement("text",filt.name),
  485. ])
  486. );
  487. }
  488. }
  489. } catch(e) {log("WM.App.init:addFilteredApps: "+e);};
  490. //draw my user defined types
  491. try{
  492. for (var u in this.userDefinedTypes){
  493. this.addUDT({id:u,name:this.userDefinedTypes[u]},true);
  494. }
  495. }catch(e){log("WM.App.init: drawUDTs: "+e);}
  496. //do events
  497. WM.rulesManager.doEvent("onSidekickReady",this);
  498. return self;
  499. }catch(e){log("WM.App.init: "+e);}};
  500.  
  501.  
  502.  
  503. })();