rsence-pre 2.2.0.15 → 2.2.0.16

Sign up to get free protection for your applications and to get access to all the features.
data/INSTALL.rdoc CHANGED
@@ -25,12 +25,12 @@ This is a list of system level dependencies. You only need to do this step once;
25
25
 
26
26
  === Mac OS X
27
27
 
28
- ==== Mac OS X 10.6
28
+ ==== Mac OS X 10.6 "Snow Leopard" and 10.7 "Lion"
29
29
 
30
30
  * Install *XCode*[http://developer.apple.com/mac/] to get the essential development tools, like compilers.
31
31
  * Proceed to section 3.0
32
32
 
33
- ==== Mac OS X 10.4 and 10.5
33
+ ==== Mac OS X 10.4 "Tiger" and 10.5 "Leopard"
34
34
 
35
35
  This step applies only to Mac OS X 10.4 "Tiger" and 10.5 "Leopard". The default ruby build of these versions of Mac OS X is somewhat broken.
36
36
 
data/README.rdoc CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- = RSence-2.1.0[http://rsence.org/]
2
+ = RSence-2.2.0[http://rsence.org/]
3
3
 
4
4
  == Introduction
5
5
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.2.0.15.pre
1
+ 2.2.0.16.pre
@@ -53,28 +53,37 @@ HSheet = HControl.extend({
53
53
  var
54
54
  _this = this,
55
55
  _elemId = _this.elemId,
56
- _styl = ELEM.setStyle,
57
56
  _rect = _this.rect,
58
57
  _width = _rect.width,
59
58
  _top = _rect.top,
60
59
  _left = 0-Math.floor(_rect.width/2)+_rect.left,
61
- _height = _rect.height;
62
-
63
- _styl( _elemId, 'left', '0px');
64
- _styl( _elemId, 'top', '0px');
65
- _styl( _elemId, 'right', '0px');
66
- _styl( _elemId, 'bottom', '0px');
67
- _styl( _elemId, 'width', 'auto');
68
- _styl( _elemId, 'height', 'auto');
69
- _styl( _elemId, 'min-width', _width+'px');
70
- _styl( _elemId, 'min-height', _height+'px');
71
-
60
+ _height = _rect.height,
61
+ _styles = [
62
+ 'left', '0px',
63
+ 'top', '0px',
64
+ 'right', '0px',
65
+ 'bottom', '0px',
66
+ 'width', 'auto',
67
+ 'height', 'auto',
68
+ 'min-width', _width+'px',
69
+ 'min-height', _height+'px'
70
+ ],
71
+ i = 0, _len;;
72
+ for( _len = _styles.length*2; i < _len; i+=2 ){
73
+ ELEM.setStyle( _elemId, _styles[i][0], _styles[i+1][1] );
74
+ }
72
75
  if(_this['markupElemIds']){
73
76
  var _stateId = _this.markupElemIds['state'];
74
- _styl( _stateId, 'left', _left+'px' );
75
- _styl( _stateId, 'top', _top+'px' );
76
- _styl( _stateId, 'width', _width+'px' );
77
- _styl( _stateId, 'height', _height+'px' );
77
+ _styles = [
78
+ 'left', _left+'px',
79
+ 'top', _top+'px',
80
+ 'width', _width+'px',
81
+ 'height', _height+'px'
82
+ ];
83
+ i = 0;
84
+ for( _len = _styles.length*2; i < _len; i+=2 ){
85
+ ELEM.setStyle( _stateId, _styles[i][0], _styles[i+1][1] );
86
+ }
78
87
  }
79
88
  //-- Show the rectangle once it gets created, unless visibility was set to++
80
89
  //-- hidden in the constructor.++
@@ -141,17 +141,19 @@ HStepper = HControl.extend({
141
141
  mouseDown: function( x, y ){
142
142
  this.setMouseUp(true);
143
143
  this._setRepeatInterval( ( y - ELEM.getVisiblePosition( this.elemId )[1] ) <= 11 );
144
-
144
+ return true;
145
145
  },
146
146
 
147
147
  /** Stops the repeating stepping, when the mouse button goes up
148
148
  **/
149
149
  mouseUp: function(){
150
150
  this._clearRepeatInterval();
151
+ return true;
151
152
  },
152
153
 
153
154
  click: function(){
154
155
  this.mouseUp();
156
+ return true;
155
157
  },
156
158
 
157
159
  /** Stops the repeating stepping, when the control becomes inactive
@@ -186,18 +188,21 @@ HStepper = HControl.extend({
186
188
  else if (_keyCode === Event.KEY_PAGEDOWN) {
187
189
  this._setRepeatInterval( 0 );
188
190
  }
191
+ return true;
189
192
  },
190
193
 
191
194
  /** stops the repeating when a key goes up
192
195
  **/
193
196
  keyUp: function(){
194
197
  this._clearRepeatInterval();
198
+ return true;
195
199
  },
196
200
 
197
201
  /** steps the value up/down based on the mouse scroll wheel
198
202
  **/
199
203
  mouseWheel: function(_delta) {
200
204
  (_delta>0)?this.stepUp():this.stepDown();
205
+ return true;
201
206
  }
202
207
 
203
208
 
@@ -0,0 +1,763 @@
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
+ opera: false
15
+ safari: false
16
+ symbian: false
17
+ chrome: false
18
+ firefox: false
19
+ firefox2: false
20
+ firefox3: false
21
+ firefox4: false
22
+
23
+ ###
24
+ The DOM Element abstraction engine
25
+ ###
26
+ ELEM = HClass.extend({
27
+
28
+ constructor: null
29
+
30
+ ###
31
+ Main control for refresh speed
32
+ ###
33
+ ELEMTickerInterval: 33
34
+
35
+ ###
36
+ Sets up object members
37
+ ###
38
+ reset: ->
39
+
40
+ # Startup queue stuff
41
+ @_domLoadQueue = []
42
+ @_domLoadTimer = null
43
+
44
+ # Flag which turns to true, when the document body is detected as loaded
45
+ @_domLoadStatus = false
46
+
47
+ @_flushTime = 0
48
+ @_flushCounter = 0
49
+ @_idleDelay = 500
50
+
51
+ @_timer = null
52
+ @_minDelay = @ELEMTickerInterval
53
+ @_flushing = false
54
+ @_needFlush = false
55
+ @_slowness = 1
56
+
57
+ @_elements = {}
58
+ @_nextElemId = 0
59
+ @_freeElemIds = []
60
+
61
+ @_styleCache = {}
62
+ @_styleTodo = {}
63
+ @_attrTodo = {}
64
+ @_attrCache = {}
65
+ @_elemTodo = []
66
+ @_elemTodoH = {}
67
+ @_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,"
68
+ null
69
+
70
+ ###
71
+ Adds an element reference
72
+ Returns the element id
73
+ ###
74
+ _add: (_elem)->
75
+ if @_freeElemIds.length != 0
76
+ _id = @_freeElemIds.shift()
77
+ else
78
+ _id = @_nextElemId
79
+ @_nextElemId++
80
+ @_elements[_id] = _elem
81
+ _id
82
+
83
+ ###
84
+ Initializes cache object helpers
85
+ ###
86
+ _initCache: (_id)->
87
+ @_styleTodo[_id] = []
88
+ @_styleCache[_id] = {}
89
+ @_attrTodo[_id] = []
90
+ @_attrCache[_id] = {}
91
+ @_elemTodoH[_id] = false
92
+ null
93
+
94
+ ###
95
+ Adds an existing document element by its id attribute
96
+ ###
97
+ bindId: (_attrId)->
98
+ _elem = document.getElementById( _attrId )
99
+ _id = @_add( _elem )
100
+ @_initCache( _id )
101
+ _id
102
+
103
+ ###
104
+ Binds the document element
105
+ ###
106
+ bind: (_elem)->
107
+ _id = @_add( _elem )
108
+ @_initCache( _id )
109
+ _id
110
+
111
+ ###
112
+ Returns an element by its id
113
+ ###
114
+ get: (_id)->
115
+ @_elements[_id]
116
+
117
+ ###
118
+ Sets the innerHTML contents of the element
119
+ ###
120
+ setHTML: (_id, _html)->
121
+ @_elements[_id].innerHTML = _html unless @_elements[_id].innerHTML == _html
122
+ null
123
+
124
+ ###
125
+ Returns the innerHTML of the element
126
+ ###
127
+ getHTML: (_id)->
128
+ @_elements[_id].innerHTML
129
+
130
+ ###
131
+ Deletes an element and its associated metadata
132
+ ###
133
+ del: (_id)->
134
+ _elem = @_elements[_id]
135
+ i = @_elemTodo.indexOf( _id )
136
+ @_elemTodo.splice( i, 1 ) unless i == -1
137
+ delete @_attrTodo[_id]
138
+ delete @_styleCache[_id]
139
+ delete @_attrCache[_id]
140
+ delete @_elemTodoH[_id]
141
+ delete @_elements[_id]
142
+ @_freeElemIds.push(_id)
143
+ _elem.parentNode.removeChild( _elem )
144
+ null
145
+
146
+ ###
147
+ Places the source element inside the target element
148
+ ###
149
+ append: (_srcId, _tgtId)->
150
+ @_elements[_tgtId].appendChild @_elements[_srcId]
151
+
152
+ ###
153
+ Replaces all styles of an element with a block of css text
154
+ ###
155
+ setCSS: (_id, _css)->
156
+ @_elements[_id].style.cssText = _css
157
+ null
158
+
159
+ ###
160
+ Returns the current css text of an element
161
+ ###
162
+ getCSS: (_id)->
163
+ @_elements[_id].style.cssText
164
+
165
+ ###
166
+ Returns the visible size of an element as a [ width, height ] tuple
167
+ ###
168
+ getVisibleSize: (_id)->
169
+ _elem = @_elements[_id]
170
+ [ _body, _visible, _overflow ] = [ 'body', 'visible', 'overflow' ]
171
+ [ w, h ] = [ _elem.offsetWidth, _elem.offsetHeight ]
172
+ _parent = _elem.parentNode
173
+ while _parent and _parent.nodeName.toLowerCase() != _body
174
+ if _visible == @_getComputedStyle( _parent, _overflow )
175
+ [ _parentClientWidth, _parentClientHeight ] = [ _parent.clientWidth, _parent.clientHeight ]
176
+ w = _parentClientWidth - _elem.offsetLeft if w > _parentClientWidth
177
+ h = _parentClientWidth - _elem.offsetTop if h > _parentClientHeight
178
+ [ _elem, _parent ] = [ _elem.parentNode, _elem.parentNode ]
179
+ [ w, h ]
180
+
181
+ ###
182
+ Returns the full offset size of the element as a [ width, height ] tuple
183
+ ###
184
+ getSize: (_id)->
185
+ _elem = @_elements[_id]
186
+ [ _elem.offsetWidth, _elem.offsetHeight ]
187
+
188
+ ###
189
+ Returns the scroll size of the element as a [ width, height ] tuple
190
+ ###
191
+ getScrollSize: (_id)->
192
+ _elem = @_elements[_id]
193
+ [ _elem.scrollWidth, _elem.scrollHeight ]
194
+
195
+ ###
196
+ Calculates the visible left position of an element
197
+ ###
198
+ _getVisibleLeftPosition: (_id)->
199
+ _elem = @_elements[_id]
200
+ x = 0
201
+ while _elem != document
202
+ x += _elem.offsetLeft - _elem.scrollLeft
203
+ _elem = _elem.parentNode
204
+ x
205
+
206
+ ###
207
+ Calculates the visible top position of an element
208
+ ###
209
+ _getVisibleTopPosition: (_id)->
210
+ _elem = @_elements[_id]
211
+ y = 0
212
+ while _elem != document
213
+ y += _elem.offsetTop - _elem.scrollTop
214
+ _elem = _elem.parentNode
215
+ y
216
+
217
+ ###
218
+ Returns the visible position of the element as a [ left, top ] tuble
219
+ ###
220
+ getVisiblePosition: (_id)->
221
+ [ @_getVisibleLeftPosition(_id), @_getVisibleTopPosition(_id) ]
222
+
223
+ ###
224
+ Returns the opacity on the element as a number equaling or between 0 and 1
225
+ ###
226
+ getOpacity: (_id)->
227
+ _elem = @_elements[_id]
228
+ _opacity = @_getComputedStyle( _elem, 'opacity' )
229
+ parseFloat( _opacity )
230
+
231
+ ###
232
+ Sets ActiveX alpha filter for IE6-8
233
+ ###
234
+ _setOpacityIE: (_id, _opacity)->
235
+ _prevFilter = @getStyle( _id, 'filter', true )
236
+ if _opacity == 1
237
+ @_elements[_id].style.setAttribute('filter', _prevFilter.replace(/alpha([^)]*)/gi, '') )
238
+ else
239
+ @_elements[_id].style.setAttribute('filter', _prevFilter.replace(/alpha([^)]*)/gi, '') + 'alpha(opacity='+(_opacity*100)+')')
240
+ null
241
+
242
+ ###
243
+ Sets the opcity of the element as a number equaling or between 0 and 1
244
+ ###
245
+ setOpacity: (_id, _opacity)->
246
+ @_elements[_id].style.setProperty('opacity', _opacity, '')
247
+ @_setOpacityIE( _id, _opacity) if BROWSER_TYPE.ie6 or BROWSER_TYPE.ie7 or BROWSER_TYPE.ie8
248
+ null
249
+
250
+ ###
251
+ Wrapper for getStyle, returns an integer number instead of a string
252
+ ###
253
+ getIntStyle: (_id, _key)->
254
+ parseInt( @getStyle(_id, _key), 10 )
255
+
256
+ ###
257
+ Sets box coordinates [ x, y, width, height ]
258
+ ###
259
+ setBoxCoords: (_id, _coords)->
260
+ [ x, y, w, h ] = _coords
261
+ @setStyle( _id, 'left', x+'px' )
262
+ @setStyle( _id, 'top', y+'px' )
263
+ @setStyle( _id, 'width', w+'px' )
264
+ @setStyle( _id, 'height', h+'px' )
265
+ null
266
+
267
+ ###
268
+ Computes extra size (padding and border size) of element
269
+ ###
270
+ _getExtraSize: (_id, _side)->
271
+ @getIntStyle( _id, 'padding-'+_side ) + @getIntStyle( _id, 'border-'+_side+'-width' )
272
+
273
+ ###
274
+ Returns left-side padding and border size
275
+ ###
276
+ _getExtraLeftWidth: (_id)->
277
+ @_getExtraSize( _id, 'left' )
278
+
279
+ ###
280
+ Returns right-side padding and border size
281
+ ###
282
+ _getExtraRightWidth: (_id)->
283
+ @_getExtraSize( _id, 'right' )
284
+
285
+ ###
286
+ Returns top-side padding and border size
287
+ ###
288
+ _getExtraTopWidth: (_id)->
289
+ @_getExtraSize( _id, 'top' )
290
+
291
+ ###
292
+ Returns right-side padding and border size
293
+ ###
294
+ _getExtraBottomWidth: (_id)->
295
+ @_getExtraSize( _id, 'bottom' )
296
+
297
+ ###
298
+ Returns extra width of element (caused by padding and borders)
299
+ ###
300
+ getExtraWidth: (_id)->
301
+ @_getExtraSize( _id, 'left' ) + @_getExtraSize( _id, 'right' )
302
+
303
+ ###
304
+ Returns extra height of element (caused by padding and borders)
305
+ ###
306
+ getExtraHeight: (_id)->
307
+ @_getExtraSize( _id, 'top' ) + @_getExtraSize( _id, 'bottom' )
308
+
309
+ ###
310
+ Sets delay between refreshes based on the target frame rate
311
+ ###
312
+ setFPS: (_fps)->
313
+ @_minDelay = 1000/_fps
314
+ @_minDelay = @ELEMTickerInterval if @_minDelay < @ELEMTickerInterval
315
+ null
316
+
317
+ ###
318
+ Sets slowness (weighted additional multiplier for slow browsers; frame-skip)
319
+ The d-efault 1.0 does not change the FPS, larger numbers gives more time for logic by skipping frames
320
+ ###
321
+ setSlowness: (_slow)->
322
+ @_slowness = _slow
323
+ null
324
+
325
+ ###
326
+ Sets the idle delay in ms
327
+ This is the maximum time between setting a style or property into the buffer and flushing the buffer to the DOM
328
+ ###
329
+ setIdleDelay: (_idleDelay)->
330
+ @_idleDelay = _idleDelay
331
+ null
332
+
333
+ ###
334
+ A flag that signals iefix (for IE6) if it needs to re-run or not
335
+ ###
336
+ _ieFixesNeeded: false
337
+
338
+ ###
339
+ Applies fixes for IE6
340
+ ###
341
+ _ieFixes: ->
342
+ iefix._traverseTree()
343
+ @_ieFixesNeeded = false
344
+ null
345
+
346
+ ###
347
+ Re-sets the flushLoop
348
+ ###
349
+ _resetFlushLoop: (_delay, _timeDelay)->
350
+ _timeDelay = _delay unless _timeDelay
351
+ @_timer = setTimeout( ->
352
+ ELEM.flushLoop( _delay )
353
+ , _timeDelay )
354
+ null
355
+
356
+ ###
357
+ Computes a default delay time based on various params
358
+ ###
359
+ _defaultDelay: ->
360
+ _delay = Math.round( @_slowness * (@_flushTime / @_flushCounter) ) # + @ELEMTickerInterval ??
361
+ _delay = @_minDelay if _delay < @_minDelay or !_delay
362
+ _delay
363
+
364
+ ###
365
+ Flushes buffered styles and properties into the DOM
366
+ ###
367
+ flushLoop: (_delay)->
368
+ @_ieFixes() if BROWSER_TYPE.ie6 and @_ieFixesNeeded
369
+ clearTimeout(@_timer)
370
+ if @_flushing
371
+ _delay *= 2
372
+ @_resetFlushLoop( _delay )
373
+ else
374
+ unless @_needFlush
375
+ # go into 'sleep mode'
376
+ @_ieFixes() if BROWSER_TYPE.ie6 and @_ieFixesNeeded
377
+ @_resetFlushLoop( _delay, @_idleDelay )
378
+ return
379
+ _delay = @_defaultDelay()
380
+ @_flushing = true
381
+ @_resetFlushLoop( _delay )
382
+ @_performFlush()
383
+ @_flushing = false
384
+ null
385
+
386
+ ###
387
+ Performs the flush of flushLoop
388
+ ###
389
+ _performFlush: ->
390
+ _flushStartTime = new Date().getTime()
391
+ @_flushTime -= _flushStartTime
392
+ _loopMaxL = @_elemTodo.length
393
+ #if _loopMaxL > 0
394
+ _currTodo = @_elemTodo.splice( 0, _loopMaxL )
395
+ for i in [ 1.._loopMaxL ]
396
+ @_flushLoopFlushed++
397
+ _id = _currTodo.shift()
398
+ @_elemTodoH[_id] = false
399
+ @_flushStyleCache( _id )
400
+ @_flushAttrCache( _id )
401
+ @_flushCounter++
402
+ @_flushTime += new Date().getTime()
403
+ @_needFlush = @_elemTodo.length != 0 # unless @_needFlush
404
+ null
405
+
406
+ ###
407
+ Flushes the attribute cache
408
+ ###
409
+ _flushAttrCache: (_id)->
410
+ _attrTodo = @_attrTodo[_id]
411
+ return null if _attrTodo.length == 0
412
+ _attrCache = @_attrCache[_id]
413
+ _elem = @_elements[_id]
414
+ _loopMaxL = _attrTodo.length
415
+ _currTodo = _attrTodo.splice( 0, _loopMaxL )
416
+ for i in [ 1.._loopMaxL ]
417
+ _key = _currTodo.shift()
418
+ _val = _attrCache[_key]
419
+ _elem.setAttribute( _key, _val )
420
+ null
421
+
422
+ ###
423
+ Gets an element attribute directly from the element
424
+ ###
425
+ _getAttrDirect: (_id, _key)->
426
+ _elem = @_elements[_id]
427
+ _elem.getAttribute( _key )
428
+
429
+ ###
430
+ Gets a named element attribute from the cache or selectively direct
431
+ ###
432
+ getAttr: (_id, _key, _noCache)->
433
+ if _noCache
434
+ _val = @_getAttrDirect( _id, _key )
435
+ else
436
+ _val = @_attrCache[_id][_key]
437
+ @_attrCache[_id][_key] = _val
438
+ _val
439
+
440
+ ###
441
+ Sets a named element attribute into the cache and buffer or selectively direct
442
+ ###
443
+ setAttr: (_id, _key, _value, _noCache)->
444
+ _attrTodo = @_attrTodo[_id]
445
+ _attrCache = @_attrCache[_id]
446
+ @_elements[_id].setAttribute( _key, _value ) if _noCache
447
+ _reCache = _value != @getAttr( _id, _key )
448
+ if _reCache or _noCache
449
+ _attrCache[_key] = _value
450
+ unless _noCache
451
+ _attrTodo.push( _key ) if _attrTodo.indexOf( _key ) == -1
452
+ unless @_elemTodoH[_id]
453
+ @_elemTodo.push( _id )
454
+ @_elemTodoH[ _id ] = true
455
+ @_checkNeedFlush()
456
+ null
457
+
458
+ ###
459
+ Deletes a named element attribute
460
+ ###
461
+ delAttr: (_id, _key)->
462
+ _attrTodo = @_attrtodo[_id]
463
+ _attrCache = @_attrCache[_id]
464
+ delete _attrCache[_key]
465
+ @_elements[_id].removeAttribute( _key )
466
+ _todoIndex = _attrTodo.indexOf( _key )
467
+ _attrTodo.splice( _todoIndex, 1 ) unless _todoIndex == -1
468
+ @_checkNeedFlush()
469
+ null
470
+
471
+ ###
472
+ Checks if the element has a named CSS className
473
+ ###
474
+ hasClassName: (_id, _className)->
475
+ _classNames = @_elements[_id].className.split(' ')
476
+ return _classNames.indexOf( _className ) != -1
477
+
478
+ ###
479
+ Adds a named CSS className to the element
480
+ ###
481
+ addClassName: (_id, _className)->
482
+ unless @hasClassName( _id, _className )
483
+ _elem = @_elements[_id]
484
+ if _elem.className.trim() == ''
485
+ _elem.className = _className
486
+ else
487
+ _classNames = _elem.className.trim().split(' ')
488
+ _classNames.push(_className)
489
+ _elem.className = _classNames.join(' ')
490
+ null
491
+
492
+ ###
493
+ Removes a named CSS className of the element
494
+ ###
495
+ removeClassName: (_id, _className)->
496
+ if @hasClassName( _id, _className )
497
+ _elem = @_elements[_id]
498
+ _classNames = _elem.className.split(' ')
499
+ _classNames.splice( _classNames.indexOf( _className ), 1 )
500
+ _elem.className = _classNames.join(' ')
501
+ null
502
+
503
+ ###
504
+ Checks if buffers need to be flushed
505
+ ###
506
+ _checkNeedFlush: ->
507
+ unless @_needFlush
508
+ @_needFlush = true
509
+ unless @_flushing
510
+ clearTimeout( @_timer)
511
+ @_resetFlushLoop( @_minDelay )
512
+ null
513
+
514
+ ###
515
+ Low-level style property setter
516
+ ###
517
+ _setElementStyle: (_elem, _key, _value)->
518
+ _elem.style.setProperty( _key, _value, '' )
519
+ null
520
+
521
+ ###
522
+ Camelizes string (mostly used for IE attribute name conversions)
523
+ ###
524
+ _camelize: (_str)->
525
+ _str.replace( /((-)([a-z])(\w))/g, ($0, $1, $2, $3, $4)->
526
+ $3.toUpperCase()+$4
527
+ )
528
+
529
+
530
+ ###
531
+ IE version of _setElementStyle
532
+ ###
533
+ _setElementStyleIE: (_elem, _key, _value)->
534
+ _elem.style[@_camelize(_key)] = _value
535
+ if BROWSER_TYPE.ie6
536
+ unless iefix._traverseStyleProperties.indexOf(_key) == -1
537
+ @_ieFixesNeeded = true
538
+ null
539
+
540
+ ###
541
+ Sets and buffers the named style attribute value or selectively direct
542
+ ###
543
+ setStyle: (_id, _key, _value, _noCache)->
544
+ _noCache = true if BROWSER_TYPE.ie9
545
+ try
546
+ _cached = @_styleCache[_id]
547
+ catch e
548
+ console.error( e, this )
549
+ _elem = @_elements[_id]
550
+ if _cached == undefined
551
+ @_initCache( _id )
552
+ _cached = @_styleCache[_id]
553
+ unless _value == _cached[_key]
554
+ _cached[_key] = _value
555
+ if _noCache
556
+ if _key == 'opacity'
557
+ @setOpacity( _id, _value )
558
+ else
559
+ @_setElementStyle( _elem, _key, _value )
560
+ else
561
+ _styleTodo = @_styleTodo[_id]
562
+ _styleTodo.push( _key ) if _styleTodo.indexOf( _key ) == -1
563
+ unless @_elemTodoH[_id]
564
+ @_elemTodo.push( _id )
565
+ @_elemTodoH[_id] = true
566
+ @_checkNeedFlush()
567
+ null
568
+
569
+ ###
570
+ Creates a new element inside another element
571
+ ###
572
+ make: (_targetId, _tagName, _options)->
573
+ _targetId = 0 if _targetId == undefined
574
+ if _tagName == undefined
575
+ _tagName = 'DIV'
576
+ else
577
+ _tagName = _tagName.toUpperCase()
578
+ _elem = document.createElement( _tagName )
579
+ _id = @_add( _elem )
580
+ @_initCache( _id )
581
+ unless _options == undefined
582
+ if _options.attrs
583
+ for _attr in _options.attrs
584
+ @setAttr( _id, _attr[0], _attr[1], true )
585
+ @_elements[_targetId].appendChild(_elem)
586
+ _id
587
+
588
+ ###
589
+ Returns inner size of the browser window as [ width, height ]
590
+ ###
591
+ windowSize: ->
592
+ _size = [ window.innerWidth, window.innerHeight ]
593
+ unless _size[0] or _size[1]
594
+ _docElem = document.documentElement
595
+ _size = [ _docElem.clientWidth, _docElem.clientHeigh ]
596
+ _size
597
+
598
+ ###
599
+ Returns computed style of element
600
+ ###
601
+ _getComputedStyle: (_elem, _key)->
602
+ document.defaultView.getComputedStyle( _elem, null ).getPropertyValue( _key )
603
+
604
+ ###
605
+ IE version of _getComputedStyle
606
+ ###
607
+ _getComputedStyleIE: (_elem, _key)->
608
+ return _elem.clientWidth if _key == 'width'
609
+ return _elem.clientHeight if _key == 'height'
610
+ _elem.currentStyle[@_camelize(_key)]
611
+
612
+ ###
613
+ Gets the named element style attribute value.
614
+ ###
615
+ getStyle: (_id, _key, _noCache)->
616
+ _cached = @_styleCache[_id]
617
+ if _cached[_key] == undefined or _noCache
618
+ if _key == 'opacity'
619
+ _value = @getOpacity(_id)
620
+ else
621
+ _value = @_getComputedStyle( @_elements[_id], _key )
622
+ _value = -1 if _key == 'z-index' and _value == 'auto'
623
+ _cached[_key] = _value
624
+ else
625
+ _value = _cached[_key]
626
+ _value
627
+
628
+ ###
629
+ Style buffer flushing method
630
+ ###
631
+ _flushStyleCache: (_id)->
632
+ _elem = @_elements[_id]
633
+ return unless _elem
634
+ _styleTodo = @_styleTodo[_id]
635
+ _cached = @_styleCache[_id]
636
+ _loopMaxP = _styleTodo.length
637
+ _currTodo = _styleTodo.splice( 0, _loopMaxP )
638
+ for i in [ 1.._loopMaxP ]
639
+ _key = _currTodo.shift()
640
+ if _key == 'opacity'
641
+ @setOpacity( _id, _cached[_key] )
642
+ else
643
+ @_setElementStyle( _elem, _key, _cached[_key] )
644
+ null
645
+
646
+ ###
647
+ Final phase of startup, when document is loaded
648
+ ###
649
+ _init: ->
650
+ RSenceInit() unless RSenceInit == undefined
651
+ if BROWSER_TYPE.ie
652
+ @_getComputedStyle = @_getComputedStyleIE
653
+ @_setElementStyle = @_setElementStyleIE
654
+ @bind( document.body ) unless @_timer
655
+ if BROWSER_TYPE.symbian
656
+ TestClass = HClass.extend({test:true, constructor:null})
657
+ # The Symbian JS implementation gets corrupted if the page is reloaded (loaded from cache), this tests that:
658
+ unless TestClass.test
659
+ 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?')
660
+ location.href = 'http://www.opera.com/download/get.pl?sub=++++&id=32792&location=270&nothanks=yes'
661
+ # Can't do anything with such badly broken js engine
662
+ return
663
+ @_flushDomLoadQueue() until @_initDone
664
+ @_resetFlushLoop( @_minDelay )
665
+ null
666
+
667
+ ###
668
+ Runs a cmd
669
+ ###
670
+ _runCmd: (_cmd)->
671
+ _type = ( typeof _cmd )
672
+ if _type == 'function'
673
+ _cmd.call()
674
+ else if _type == 'string'
675
+ console.log("Evaluation of LOAD strings no longer supported. Please convert to anonymous function: "+_cmd)
676
+ null
677
+
678
+ ###
679
+ Processes the queue for tasks to run upon completion of document load
680
+ ###
681
+ _flushDomLoadQueue: ->
682
+ if @_domLoadQueue.length == 0
683
+ @_initDone = true
684
+ return
685
+ else
686
+ @_runCmd( @_domLoadQueue.shift() )
687
+ null
688
+
689
+ ###
690
+ Does browser version checks and starts the document loaded check poll
691
+ ###
692
+ _warmup: ->
693
+ _ua = navigator.userAgent
694
+ _browserType = BROWSER_TYPE
695
+ _browserType.opera = _ua.indexOf('Opera') != -1
696
+ _browserType.safari = _ua.indexOf('KHTML') != -1
697
+ _browserType.symbian = _ua.indexOf('SymbianOS') != -1
698
+ _browserType.chrome = _ua.indexOf('Chrome') != -1
699
+ _isIE = document.all and not _browserType.opera
700
+ if _isIE
701
+ _browserType.ie = _isIE
702
+ _browserType.ie6 = _ua.indexOf('MSIE 6') != -1
703
+ _browserType.ie7 = _ua.indexOf('MSIE 7') != -1
704
+ _browserType.ie8 = _ua.indexOf('MSIE 8') != -1
705
+ _browserType.ie9 = _ua.indexOf('MSIE 9') != -1
706
+ _browserType.mac = _ua.indexOf('Macintosh') != -1
707
+ _browserType.win = _ua.indexOf('Windows') != -1
708
+ _browserType.firefox = _ua.indexOf('Firefox') != -1
709
+ _browserType.firefox2 = _ua.indexOf('Firefox/2.') != -1
710
+ _browserType.firefox3 = _ua.indexOf('Firefox/3.') != -1
711
+ _browserType.firefox4 = _ua.indexOf('Firefox/4.') != -1
712
+ @_domWaiter()
713
+ null
714
+
715
+ ###
716
+ Adds tasks to run when the document load check is completed
717
+ ###
718
+ _domLoader: (_cmd)->
719
+ if ELEM._initDone
720
+ ELEM._runCmd( _cmd )
721
+ else
722
+ ELEM._domLoadQueue.push( _cmd )
723
+ null
724
+
725
+ ###
726
+ Checks if the document is fully loaded
727
+ ###
728
+ _domWaiter: ->
729
+ if BROWSER_TYPE.ie6 or BROWSER_TYPE.ie7 or BROWSER_TYPE.ie8
730
+ if location.protocol = 'https:'
731
+ _ie_proto = 'src=//0'
732
+ else
733
+ _ie_proto = 'javascript:void(0)'
734
+ document.write('<scr'+'ipt id=__ie_onload defer src='+ _ie_proto +'></scr'+'ipt>')
735
+ document.getElementById('__ie_onload').onreadystatechange ->
736
+ if ELEM.readyState == 'complete'
737
+ clearTimeout( ELEM._domLoadTimer )
738
+ ELEM._domLoadStatus = true
739
+ ELEM._init()
740
+ return
741
+ else if BROWSER_TYPE.safari and document.readyState == 'complete'
742
+ ELEM._domLoadStatus = true
743
+ else if document.body
744
+ ELEM._domLoadStatus = true
745
+
746
+ if ELEM._domLoadStatus
747
+ clearTimeout( @_domLoadTimer )
748
+ BROWSER_TYPE.symbian = document.body.innerHTML == 'fastinnerhtml!' if BROWSER_TYPE.symbian
749
+ @_init()
750
+ else
751
+ ELEM._domLoadTimer = setTimeout( =>
752
+ ELEM._domWaiter()
753
+ , 10 )
754
+ null
755
+
756
+ })
757
+ ELEM.reset()
758
+
759
+ ElementManager = ELEM
760
+
761
+ LOAD = ELEM._domLoader
762
+
763
+ ELEM._warmup()
data/js/core/elem/elem.js CHANGED
@@ -820,7 +820,7 @@ ELEM = {
820
820
  _attrTodo.splice(_attrTodo.indexOf(_key, 1));
821
821
  }
822
822
  if (_this._elemTodoH[_id]) {
823
- _this._elemTodo.splice(_this._elemTodo.indexOf(_id, 1));
823
+ _this._elemTodo.splice(_this._elemTodo.indexOf(_id),1);
824
824
  _this._elemTodoH[_id] = false;
825
825
  _this._checkNeedFlush();
826
826
  }
@@ -1231,14 +1231,6 @@ ELEM = {
1231
1231
  _browserType.mac = (_ua.indexOf("Macintosh") !== -1);
1232
1232
  _browserType.win = (_ua.indexOf("Windows") !== -1);
1233
1233
 
1234
- // Experimental; don't treat IE9 as an IE at all.
1235
- // NOTE: IE9 Beta does still not behave like a standard web browser.
1236
- // It will probably require as much tuning as earlier IE versions.
1237
- if(_browserType.ie9){
1238
- // _browserType.ie = false;
1239
- // _browserType.safari = true;
1240
- }
1241
-
1242
1234
  _browserType.firefox = _ua.indexOf("Firefox") !== -1;
1243
1235
  _browserType.firefox2 = _ua.indexOf("Firefox/2.") !== -1;
1244
1236
  _browserType.firefox3 = _ua.indexOf("Firefox/3.") !== -1;
@@ -228,7 +228,7 @@ COMM.JSONRenderer = HClass.extend({
228
228
  }
229
229
  }
230
230
  catch(e){
231
- console.log('renderNode error:',e.toString()+', rect:',_rect,', class:',_dataNode['class'],', options:', _options);
231
+ console.log('renderNode error:',e.toString()+', rect:',_rect,', class:',_dataNode['class'],', options:', _options,', e:',e);
232
232
  }
233
233
  // Iterates recursively through all subviews, if specified.
234
234
  if(_hasSubviews){
@@ -331,7 +331,6 @@ HSystem = {
331
331
  _viewLen = _views.length,
332
332
 
333
333
  // reference to the setStyle method of the element manager
334
- _setStyl = ELEM.setStyle,
335
334
 
336
335
  // reference to HSystem.views (collection of all views, by index)
337
336
  _sysViews = _this.views,
@@ -371,7 +370,7 @@ HSystem = {
371
370
  _elemId = _view[ _elemIdStr ];
372
371
 
373
372
  // do the element manager call itself to update the dom property
374
- _setStyl( _elemId, _zIdxStr, i );
373
+ ELEM.setStyle( _elemId, _zIdxStr, i );
375
374
  }
376
375
  }
377
376
  }
@@ -625,7 +625,6 @@ HView = HClass.extend({
625
625
  i = 0,
626
626
  _this = this,
627
627
  _elemId = _this.elemId,
628
- _styl = ELEM.setStyle,
629
628
  _rect = _this.rect,
630
629
  _auto = 'auto',
631
630
  _left = _this.flexLeft?_rect.left:_auto,
@@ -655,7 +654,7 @@ HView = HClass.extend({
655
654
  if( i < 6 && _value !== _auto ){
656
655
  _value += 'px';
657
656
  }
658
- _styl(_elemId,_key,_value,true);
657
+ ELEM.setStyle(_elemId,_key,_value,true);
659
658
  }
660
659
  (this.drawn === false) && _this._updateZIndex();
661
660
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsence-pre
3
3
  version: !ruby/object:Gem::Version
4
- hash: 97
4
+ hash: 95
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 2
9
9
  - 0
10
- - 15
11
- version: 2.2.0.15
10
+ - 16
11
+ version: 2.2.0.16
12
12
  platform: ruby
13
13
  authors:
14
14
  - Riassence Inc.
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-07-27 00:00:00 Z
20
+ date: 2011-07-28 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rsence-deps
@@ -235,6 +235,7 @@ files:
235
235
  - js/controls/window/themes/default/window_parts2.png
236
236
  - js/controls/window/window.js
237
237
  - js/core/class/class.js
238
+ - js/core/elem/elem.coffee
238
239
  - js/core/elem/elem.js
239
240
  - js/core/event/event.js
240
241
  - js/core/iefix/ie_css_element.htc