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