rsence 2.1.11 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -15,7 +15,7 @@
|
|
15
15
|
<div class="button_edge_left"></div>
|
16
16
|
<div class="button_center"></div>
|
17
17
|
<div class="button_edge_right"></div>
|
18
|
-
<div class="button_label"
|
18
|
+
<div class="button_label">#{this.getLocaleString('HUploader.strings.ok')}</div>
|
19
19
|
<div class="button_antiselect"></div>
|
20
20
|
</div>
|
21
21
|
<form id="form#{this.elemId}" name="upload_form_#{this.elemId}" enctype="multipart/form-data" method="POST" action="/U/NoUploadKey" target="upload_target_#{this.elemId}" class="uploader_form">
|
@@ -0,0 +1,110 @@
|
|
1
|
+
## RSence
|
2
|
+
# Copyright 2008-2011 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
|
+
# The default locale settings, may be overridden on the server.
|
10
|
+
HLocale.components.HUploader =
|
11
|
+
strings:
|
12
|
+
ok: 'OK'
|
13
|
+
stateLabels:
|
14
|
+
# Upload success states:
|
15
|
+
'0': "Select file...",
|
16
|
+
'1': "Uploading...",
|
17
|
+
'2': "Processing data...",
|
18
|
+
'3': "Upload Complete",
|
19
|
+
'4': "Preparing upload",
|
20
|
+
# Upload failure states:
|
21
|
+
'-1': "Error: Invalid request",
|
22
|
+
'-2': "Error: Invalid upload key",
|
23
|
+
'-3': "Error: Invalid data format",
|
24
|
+
'-4': "Error: File too big",
|
25
|
+
'-6': "Error: Post-processing failed"
|
26
|
+
|
27
|
+
HUploader = HControl.extend
|
28
|
+
componentName: 'uploader'
|
29
|
+
uploadState: false
|
30
|
+
uploadKey: false
|
31
|
+
markupElemNames: [
|
32
|
+
'form',
|
33
|
+
'file',
|
34
|
+
'iframe',
|
35
|
+
'upload_progress',
|
36
|
+
'progress_label',
|
37
|
+
'progress_indicator',
|
38
|
+
'button',
|
39
|
+
'button_label',
|
40
|
+
'value',
|
41
|
+
'ack_button'
|
42
|
+
]
|
43
|
+
|
44
|
+
defaultEvents:
|
45
|
+
click: true
|
46
|
+
|
47
|
+
setUploadKey: (_uploadKey, _label)->
|
48
|
+
@setStyleOfPart( 'upload_progress', 'visibility', 'hidden' )
|
49
|
+
@setStyleOfPart( 'progress_indicator', 'visibility', 'hidden' )
|
50
|
+
@setStyleOfPart( 'ack_button', 'visibility', 'hidden' )
|
51
|
+
@setMarkupOfPart( 'button_label', _label )
|
52
|
+
@setStyleOfPart( 'button', 'visibility', 'inherit' )
|
53
|
+
@setStyleOfPart( 'form', 'visibility', 'inherit' )
|
54
|
+
@setAttrOfPart( 'form', 'action', '/U/'+_uploadKey, true )
|
55
|
+
@setAttrOfPart( 'file', 'value', '', true )
|
56
|
+
@uploadKey = _uploadKey
|
57
|
+
|
58
|
+
setProgressState: (_state, _label)->
|
59
|
+
@setStyleOfPart( 'upload_progress', 'visibility', 'inherit' )
|
60
|
+
if _state == 3
|
61
|
+
@setStyleOfPart( 'progress_indicator', 'visibility', 'hidden' )
|
62
|
+
@setStyleOfPart( 'ack_button', 'visibility', 'inherit' )
|
63
|
+
else
|
64
|
+
@setStyleOfPart( 'progress_indicator', 'visibility', 'inherit' )
|
65
|
+
@setStyleOfPart( 'ack_button', 'visibility', 'hidden' )
|
66
|
+
@setMarkupOfPart( 'progress_label', _label )
|
67
|
+
@setStyleOfPart( 'button', 'visibility', 'hidden' )
|
68
|
+
@setStyleOfPart( 'form', 'visibility', 'hidden' )
|
69
|
+
if _state == 1
|
70
|
+
@elemOfPart( 'form' ).submit()
|
71
|
+
|
72
|
+
setErrorState: (_label)->
|
73
|
+
@setStyleOfPart( 'progress_indicator', 'visibility', 'hidden' )
|
74
|
+
@setStyleOfPart( 'ack_button', 'visibility', 'inherit' )
|
75
|
+
@setMarkupOfPart( 'progress_label', '<span style="color:red;">'+_label+'</span>' )
|
76
|
+
@setStyleOfPart( 'button', 'visibility', 'hidden' )
|
77
|
+
@setStyleOfPart( 'form', 'visibility', 'hidden' )
|
78
|
+
|
79
|
+
setUploadState: (_state, _uploadKey)->
|
80
|
+
if _state != @uploadState
|
81
|
+
@uploadState = _state
|
82
|
+
_stateKey = _state.toString()
|
83
|
+
_stateLabels = HLocale.components.HUploader.strings.stateLabels
|
84
|
+
if _stateLabels[_stateKey]?
|
85
|
+
_label = _stateLabels[_stateKey]
|
86
|
+
ELEM.get(@markupElemIds.value).value = @valueObj.id
|
87
|
+
if _state == 0
|
88
|
+
@setUploadKey( _uploadKey, _label )
|
89
|
+
else if _state >= 1 and _state <= 4
|
90
|
+
@setProgressState( _state, _label )
|
91
|
+
else if _state < 0
|
92
|
+
@setErrorState( _label )
|
93
|
+
|
94
|
+
refreshValue: ->
|
95
|
+
return unless typeof @value == 'string'
|
96
|
+
return if @value.indexOf(':::') == -1
|
97
|
+
_stateAndKey = @value.split(':::')
|
98
|
+
return unless _stateAndKey.length == 2
|
99
|
+
@setUploadState(
|
100
|
+
parseInt( _stateAndKey[0], 10),
|
101
|
+
_stateAndKey[1]
|
102
|
+
)
|
103
|
+
upload: ->
|
104
|
+
@setValue( '1:::'+@uploadKey )
|
105
|
+
|
106
|
+
getNewUploadKey: ->
|
107
|
+
@setValue( '4:::'+@uploadKey )
|
108
|
+
|
109
|
+
click: ->
|
110
|
+
@getNewUploadKey() if @uploadState == 3 or @uploadState < 0
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
.window_shadow,
|
3
3
|
.window_titlebar,
|
4
4
|
.window_titlebar_edge_left,
|
5
5
|
.window_titlebar_center,
|
@@ -23,6 +23,29 @@
|
|
23
23
|
cursor: inherit;
|
24
24
|
background-repeat: no-repeat;
|
25
25
|
}
|
26
|
+
.window_bg, .window_body {
|
27
|
+
opacity: 0.95;
|
28
|
+
}
|
29
|
+
.window_titlebar {
|
30
|
+
opacity: 0.97;
|
31
|
+
}
|
32
|
+
.inactive .window_titlebar {
|
33
|
+
opacity: 0.95;
|
34
|
+
}
|
35
|
+
|
36
|
+
.window_shadow {
|
37
|
+
left: 4px; right: 4px; top: 4px; bottom: 4px;
|
38
|
+
overflow: visible;
|
39
|
+
-moz-box-shadow: 3px 3px 20px #333, 3px 3px 10px #000;
|
40
|
+
-webkit-box-shadow: 3px 3px 20px #333, 3px 3px 10px #000;
|
41
|
+
box-shadow: 3px 3px 20px #333, 3px 3px 10px #000;
|
42
|
+
}
|
43
|
+
|
44
|
+
.inactive .window_shadow {
|
45
|
+
-moz-box-shadow: 3px 3px 13px #333;
|
46
|
+
-webkit-box-shadow: 3px 3px 13px #333;
|
47
|
+
box-shadow: 3px 3px 13px #333;
|
48
|
+
}
|
26
49
|
|
27
50
|
.window_controls * {
|
28
51
|
cursor: pointer;
|
@@ -134,7 +157,7 @@
|
|
134
157
|
|
135
158
|
.window_label {
|
136
159
|
left: 0px; top: 0px; right: 0px; height: 24px;
|
137
|
-
line-height:
|
160
|
+
line-height: 26px;
|
138
161
|
text-align: center;
|
139
162
|
vertical-align: middle;
|
140
163
|
font-family: Arial, sans-serif;
|
@@ -177,7 +200,7 @@
|
|
177
200
|
}
|
178
201
|
|
179
202
|
.window_controls_close {
|
180
|
-
left: 8px;
|
203
|
+
#{BROWSER_TYPE.mac?'left':'right'}: 8px;
|
181
204
|
background-position: 0px 0px;
|
182
205
|
}
|
183
206
|
|
@@ -191,7 +214,7 @@
|
|
191
214
|
|
192
215
|
|
193
216
|
.window_controls_collapse {
|
194
|
-
left: 27px;
|
217
|
+
#{BROWSER_TYPE.mac?'left: 27px':'right: 46px'};
|
195
218
|
background-position: -30px 0px;
|
196
219
|
}
|
197
220
|
|
@@ -205,7 +228,7 @@
|
|
205
228
|
|
206
229
|
|
207
230
|
.window_controls_zoom {
|
208
|
-
left: 46px;
|
231
|
+
#{BROWSER_TYPE.mac?'left: 46px':'right: 27px'};
|
209
232
|
background-position: -15px 0px;
|
210
233
|
}
|
211
234
|
|
@@ -173,7 +173,9 @@ HWindow = HDynControl.extend({
|
|
173
173
|
}
|
174
174
|
return _rect;
|
175
175
|
},
|
176
|
-
|
176
|
+
|
177
|
+
hasWindowFocus: false,
|
178
|
+
|
177
179
|
/** Reports to HSystem that this window has the focus and the
|
178
180
|
* previously active window needs to blur
|
179
181
|
**/
|
@@ -184,6 +186,7 @@ HWindow = HDynControl.extend({
|
|
184
186
|
/** HSystem calls this method, whenever this window is allowed to be focused
|
185
187
|
**/
|
186
188
|
windowFocus: function(){
|
189
|
+
this.hasWindowFocus = true;
|
187
190
|
this.toggleCSSClass(this.elemId, 'inactive', false);
|
188
191
|
},
|
189
192
|
|
@@ -191,6 +194,7 @@ HWindow = HDynControl.extend({
|
|
191
194
|
* focus (another window focused)
|
192
195
|
**/
|
193
196
|
windowBlur: function(){
|
197
|
+
this.hasWindowFocus = false;
|
194
198
|
this.toggleCSSClass(this.elemId, 'inactive', true);
|
195
199
|
this.setStyle('cursor','default');
|
196
200
|
},
|
data/js/core/class/class.js
CHANGED
@@ -70,7 +70,7 @@ HClass.prototype = {
|
|
70
70
|
/* The property copying method. */
|
71
71
|
extend: function(_source, _value) {
|
72
72
|
var _extend = HClass.prototype.extend,
|
73
|
-
_ancestor, _method,
|
73
|
+
_ancestor, _method, _returnValue, i, _name, _prototype, _protected;
|
74
74
|
if (arguments.length === 2) {
|
75
75
|
_ancestor = this[_source];
|
76
76
|
// only methods are inherited
|
@@ -79,7 +79,7 @@ HClass.prototype = {
|
|
79
79
|
_method = _value;
|
80
80
|
_value = function() {
|
81
81
|
// saves the this.base that is the this.base method of this child
|
82
|
-
_previous = this.base;
|
82
|
+
var _previous = this.base;
|
83
83
|
// copies previous this.base from the direction from HClass
|
84
84
|
this.base = _ancestor;
|
85
85
|
// current class's method is called
|
@@ -129,6 +129,10 @@ HClass.prototype = {
|
|
129
129
|
} )
|
130
130
|
)( arguments );
|
131
131
|
};
|
132
|
+
this.hasAncestor = function( _obj ){
|
133
|
+
return this.ancestors.indexOf( _obj ) !== -1;
|
134
|
+
};
|
135
|
+
this['new'] = this.nu;
|
132
136
|
return this;
|
133
137
|
},
|
134
138
|
/** = Description
|
@@ -189,7 +193,8 @@ HClass.prototype = {
|
|
189
193
|
HClass.extend = function(_instance, _static) {
|
190
194
|
// reference to HClass's prototype extend method (HClass's class structure extend method)
|
191
195
|
var _extend = HClass.prototype.extend,
|
192
|
-
_prototype, _constructor, _klass, _object
|
196
|
+
_prototype, _constructor, _klass, _object,
|
197
|
+
_ancestors, i=0;
|
193
198
|
// if _instance is undefined,null,"" etc. creates object so that code below works
|
194
199
|
if (!_instance) {
|
195
200
|
_instance = {};
|
@@ -205,11 +210,13 @@ HClass.extend = function(_instance, _static) {
|
|
205
210
|
_prototype.constructor = this;
|
206
211
|
delete HClass._prototyping;
|
207
212
|
|
213
|
+
_ancestors = [];
|
208
214
|
_klass = function() {
|
209
215
|
if (!HClass._prototyping) {
|
210
216
|
_constructor.apply(this, arguments);
|
211
217
|
}
|
212
218
|
this.constructor = _klass;
|
219
|
+
this.ancestors = _ancestors;
|
213
220
|
};
|
214
221
|
// this is the new class's prototype (class structure)
|
215
222
|
_klass.prototype = _prototype;
|
@@ -231,8 +238,14 @@ HClass.extend = function(_instance, _static) {
|
|
231
238
|
if (_object.init instanceof Function) {
|
232
239
|
_object.init();
|
233
240
|
}
|
241
|
+
_ancestors.push( _object );
|
242
|
+
for( ; i < this.ancestors.length; i++ ){
|
243
|
+
_ancestors.push( this.ancestors[i] );
|
244
|
+
}
|
245
|
+
_object.ancestors = _ancestors;
|
234
246
|
return _object;
|
235
247
|
};
|
248
|
+
HClass.ancestors = [ HClass ];
|
236
249
|
|
237
250
|
/** = Description
|
238
251
|
* Copies the prototype properties and methods from _interface or if it is an object it's properties and functions
|
@@ -300,6 +313,12 @@ if ([]['indexOf']===undefined) {
|
|
300
313
|
};
|
301
314
|
}
|
302
315
|
|
316
|
+
// String fix
|
317
|
+
if(typeof String.prototype.trim !== 'function') {
|
318
|
+
String.prototype.trim = function() {
|
319
|
+
return this.replace(/^\s+|\s+$/g, '');
|
320
|
+
};
|
321
|
+
}
|
303
322
|
|
304
323
|
// ff version 3.0.3 fails on this, when firebug installed: try/catch block
|
305
324
|
try {
|
@@ -315,4 +334,3 @@ if(window['console']===undefined){
|
|
315
334
|
|
316
335
|
} catch(e) {}
|
317
336
|
|
318
|
-
|
@@ -0,0 +1,816 @@
|
|
1
|
+
|
2
|
+
###
|
3
|
+
BROWSER_TYPE contains browser types.
|
4
|
+
Used for quick checks mostly in layout code
|
5
|
+
###
|
6
|
+
BROWSER_TYPE =
|
7
|
+
mac: false
|
8
|
+
win: false
|
9
|
+
ie: false
|
10
|
+
ie6: false
|
11
|
+
ie7: false
|
12
|
+
ie8: false
|
13
|
+
ie9: false
|
14
|
+
ie10: false
|
15
|
+
opera: false
|
16
|
+
safari: false
|
17
|
+
symbian: false
|
18
|
+
chrome: false
|
19
|
+
firefox: false
|
20
|
+
firefox2: false
|
21
|
+
firefox3: false
|
22
|
+
firefox4: false # version 4 or newer
|
23
|
+
|
24
|
+
###
|
25
|
+
The DOM Element abstraction engine
|
26
|
+
###
|
27
|
+
ELEM = HClass.extend
|
28
|
+
|
29
|
+
constructor: null
|
30
|
+
|
31
|
+
###
|
32
|
+
Main control for refresh speed
|
33
|
+
###
|
34
|
+
ELEMTickerInterval: 33
|
35
|
+
|
36
|
+
###
|
37
|
+
Sets up object members
|
38
|
+
###
|
39
|
+
reset: ->
|
40
|
+
|
41
|
+
# Startup queue stuff
|
42
|
+
@_domLoadQueue = []
|
43
|
+
@_domLoadTimer = null
|
44
|
+
|
45
|
+
# Flag which turns to true, when the document body is detected as loaded
|
46
|
+
@_domLoadStatus = false
|
47
|
+
|
48
|
+
@_flushTime = 0
|
49
|
+
@_flushCounter = 0
|
50
|
+
@_idleDelay = 500
|
51
|
+
|
52
|
+
@_timer = null
|
53
|
+
@_minDelay = @ELEMTickerInterval
|
54
|
+
@_flushing = false
|
55
|
+
@_needFlush = false
|
56
|
+
@_slowness = 1
|
57
|
+
|
58
|
+
@_elements = {}
|
59
|
+
@_nextElemId = 0
|
60
|
+
@_freeElemIds = []
|
61
|
+
|
62
|
+
@_styleCache = {}
|
63
|
+
@_styleTodo = {}
|
64
|
+
@_attrTodo = {}
|
65
|
+
@_attrCache = {}
|
66
|
+
@_elemTodo = []
|
67
|
+
@_elemTodoH = {}
|
68
|
+
@_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,"
|
69
|
+
null
|
70
|
+
|
71
|
+
###
|
72
|
+
Adds an element reference
|
73
|
+
Returns the element id
|
74
|
+
###
|
75
|
+
_add: (_elem)->
|
76
|
+
if @_freeElemIds.length != 0
|
77
|
+
_id = @_freeElemIds.shift()
|
78
|
+
else
|
79
|
+
_id = @_nextElemId
|
80
|
+
@_nextElemId++
|
81
|
+
@_elements[_id] = _elem
|
82
|
+
_id
|
83
|
+
|
84
|
+
###
|
85
|
+
Initializes cache object helpers
|
86
|
+
###
|
87
|
+
_initCache: (_id)->
|
88
|
+
@_styleTodo[_id] = []
|
89
|
+
@_styleCache[_id] = {}
|
90
|
+
@_attrTodo[_id] = []
|
91
|
+
@_attrCache[_id] = {}
|
92
|
+
@_elemTodoH[_id] = false
|
93
|
+
null
|
94
|
+
|
95
|
+
###
|
96
|
+
Adds an existing document element by its id attribute
|
97
|
+
###
|
98
|
+
bindId: (_attrId)->
|
99
|
+
_elem = document.getElementById( _attrId )
|
100
|
+
_id = @_add( _elem )
|
101
|
+
@_initCache( _id )
|
102
|
+
_id
|
103
|
+
|
104
|
+
###
|
105
|
+
Binds the document element
|
106
|
+
###
|
107
|
+
bind: (_elem)->
|
108
|
+
_id = @_add( _elem )
|
109
|
+
@_initCache( _id )
|
110
|
+
_id
|
111
|
+
|
112
|
+
###
|
113
|
+
Returns an element by its id
|
114
|
+
###
|
115
|
+
get: (_id)->
|
116
|
+
@_elements[_id]
|
117
|
+
|
118
|
+
###
|
119
|
+
Sets the innerHTML contents of the element
|
120
|
+
###
|
121
|
+
setHTML: (_id, _html)->
|
122
|
+
@_elements[_id].innerHTML = _html unless @_elements[_id].innerHTML == _html
|
123
|
+
null
|
124
|
+
|
125
|
+
###
|
126
|
+
Returns the innerHTML of the element
|
127
|
+
###
|
128
|
+
getHTML: (_id)->
|
129
|
+
@_elements[_id].innerHTML
|
130
|
+
|
131
|
+
###
|
132
|
+
Deletes an element and its associated metadata
|
133
|
+
###
|
134
|
+
del: (_id)->
|
135
|
+
_elem = @_elements[_id]
|
136
|
+
i = @_elemTodo.indexOf( _id )
|
137
|
+
@_elemTodo.splice( i, 1 ) unless i == -1
|
138
|
+
delete @_attrTodo[_id]
|
139
|
+
delete @_styleCache[_id]
|
140
|
+
delete @_attrCache[_id]
|
141
|
+
delete @_elemTodoH[_id]
|
142
|
+
delete @_elements[_id]
|
143
|
+
@_freeElemIds.push(_id)
|
144
|
+
_elem.parentNode.removeChild( _elem )
|
145
|
+
null
|
146
|
+
|
147
|
+
###
|
148
|
+
Places the source element inside the target element
|
149
|
+
###
|
150
|
+
append: (_srcId, _tgtId)->
|
151
|
+
@_elements[_tgtId].appendChild @_elements[_srcId]
|
152
|
+
|
153
|
+
###
|
154
|
+
Replaces all styles of an element with a block of css text
|
155
|
+
###
|
156
|
+
setCSS: (_id, _css)->
|
157
|
+
@_elements[_id].style.cssText = _css
|
158
|
+
null
|
159
|
+
|
160
|
+
###
|
161
|
+
Returns the current css text of an element
|
162
|
+
###
|
163
|
+
getCSS: (_id)->
|
164
|
+
@_elements[_id].style.cssText
|
165
|
+
|
166
|
+
###
|
167
|
+
Returns the visible size of an element as a [ width, height ] tuple
|
168
|
+
###
|
169
|
+
getVisibleSize: (_id)->
|
170
|
+
_elem = @_elements[_id]
|
171
|
+
[ _body, _visible, _overflow ] = [ 'body', 'visible', 'overflow' ]
|
172
|
+
[ w, h ] = [ _elem.offsetWidth, _elem.offsetHeight ]
|
173
|
+
_parent = _elem.parentNode
|
174
|
+
while _parent and _parent.nodeName.toLowerCase() != _body
|
175
|
+
if _visible == @_getComputedStyle( _parent, _overflow )
|
176
|
+
[ _parentClientWidth, _parentClientHeight ] = [ _parent.clientWidth, _parent.clientHeight ]
|
177
|
+
w = _parentClientWidth - _elem.offsetLeft if w > _parentClientWidth
|
178
|
+
h = _parentClientWidth - _elem.offsetTop if h > _parentClientHeight
|
179
|
+
_elem = _elem.parentNode
|
180
|
+
break unless _parent.parentNode
|
181
|
+
_parent = _parent.parentNode
|
182
|
+
[ w, h ]
|
183
|
+
|
184
|
+
###
|
185
|
+
Returns the full offset size of the element as a [ width, height ] tuple
|
186
|
+
###
|
187
|
+
getSize: (_id)->
|
188
|
+
_elem = @_elements[_id]
|
189
|
+
[ _elem.offsetWidth, _elem.offsetHeight ]
|
190
|
+
|
191
|
+
###
|
192
|
+
Returns the position of the element as a [ x, y ] tuple
|
193
|
+
###
|
194
|
+
getPosition: (_id)->
|
195
|
+
_elem = @_elements[_id]
|
196
|
+
[ _elem.offsetLeft, _elem.offsetTop ]
|
197
|
+
|
198
|
+
###
|
199
|
+
Returns the scroll position of the element as a [ x, y ] tuple
|
200
|
+
###
|
201
|
+
getScrollPosition: (_id)->
|
202
|
+
_elem = @_elements[_id]
|
203
|
+
[ _elem.scrollLeft, _elem.scrollTop ]
|
204
|
+
|
205
|
+
###
|
206
|
+
Returns the scroll size of the element as a [ width, height ] tuple
|
207
|
+
###
|
208
|
+
getScrollSize: (_id)->
|
209
|
+
_elem = @_elements[_id]
|
210
|
+
[ _elem.scrollWidth, _elem.scrollHeight ]
|
211
|
+
|
212
|
+
###
|
213
|
+
Calculates the visible left position of an element
|
214
|
+
###
|
215
|
+
_getVisibleLeftPosition: (_id)->
|
216
|
+
_elem = @_elements[_id]
|
217
|
+
x = 0
|
218
|
+
while _elem != document
|
219
|
+
x += _elem.offsetLeft - _elem.scrollLeft
|
220
|
+
_elem = _elem.parentNode
|
221
|
+
x
|
222
|
+
|
223
|
+
###
|
224
|
+
Calculates the visible top position of an element
|
225
|
+
###
|
226
|
+
_getVisibleTopPosition: (_id)->
|
227
|
+
_elem = @_elements[_id]
|
228
|
+
y = 0
|
229
|
+
while _elem != document
|
230
|
+
y += _elem.offsetTop - _elem.scrollTop
|
231
|
+
_elem = _elem.parentNode
|
232
|
+
y
|
233
|
+
|
234
|
+
###
|
235
|
+
Returns the visible position of the element as a [ left, top ] tuble
|
236
|
+
###
|
237
|
+
getVisiblePosition: (_id)->
|
238
|
+
[ @_getVisibleLeftPosition(_id), @_getVisibleTopPosition(_id) ]
|
239
|
+
|
240
|
+
###
|
241
|
+
Returns the opacity on the element as a number equaling or between 0 and 1
|
242
|
+
###
|
243
|
+
getOpacity: (_id)->
|
244
|
+
_elem = @_elements[_id]
|
245
|
+
_opacity = @_getComputedStyle( _elem, 'opacity' )
|
246
|
+
parseFloat( _opacity )
|
247
|
+
|
248
|
+
###
|
249
|
+
Sets ActiveX alpha filter for IE6-8
|
250
|
+
###
|
251
|
+
_setOpacityIE: (_id, _opacity)->
|
252
|
+
_prevFilter = @getStyle( _id, 'filter', true )
|
253
|
+
if _opacity == 1
|
254
|
+
@_elements[_id].style.setAttribute('filter', _prevFilter.replace(/alpha([^)]*)/gi, '') )
|
255
|
+
else
|
256
|
+
@_elements[_id].style.setAttribute('filter', _prevFilter.replace(/alpha([^)]*)/gi, '') + 'alpha(opacity='+(_opacity*100)+')')
|
257
|
+
null
|
258
|
+
|
259
|
+
###
|
260
|
+
Sets the opcity of the element as a number equaling or between 0 and 1
|
261
|
+
###
|
262
|
+
setOpacity: (_id, _opacity)->
|
263
|
+
if BROWSER_TYPE.ie6 or BROWSER_TYPE.ie7 or BROWSER_TYPE.ie8
|
264
|
+
@_setOpacityIE( _id, _opacity)
|
265
|
+
else
|
266
|
+
@_elements[_id].style.setProperty('opacity', _opacity.toString(), '')
|
267
|
+
null
|
268
|
+
|
269
|
+
###
|
270
|
+
Wrapper for getStyle, returns an integer number instead of a string
|
271
|
+
###
|
272
|
+
getIntStyle: (_id, _key)->
|
273
|
+
parseInt( @getStyle(_id, _key), 10 )
|
274
|
+
|
275
|
+
###
|
276
|
+
Sets box coordinates [ x, y, width, height ]
|
277
|
+
###
|
278
|
+
setBoxCoords: (_id, _coords)->
|
279
|
+
[ x, y, w, h ] = _coords
|
280
|
+
@setStyle( _id, 'left', x+'px' )
|
281
|
+
@setStyle( _id, 'top', y+'px' )
|
282
|
+
@setStyle( _id, 'width', w+'px' )
|
283
|
+
@setStyle( _id, 'height', h+'px' )
|
284
|
+
null
|
285
|
+
|
286
|
+
###
|
287
|
+
Gets box coordinates [ x, y, width, height )
|
288
|
+
###
|
289
|
+
getBoxCoords: (_id)->
|
290
|
+
[ x, y ] = @getPosition( _id )
|
291
|
+
[ w, h ] = @getSize( _id )
|
292
|
+
[ x, y, w, h ]
|
293
|
+
|
294
|
+
###
|
295
|
+
Computes extra size (padding and border size) of element
|
296
|
+
###
|
297
|
+
_getExtraSize: (_id, _side)->
|
298
|
+
@getIntStyle( _id, 'padding-'+_side ) + @getIntStyle( _id, 'border-'+_side+'-width' )
|
299
|
+
|
300
|
+
###
|
301
|
+
Returns left-side padding and border size
|
302
|
+
###
|
303
|
+
_getExtraLeftWidth: (_id)->
|
304
|
+
@_getExtraSize( _id, 'left' )
|
305
|
+
|
306
|
+
###
|
307
|
+
Returns right-side padding and border size
|
308
|
+
###
|
309
|
+
_getExtraRightWidth: (_id)->
|
310
|
+
@_getExtraSize( _id, 'right' )
|
311
|
+
|
312
|
+
###
|
313
|
+
Returns top-side padding and border size
|
314
|
+
###
|
315
|
+
_getExtraTopWidth: (_id)->
|
316
|
+
@_getExtraSize( _id, 'top' )
|
317
|
+
|
318
|
+
###
|
319
|
+
Returns right-side padding and border size
|
320
|
+
###
|
321
|
+
_getExtraBottomWidth: (_id)->
|
322
|
+
@_getExtraSize( _id, 'bottom' )
|
323
|
+
|
324
|
+
###
|
325
|
+
Returns extra width of element (caused by padding and borders)
|
326
|
+
###
|
327
|
+
getExtraWidth: (_id)->
|
328
|
+
@_getExtraSize( _id, 'left' ) + @_getExtraSize( _id, 'right' )
|
329
|
+
|
330
|
+
###
|
331
|
+
Returns extra height of element (caused by padding and borders)
|
332
|
+
###
|
333
|
+
getExtraHeight: (_id)->
|
334
|
+
@_getExtraSize( _id, 'top' ) + @_getExtraSize( _id, 'bottom' )
|
335
|
+
|
336
|
+
###
|
337
|
+
Sets delay between refreshes based on the target frame rate
|
338
|
+
###
|
339
|
+
setFPS: (_fps)->
|
340
|
+
@_minDelay = 1000/_fps
|
341
|
+
@_minDelay = @ELEMTickerInterval if @_minDelay < @ELEMTickerInterval
|
342
|
+
null
|
343
|
+
|
344
|
+
###
|
345
|
+
Sets slowness (weighted additional multiplier for slow browsers; frame-skip)
|
346
|
+
The d-efault 1.0 does not change the FPS, larger numbers gives more time for logic by skipping frames
|
347
|
+
###
|
348
|
+
setSlowness: (_slow)->
|
349
|
+
@_slowness = _slow
|
350
|
+
null
|
351
|
+
|
352
|
+
###
|
353
|
+
Sets the idle delay in ms
|
354
|
+
This is the maximum time between setting a style or property into the buffer and flushing the buffer to the DOM
|
355
|
+
###
|
356
|
+
setIdleDelay: (_idleDelay)->
|
357
|
+
@_idleDelay = _idleDelay
|
358
|
+
null
|
359
|
+
|
360
|
+
###
|
361
|
+
A flag that signals iefix (for IE6) if it needs to re-run or not
|
362
|
+
###
|
363
|
+
_ieFixesNeeded: false
|
364
|
+
|
365
|
+
###
|
366
|
+
Applies fixes for IE6
|
367
|
+
###
|
368
|
+
_ieFixes: ->
|
369
|
+
iefix._traverseTree()
|
370
|
+
@_ieFixesNeeded = false
|
371
|
+
null
|
372
|
+
|
373
|
+
###
|
374
|
+
Re-sets the flushLoop
|
375
|
+
###
|
376
|
+
_resetFlushLoop: (_delay, _timeDelay)->
|
377
|
+
_timeDelay = _delay unless _timeDelay
|
378
|
+
@_timer = setTimeout( ->
|
379
|
+
ELEM.flushLoop( _delay )
|
380
|
+
, _timeDelay )
|
381
|
+
null
|
382
|
+
|
383
|
+
###
|
384
|
+
Computes a default delay time based on various params
|
385
|
+
###
|
386
|
+
_defaultDelay: ->
|
387
|
+
_delay = Math.round( @_slowness * (@_flushTime / @_flushCounter) ) # + @ELEMTickerInterval ??
|
388
|
+
_delay = @_minDelay if _delay < @_minDelay or !_delay
|
389
|
+
_delay
|
390
|
+
|
391
|
+
###
|
392
|
+
Flushes buffered styles and properties into the DOM
|
393
|
+
###
|
394
|
+
flushLoop: (_delay)->
|
395
|
+
_delay = @_defaultDelay() unless _delay?
|
396
|
+
@_ieFixes() if BROWSER_TYPE.ie6 and @_ieFixesNeeded
|
397
|
+
clearTimeout(@_timer)
|
398
|
+
if @_flushing
|
399
|
+
_delay *= 2
|
400
|
+
@_resetFlushLoop( _delay )
|
401
|
+
else
|
402
|
+
unless @_needFlush
|
403
|
+
# go into 'sleep mode'
|
404
|
+
@_ieFixes() if BROWSER_TYPE.ie6 and @_ieFixesNeeded
|
405
|
+
@_resetFlushLoop( _delay, @_idleDelay )
|
406
|
+
return
|
407
|
+
_delay = @_defaultDelay()
|
408
|
+
@_flushing = true
|
409
|
+
@_resetFlushLoop( _delay )
|
410
|
+
@_performFlush()
|
411
|
+
@_flushing = false
|
412
|
+
null
|
413
|
+
|
414
|
+
# Alias for flushLoop
|
415
|
+
flush: ->
|
416
|
+
@flushLoop()
|
417
|
+
|
418
|
+
###
|
419
|
+
Performs the flush of flushLoop
|
420
|
+
###
|
421
|
+
_performFlush: ->
|
422
|
+
_flushStartTime = new Date().getTime()
|
423
|
+
@_flushTime -= _flushStartTime
|
424
|
+
_loopMaxL = @_elemTodo.length
|
425
|
+
if _loopMaxL > 0
|
426
|
+
_currTodo = @_elemTodo.splice( 0, _loopMaxL )
|
427
|
+
for i in [ 1.._loopMaxL ]
|
428
|
+
@_flushLoopFlushed++
|
429
|
+
_id = _currTodo.shift()
|
430
|
+
if _id == null
|
431
|
+
console.log('no id:',_id)
|
432
|
+
continue
|
433
|
+
@_elemTodoH[_id] = false
|
434
|
+
@_flushStyleCache( _id )
|
435
|
+
@_flushAttrCache( _id )
|
436
|
+
@_flushCounter++
|
437
|
+
@_flushTime += new Date().getTime()
|
438
|
+
@_needFlush = @_elemTodo.length != 0 # unless @_needFlush
|
439
|
+
null
|
440
|
+
|
441
|
+
###
|
442
|
+
Flushes the attribute cache
|
443
|
+
###
|
444
|
+
_flushAttrCache: (_id)->
|
445
|
+
_attrTodo = @_attrTodo[_id]
|
446
|
+
return null if _attrTodo.length == 0
|
447
|
+
_attrCache = @_attrCache[_id]
|
448
|
+
_elem = @_elements[_id]
|
449
|
+
_loopMaxL = _attrTodo.length
|
450
|
+
_currTodo = _attrTodo.splice( 0, _loopMaxL )
|
451
|
+
for i in [ 1.._loopMaxL ]
|
452
|
+
_key = _currTodo.shift()
|
453
|
+
_val = _attrCache[_key]
|
454
|
+
_elem.setAttribute( _key, _val )
|
455
|
+
null
|
456
|
+
|
457
|
+
###
|
458
|
+
Gets an element attribute directly from the element
|
459
|
+
###
|
460
|
+
_getAttrDirect: (_id, _key)->
|
461
|
+
_elem = @_elements[_id]
|
462
|
+
_elem.getAttribute( _key )
|
463
|
+
|
464
|
+
###
|
465
|
+
Gets a named element attribute from the cache or selectively direct
|
466
|
+
###
|
467
|
+
getAttr: (_id, _key, _noCache)->
|
468
|
+
if _noCache
|
469
|
+
_val = @_getAttrDirect( _id, _key )
|
470
|
+
else
|
471
|
+
_val = @_attrCache[_id][_key]
|
472
|
+
@_attrCache[_id][_key] = _val
|
473
|
+
_val
|
474
|
+
|
475
|
+
###
|
476
|
+
Sets a named element attribute into the cache and buffer or selectively direct
|
477
|
+
###
|
478
|
+
setAttr: (_id, _key, _value, _noCache)->
|
479
|
+
_attrTodo = @_attrTodo[_id]
|
480
|
+
_attrCache = @_attrCache[_id]
|
481
|
+
@_elements[_id].setAttribute( _key, _value ) if _noCache
|
482
|
+
_reCache = _value != @getAttr( _id, _key )
|
483
|
+
if _reCache or _noCache
|
484
|
+
_attrCache[_key] = _value
|
485
|
+
unless _noCache
|
486
|
+
_attrTodo.push( _key ) if _attrTodo.indexOf( _key ) == -1
|
487
|
+
unless @_elemTodoH[_id]
|
488
|
+
@_elemTodo.push( _id )
|
489
|
+
@_elemTodoH[ _id ] = true
|
490
|
+
@_checkNeedFlush()
|
491
|
+
null
|
492
|
+
|
493
|
+
###
|
494
|
+
Deletes a named element attribute
|
495
|
+
###
|
496
|
+
delAttr: (_id, _key)->
|
497
|
+
_attrTodo = @_attrtodo[_id]
|
498
|
+
_attrCache = @_attrCache[_id]
|
499
|
+
delete _attrCache[_key]
|
500
|
+
@_elements[_id].removeAttribute( _key )
|
501
|
+
_todoIndex = _attrTodo.indexOf( _key )
|
502
|
+
_attrTodo.splice( _todoIndex, 1 ) unless _todoIndex == -1
|
503
|
+
@_checkNeedFlush()
|
504
|
+
null
|
505
|
+
|
506
|
+
###
|
507
|
+
Checks if the element has a named CSS className
|
508
|
+
###
|
509
|
+
hasClassName: (_id, _className)->
|
510
|
+
_classNames = @_elements[_id].className.split(' ')
|
511
|
+
return _classNames.indexOf( _className ) != -1
|
512
|
+
|
513
|
+
###
|
514
|
+
Adds a named CSS className to the element
|
515
|
+
###
|
516
|
+
addClassName: (_id, _className)->
|
517
|
+
unless @hasClassName( _id, _className )
|
518
|
+
_elem = @_elements[_id]
|
519
|
+
if _elem.className.trim() == ''
|
520
|
+
_elem.className = _className
|
521
|
+
else
|
522
|
+
_classNames = _elem.className.trim().split(' ')
|
523
|
+
_classNames.push(_className)
|
524
|
+
_elem.className = _classNames.join(' ')
|
525
|
+
null
|
526
|
+
|
527
|
+
###
|
528
|
+
Removes a named CSS className of the element
|
529
|
+
###
|
530
|
+
removeClassName: (_id, _className)->
|
531
|
+
if @hasClassName( _id, _className )
|
532
|
+
_elem = @_elements[_id]
|
533
|
+
_classNames = _elem.className.split(' ')
|
534
|
+
_classNames.splice( _classNames.indexOf( _className ), 1 )
|
535
|
+
_elem.className = _classNames.join(' ')
|
536
|
+
null
|
537
|
+
|
538
|
+
###
|
539
|
+
Checks if buffers need to be flushed
|
540
|
+
###
|
541
|
+
_checkNeedFlush: ->
|
542
|
+
unless @_needFlush
|
543
|
+
@_needFlush = true
|
544
|
+
unless @_flushing
|
545
|
+
clearTimeout( @_timer)
|
546
|
+
@_resetFlushLoop( @_minDelay )
|
547
|
+
null
|
548
|
+
|
549
|
+
###
|
550
|
+
Low-level style property setter
|
551
|
+
###
|
552
|
+
_setElementStyle: (_elem, _key, _value)->
|
553
|
+
_elem.style.setProperty( _key, _value, '' )
|
554
|
+
null
|
555
|
+
|
556
|
+
###
|
557
|
+
Camelizes string (mostly used for IE attribute name conversions)
|
558
|
+
###
|
559
|
+
_camelize: (_str)->
|
560
|
+
_str.replace( /((-)([a-z])(\w))/g, ($0, $1, $2, $3, $4)->
|
561
|
+
$3.toUpperCase()+$4
|
562
|
+
)
|
563
|
+
|
564
|
+
###
|
565
|
+
Decamelizes string (used for js property to css property conversion)
|
566
|
+
###
|
567
|
+
_deCamelize: (_str)->
|
568
|
+
_str.replace( /(([A-Z])(\w))/g, ($0, $1, $2, $3)->
|
569
|
+
'-'+$2.toLowerCase()+$3
|
570
|
+
)
|
571
|
+
|
572
|
+
###
|
573
|
+
IE version of _setElementStyle
|
574
|
+
###
|
575
|
+
_setElementStyleIE: (_elem, _key, _value)->
|
576
|
+
_elem.style[@_camelize(_key)] = _value
|
577
|
+
if BROWSER_TYPE.ie6
|
578
|
+
unless iefix._traverseStyleProperties.indexOf(_key) == -1
|
579
|
+
@_ieFixesNeeded = true
|
580
|
+
null
|
581
|
+
|
582
|
+
###
|
583
|
+
Sets and buffers the named style attribute value or selectively direct
|
584
|
+
###
|
585
|
+
setStyle: (_id, _key, _value, _noCache)->
|
586
|
+
if _id == undefined
|
587
|
+
console.log('ERROR; undefined id in ELEM#setStyle(',_id, _key, _value, _noCache,')')
|
588
|
+
_noCache = true if BROWSER_TYPE.ie9
|
589
|
+
try
|
590
|
+
_cached = @_styleCache[_id]
|
591
|
+
catch e
|
592
|
+
console.error( e, this )
|
593
|
+
_elem = @_elements[_id]
|
594
|
+
if _cached == undefined
|
595
|
+
@_initCache( _id )
|
596
|
+
_cached = @_styleCache[_id]
|
597
|
+
_key = @_deCamelize( _key )
|
598
|
+
unless _value == _cached[_key]
|
599
|
+
_cached[_key] = _value
|
600
|
+
if _noCache
|
601
|
+
if _key == 'opacity'
|
602
|
+
@setOpacity( _id, _value )
|
603
|
+
else
|
604
|
+
@_setElementStyle( _elem, _key, _value )
|
605
|
+
else
|
606
|
+
_styleTodo = @_styleTodo[_id]
|
607
|
+
_styleTodo.push( _key ) if _styleTodo.indexOf( _key ) == -1
|
608
|
+
unless @_elemTodoH[_id]
|
609
|
+
@_elemTodo.push( _id )
|
610
|
+
@_elemTodoH[_id] = true
|
611
|
+
@_checkNeedFlush()
|
612
|
+
null
|
613
|
+
|
614
|
+
###
|
615
|
+
Creates a new element inside another element
|
616
|
+
###
|
617
|
+
make: (_targetId, _tagName, _options)->
|
618
|
+
_targetId = 0 if _targetId == undefined
|
619
|
+
if _tagName == undefined
|
620
|
+
_tagName = 'DIV'
|
621
|
+
else
|
622
|
+
_tagName = _tagName.toUpperCase()
|
623
|
+
_elem = document.createElement( _tagName )
|
624
|
+
_id = @_add( _elem )
|
625
|
+
@_initCache( _id )
|
626
|
+
unless _options == undefined
|
627
|
+
if _options.attrs
|
628
|
+
for _attr in _options.attrs
|
629
|
+
@setAttr( _id, _attr[0], _attr[1], true )
|
630
|
+
@_elements[_targetId].appendChild(_elem)
|
631
|
+
_id
|
632
|
+
|
633
|
+
###
|
634
|
+
Returns inner size of the browser window as [ width, height ]
|
635
|
+
###
|
636
|
+
windowSize: ->
|
637
|
+
_size = [ window.innerWidth, window.innerHeight ]
|
638
|
+
if _size[0] == undefined or _size[1] == undefined
|
639
|
+
_docElem = document.documentElement
|
640
|
+
_size = [ _docElem.clientWidth, _docElem.clientHeight ]
|
641
|
+
_size
|
642
|
+
|
643
|
+
###
|
644
|
+
Returns computed style of element
|
645
|
+
###
|
646
|
+
_getComputedStyle: (_elem, _key)->
|
647
|
+
document.defaultView.getComputedStyle( _elem, null ).getPropertyValue( _key )
|
648
|
+
|
649
|
+
###
|
650
|
+
IE version of _getComputedStyle
|
651
|
+
###
|
652
|
+
_getComputedStyleIE: (_elem, _key)->
|
653
|
+
return _elem.clientWidth if _key == 'width'
|
654
|
+
return _elem.clientHeight if _key == 'height'
|
655
|
+
_elem.currentStyle[@_camelize(_key)]
|
656
|
+
|
657
|
+
###
|
658
|
+
Gets the named element style attribute value.
|
659
|
+
###
|
660
|
+
getStyle: (_id, _key, _noCache)->
|
661
|
+
_cached = @_styleCache[_id]
|
662
|
+
_key = @_deCamelize(_key)
|
663
|
+
if _cached[_key] == undefined or _noCache
|
664
|
+
if _key == 'opacity'
|
665
|
+
_value = @getOpacity(_id)
|
666
|
+
else
|
667
|
+
_value = @_getComputedStyle( @_elements[_id], _key )
|
668
|
+
_value = -1 if _key == 'z-index' and _value == 'auto'
|
669
|
+
_cached[_key] = _value
|
670
|
+
else
|
671
|
+
_value = _cached[_key]
|
672
|
+
_value
|
673
|
+
|
674
|
+
###
|
675
|
+
Style buffer flushing method
|
676
|
+
###
|
677
|
+
_flushStyleCache: (_id)->
|
678
|
+
_elem = @_elements[_id]
|
679
|
+
return unless _elem
|
680
|
+
_styleTodo = @_styleTodo[_id]
|
681
|
+
_cached = @_styleCache[_id]
|
682
|
+
_loopMaxP = _styleTodo.length
|
683
|
+
return null if _loopMaxP == 0
|
684
|
+
_currTodo = _styleTodo.splice( 0, _loopMaxP )
|
685
|
+
for i in [ 1.._loopMaxP ]
|
686
|
+
_key = _currTodo.shift()
|
687
|
+
if _key == 'opacity'
|
688
|
+
@setOpacity( _id, _cached[_key] )
|
689
|
+
else
|
690
|
+
console.log( 'invalid style key:',_elem, _key, _cached) unless _key
|
691
|
+
@_setElementStyle( _elem, _key, _cached[_key] )
|
692
|
+
null
|
693
|
+
|
694
|
+
###
|
695
|
+
Final phase of startup, when document is loaded
|
696
|
+
###
|
697
|
+
_init: ->
|
698
|
+
RSenceInit() if RSenceInit?
|
699
|
+
if BROWSER_TYPE.ie
|
700
|
+
@_getComputedStyle = @_getComputedStyleIE
|
701
|
+
@_setElementStyle = @_setElementStyleIE
|
702
|
+
@bind( document.body ) unless @_timer
|
703
|
+
if BROWSER_TYPE.symbian
|
704
|
+
TestClass = HClass.extend({test:true, constructor:null})
|
705
|
+
# The Symbian JS implementation gets corrupted if the page is reloaded (loaded from cache), this tests that:
|
706
|
+
unless TestClass.test
|
707
|
+
if 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?')
|
708
|
+
location.href = 'http://www.opera.com/download/get.pl?sub=++++&id=32792&location=270¬hanks=yes'
|
709
|
+
# Can't do anything with such badly broken js engine
|
710
|
+
return
|
711
|
+
@_flushDomLoadQueue() until @_initDone
|
712
|
+
@_resetFlushLoop( @_minDelay )
|
713
|
+
null
|
714
|
+
|
715
|
+
###
|
716
|
+
Runs a cmd
|
717
|
+
###
|
718
|
+
_runCmd: (_cmd)->
|
719
|
+
_type = ( typeof _cmd )
|
720
|
+
if _type == 'function'
|
721
|
+
_cmd.call()
|
722
|
+
else if _type == 'string'
|
723
|
+
console.log("Evaluation of LOAD strings no longer supported. Please convert to anonymous function: "+_cmd)
|
724
|
+
null
|
725
|
+
|
726
|
+
###
|
727
|
+
Processes the queue for tasks to run upon completion of document load
|
728
|
+
###
|
729
|
+
_flushDomLoadQueue: ->
|
730
|
+
if @_domLoadQueue.length == 0
|
731
|
+
@_initDone = true
|
732
|
+
return
|
733
|
+
else
|
734
|
+
@_runCmd( @_domLoadQueue.shift() )
|
735
|
+
null
|
736
|
+
|
737
|
+
###
|
738
|
+
Does browser version checks and starts the document loaded check poll
|
739
|
+
###
|
740
|
+
_warmup: ->
|
741
|
+
_ua = navigator.userAgent
|
742
|
+
_browserType = BROWSER_TYPE
|
743
|
+
_browserType.opera = _ua.indexOf('Opera') != -1
|
744
|
+
_browserType.safari = _ua.indexOf('KHTML') != -1
|
745
|
+
_browserType.symbian = _ua.indexOf('SymbianOS') != -1
|
746
|
+
_browserType.chrome = _ua.indexOf('Chrome') != -1
|
747
|
+
_isIE = document.all and not _browserType.opera
|
748
|
+
if _isIE
|
749
|
+
_browserType.ie = _isIE
|
750
|
+
_browserType.ie6 = _ua.indexOf('MSIE 6') != -1
|
751
|
+
_browserType.ie7 = _ua.indexOf('MSIE 7') != -1
|
752
|
+
_browserType.ie8 = _ua.indexOf('MSIE 8') != -1
|
753
|
+
_browserType.ie9 = _ua.indexOf('MSIE 9') != -1
|
754
|
+
_browserType.ie10 = _ua.indexOf('MSIE 10') != -1
|
755
|
+
unless _browserType.ie9
|
756
|
+
_browserType.ie9 = _browserType.ie10 # IE 10 is treated like IE 9
|
757
|
+
_browserType.mac = _ua.indexOf('Macintosh') != -1
|
758
|
+
_browserType.win = _ua.indexOf('Windows') != -1
|
759
|
+
_browserType.firefox = _ua.indexOf('Firefox') != -1
|
760
|
+
_browserType.firefox2 = _ua.indexOf('Firefox/2.') != -1
|
761
|
+
_browserType.firefox3 = _ua.indexOf('Firefox/3.') != -1
|
762
|
+
_browserType.firefox4 = _browserType.firefox and not _browserType.firefox2 and not _browserType.firefox3
|
763
|
+
@_domWaiter()
|
764
|
+
null
|
765
|
+
|
766
|
+
###
|
767
|
+
Adds tasks to run when the document load check is completed
|
768
|
+
###
|
769
|
+
_domLoader: (_cmd)->
|
770
|
+
if ELEM._initDone
|
771
|
+
ELEM._runCmd( _cmd )
|
772
|
+
else
|
773
|
+
ELEM._domLoadQueue.push( _cmd )
|
774
|
+
null
|
775
|
+
|
776
|
+
###
|
777
|
+
Checks if the document is fully loaded
|
778
|
+
###
|
779
|
+
_domWaiter: ->
|
780
|
+
if BROWSER_TYPE.ie6 or BROWSER_TYPE.ie7 or BROWSER_TYPE.ie8
|
781
|
+
if location.protocol == 'https:'
|
782
|
+
_ie_proto = 'src=//0'
|
783
|
+
else
|
784
|
+
_ie_proto = 'javascript:void(0)'
|
785
|
+
_s1 = '<scr'
|
786
|
+
_s2 = 'ipt id=__ie_onload defer src='
|
787
|
+
_s3 = '></scr'
|
788
|
+
_s4 = 'ipt>'
|
789
|
+
document.write(_s1+_s2+_ie_proto+_s3+_s4)
|
790
|
+
document.getElementById('__ie_onload').onreadystatechange = ->
|
791
|
+
if this.readyState == 'complete'
|
792
|
+
clearTimeout( ELEM._domLoadTimer )
|
793
|
+
ELEM._domLoadStatus = true
|
794
|
+
ELEM._init()
|
795
|
+
return
|
796
|
+
else if BROWSER_TYPE.safari and document.readyState == 'complete'
|
797
|
+
ELEM._domLoadStatus = true
|
798
|
+
else if document.body
|
799
|
+
ELEM._domLoadStatus = true
|
800
|
+
|
801
|
+
if ELEM._domLoadStatus
|
802
|
+
clearTimeout( @_domLoadTimer )
|
803
|
+
BROWSER_TYPE.symbian = document.body.innerHTML == 'fastinnerhtml!' if BROWSER_TYPE.symbian
|
804
|
+
@_init()
|
805
|
+
else
|
806
|
+
ELEM._domLoadTimer = setTimeout( =>
|
807
|
+
ELEM._domWaiter()
|
808
|
+
, 10 )
|
809
|
+
null
|
810
|
+
ELEM.reset()
|
811
|
+
|
812
|
+
ElementManager = ELEM
|
813
|
+
|
814
|
+
LOAD = ELEM._domLoader
|
815
|
+
|
816
|
+
ELEM._warmup()
|