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