rsence 2.0.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (311) hide show
  1. data/INSTALL.rdoc +295 -0
  2. data/LICENSE +622 -0
  3. data/README.rdoc +24 -0
  4. data/VERSION +1 -0
  5. data/bin/build_client.rb +254 -0
  6. data/bin/help +6 -0
  7. data/bin/launch.rb +120 -0
  8. data/bin/rdoc.sh +2 -0
  9. data/bin/restart +6 -0
  10. data/bin/rsence +120 -0
  11. data/bin/run +6 -0
  12. data/bin/run.rb +6 -0
  13. data/bin/save +6 -0
  14. data/bin/start +6 -0
  15. data/bin/status +6 -0
  16. data/bin/stop +6 -0
  17. data/conf/config.ru +5 -0
  18. data/conf/default_conf.yaml +337 -0
  19. data/conf/default_strings.yaml +77 -0
  20. data/conf/local_conf.yaml +14 -0
  21. data/conf/unicorn.conf +78 -0
  22. data/js/comm/comm/autosync/autosync.js +18 -0
  23. data/js/comm/comm/autosync/js.inc +0 -0
  24. data/js/comm/comm/comm.js +195 -0
  25. data/js/comm/comm/js.inc +0 -0
  26. data/js/comm/comm/queue/js.inc +0 -0
  27. data/js/comm/comm/queue/queue.js +183 -0
  28. data/js/comm/comm/session/js.inc +0 -0
  29. data/js/comm/comm/session/session.js +51 -0
  30. data/js/comm/comm/sessionwatcher/js.inc +0 -0
  31. data/js/comm/comm/sessionwatcher/sessionwatcher.js +43 -0
  32. data/js/comm/comm/transporter/js.inc +0 -0
  33. data/js/comm/comm/transporter/transporter.js +257 -0
  34. data/js/comm/comm/urlresponder/js.inc +0 -0
  35. data/js/comm/comm/urlresponder/urlresponder.js +148 -0
  36. data/js/comm/comm/values/js.inc +0 -0
  37. data/js/comm/comm/values/values.js +432 -0
  38. data/js/comm/jsloader/js.inc +0 -0
  39. data/js/comm/jsloader/jsloader.js +114 -0
  40. data/js/comm/reloadapp/js.inc +0 -0
  41. data/js/comm/reloadapp/reloadapp.js +150 -0
  42. data/js/comm/reloadapp/themes/default/reloadapp_warning-ie6.gif +0 -0
  43. data/js/comm/reloadapp/themes/default/reloadapp_warning.png +0 -0
  44. data/js/comm/sha/js.inc +0 -0
  45. data/js/comm/sha/sha.js +432 -0
  46. data/js/comm/values/value/js.inc +0 -0
  47. data/js/comm/values/value/value.js +182 -0
  48. data/js/comm/values/valuematrix/js.inc +0 -0
  49. data/js/comm/values/valuematrix/valuematrix.js +138 -0
  50. data/js/controls/button/button.js +57 -0
  51. data/js/controls/button/js.inc +0 -0
  52. data/js/controls/button/themes/bright/button.css +89 -0
  53. data/js/controls/button/themes/bright/button.html +7 -0
  54. data/js/controls/button/themes/bright/button_parts1-ie6.gif +0 -0
  55. data/js/controls/button/themes/bright/button_parts1.png +0 -0
  56. data/js/controls/button/themes/default/button.css +89 -0
  57. data/js/controls/button/themes/default/button.html +7 -0
  58. data/js/controls/button/themes/default/button_parts1-ie6.gif +0 -0
  59. data/js/controls/button/themes/default/button_parts1.png +0 -0
  60. data/js/controls/checkbox/checkbox.js +47 -0
  61. data/js/controls/checkbox/js.inc +0 -0
  62. data/js/controls/checkbox/themes/default/checkbox.css +69 -0
  63. data/js/controls/checkbox/themes/default/checkbox.html +5 -0
  64. data/js/controls/checkbox/themes/default/checkbox_parts1-ie6.gif +0 -0
  65. data/js/controls/checkbox/themes/default/checkbox_parts1.png +0 -0
  66. data/js/controls/datetime/calendar/calendar.js +197 -0
  67. data/js/controls/datetime/calendar/js.inc +0 -0
  68. data/js/controls/datetime/calendar/themes/default/calendar.css +108 -0
  69. data/js/controls/datetime/calendar/themes/default/calendar.html +9 -0
  70. data/js/controls/datetime/calendar/themes/default/calendar_arrows-ie6.gif +0 -0
  71. data/js/controls/datetime/calendar/themes/default/calendar_arrows.png +0 -0
  72. data/js/controls/datetime/datetimevalue/datetimevalue.js +246 -0
  73. data/js/controls/datetime/datetimevalue/js.inc +0 -0
  74. data/js/controls/datetime/timesheet/js.inc +0 -0
  75. data/js/controls/datetime/timesheet/themes/default/timesheet.css +30 -0
  76. data/js/controls/datetime/timesheet/themes/default/timesheet.html +2 -0
  77. data/js/controls/datetime/timesheet/timesheet.js +182 -0
  78. data/js/controls/datetime/timesheet_item/js.inc +0 -0
  79. data/js/controls/datetime/timesheet_item/themes/default/timesheet_item.css +42 -0
  80. data/js/controls/datetime/timesheet_item/themes/default/timesheet_item.html +8 -0
  81. data/js/controls/datetime/timesheet_item/timesheet_item.js +247 -0
  82. data/js/controls/datetime/timesheet_item_edit/js.inc +0 -0
  83. data/js/controls/datetime/timesheet_item_edit/timesheet_item_edit.js +274 -0
  84. data/js/controls/dialogs/alert_sheet/alert_sheet.js +62 -0
  85. data/js/controls/dialogs/alert_sheet/js.inc +0 -0
  86. data/js/controls/dialogs/confirm_sheet/confirm_sheet.js +36 -0
  87. data/js/controls/dialogs/confirm_sheet/js.inc +0 -0
  88. data/js/controls/dialogs/sheet/js.inc +0 -0
  89. data/js/controls/dialogs/sheet/sheet.js +83 -0
  90. data/js/controls/dialogs/sheet/themes/default/sheet.css +64 -0
  91. data/js/controls/dialogs/sheet/themes/default/sheet.html +14 -0
  92. data/js/controls/dialogs/sheet/themes/default/sheet_bg-ie6.gif +0 -0
  93. data/js/controls/dialogs/sheet/themes/default/sheet_bg.png +0 -0
  94. data/js/controls/dialogs/sheet/themes/default/sheet_dim-ie6.gif +0 -0
  95. data/js/controls/dialogs/sheet/themes/default/sheet_dim.png +0 -0
  96. data/js/controls/dialogs/sheet/themes/default/sheet_parts1-ie6.gif +0 -0
  97. data/js/controls/dialogs/sheet/themes/default/sheet_parts1.png +0 -0
  98. data/js/controls/dialogs/sheet/themes/default/sheet_parts2-ie6.gif +0 -0
  99. data/js/controls/dialogs/sheet/themes/default/sheet_parts2.png +0 -0
  100. data/js/controls/dialogs/sheet/themes/default/sheet_warning-ie6.gif +0 -0
  101. data/js/controls/dialogs/sheet/themes/default/sheet_warning.png +0 -0
  102. data/js/controls/imageview/imageview.js +108 -0
  103. data/js/controls/imageview/js.inc +0 -0
  104. data/js/controls/imageview/themes/default/blank.gif +0 -0
  105. data/js/controls/lists/checkboxlist/checkboxlist.js +170 -0
  106. data/js/controls/lists/checkboxlist/js.inc +0 -0
  107. data/js/controls/lists/listitems/js.inc +0 -0
  108. data/js/controls/lists/listitems/listitems.js +65 -0
  109. data/js/controls/lists/radiobuttonlist/js.inc +0 -0
  110. data/js/controls/lists/radiobuttonlist/radiobuttonlist.js +126 -0
  111. data/js/controls/passwordcontrol/js.inc +0 -0
  112. data/js/controls/passwordcontrol/passwordcontrol.js +22 -0
  113. data/js/controls/passwordcontrol/themes/default/passwordcontrol.css +0 -0
  114. data/js/controls/passwordcontrol/themes/default/passwordcontrol.html +18 -0
  115. data/js/controls/progress/progressbar/js.inc +0 -0
  116. data/js/controls/progress/progressbar/progressbar.js +36 -0
  117. data/js/controls/progress/progressbar/themes/default/progressbar.css +16 -0
  118. data/js/controls/progress/progressbar/themes/default/progressbar.html +2 -0
  119. data/js/controls/progress/progressindicator/js.inc +0 -0
  120. data/js/controls/progress/progressindicator/progressindicator.js +43 -0
  121. data/js/controls/radiobutton/js.inc +0 -0
  122. data/js/controls/radiobutton/radiobutton.js +41 -0
  123. data/js/controls/radiobutton/themes/default/radiobutton.css +69 -0
  124. data/js/controls/radiobutton/themes/default/radiobutton.html +5 -0
  125. data/js/controls/radiobutton/themes/default/radiobutton_parts1-ie6.gif +0 -0
  126. data/js/controls/radiobutton/themes/default/radiobutton_parts1.png +0 -0
  127. data/js/controls/sliders/slider/js.inc +0 -0
  128. data/js/controls/sliders/slider/slider.js +356 -0
  129. data/js/controls/sliders/slider/themes/default/hslider_tracks-ie6.gif +0 -0
  130. data/js/controls/sliders/slider/themes/default/hslider_tracks.png +0 -0
  131. data/js/controls/sliders/slider/themes/default/slider.css +108 -0
  132. data/js/controls/sliders/slider/themes/default/slider.html +5 -0
  133. data/js/controls/sliders/slider/themes/default/slider_thumbs-ie6.gif +0 -0
  134. data/js/controls/sliders/slider/themes/default/slider_thumbs.png +0 -0
  135. data/js/controls/sliders/vslider/js.inc +0 -0
  136. data/js/controls/sliders/vslider/themes/default/vslider.css +52 -0
  137. data/js/controls/sliders/vslider/themes/default/vslider.html +5 -0
  138. data/js/controls/sliders/vslider/themes/default/vslider_tracks-ie6.gif +0 -0
  139. data/js/controls/sliders/vslider/themes/default/vslider_tracks.png +0 -0
  140. data/js/controls/sliders/vslider/vslider.js +40 -0
  141. data/js/controls/stepper/js.inc +0 -0
  142. data/js/controls/stepper/stepper.js +212 -0
  143. data/js/controls/stepper/themes/default/stepper-ie6.gif +0 -0
  144. data/js/controls/stepper/themes/default/stepper.css +14 -0
  145. data/js/controls/stepper/themes/default/stepper.html +2 -0
  146. data/js/controls/stepper/themes/default/stepper.png +0 -0
  147. data/js/controls/stringview/js.inc +0 -0
  148. data/js/controls/stringview/stringview.js +49 -0
  149. data/js/controls/stringview/themes/default/stringview.css +8 -0
  150. data/js/controls/stringview/themes/default/stringview.html +1 -0
  151. data/js/controls/tab/js.inc +0 -0
  152. data/js/controls/tab/tab.js +276 -0
  153. data/js/controls/tab/themes/bright/tab.css +76 -0
  154. data/js/controls/tab/themes/bright/tab.html +6 -0
  155. data/js/controls/tab/themes/bright/tab_bg_color-ie6.gif +0 -0
  156. data/js/controls/tab/themes/bright/tab_bg_color.png +0 -0
  157. data/js/controls/tab/themes/bright/tab_border_pattern-ie6.gif +0 -0
  158. data/js/controls/tab/themes/bright/tab_border_pattern.png +0 -0
  159. data/js/controls/tab/themes/bright/tab_parts1-ie6.gif +0 -0
  160. data/js/controls/tab/themes/bright/tab_parts1.png +0 -0
  161. data/js/controls/tab/themes/default/tab.css +77 -0
  162. data/js/controls/tab/themes/default/tab.html +6 -0
  163. data/js/controls/tab/themes/default/tab_bg_color-ie6.gif +0 -0
  164. data/js/controls/tab/themes/default/tab_bg_color.png +0 -0
  165. data/js/controls/tab/themes/default/tab_border_pattern-ie6.gif +0 -0
  166. data/js/controls/tab/themes/default/tab_border_pattern.png +0 -0
  167. data/js/controls/tab/themes/default/tab_parts1-ie6.gif +0 -0
  168. data/js/controls/tab/themes/default/tab_parts1.png +0 -0
  169. data/js/controls/textarea/js.inc +0 -0
  170. data/js/controls/textarea/textarea.js +23 -0
  171. data/js/controls/textarea/themes/default/textarea.css +21 -0
  172. data/js/controls/textarea/themes/default/textarea.html +18 -0
  173. data/js/controls/textcontrol/js.inc +0 -0
  174. data/js/controls/textcontrol/textcontrol.js +372 -0
  175. data/js/controls/textcontrol/themes/default/textcontrol.css +107 -0
  176. data/js/controls/textcontrol/themes/default/textcontrol.html +18 -0
  177. data/js/controls/textcontrol/themes/default/textcontrol_parts1-ie6.gif +0 -0
  178. data/js/controls/textcontrol/themes/default/textcontrol_parts1.png +0 -0
  179. data/js/controls/textcontrol/themes/default/textcontrol_parts2-ie6.gif +0 -0
  180. data/js/controls/textcontrol/themes/default/textcontrol_parts2.png +0 -0
  181. data/js/controls/textcontrol/themes/default/textcontrol_parts3-ie6.gif +0 -0
  182. data/js/controls/textcontrol/themes/default/textcontrol_parts3.png +0 -0
  183. data/js/controls/uploader/js.inc +0 -0
  184. data/js/controls/uploader/themes/default/upload_progress.gif +0 -0
  185. data/js/controls/uploader/themes/default/uploader.css +108 -0
  186. data/js/controls/uploader/themes/default/uploader.html +27 -0
  187. data/js/controls/uploader/uploader.js +153 -0
  188. data/js/controls/validatorview/js.inc +0 -0
  189. data/js/controls/validatorview/themes/default/validator-ie6.gif +0 -0
  190. data/js/controls/validatorview/themes/default/validator.png +0 -0
  191. data/js/controls/validatorview/themes/default/validatorview.css +0 -0
  192. data/js/controls/validatorview/themes/default/validatorview.html +0 -0
  193. data/js/controls/validatorview/validatorview.js +55 -0
  194. data/js/controls/window/js.inc +0 -0
  195. data/js/controls/window/themes/default/window.css +219 -0
  196. data/js/controls/window/themes/default/window.html +17 -0
  197. data/js/controls/window/themes/default/window_bg_active-ie6.gif +0 -0
  198. data/js/controls/window/themes/default/window_bg_active.png +0 -0
  199. data/js/controls/window/themes/default/window_bg_inactive-ie6.gif +0 -0
  200. data/js/controls/window/themes/default/window_bg_inactive.png +0 -0
  201. data/js/controls/window/themes/default/window_buttons-ie6.gif +0 -0
  202. data/js/controls/window/themes/default/window_buttons.png +0 -0
  203. data/js/controls/window/themes/default/window_parts1-ie6.gif +0 -0
  204. data/js/controls/window/themes/default/window_parts1.png +0 -0
  205. data/js/controls/window/themes/default/window_parts2-ie6.gif +0 -0
  206. data/js/controls/window/themes/default/window_parts2.png +0 -0
  207. data/js/controls/window/window.js +284 -0
  208. data/js/core/class/class.js +317 -0
  209. data/js/core/class/js.inc +0 -0
  210. data/js/core/elem/elem.js +1376 -0
  211. data/js/core/elem/js.inc +0 -0
  212. data/js/core/event/event.js +1021 -0
  213. data/js/core/event/js.inc +0 -0
  214. data/js/core/iefix/ie_css_element.htc +5 -0
  215. data/js/core/iefix/ie_css_style.htc +5 -0
  216. data/js/core/iefix/iefix.js +359 -0
  217. data/js/core/iefix/js.inc +0 -0
  218. data/js/debugg/debugg.js +43 -0
  219. data/js/debugg/js.inc +0 -0
  220. data/js/foundation/application/application.js +209 -0
  221. data/js/foundation/application/js.inc +0 -0
  222. data/js/foundation/control/control.js +342 -0
  223. data/js/foundation/control/controldefaults/controldefaults.js +59 -0
  224. data/js/foundation/control/controldefaults/js.inc +0 -0
  225. data/js/foundation/control/dummyvalue/dummyvalue.js +50 -0
  226. data/js/foundation/control/dummyvalue/js.inc +0 -0
  227. data/js/foundation/control/dyncontrol/dyncontrol.js +494 -0
  228. data/js/foundation/control/dyncontrol/js.inc +0 -0
  229. data/js/foundation/control/dyncontrol/themes/default/dyncontrol.css +0 -0
  230. data/js/foundation/control/dyncontrol/themes/default/dyncontrol.html +0 -0
  231. data/js/foundation/control/eventresponder/eventresponder.js +713 -0
  232. data/js/foundation/control/eventresponder/js.inc +0 -0
  233. data/js/foundation/control/js.inc +0 -0
  234. data/js/foundation/control/valueresponder/js.inc +0 -0
  235. data/js/foundation/control/valueresponder/valueresponder.js +77 -0
  236. data/js/foundation/geom/point/js.inc +0 -0
  237. data/js/foundation/geom/point/point.js +202 -0
  238. data/js/foundation/geom/rect/js.inc +0 -0
  239. data/js/foundation/geom/rect/rect.js +610 -0
  240. data/js/foundation/json_renderer/js.inc +0 -0
  241. data/js/foundation/json_renderer/json_renderer.js +231 -0
  242. data/js/foundation/system/js.inc +0 -0
  243. data/js/foundation/system/system.js +369 -0
  244. data/js/foundation/thememanager/js.inc +0 -0
  245. data/js/foundation/thememanager/thememanager.js +387 -0
  246. data/js/foundation/view/js.inc +0 -0
  247. data/js/foundation/view/markupview/js.inc +0 -0
  248. data/js/foundation/view/markupview/markupview.js +113 -0
  249. data/js/foundation/view/morphanimation/js.inc +0 -0
  250. data/js/foundation/view/morphanimation/morphanimation.js +236 -0
  251. data/js/foundation/view/view.js +1804 -0
  252. data/js/foundation/view/viewdefaults/js.inc +0 -0
  253. data/js/foundation/view/viewdefaults/viewdefaults.js +25 -0
  254. data/js/views/centerview/centerview.js +45 -0
  255. data/js/views/centerview/js.inc +0 -0
  256. data/js/views/inlineview/inlineview.js +14 -0
  257. data/js/views/inlineview/js.inc +0 -0
  258. data/js/views/scrollview/js.inc +0 -0
  259. data/js/views/scrollview/scrollview.js +39 -0
  260. data/lib/conf/default.rb +220 -0
  261. data/lib/conf/wizard.rb +303 -0
  262. data/lib/daemon/daemon.rb +293 -0
  263. data/lib/http/broker.rb +102 -0
  264. data/lib/http/rackup.rb +88 -0
  265. data/lib/http/request.rb +69 -0
  266. data/lib/http/response.rb +63 -0
  267. data/lib/plugins/gui_plugin.rb +129 -0
  268. data/lib/plugins/guiparser.rb +114 -0
  269. data/lib/plugins/plugin.rb +652 -0
  270. data/lib/plugins/plugin_plugins.rb +47 -0
  271. data/lib/plugins/plugin_sqlite_db.rb +72 -0
  272. data/lib/plugins/plugin_util.rb +96 -0
  273. data/lib/plugins/pluginmanager.rb +517 -0
  274. data/lib/plugins/servlet.rb +69 -0
  275. data/lib/session/msg.rb +291 -0
  276. data/lib/session/sessionmanager.rb +491 -0
  277. data/lib/session/sessionstorage.rb +314 -0
  278. data/lib/transporter/transporter.rb +254 -0
  279. data/lib/util/gzstring.rb +5 -0
  280. data/lib/values/hvalue.rb +323 -0
  281. data/lib/values/valuemanager.rb +152 -0
  282. data/plugins/client_pkg/client_pkg.rb +186 -0
  283. data/plugins/client_pkg/info.yaml +25 -0
  284. data/plugins/client_pkg/lib/client_pkg_build.rb +569 -0
  285. data/plugins/client_pkg/lib/client_pkg_cache.rb +50 -0
  286. data/plugins/client_pkg/lib/client_pkg_serve.rb +210 -0
  287. data/plugins/client_pkg/log/build_log +0 -0
  288. data/plugins/index_html/img/loading.gif +0 -0
  289. data/plugins/index_html/img/riassence.gif +0 -0
  290. data/plugins/index_html/index_html.rb +150 -0
  291. data/plugins/index_html/tmpl/index.html +22 -0
  292. data/plugins/index_html/tmpl/startup_index.html +29 -0
  293. data/plugins/legacy/disabled +0 -0
  294. data/plugins/legacy/disabled- +0 -0
  295. data/plugins/legacy/info.yaml +22 -0
  296. data/plugins/legacy/legacy.rb +15 -0
  297. data/plugins/main/js/riassence_ns.js +87 -0
  298. data/plugins/main/main.rb +234 -0
  299. data/plugins/main/values.yaml +8 -0
  300. data/plugins/ticketservices/lib/common.rb +300 -0
  301. data/plugins/ticketservices/lib/favicon.rb +38 -0
  302. data/plugins/ticketservices/lib/file.rb +58 -0
  303. data/plugins/ticketservices/lib/img.rb +50 -0
  304. data/plugins/ticketservices/lib/objblob.rb +66 -0
  305. data/plugins/ticketservices/lib/rsrc.rb +34 -0
  306. data/plugins/ticketservices/lib/upload.rb +206 -0
  307. data/plugins/ticketservices/ticketservices.rb +268 -0
  308. data/var/db/.git_include +0 -0
  309. data/var/log/.git_include +0 -0
  310. data/var/run/.git_include +0 -0
  311. metadata +390 -0
@@ -0,0 +1,317 @@
1
+ /* Riassence Framework
2
+ * Copyright 2006 Riassence Inc.
3
+ * http://riassence.com/
4
+ *
5
+ * You should have received a copy of the GNU General Public License along
6
+ * with this software package. If not, contact licensing@riassence.com
7
+ */
8
+
9
+ /** = Description
10
+ * The extended object model.
11
+ *
12
+ * HClass is the foundation class of all other classes. It implements
13
+ * a proper object oriented environment in Javascript. It supports
14
+ * inheritance (HClass.extend), superclass invocation ( this.base ),
15
+ * interfaces (HClass.implement) and such.
16
+ *
17
+ * It's derived from and backwards compatible with Dean Edward's Base.js,
18
+ * so you can mix and match code written against Base.js.
19
+ *
20
+ * It is intended for the following main purposes:
21
+ * * To easily create classes without the MyClass.prototype cruft
22
+ * * Method overriding with intuitive access to the overridden method (like Ruby's super)
23
+ * * To avoid calling a class' constructor function during the prototyping phase
24
+ * * To easily add static (class) properties and methods
25
+ * * To achieve the above without resorting to global functions to build prototype chains
26
+ * * To achieve the above without affecting Object.prototype
27
+ *
28
+ * The HClass class extends the 'Object' object by adding one instance method (base)
29
+ * and two class methods (extend, implement). Instance method extend can be also called directly.
30
+ *
31
+ * == Example:
32
+ * MyClass = HClass.extend({
33
+ * constructor: function( foo ){
34
+ * this.setFoo( foo );
35
+ * },
36
+ * setFoo: function( foo ){
37
+ * this.foo = foo;
38
+ * }
39
+ * });
40
+ *
41
+ * myClassInstance1 = MyClass.nu( 'rabbids' );
42
+ * myClassInstance2 = new MyClass( 'ribbit' );
43
+ *
44
+ * MyEqualsClass = MyClass.extend({
45
+ * testFoo: function( that ){
46
+ * return this.foo === that.foo;
47
+ * }
48
+ * });
49
+ * myEqualsClassInstance1 = MyEqualsClass.nu( 'woof' );
50
+ * equals1 = myEqualsClassInstance1.testFoo( myClassIntance1 );
51
+ * myClassInstance2.setFoo( myEqualsClassInstance1.foo );
52
+ * equals2 = myEqualsClassInstance1.testFoo( myClassIntance2 );
53
+ *
54
+ **/
55
+ HClass = function() {
56
+ if ( arguments.length ) {
57
+ if (this === window) {
58
+ HClass.prototype.extend.call( arguments[0], arguments.callee.prototype );
59
+ }
60
+ else {
61
+ this.extend( arguments[0] );
62
+ }
63
+ }
64
+ };
65
+
66
+
67
+ HClass.prototype = {
68
+
69
+ /* The property copying method. */
70
+ extend: function(_source, _value) {
71
+ var _extend = HClass.prototype.extend,
72
+ _ancestor, _method, _previous, _returnValue, i, _name, _prototype, _protected;
73
+ if (arguments.length === 2) {
74
+ _ancestor = this[_source];
75
+ // only methods are inherited
76
+ if ((_ancestor instanceof Function) && (_value instanceof Function) &&
77
+ _ancestor.valueOf() !== _value.valueOf() && (/\bbase\b/).test(_value)) {
78
+ _method = _value;
79
+ _value = function() {
80
+ // saves the this.base that is the this.base method of this child
81
+ _previous = this.base;
82
+ // copies previous this.base from the direction from HClass
83
+ this.base = _ancestor;
84
+ // current class's method is called
85
+ // now inside the function when called this.base points to parent method
86
+ _returnValue = _method.apply(this, arguments);
87
+ // then because event this function can be called from child method
88
+ // resets the base to as is was before calling this function
89
+ this.base = _previous;
90
+ return _returnValue;
91
+ };
92
+ _value.valueOf = function() {
93
+ return _method;
94
+ };
95
+ _value.toString = function() {
96
+ return String(_method);
97
+ };
98
+ }
99
+ return this[_source] = _value;
100
+ // this is called when called by HClass.extend
101
+ } else if (_source) {
102
+ _prototype = {toSource: null};
103
+ _protected = ["toString", "valueOf"];
104
+ // we want default constructor function
105
+ if (HClass._prototyping) {
106
+ // 3. index
107
+ _protected.push("constructor");
108
+ }
109
+ for (i = 0; (_name = _protected[i]); i++) {
110
+ if (_source[_name] !== _prototype[_name]) {
111
+ _extend.call(this, _name, _source[_name]);
112
+ }
113
+ }
114
+ for (_name in _source) {
115
+ if (!_prototype[_name]) {
116
+ _extend.call(this, _name, _source[_name]);
117
+ }
118
+ }
119
+ }
120
+
121
+ // alternative constructor (use instead of the new keywoard)
122
+ this.nu = function() {
123
+ return new (
124
+ this.extend( {
125
+ constructor: function( args ){
126
+ this.base.apply( this, args );
127
+ }
128
+ } )
129
+ )( arguments );
130
+ };
131
+ return this;
132
+ },
133
+ /** = Description
134
+ * If a method has been overridden then the base method provides access to the overridden method.
135
+ * Call this method from any other method to invoke that method's ancestor.
136
+ * It is also possible to call the base method from within a constructor function.
137
+ *
138
+ **/
139
+ base: function() {
140
+ // this method can be called from any other method to invoke that method's parent
141
+ }
142
+ };
143
+
144
+ /** = Description
145
+ * The class method method to create a new extended class.
146
+ *
147
+ * If the method name constructor is defined null as the +_instance+ parameter,
148
+ * it will return a single instance.
149
+ *
150
+ * = Parameters:
151
+ * +_instance+:: An object that has properties and methods of inherited class.
152
+ * +_static+:: An object that has properties and methods of inherited class's
153
+ * class methods if the method named constructor is defined null
154
+ * in _instance parameter.
155
+ *
156
+ * = Returns:
157
+ * Returns the extended class object.
158
+ *
159
+ * = Usage:
160
+ * Point = HClass.extend({
161
+ * constructor: function(x, y) {
162
+ * this.x = x;
163
+ * this.y = y;
164
+ * }
165
+ * });
166
+ * Rectangle = Point.extend({
167
+ * constructor: function(x, y, width, height) {
168
+ * this.base(x, y);
169
+ * this.width = width;
170
+ * this.height = height;
171
+ * },
172
+ * getWidth: function() {
173
+ * return this.width;
174
+ * },
175
+ * getHeight: function() {
176
+ * return this.height;
177
+ * }
178
+ * },
179
+ * {
180
+ * // class methods
181
+ * description: "this is a Rectangle",
182
+ * getClass: function() {
183
+ * return this;
184
+ * }
185
+ * });
186
+ *
187
+ **/
188
+ HClass.extend = function(_instance, _static) {
189
+ // reference to HClass's prototype extend method (HClass's class structure extend method)
190
+ var _extend = HClass.prototype.extend,
191
+ _prototype, _constructor, _klass, _object;
192
+ // if _instance is undefined,null,"" etc. creates object so that code below works
193
+ if (!_instance) {
194
+ _instance = {};
195
+ }
196
+ HClass._prototyping = true;
197
+ // this is base for single instance or prototype (class structure) for object that are created
198
+ // from this class
199
+ _prototype = new this;
200
+ // copies properties and methods from _instance to _prototype (class structure)
201
+ _extend.call(_prototype, _instance);
202
+ // this constructor came from _instance
203
+ _constructor = _prototype.constructor;
204
+ _prototype.constructor = this;
205
+ delete HClass._prototyping;
206
+
207
+ _klass = function() {
208
+ if (!HClass._prototyping) {
209
+ _constructor.apply(this, arguments);
210
+ }
211
+ this.constructor = _klass;
212
+ };
213
+ // this is the new class's prototype (class structure)
214
+ _klass.prototype = _prototype;
215
+ // copies static method (class method)
216
+ // acts like HClass.extend
217
+ _klass.extend = this.extend;
218
+ // copies static method (class method)
219
+ // acts like HClass.implement
220
+ _klass.implement = this.implement;
221
+ _klass.toString = function() {
222
+ return String(_constructor);
223
+ };
224
+ // copies properties and methods from _static directly to statc methods (class methods)
225
+ // of new class
226
+ _extend.call(_klass, _static);
227
+ // if _constructor is marked as null returns the created instance (that is also class structure for
228
+ // instances if class is returned
229
+ _object = (_constructor !== null) ? _klass : _prototype;
230
+ if (_object.init instanceof Function) {
231
+ _object.init();
232
+ }
233
+ return _object;
234
+ };
235
+
236
+ /** = Description
237
+ * Copies the prototype properties and methods from _interface or if it is an object it's properties and functions
238
+ * to HClass or class inherited from HClass. Mimics the interface behaviour of ordinary programming languages.
239
+ *
240
+ * = Usage:
241
+ * Defines an interface:
242
+ *
243
+ * AreaInterface = HClass.extend({
244
+ * constructor: null,
245
+ * // implement
246
+ * // don't define here
247
+ * //getWidth: function() {},
248
+ * //getHeight: function() {},
249
+ * area: function() {
250
+ * return this.getWidth() * this.getHeight();
251
+ * }
252
+ * });
253
+ *
254
+ * Rectangle = HClass.extend({
255
+ * constructor: function(x, y, width, height) {
256
+ * this.x = x;
257
+ * this.y = y;
258
+ * this.width = width;
259
+ * this.height = height;
260
+ * },
261
+ * getWidth: function() {
262
+ * return this.width;
263
+ * },
264
+ * getHeight: function() {
265
+ * return this.height;
266
+ * }
267
+ * });
268
+ *
269
+ * Rectangle.implement(AreaInterface);
270
+ *
271
+ **/
272
+ HClass.implement = function(_interface) {
273
+ // copies prototype fields and methods (class structures properties and methods)
274
+ if (_interface instanceof Function) {
275
+ _interface = _interface.prototype;
276
+ }
277
+ this.prototype.extend(_interface);
278
+ };
279
+
280
+ var Base = HClass;
281
+
282
+ // Array fix
283
+ if ([]['indexOf']===undefined) {
284
+ // Object.extend = function(_destination, _source) {
285
+ // for (var _property in _source) {
286
+ // _destination[_property] = _source[_property];
287
+ // }
288
+ // return _destination;
289
+ // };
290
+ // Object.extend(Array.prototype, {
291
+ Array.prototype.indexOf = function(_anObject){
292
+ var i = 0, l = this.length;
293
+ for (; i < l; i++) {
294
+ if (this[i] === _anObject) {
295
+ return i;
296
+ }
297
+ }
298
+ return -1;
299
+ };
300
+ }
301
+
302
+
303
+ // ff version 3.0.3 fails on this, when firebug installed: try/catch block
304
+ try {
305
+
306
+ // console.log surrogate for browsers without a console
307
+ if(window['console']===undefined){
308
+ window.console = {
309
+ log: function(){
310
+ }
311
+ };
312
+ }
313
+
314
+
315
+ } catch(e) {}
316
+
317
+
File without changes
@@ -0,0 +1,1376 @@
1
+ /* Riassence Framework
2
+ * Copyright 2007 Riassence Inc.
3
+ * http://riassence.com/
4
+ *
5
+ * You should have received a copy of the GNU General Public License along
6
+ * with this software package. If not, contact licensing@riassence.com
7
+ */
8
+
9
+ /** = Description
10
+ * The interval to flush the buffer specified in milliseconds.
11
+ **/
12
+ ELEMTickerInterval = 10;
13
+
14
+ /** = Description
15
+ * An object that contains the browser types detected as booleans.
16
+ **/
17
+ BROWSER_TYPE = {
18
+
19
+ /* Any version of Microsoft Internet Explorer */
20
+ ie: false,
21
+
22
+ /* Microsoft Internet Explorer version 6 */
23
+ ie6: false,
24
+
25
+ /* Microsoft Internet Explorer version 7 */
26
+ ie7: false,
27
+
28
+ /* Microsoft Internet Explorer version 8 */
29
+ ie8: false,
30
+
31
+ /* Any version of Opera */
32
+ opera: false,
33
+
34
+ /* Any version of Safari (and other KHTML/WebKit -derived browsers) */
35
+ safari: false,
36
+
37
+ /* The Symbian version of KHTML/WebKit/Safari, is also registered as +safari+ */
38
+ symbian: false,
39
+
40
+ /* Any version of Google Chrome, is also registered as +safari+ */
41
+ chrome: false,
42
+
43
+ /* Any version of Mozilla Firefox */
44
+ firefox: false,
45
+
46
+ /* Mozilla Firefox version 2 */
47
+ firefox2: false,
48
+
49
+ /* Mozilla Firefox version 3 */
50
+ firefox3: false
51
+ };
52
+
53
+ /** = Description
54
+ * The DOM Abstraction collection. Implements a managed buffer
55
+ * for style properties.
56
+ **/
57
+ ELEM = {
58
+
59
+ // stuff moved inside this function, because (surprise, surprise!) ie6 had some issues with it.
60
+ _constructor: function() {
61
+ var _this = ELEM;
62
+
63
+ _this._enableRecycler = false;
64
+
65
+ // pre-init queue
66
+ _this._domLoadQueue = [];
67
+ _this._domLoadTimer = null;
68
+
69
+ // turns true when document is actually loaded:
70
+ _this._domLoadStatus = false;
71
+
72
+ // initial tasks
73
+ _this._initDone = false;
74
+
75
+ _this._makeCount = 0;
76
+
77
+ _this._setStyleCount = 0;
78
+ _this._setStyleDiffCount = 0;
79
+ _this._getStyleCount = 0;
80
+ _this._getStyleMissCount = 0;
81
+
82
+ _this._flushLoopCount = 0;
83
+ _this._flushLoopFlushedCount = 0;
84
+ _this._flushStylCount = 0;
85
+
86
+ _this._flushTime = 0;
87
+ _this._flushCounter = 0;
88
+ _this._idleDelay = 500;
89
+
90
+ _this._timer = null;
91
+ _this._minDelay = ELEMTickerInterval;
92
+ _this._flushing = false;
93
+ _this._needFlush = false;
94
+ _this._slowness = 1;
95
+
96
+ _this._elements = [];
97
+ if (_this._enableRecycler) {
98
+ _this._recycler = {
99
+ _tagNames: []
100
+ };
101
+ } else {
102
+ _this._freeElemIds = [];
103
+ }
104
+ _this._styleCache = {};
105
+ _this._styleTodo = {};
106
+ _this._attrTodo = {};
107
+ _this._attrCache = {};
108
+ _this._elemTodo = [];
109
+ _this._elemTodoH = {};
110
+ _this._blockElems = ",ADDRESS,BLOCKQUOTE,CENTER,DIR,DIV,DL,FIELDSET,FORM,H1,H2,H3,H4,H5,H6,HR,ISINDEX,MENU,NOFRAMES,NOSCRIPT,OL,P,PRE,TABLE,UL,";
111
+ },
112
+
113
+
114
+ _fillTrash: function(_count, _tagName) {
115
+ if (!ELEM._enableRecycler) {
116
+ return;
117
+ }
118
+ var _this = ELEM,
119
+ i = 0,
120
+ _toDel = [],
121
+ _recycler = _this._initRecycler(_tagName),
122
+ _trashId = _recycler._trashId;
123
+ for (; i !== _count; i++) {
124
+ _toDel.push(_this.make(_trashId, _tagName));
125
+ }
126
+ for (i = 0; i !== _count; i++) {
127
+ _this.del(_toDel[i]);
128
+ }
129
+ },
130
+
131
+ // adds an element reference
132
+ // returns its id
133
+ _add: function(_elem) {
134
+ var _id,
135
+ _this = ELEM,
136
+ _elements = _this._elements,
137
+ _hasFreeElemIds = (_this._freeElemIds.length !== 0);
138
+ if (_hasFreeElemIds) {
139
+ _id = _this._freeElemIds.pop();
140
+ _elements[_id] = _elem;
141
+ }
142
+ else {
143
+ // Adds the element to the cache
144
+ _elements.push(_elem);
145
+ // Get cache size == serial id
146
+ _id = _elements.length - 1;
147
+ }
148
+ return _id;
149
+ },
150
+
151
+ // makes new style caches
152
+ _initCache: function(_id) {
153
+ var _this = ELEM;
154
+ _this._styleTodo[_id] = [];
155
+ _this._styleCache[_id] = {};
156
+ _this._attrTodo[_id] = [];
157
+ _this._attrCache[_id] = {};
158
+ _this._elemTodoH[_id] = false;
159
+ },
160
+
161
+ /** = Description
162
+ * Binds a DOM element by the DOM ID-attribute.
163
+ *
164
+ * = Parameters
165
+ * +_domId+:: The element's ID-attribute to bind.
166
+ *
167
+ * = Returns
168
+ * The ELEM ID (to use with other ELEM methods.
169
+ *
170
+ **/
171
+ bindId: function(_domId) {
172
+ var _this = ELEM,
173
+ _elem = document.getElementById(_domId),
174
+ _elemId = _this._add(_elem);
175
+ _this._initCache(_elemId);
176
+ return _elemId;
177
+ },
178
+
179
+ /** = Description
180
+ * Binds a DOM element by the DOM Element Object itself.
181
+ *
182
+ * = Parameters
183
+ * +_elem+:: The DOM Element object to bind.
184
+ *
185
+ * = Returns
186
+ * The ELEM ID (to use with other ELEM methods.
187
+ *
188
+ **/
189
+ bind: function(_elem) {
190
+ var _this = ELEM,
191
+ _id = _this._add(_elem);
192
+ _this._initCache(_id);
193
+ return _id;
194
+ },
195
+
196
+ // deprecated; backwards-compatibility
197
+ _replace: function(_id, _elem) {
198
+ ELEM._elements[_id] = _elem;
199
+ },
200
+
201
+ /** = Description
202
+ * Gets a DOM Element by its ELEM ID.
203
+ *
204
+ * = Parameters
205
+ * +_id+:: The ELEM ID.
206
+ *
207
+ * = Returns
208
+ * The DOM Element object.
209
+ *
210
+ **/
211
+ get: function(_id) {
212
+ return ELEM._elements[_id];
213
+ },
214
+
215
+ /** = Description
216
+ * Sets the innerHTML of an element by its ELEM ID.
217
+ *
218
+ * = Parameters
219
+ * +_id+:: The ELEM ID.
220
+ * +_html+:: The HTML Block as a string to set the innerHTMl property with.
221
+ *
222
+ **/
223
+ setHTML: function(_id, _html) {
224
+ try {
225
+ var _this = ELEM;
226
+ if (!_this._elements[_id]) {
227
+ return;
228
+ }
229
+ if (! ((typeof _html === 'string') || (typeof _html === 'number'))) {
230
+ return;
231
+ }
232
+ _this._elements[_id].innerHTML = _html;
233
+ } catch(e) {}
234
+ //_this._initCache(_id);
235
+ },
236
+
237
+ /** = Description
238
+ * Gets the innerHTML of an element by its ELEM ID.
239
+ *
240
+ * = Parameters
241
+ * +_id+:: The ELEM ID.
242
+ *
243
+ * = Returns
244
+ * The innerHTML of the element the ELEM ID is bound to.
245
+ *
246
+ **/
247
+ getHTML: function(_id) {
248
+ try {
249
+ var _this = ELEM;
250
+ if (_this._elements[_id]) {
251
+ return _this._elements[_id].innerHTML;
252
+ }
253
+ } catch(e) {}
254
+ //_this._initCache(_id);
255
+ return '';
256
+ },
257
+
258
+ _initRecycler: function(_tagName) {
259
+ if (!ELEM._enableRecycler) {
260
+ return null;
261
+ }
262
+ var _this = ELEM,
263
+ _recycler = _this._recycler;
264
+ if (!_recycler[_tagName]) {
265
+ _recycler._tagNames.push(_tagName);
266
+ _recycler[_tagName] = [];
267
+ _recycler[_tagName]._countIn = 1;
268
+ _recycler[_tagName]._countOut = 0;
269
+ _recycler[_tagName]._trashId = _this.make(_this._trashId, 'div');
270
+ }
271
+ return _recycler[_tagName]._trashId;
272
+ },
273
+
274
+ /** = Description
275
+ * Deletes an element and its associated buffers by ELEM ID.
276
+ *
277
+ * = Parameters
278
+ * +_id+:: The ELEM Id to delete.
279
+ *
280
+ **/
281
+ del: function(_id) {
282
+ var _this = ELEM,
283
+ _elem = _this._elements[_id];
284
+ if (_this._flushing) {
285
+ _this.del(_id);
286
+ }
287
+ _this._flushing = true;
288
+ if (_this._enableRecycler) {
289
+ var _tagName = _elem.tagName,
290
+ _trashId = _this._initRecycler(_tagName),
291
+ _recycler = _this._recycler[_tagName];
292
+ _this.append(_id, _trashId);
293
+ }
294
+
295
+ var _elemTodoIdx = _this._elemTodo.indexOf(_id);
296
+ if (_elemTodoIdx !== -1) {
297
+ _this._elemTodo.splice(_elemTodoIdx, 1);
298
+ }
299
+ _this._initCache(_id);
300
+ if (_this._enableRecycler) {
301
+ _recycler._countIn++;
302
+ _recycler.push(_id);
303
+ } else {
304
+ _this._freeElemIds.push(_id);
305
+ var _parentNode = _elem.parentNode;
306
+ if (_parentNode !== null) {
307
+ _parentNode.removeChild(_elem);
308
+ }
309
+ _elem = null;
310
+ _this._elements[_id] = null;
311
+ }
312
+ _this._flushing = false;
313
+ },
314
+
315
+ /** = Description
316
+ * Moves the source element inside the target element.
317
+ *
318
+ * = Parameters
319
+ * +_sourceId+:: The source element's ELEM ID to move.
320
+ * +_targetId+:: The target element's ELEM ID to move the source element into.
321
+ *
322
+ **/
323
+ append: function(_sourceId, _targetId) {
324
+ var _this = ELEM,
325
+ _source = _this._elements[_sourceId],
326
+ _target = _this._elements[_targetId];
327
+ _target.appendChild(_source);
328
+ },
329
+
330
+ /** = Description
331
+ * Replaces all styles of the element with the string containing css source.
332
+ *
333
+ * = Parameters
334
+ * +_id+:: The ELEM ID which all styles will be replaced
335
+ * with the css source.
336
+ * +_cssText+:: A string containing the CSS Text.
337
+ *
338
+ **/
339
+ setCSS: function(_id, _cssText) {
340
+ ELEM._elements[_id].style.cssText = _cssText;
341
+ },
342
+
343
+ /** = Description
344
+ * Returns the CSS source style of the element.
345
+ *
346
+ * = Parameters
347
+ * +_id+:: The ELEM ID which all styles will be returned as
348
+ * a string containing the CSS source.
349
+ *
350
+ * = Returns
351
+ * A string containing the CSS source of the element.
352
+ *
353
+ **/
354
+ getCSS: function(_id) {
355
+ return ELEM._elements[_id].style.cssText;
356
+ },
357
+
358
+ /** = Description
359
+ * Returns the visible size of an element.
360
+ *
361
+ * = Parameters
362
+ * +_id+:: The ELEM ID.
363
+ *
364
+ * = Returns
365
+ * An [ width, height ] pair as an Array.
366
+ *
367
+ **/
368
+ getVisibleSize: function(_id) {
369
+ var _parentOverflow,
370
+ _this = ELEM,
371
+ _elem = _this._elements[_id],
372
+ w = _elem.offsetWidth,
373
+ h = _elem.offsetHeight,
374
+ _parent = _elem.parentNode;
375
+ while (_parent && _parent.nodeName.toLowerCase() !== 'body') {
376
+ if (!BROWSER_TYPE.ie) {
377
+ _parentOverflow = document.defaultView.getComputedStyle(
378
+ _parent, null
379
+ ).getPropertyValue('overflow');
380
+ }
381
+ else {
382
+ _parentOverflow = _parent.currentStyle.getAttribute('overflow');
383
+ }
384
+ _parentOverflow = _parentOverflow !== 'visible';
385
+ if (w > _parent.clientWidth && _parentOverflow) {
386
+ w = _parent.clientWidth - _elem.offsetLeft;
387
+ }
388
+ if (h > _parent.clientHeight && _parentOverflow) {
389
+ h = _parent.clientHeight - _elem.offsetTop;
390
+ }
391
+ _elem = _elem.parentNode;
392
+ _parent = _elem.parentNode;
393
+ }
394
+ return [w, h];
395
+ },
396
+
397
+ /** = Description
398
+ * Returns the full size of the element.
399
+ *
400
+ * = Parameters
401
+ * +_id+:: The ELEM ID.
402
+ *
403
+ * = Returns
404
+ * An [ width, height ] pair as an Array.
405
+ *
406
+ **/
407
+ getSize: function(_id) {
408
+ var _this = ELEM,
409
+ _elem = _this._elements[_id],
410
+ w = _elem.offsetWidth,
411
+ h = _elem.offsetHeight;
412
+ return [w, h];
413
+ },
414
+
415
+ /** = Description
416
+ * Returns the scroll size of the element.
417
+ *
418
+ * = Parameters
419
+ * +_id+:: The ELEM ID.
420
+ *
421
+ * = Returns
422
+ * An [ width, height ] pair as an Array.
423
+ *
424
+ **/
425
+ getScrollSize: function(_id) {
426
+ var _this = ELEM,
427
+ _elem = _this._elements[_id],
428
+ w = _elem.scrollWidth,
429
+ h = _elem.scrollHeight;
430
+ return [w, h];
431
+ },
432
+
433
+ /** = Description
434
+ * Returns the real position of the element, subtracting whatever
435
+ * scroll bars do to the position..
436
+ *
437
+ * = Parameters
438
+ * +_id+:: The ELEM ID.
439
+ *
440
+ * = Returns
441
+ * An [ x, y ] coordinate pair as an Array.
442
+ *
443
+ **/
444
+ getVisiblePosition: function(_id) {
445
+ var _this = ELEM,
446
+ x = 0,
447
+ y = 0,
448
+ _elem = _this._elements[_id];
449
+ while (_elem !== document) {
450
+ x += _elem.offsetLeft;
451
+ y += _elem.offsetTop;
452
+ x -= _elem.scrollLeft;
453
+ y -= _elem.scrollTop;
454
+ _elem = _elem.parentNode;
455
+ if (!_elem) {
456
+ break;
457
+ }
458
+ }
459
+ return [x, y];
460
+ },
461
+
462
+ /** = Description
463
+ * Returns the opacity of the element.
464
+ *
465
+ * = Parameters
466
+ * +_id+:: The ELEM ID.
467
+ *
468
+ * = Returns
469
+ * The opacity as a floating point number between 0.0 (transparent) and 1.0 (opaque).
470
+ *
471
+ **/
472
+ getOpacity: function(_id) {
473
+ var _opacity,
474
+ _try_opacity,
475
+ _this = ELEM,
476
+ _getStyle = _this.getStyle;
477
+ // old safari (1.x):
478
+ if (_opacity === _getStyle(_id, '-khtml-opacity')) {
479
+ return parseFloat(_opacity);
480
+ }
481
+ // old mozilla (ff 1.0 and below):
482
+ if (_opacity === _getStyle(_id, '-moz-opacity')) {
483
+ return parseFloat(_opacity);
484
+ }
485
+ _try_opacity = _getStyle(_id, 'opacity', true);
486
+ if (_opacity === _try_opacity || (_try_opacity === 0)) {
487
+ return parseFloat(_opacity);
488
+ }
489
+ if (_opacity === (_this._elements[_id].currentStyle['filter'] || '').match(/alpha(opacity=(.*))/)) {
490
+ if (_opacity[1]) {
491
+ return parseFloat(_opacity[1]) / 100;
492
+ }
493
+ }
494
+ return 1.0;
495
+ },
496
+
497
+ /** = Description
498
+ * Sets the opacity of the element.
499
+ *
500
+ * = Parameters
501
+ * +_id+:: The ELEM ID.
502
+ * +_opacity+:: The opacity as a floating point number between 0.0 (transparent) and 1.0 (opaque).
503
+ *
504
+ **/
505
+ setOpacity: function(_id, _opacity) {
506
+ var _this = ELEM;
507
+ if (_opacity === 1 && BROWSER_TYPE.ie6) {
508
+ _this._elements[_id].style.setAttribute('filter', _this.getStyle(_id, 'filter', true).replace(/alpha([^)]*)/gi, ''));
509
+ }
510
+ else {
511
+ if (_opacity < 0.01) {
512
+ _opacity = 0;
513
+ }
514
+ if (BROWSER_TYPE.ie6) {
515
+ _this._elements[_id].style.setAttribute('filter', _this.getStyle(_id, 'filter', true).replace(/alpha([^)]*)/gi, '') + 'alpha(opacity=' + _opacity * 100 + ')');
516
+ }
517
+ else if (BROWSER_TYPE.ie) {
518
+ (_this._elements[_id].style.setAttribute('opacity', _opacity));
519
+ }
520
+ else {
521
+ _this._elements[_id].style.setProperty('opacity', _opacity, '');
522
+ }
523
+ }
524
+ },
525
+
526
+ /** = Description
527
+ * Like getStyle, but always return an integer number.
528
+ *
529
+ * = Parameters
530
+ * +_id+:: The ELEM ID.
531
+ * +_key+:: The style property name.
532
+ *
533
+ * = Returns
534
+ * The value of the style property.
535
+ *
536
+ **/
537
+ getIntStyle: function(_id, _key) {
538
+ var _value = ELEM.getStyle(_id, _key);
539
+ return parseInt(_value, 10);
540
+ },
541
+
542
+ /** = Description
543
+ * Sets the box coordinates (x,y,width,height) all at once.
544
+ *
545
+ * = Parameters
546
+ * +_id+:: The ELEM ID.
547
+ * +_coords+:: An array containing exactly four coordinates in the following
548
+ * order: x, y, width, height
549
+ *
550
+ **/
551
+ setBoxCoords: function(_id, _coords) {
552
+ ELEM.setStyle(_id, 'left', _coords[0] + 'px');
553
+ ELEM.setStyle(_id, 'top', _coords[1] + 'px');
554
+ ELEM.setStyle(_id, 'width', _coords[2] + 'px');
555
+ ELEM.setStyle(_id, 'height', _coords[3] + 'px');
556
+ },
557
+
558
+ /** = Description
559
+ * Returns the amount of width of the element taken by 'extra' space: border
560
+ * and padding size.
561
+ *
562
+ * = Parameters
563
+ * +_id+:: The ELEM ID.
564
+ *
565
+ * = Returns
566
+ * The amount of extra width as an integer.
567
+ *
568
+ **/
569
+ getExtraWidth: function(_id) {
570
+ var _int = ELEM.getIntStyle;
571
+ return _int(_id, 'padding-left') + _int(_id, 'padding-right') + _int(_id, 'border-left-width') + _int(_id, 'border-right-width');
572
+ },
573
+
574
+ /** = Description
575
+ * Returns the amount of height of the element taken by 'extra' space: border
576
+ * and padding size.
577
+ *
578
+ * = Parameters
579
+ * +_id+:: The ELEM ID.
580
+ *
581
+ * = Returns
582
+ * The amount of extra height as an integer.
583
+ *
584
+ **/
585
+ getExtraHeight: function(_id) {
586
+ var _int = ELEM.getIntStyle;
587
+ return _int(_id, 'padding-top') + _int(_id, 'padding-bottom') + _int(_id, 'border-top-width') + _int(_id, 'border-bottom-width');
588
+ },
589
+
590
+ /** = Description
591
+ * Re-calculates the amount of delay to achieve a new target frame rate.
592
+ *
593
+ * The DOM refreshes are typically the most expensive tasks of an Javascript
594
+ * application, it's a good idea to set an optimal frame rate for the DOM
595
+ * updates to let your logic code get as many cpu cycles as possible without
596
+ * wasting most of them on more DOM refreshes than necessary.
597
+ *
598
+ * The default frame rate is 30 and the maximum frame rate allowed is 100.
599
+ *
600
+ * = Parameters
601
+ * +_fps+:: The target frame rate (DOM updates per second).
602
+ *
603
+ **/
604
+ setFPS: function(_fps) {
605
+ var _this = ELEM;
606
+ _this._minDelay = 1000 / _fps;
607
+ if (_this._minDelay < ELEMTickerInterval) {
608
+ _this._minDelay = ELEMTickerInterval;
609
+ }
610
+ },
611
+
612
+ /** = Description
613
+ * An additional adjustment multiplier to offset the slowness of a
614
+ * target browser.
615
+ *
616
+ * The default is 1.0 (no change to the flush delay calculated by setFPS)
617
+ * A higher value than 1.0 means less frequent updates (slower than
618
+ * target machine).
619
+ *
620
+ * You'll need a benchmark in your application to calculate the multiplier
621
+ * correctly depending on the tasks necessary. The multiplier is useless
622
+ * without a benchmark, unless you want to temporarily make updates very
623
+ * infrequent (or frequent) depending on what your application needs to do.
624
+ *
625
+ * = Parameters
626
+ * +_slowness+:: The multiplier used to offset the DOM update delay.
627
+ *
628
+ **/
629
+ setSlowness: function(_slowness) {
630
+ // we should replace this with an
631
+ // actual browser speed benchmark
632
+ ELEM._slowness = _slowness;
633
+ },
634
+
635
+ /** = Description
636
+ * Sets the idle delay.
637
+ *
638
+ * The idle delay is the amount of milliseconds between polling for something
639
+ * to flush to DOM. This is the setting affecting how long (max) it takes to
640
+ * start flushing the buffers after the buffers have been emptied.
641
+ *
642
+ * = Parameters
643
+ * +_idleDelay+:: The amount of milliseconds to wait before re-checking
644
+ * the buffers after going idle.
645
+ *
646
+ **/
647
+ setIdleDelay: function(_idleDelay) {
648
+ ELEM._idleDelay = _idleDelay;
649
+ },
650
+
651
+ // flag for IE6
652
+ _ieFixesNeeded: false,
653
+
654
+ /** = Description
655
+ * Flushes the buffers.
656
+ * Call this method manually, if you need to ensure all changes are
657
+ * flushed to the DOM before doing another operation.
658
+ *
659
+ * = Parameters:
660
+ * +_delay+:: Time (ms) before retrying, if another flushLoop is busy.
661
+ *
662
+ **/
663
+ flushLoop: function(_delay) {
664
+ var _this = ELEM;
665
+ _this._flushLoopCount++;
666
+ if (BROWSER_TYPE.ie6 && /* (_this._flushLoopCount % 5 === 0) && */ _this._ieFixesNeeded) {
667
+ //window.status = 'traversetree0:'+_this._flushLoopCount;
668
+ iefix._traverseTree();
669
+ _this._ieFixesNeeded = false;
670
+ }
671
+ clearTimeout(_this._timer);
672
+ if (_this._flushing) {
673
+ _delay *= 2;
674
+ _this._timer = setTimeout(
675
+ function(){
676
+ ELEM.flushLoop( _delay );
677
+ }, _delay
678
+ );
679
+ return;
680
+ } else {
681
+ if (!_this._needFlush) {
682
+ // goto sleep mode
683
+ if (BROWSER_TYPE.ie6 && _this._ieFixesNeeded) {
684
+ //window.status = 'traversetree1:'+_this._flushLoopCount;
685
+ iefix._traverseTree();
686
+ _this._ieFixesNeeded = false;
687
+ }
688
+ _this._timer = setTimeout(
689
+ function(){
690
+ ELEM.flushLoop(_delay);
691
+ }, _this._idleDelay
692
+ );
693
+ return;
694
+ }
695
+ _delay = parseInt(_this._slowness * (_this._flushTime / _this._flushCounter), ELEMTickerInterval);
696
+ if (_delay < _this._minDelay || !_delay) {
697
+ _delay = _this._minDelay;
698
+ }
699
+ _this._flushing = true;
700
+ _this._timer = setTimeout(
701
+ function(){
702
+ ELEM.flushLoop(_delay);
703
+ }, _delay
704
+ );
705
+ }
706
+ _this._flushTime -= new Date().getTime();
707
+ var i,
708
+ _id,
709
+ _elemTodo = _this._elemTodo,
710
+ _loopMaxL = _elemTodo.length,
711
+ _currTodo = _elemTodo.splice(0, _loopMaxL),
712
+ _flushStartTime = new Date().getTime();
713
+ for (i = 0; i < _loopMaxL; i++) {
714
+ _this._flushLoopFlushed++;
715
+ _id = _currTodo.pop();
716
+ _this._elemTodoH[_id] = false;
717
+ _this._flushStyleCache(_id);
718
+ _this._flushAttrCache(_id);
719
+ }
720
+ _this._flushCounter++;
721
+ _this._flushTime += new Date().getTime();
722
+ if (_this._elemTodo.length === 0 && _this._needFlush) {
723
+ _this._needFlush = false;
724
+ }
725
+ _this._flushing = false;
726
+ },
727
+
728
+ /* Method for flushing the attribute cache */
729
+ _flushAttrCache: function(_id) {
730
+ var _this = ELEM,
731
+ _attrTodo = _this._attrTodo[_id],
732
+ _attrCache = _this._attrCache[_id],
733
+ _elem = _this._elements[_id],
734
+ //_elemP=_elem.setAttribute,
735
+ _key,
736
+ _val,
737
+ i,
738
+ _iMax = _attrTodo.length,
739
+ _currTodo = _attrTodo.splice(0, _iMax);
740
+ for (i = 0; i !== _iMax; i++) {
741
+ _key = _currTodo.pop();
742
+ _val = _attrCache[_key];
743
+ _elem.setAttribute(_key, _val);
744
+ //_elem[_key]=_val;
745
+ }
746
+ },
747
+
748
+ /** = Description
749
+ * Gets a named element attribute.
750
+ *
751
+ * Regular element attributes are cached like the style attributes.
752
+ * Use this method to get an attribute from the element.
753
+ *
754
+ * = Parameters
755
+ * +_id+:: The ELEM ID.
756
+ * +_key+:: The Attribute name.
757
+ * +_bypass+:: A flag used to bypass the buffers (Optional, default: false)
758
+ *
759
+ * = Returns
760
+ * The attribute value.
761
+ *
762
+ **/
763
+ getAttr: function(_id, _key, _bypass) {
764
+ var _this = ELEM,
765
+ _attrVal = _this._attrCache[_id][_key],
766
+ _val;
767
+ if (_attrVal !== undefined && !_bypass) {
768
+ return _attrVal;
769
+ }
770
+ var _elem = _this._elements[_id];
771
+ if (_elem.getAttribute(_key) === null) {
772
+ _elem[_key] = '';
773
+ }
774
+ _val = _elem.getAttribute(_key);
775
+ _this._attrCache[_id][_key] = _val;
776
+ return _val;
777
+ },
778
+
779
+ /** = Description
780
+ * Sets a named element attribute value.
781
+ *
782
+ * Regular element attributes are cached like the style attributes.
783
+ * Use this method to set an attribute value to the element.
784
+ *
785
+ * = Parameters
786
+ * +_id+:: The ELEM ID.
787
+ * +_key+:: The Attribute name.
788
+ * +_value+:: The Attribute value.
789
+ * +_bypass+:: A flag used to bypass the buffers (Optional, default: false)
790
+ *
791
+ **/
792
+ setAttr: function(_id, _key, _value, _bypass) {
793
+ var _this = ELEM,
794
+ _attrTodo = _this._attrTodo[_id],
795
+ _attrCache = _this._attrCache[_id],
796
+ _differs = _value !== _this.getAttr(_id, _key);
797
+ if (_differs) {
798
+ _attrCache[_key] = _value;
799
+ if (_bypass) {
800
+ _this._elements[_id].setAttribute(_key, _value);
801
+ }
802
+ else {
803
+ if (_attrTodo.indexOf(_key) === -1) {
804
+ _attrTodo.push(_key);
805
+ }
806
+ if (!_this._elemTodoH[_id]) {
807
+ _this._elemTodo.push(_id);
808
+ _this._elemTodoH[_id] = true;
809
+ _this._checkNeedFlush();
810
+ }
811
+ }
812
+ }
813
+ },
814
+
815
+ /** = Description
816
+ * Deletes a named element attribute
817
+ *
818
+ * = Parameters
819
+ * +_id+:: The ELEM ID.
820
+ * +_key+:: The Attribute name.
821
+ *
822
+ **/
823
+ delAttr: function(_id, _key) {
824
+ var _differs,
825
+ _this = ELEM,
826
+ _attrTodo = _this._attrTodo[_id],
827
+ _attrCache = _this._attrCache[_id];
828
+ delete _attrCache[_key];
829
+ _this._elements[_id].removeAttribute(_key);
830
+ if (_attrTodo.indexOf(_key) !== -1) {
831
+ _attrTodo.splice(_attrTodo.indexOf(_key, 1));
832
+ }
833
+ if (_this._elemTodoH[_id]) {
834
+ _this._elemTodo.splice(_this._elemTodo.indexOf(_id, 1));
835
+ _this._elemTodoH[_id] = false;
836
+ _this._checkNeedFlush();
837
+ }
838
+ },
839
+
840
+ /** = Description
841
+ * Checks if a element has a CSS class name.
842
+ *
843
+ * = Parameters
844
+ * +_elemId+:: The ELEM ID.
845
+ * +_className+:: The CSS class name to check.
846
+ *
847
+ * = Returns
848
+ * Returns null, if the element does not exist
849
+ * Returns true, if the element has the class name set
850
+ * Returns false otherwise
851
+ *
852
+ **/
853
+ hasClassName: function(_elemId, _className) {
854
+ var _element = ELEM.get(_elemId);
855
+ if (!_element) {
856
+ return null;
857
+ }
858
+ var _classNames = _element.className.split(' ');
859
+ return (_classNames.indexOf(_className) !== -1);
860
+ },
861
+
862
+ /** = Description
863
+ * Adds a CSS class name to the element.
864
+ *
865
+ * = Parameters
866
+ * +_elemId+:: The ELEM ID.
867
+ * +_className+:: The CSS class name to add.
868
+ *
869
+ **/
870
+ addClassName: function(_elemId, _className) {
871
+ var _this = ELEM,
872
+ _element = _this.get(_elemId);
873
+ if (!_element) {
874
+ return;
875
+ }
876
+
877
+ if(_element.className === '' || _element.className === ' '){
878
+ _element.className = _className;
879
+ }
880
+ else{
881
+ var _classNames = _element.className.split(' '),
882
+ _index = _classNames.indexOf(_className);
883
+ if(_index===-1){
884
+ _classNames.push(_className);
885
+ _element.className = _classNames.join(' ');
886
+ }
887
+ }
888
+ },
889
+
890
+ /** = Description
891
+ * Removes the CSS class name from the element.
892
+ *
893
+ * = Parameters
894
+ * +_elemId+:: The ELEM ID.
895
+ * +_className+:: The CSS class name to remove.
896
+ *
897
+ **/
898
+ removeClassName: function(_elemId, _className) {
899
+ var _this = ELEM,
900
+ _element = _this.get(_elemId);
901
+ if (!_element) {
902
+ return;
903
+ }
904
+
905
+ if(!_this.hasClassName(_elemId, _className)){
906
+ return;
907
+ }
908
+
909
+ var _classNames = _element.className.split(' '),
910
+ _index = _classNames.indexOf(_className);
911
+ if(_index!==-1){
912
+ _classNames.splice(_index,1);
913
+ _element.className = _classNames.join(' ');
914
+ }
915
+ },
916
+
917
+ /* Checks, if the buffers need to be flushed. */
918
+ _checkNeedFlush: function() {
919
+ var _this = ELEM;
920
+ if (!_this._needFlush) {
921
+ _this._needFlush = true;
922
+ if (!_this._flushing) {
923
+ clearTimeout(_this._timer);
924
+ _this._timer = setTimeout( function(){ELEM.flushLoop(ELEM._minDelay);}, _this._minDelay);
925
+ }
926
+ }
927
+ },
928
+
929
+ /** = Description
930
+ * Sets the named element style attribute value.
931
+ *
932
+ * Use this method to set a style attribute value optimally.
933
+ * Element style attributes are buffered.
934
+ * The buffers are flushed on regular intervals.
935
+ *
936
+ * = Parameters
937
+ * +_id+:: The ELEM ID.
938
+ * +_key+:: The Style Attribute name.
939
+ * +_value+:: The Style Attribute value.
940
+ * +_bypass+:: A flag used to bypass the buffers (Optional, default: false)
941
+ *
942
+ **/
943
+ setStyle: function(_id, _key, _value, _bypass) {
944
+ var _this = ELEM,
945
+ _cached = _this._styleCache[_id],
946
+ _elems = _this._elements,
947
+ _differs,
948
+ _styleTodo;
949
+ _this._setStyleCount++;
950
+ if (_cached === undefined) {
951
+ _this._initCache(_id);
952
+ _cached = _this._styleCache[_id];
953
+ }
954
+ _differs = _value !== _cached[_key];
955
+ if (_differs) {
956
+ _this._setStyleDiffCount++;
957
+ _cached[_key] = _value;
958
+ if (_bypass) {
959
+ if (_key === 'opacity') {
960
+ _this.setOpacity(_id, _value);
961
+ }
962
+ else {
963
+ if( BROWSER_TYPE.ie ) {
964
+ var _camelKey = _key.replace(
965
+ /((-)([a-z])(\w))/g,
966
+ function($0, $1, $2, $3, $4) {
967
+ return $3.toUpperCase() + $4;
968
+ }
969
+ );
970
+ _elems[_id].style[_camelKey] = _cached[_key];
971
+ }
972
+ else {
973
+ _elems[_id].style.setProperty(_key, _cached[_key], '');
974
+ }
975
+ }
976
+ if (BROWSER_TYPE.ie6) {
977
+ if (iefix._traverseStyleProperties.indexOf(_key) !== -1) {
978
+ _this._ieFixesNeeded = true;
979
+ }
980
+ }
981
+ }
982
+ else {
983
+ _elemTodoH = _this._elemTodoH;
984
+ _styleTodo = _this._styleTodo[_id];
985
+ if (_styleTodo.indexOf(_key) === -1) {
986
+ _styleTodo.push(_key);
987
+ }
988
+ if (!_elemTodoH[_id]) {
989
+ _this._elemTodo.push(_id);
990
+ _elemTodoH[_id] = true;
991
+ _this._checkNeedFlush();
992
+ }
993
+ }
994
+ }
995
+ },
996
+
997
+ /** = Description
998
+ * Creates a new element inside another.
999
+ *
1000
+ * Use this method to create a new DOM element.
1001
+ *
1002
+ * = Parameters
1003
+ * +_targetId+:: The ELEM ID of the parent element.
1004
+ * (Optional, default: 0; the document body)
1005
+ *
1006
+ * +_tagName+:: The tag name of the element.
1007
+ * (Optional, default: 'DIV')
1008
+ *
1009
+ * = Returns
1010
+ * The new ELEM ID.
1011
+ *
1012
+ **/
1013
+ make: function(_targetId, _tagName) {
1014
+ if (_targetId === undefined) {
1015
+ _targetId = 0;
1016
+ }
1017
+ if (_tagName === undefined) {
1018
+ _tagName = 'DIV';
1019
+ } else {
1020
+ _tagName = _tagName.toUpperCase();
1021
+ }
1022
+ var _this = ELEM,
1023
+ _elem,
1024
+ _id;
1025
+ _this._makeCount++;
1026
+ if (_this._enableRecycler) {
1027
+ if (_this._recycler[_tagName]) {
1028
+ if (_this._recycler[_tagName].length !== 0) {
1029
+ // Recycle the id of a previously deleted element
1030
+ _id = _this._recycler[_tagName].pop();
1031
+ _this._recycler[_tagName]._countOut++;
1032
+ _elem = _this._elements[_id];
1033
+ //_elem.innerHTML='';
1034
+ /*
1035
+ if(_elem.tagName!==_tagName){
1036
+ _elem.outerHTML='<'+_tagName+'></'+_tagName+'>';
1037
+ }
1038
+ */
1039
+ if (_this._blockElems.indexOf(',' + _tagName + ',') !== -1) {
1040
+ _this.setCSS(_id, 'display:block;');
1041
+ } else {
1042
+ _this.setCSS(_id, 'display:inline;');
1043
+ }
1044
+ _this.append(_id, _targetId);
1045
+ return _id;
1046
+ }
1047
+ }
1048
+ }
1049
+ _elem = document.createElement(_tagName);
1050
+ _this._elements[_targetId].appendChild(_elem);
1051
+ _id = _this._add(_elem);
1052
+ _this._initCache(_id);
1053
+ return _id;
1054
+ },
1055
+
1056
+ /** = Description
1057
+ * Returns the inner size of the browser window.
1058
+ *
1059
+ * = Returns
1060
+ * An [ width, height ] pair as an Array.
1061
+ *
1062
+ **/
1063
+ windowSize: function() {
1064
+ return [
1065
+ (window.innerWidth) ? window.innerWidth: document.documentElement.clientWidth,
1066
+ (window.innerHeight) ? window.innerHeight: document.documentElement.clientHeight
1067
+ ];
1068
+ },
1069
+
1070
+ /** = Description
1071
+ * Gets the named element style attribute value.
1072
+ *
1073
+ * Use this method to get a style attribute value optimally.
1074
+ * Element style attributes are buffered.
1075
+ *
1076
+ * = Parameters
1077
+ * +_id+:: The ELEM ID.
1078
+ * +_key+:: The Style Attribute name.
1079
+ * +_bypass+:: A flag used to bypass the buffers (Optional, default: false)
1080
+ *
1081
+ * = Returns
1082
+ * The element style attribute value.
1083
+ *
1084
+ **/
1085
+ getStyle: function(_id, _key, _bypass){
1086
+ var _this=ELEM,
1087
+ _cached=_this._styleCache[_id],
1088
+ _retval;
1089
+ _this._getStyleCount++;
1090
+ if ((_cached[_key] === undefined) || _bypass) {
1091
+ if (!_bypass) {
1092
+ _this._getStyleMissCount++;
1093
+ }
1094
+ if ((_key === 'opacity') && _bypass) {
1095
+ _retval = _this.getOpacity(_id);
1096
+ }
1097
+ else {
1098
+ _retval = document.defaultView.getComputedStyle(_this._elements[_id], null).getPropertyValue(_key);
1099
+ }
1100
+ _cached[_key] = _retval;
1101
+ }
1102
+ return _cached[_key];
1103
+ },
1104
+
1105
+ /* The Internet Explorer version of getStyle */
1106
+ _getStyleIE: function( _id, _key, _bypass){
1107
+ var _this=ELEM,
1108
+ _cached=_this._styleCache[_id],
1109
+ _retval;
1110
+ _this._getStyleCount++;
1111
+ if ((_cached[_key] === undefined) || _bypass) {
1112
+ if (!_bypass) {
1113
+ _this._getStyleMissCount++;
1114
+ }
1115
+ if ((_key === 'opacity') && _bypass) {
1116
+ _retval = _this.getOpacity(_id);
1117
+ }
1118
+ else {
1119
+ _camelName = _key.replace(
1120
+ /((-)([a-z])(\w))/g,
1121
+ function($0, $1, $2, $3, $4) {
1122
+ return $3.toUpperCase() + $4;
1123
+ }
1124
+ );
1125
+ _this._elements[_id].currentStyle[_camelName];
1126
+ }
1127
+ _cached[_key] = _retval;
1128
+ }
1129
+ return _cached[_key];
1130
+ },
1131
+
1132
+ /* Style buffer flushing algorithm */
1133
+ _flushStyleCache: function(_id) {
1134
+ var _this = ELEM,
1135
+ _styleTodo = _this._styleTodo[_id],
1136
+ _cached = _this._styleCache[_id],
1137
+ _elem = _this._elements[_id],
1138
+ _elemS,
1139
+ _loopMaxP,
1140
+ _cid,
1141
+ _key,
1142
+ _currTodo,
1143
+ _retval;
1144
+ if (!_elem) {
1145
+ return;
1146
+ }
1147
+ _elemS = _elem.style;
1148
+ _loopMaxP = _styleTodo.length;
1149
+ _currTodo = _styleTodo.splice(0, _loopMaxP);
1150
+ for (_cid = 0; _cid !== _loopMaxP; _cid++) {
1151
+ _key = _currTodo.pop();
1152
+ _this._flushStylCount++;
1153
+ if (_key === 'opacity') {
1154
+ _retval = _this.setOpacity(_id, _cached[_key]);
1155
+ }
1156
+ else {
1157
+ _elemS.setProperty(_key, _cached[_key], '');
1158
+ }
1159
+ }
1160
+ },
1161
+
1162
+ /* Internet Explorer version of _flushStyleCache */
1163
+ _flushStyleCacheIE: function(_id) {
1164
+ var _this = ELEM,
1165
+ _styleTodo = _this._styleTodo[_id],
1166
+ _cached = _this._styleCache[_id],
1167
+ _elem = _this._elements[_id];
1168
+ if (!_elem) {
1169
+ return;
1170
+ }
1171
+ var _elemS = _elem.style,
1172
+ _loopMaxP = _styleTodo.length,
1173
+ i = 0,
1174
+ _key,
1175
+ _currTodo = _styleTodo.splice(0, _loopMaxP);
1176
+ for (; i !== _loopMaxP; i++) {
1177
+ _key = _currTodo.pop();
1178
+ _this._flushStylCount++;
1179
+ if (_key === 'opacity') {
1180
+ _this.setOpacity(_id, _cached[_key]);
1181
+ }
1182
+ else {
1183
+ if (BROWSER_TYPE.ie6) {
1184
+ if (iefix._traverseStyleProperties.indexOf(_key) !== -1) {
1185
+ _this._ieFixesNeeded = true;
1186
+ }
1187
+ }
1188
+ try {
1189
+ var _camelKey = _key.replace(
1190
+ /((-)([a-z])(\w))/g,
1191
+ function($0, $1, $2, $3, $4) {
1192
+ return $3.toUpperCase() + $4;
1193
+ }
1194
+ );
1195
+ // _elemS[_camelKey] = _cached[_key];
1196
+ _elemS.setAttribute(
1197
+ _camelKey,
1198
+ _cached[_key]
1199
+ );
1200
+ }
1201
+ catch(e) {
1202
+ console.log(e);
1203
+ }
1204
+ }
1205
+ }
1206
+ },
1207
+
1208
+ /* The ELEM "post-constructor" */
1209
+ _init: function() {
1210
+
1211
+ var _this = ELEM;
1212
+
1213
+ if (BROWSER_TYPE.ie6) {
1214
+ _this.getStyle = _this._getStyleIE;
1215
+ }
1216
+ if (BROWSER_TYPE.ie) {
1217
+ _this._flushStyleCache = _this._flushStyleCacheIE;
1218
+ }
1219
+
1220
+ if(!_this['_timer']){
1221
+ _this.bind(document.body);
1222
+ }
1223
+
1224
+ if (_this._enableRecycler) {
1225
+ _this._trashId = _this.make(0, 'div');
1226
+ _this.setCSS(_this._trashId, "display:none;visibility:hidden;");
1227
+ _this.setAttr(_this._trashId, 'id', 'trashcan_' + _this._trashId);
1228
+ }
1229
+
1230
+ if(BROWSER_TYPE.symbian){
1231
+ var TestClass = HClass.extend({
1232
+ test: true,
1233
+ constructor: null
1234
+ });
1235
+ // Symbian dies in the loop when loading itself cached on reload, restart loop by re-calling this function in 1 second.
1236
+ if(!TestClass.test){
1237
+ var _gotoOpera = confirm('Your Web Browser fails. Please restart the S60 Web Browser or install a better browser.\nDo you want to download and install Opera Mobile now?');
1238
+ if(_gotoOpera){
1239
+ location.href = 'http://www.opera.com/download/get.pl?sub=++++&id=32792&location=270&nothanks=yes';
1240
+ }
1241
+ // Can't do anything wightout proper JS support.
1242
+ return;
1243
+ }
1244
+ }
1245
+
1246
+ _this._flushDomLoadQueueBusy = false;
1247
+ while(!ELEM._initDone){
1248
+ ELEM._flushDomLoadQueue();
1249
+ }
1250
+ _this._timer = setTimeout( function(){ if(!ELEM._flushDomLoadQueueBusy){ELEM.flushLoop(ELEM._minDelay); }}, ELEM._minDelay );
1251
+ // _this._flushDomLoadQueueTimer = setInterval( function(){ELEM._flushDomLoadQueue();}, 10 );
1252
+
1253
+ // alert(_this._minDelay);
1254
+ },
1255
+
1256
+ _flushDomLoadQueue: function(){
1257
+ var _cmd,
1258
+ _type,
1259
+ _cmdResult;
1260
+ if(ELEM._domLoadQueue.length === 0){
1261
+ ELEM._initDone = true;
1262
+ }
1263
+ else {
1264
+ _cmd = ELEM._domLoadQueue.shift();
1265
+ _type = (typeof _cmd);
1266
+ if (_type === 'function') {
1267
+ _cmd.call();
1268
+ }
1269
+ else if (_type === 'string') {
1270
+ _cmdResult = eval(_cmd);
1271
+ if (typeof _cmdResult === 'string') {
1272
+ ELEM._domLoadQueue.push(_cmdResult);
1273
+ }
1274
+ }
1275
+ }
1276
+ },
1277
+
1278
+ /* Checks browser versions and starts the document load check */
1279
+ _warmup: function() {
1280
+ var _this = ELEM,
1281
+ _ua = navigator.userAgent,
1282
+ _isIE = (document.all && (_ua.indexOf("Opera") === -1)),
1283
+ _browserType = BROWSER_TYPE;
1284
+ _browserType.opera = _ua.indexOf("Opera") !== -1;
1285
+ _browserType.safari = _ua.indexOf("KHTML") !== -1;
1286
+ _browserType.symbian = _ua.indexOf("SymbianOS") !== -1;
1287
+ _browserType.chrome = _ua.indexOf("Chrome") !== -1;
1288
+ _browserType.ie = _isIE;
1289
+ _browserType.ie6 = _isIE && (_ua.indexOf("MSIE 6") !== -1);
1290
+ _browserType.ie7 = _isIE && (_ua.indexOf("MSIE 7") !== -1);
1291
+ _browserType.ie8 = _isIE && (_ua.indexOf("MSIE 8") !== -1);
1292
+ _browserType.firefox = _ua.indexOf("Firefox") !== -1;
1293
+ _browserType.firefox2 = _ua.indexOf("Firefox/2.") !== -1;
1294
+ _browserType.firefox3 = _ua.indexOf("Firefox/3.") !== -1;
1295
+ _this._domWaiter();
1296
+ },
1297
+
1298
+ /* Adds commands to be run when the document load check turns true */
1299
+ _domLoader: function(_cmd) {
1300
+ var _type = (typeof _cmd);
1301
+ if (ELEM._initDone === true) {
1302
+ if( _type === 'string' ) {
1303
+ eval(_cmd);
1304
+ }
1305
+ else if (_type === 'function'){
1306
+ _cmd.call();
1307
+ }
1308
+ }
1309
+ else {
1310
+ ELEM._domLoadQueue.push(_cmd);
1311
+ }
1312
+ },
1313
+
1314
+ /* Checks if the document is fully loaded */
1315
+ _domWaiter: function() {
1316
+ var _isloaded = false,
1317
+ _this = ELEM;
1318
+ // A hack for ie (ripped from DomLoaded.js)
1319
+ // http://www.cherny.com/demos/onload/domloaded.js
1320
+ if (BROWSER_TYPE.ie) {
1321
+ var _ie_proto = "javascript:void(0)";
1322
+ if (location.protocol === "https:") {
1323
+ _ie_proto = "src=//0";
1324
+ }
1325
+ document.write("<scr" + "ipt id=__ie_onload defer src=" + _ie_proto + "></scr" + "ipt>");
1326
+ var _ie_script = document.getElementById("__ie_onload");
1327
+ _ie_script.onreadystatechange = function() {
1328
+ if ((this.readyState === "complete") && true) {
1329
+ clearTimeout(ELEM._domLoadTimer);
1330
+ ELEM._domLoadStatus = true;
1331
+ ELEM._init();
1332
+ }
1333
+ };
1334
+ // the event will trigger on ie, so we don't have to keep on polling:
1335
+ return;
1336
+ }
1337
+
1338
+ // Safari / KHTML readyness detection:
1339
+ else if (BROWSER_TYPE.safari && document.readyState === 'complete'){
1340
+ // (/loaded|complete/.test(document.readyState))) {
1341
+ // (/loaded|complete/.test(document.readyState))) {
1342
+ _this._domLoadStatus = true;
1343
+ }
1344
+
1345
+ // Works for Mozilla:
1346
+ else if (document.body) {
1347
+ _this._domLoadStatus = true;
1348
+ }
1349
+
1350
+ if (_this._domLoadStatus) {
1351
+ clearTimeout(_this._domLoadTimer);
1352
+ if(BROWSER_TYPE.symbian){
1353
+ // document.body.innerHTML produces beyond-wtf "fastinnerhtml!", maybe they "fixed" an unit test?
1354
+ // see: http://trac.webkit.org/browser/S60/trunk/WebCore/khtml/html/html_elementimpl.cpp#L750
1355
+ //document.body.innerHTML += '';
1356
+
1357
+ // This check ensures we are use actually testing the beyond buggy S60 Web Browser.
1358
+ // Better versions are handled like regular safari/webkit/chrome/khtml
1359
+ BROWSER_TYPE.symbian = document.body.innerHTML === "fastinnerhtml!";
1360
+ // var _timer = setTimeout(_this._init, 5000);
1361
+ }
1362
+ // else {
1363
+ _this._init();
1364
+ // }
1365
+ }
1366
+ else {
1367
+ _this._domLoadTimer = setTimeout('ELEM._domWaiter()', ELEMTickerInterval * 10);
1368
+ }
1369
+ }
1370
+ };
1371
+ ELEM._constructor();
1372
+
1373
+ LOAD = ELEM._domLoader;
1374
+
1375
+ ELEM._warmup();
1376
+