sproutcore 0.9.10 → 0.9.11
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/History.txt +25 -0
- data/Manifest.txt +2 -1
- data/bin/sc-server +4 -1
- data/frameworks/sproutcore/HISTORY +75 -3
- data/frameworks/sproutcore/{Core.js → core.js} +2 -3
- data/frameworks/sproutcore/drag/drag.js +1 -1
- data/frameworks/sproutcore/english.lproj/buttons.css +3 -2
- data/frameworks/sproutcore/english.lproj/detect-browser +44 -0
- data/frameworks/sproutcore/foundation/animator.js +40 -40
- data/frameworks/sproutcore/foundation/application.js +1 -1
- data/frameworks/sproutcore/foundation/benchmark.js +2 -2
- data/frameworks/sproutcore/foundation/error.js +61 -16
- data/frameworks/sproutcore/foundation/input_manager.js +1 -1
- data/frameworks/sproutcore/foundation/mock.js +1 -1
- data/frameworks/sproutcore/foundation/node_descriptor.js +2 -2
- data/frameworks/sproutcore/foundation/object.js +1 -1
- data/frameworks/sproutcore/foundation/path_module.js +1 -1
- data/frameworks/sproutcore/foundation/responder.js +1 -1
- data/frameworks/sproutcore/foundation/run_loop.js +1 -1
- data/frameworks/sproutcore/foundation/server.js +1 -1
- data/frameworks/sproutcore/foundation/string.js +32 -3
- data/frameworks/sproutcore/foundation/timer.js +1 -1
- data/frameworks/sproutcore/foundation/undo_manager.js +1 -1
- data/frameworks/sproutcore/globals/window.js +1 -1
- data/frameworks/sproutcore/lib/core_views.rb +1 -1
- data/frameworks/sproutcore/lib/index.rhtml +7 -1
- data/frameworks/sproutcore/mixins/observable.js +115 -7
- data/frameworks/sproutcore/models/record.js +1 -1
- data/frameworks/sproutcore/tests/views/view/innerFrame.rhtml +101 -99
- data/frameworks/sproutcore/views/collection/grid.js +1 -1
- data/frameworks/sproutcore/views/collection/table.js +1 -1
- data/frameworks/sproutcore/views/list_item.js +1 -1
- data/frameworks/sproutcore/views/progress.js +21 -11
- data/frameworks/sproutcore/views/segmented.js +40 -15
- data/lib/sproutcore/bundle.rb +3 -3
- data/lib/sproutcore/bundle_manifest.rb +7 -7
- data/lib/sproutcore/jsdoc.rb +4 -2
- data/lib/sproutcore/library.rb +112 -43
- data/lib/sproutcore/merb/bundle_controller.rb +77 -4
- data/lib/sproutcore/version.rb +1 -1
- data/sc_generators/client/templates/core.js +1 -4
- metadata +4 -3
data/History.txt
CHANGED
@@ -1,3 +1,28 @@
|
|
1
|
+
== SproutCore 0.9.11
|
2
|
+
|
3
|
+
* Build tools are now much smarter about how the they process environment
|
4
|
+
configs. Before if you imported a framework (such as sproutcore) locally
|
5
|
+
into your project you would need to import any dependent frameworks as well
|
6
|
+
AND create configs for all of them. Now you do not need to do that. The
|
7
|
+
build tools will load the most recent base environment (defined in config
|
8
|
+
:all), along with the most recent bundle-specific config (defined in config
|
9
|
+
:bundle_name) and the bundle-location details from whatever library holds
|
10
|
+
the bundle. This will avoid a whole class of head-scratching config probs
|
11
|
+
that people encountered when trying to setup their system.
|
12
|
+
|
13
|
+
* Removed unused controllers array from core.js template in client generator
|
14
|
+
|
15
|
+
* sc-server now supports the new proxy option in sc-config. You can use this
|
16
|
+
to proxy your backend services through to your front-end SproutCore clients
|
17
|
+
without having to setup a separate service.
|
18
|
+
|
19
|
+
* Changed some launch options for sc-server that will improve performance.
|
20
|
+
|
21
|
+
* JSDoc can now handle paths spaces in them.
|
22
|
+
|
23
|
+
* Build tools no longer rely on symlink in dev mode. This should improve compatibility with Windows systems.
|
24
|
+
|
25
|
+
== SproutCore 0.9.10
|
1
26
|
|
2
27
|
* The build tools can now generate bundles with relative paths. Fixes #19
|
3
28
|
|
data/Manifest.txt
CHANGED
@@ -57,7 +57,7 @@ frameworks/sproutcore/controllers/array.js
|
|
57
57
|
frameworks/sproutcore/controllers/collection.js
|
58
58
|
frameworks/sproutcore/controllers/controller.js
|
59
59
|
frameworks/sproutcore/controllers/object.js
|
60
|
-
frameworks/sproutcore/
|
60
|
+
frameworks/sproutcore/core.js
|
61
61
|
frameworks/sproutcore/drag/drag.js
|
62
62
|
frameworks/sproutcore/drag/drag_data_source.js
|
63
63
|
frameworks/sproutcore/drag/drag_source.js
|
@@ -65,6 +65,7 @@ frameworks/sproutcore/drag/drop_target.js
|
|
65
65
|
frameworks/sproutcore/english.lproj/blank.gif
|
66
66
|
frameworks/sproutcore/english.lproj/buttons.css
|
67
67
|
frameworks/sproutcore/english.lproj/core.css
|
68
|
+
frameworks/sproutcore/english.lproj/detect-browser
|
68
69
|
frameworks/sproutcore/english.lproj/icons.css
|
69
70
|
frameworks/sproutcore/english.lproj/images/indicator.gif
|
70
71
|
frameworks/sproutcore/english.lproj/images/sc-theme-sprite.png
|
data/bin/sc-server
CHANGED
@@ -44,7 +44,10 @@ Merb::Router.prepare { |r| r.connect_clients('/') }
|
|
44
44
|
Merb::Config.use { |c|
|
45
45
|
c[:framework] = {},
|
46
46
|
c[:session_store] = 'none',
|
47
|
-
c[:exception_details] = true
|
47
|
+
c[:exception_details] = true,
|
48
|
+
c[:reload_classes] = false,
|
49
|
+
c[:use_mutex] = false,
|
50
|
+
c[:log_auto_flush] = true
|
48
51
|
}
|
49
52
|
|
50
53
|
############################################################
|
@@ -1,11 +1,83 @@
|
|
1
|
-
== GIT HEAD
|
2
1
|
|
2
|
+
- [FIX] innerFrame tests were failing. Now working.
|
3
3
|
|
4
|
-
|
4
|
+
- Progress bar now shows 100% fill when set to indeterminate. This should
|
5
|
+
make it easier to style an indeterminate appearance.
|
6
|
+
|
7
|
+
- Changed all references for window.location= to window.location.href=.
|
8
|
+
Improves IE compatibility.
|
9
|
+
|
10
|
+
- Cleaned JSLink warnings from animator.js
|
5
11
|
|
6
|
-
|
12
|
+
- Removed stray debugger statements (thanks august!)
|
13
|
+
|
14
|
+
- Fixed CSS issues with SC-theme that made buttons appear offset. Now appears
|
15
|
+
correct in FF3 & Safari (thanks mde!)
|
16
|
+
|
17
|
+
- Added detect-browser script which can be included at the top of your page to
|
18
|
+
detect the current browser and platform. Also includes an
|
19
|
+
SC.setupBodyClassNames method that you can call after the body tag has been
|
20
|
+
declared that will add class names for the current browser and platform.
|
21
|
+
|
22
|
+
- Added documentation for Function.property()
|
23
|
+
- Added documentation for SC.Error.
|
24
|
+
- Added documentation for SC.SegmentedView
|
25
|
+
|
26
|
+
== sproutcore-0.9.10
|
27
|
+
|
28
|
+
- SC.Platform.Firefox now returns 2 for any gecko browser that is not Firefox.
|
29
|
+
|
30
|
+
- set() and a variety of other methods now returns this instead of the set
|
7
31
|
value. This makes it possible to do method chaining.
|
8
32
|
|
33
|
+
- Fixed typo in (). Fixes #12
|
34
|
+
|
35
|
+
- Fixed #11
|
36
|
+
|
37
|
+
- Switch from transitional to strict DTD
|
38
|
+
|
39
|
+
- Replacement of window.location to window.location.href.
|
40
|
+
|
41
|
+
- Added default src to image_view (static_url('blank'))
|
42
|
+
|
43
|
+
- Fix for view_helper view that was closing the element.
|
44
|
+
|
45
|
+
- sproutcore now treats space as a printable key instead of a function key.
|
46
|
+
|
47
|
+
- Added chainability to observer methods; improved docs
|
48
|
+
|
49
|
+
set(), beginPropertyChanges(), endPropertyChanges() and a whole slew of other
|
50
|
+
methods now return this instead of void or the set value. This allows for
|
51
|
+
method chainings jQuery style such as:
|
52
|
+
|
53
|
+
contact.beginPropertyChanges()
|
54
|
+
.set('firstName', 'Charles')
|
55
|
+
.set('lastName', 'Jolley')
|
56
|
+
.endPropertyChanges();
|
57
|
+
|
58
|
+
- auto select content of textarea when it's focused: this._isFocused is true for textarea while false for text input in didBecomeFirstRespo
|
59
|
+
|
60
|
+
- scrollable#scrollViewToVisible now scrolls up and left. This corrects a bug with keyboard control that would bust when you move up or left.
|
61
|
+
|
62
|
+
- Updated documentation on form
|
63
|
+
|
64
|
+
- Use Element instead of element for IE compatability in Element.setClassName()
|
65
|
+
|
66
|
+
- Added SC.View#destroy() to remove views from internal caches. insertBefore, removeChild, etc. also now return the view instance so you can chain them.
|
67
|
+
|
68
|
+
- Popup menu was setting the width on each of the child menu items in addition to itself. This had a huge performance impact with little ac
|
69
|
+
|
70
|
+
- Disabled the current behavior for the menu item view helper which parses the shortcut before inserting it; now it simply passes the passe
|
71
|
+
|
72
|
+
- [FIX] Replaced url() calls with static_url() in CSS so that they will work properly in build mode
|
73
|
+
|
74
|
+
- Cleanup in drag.js
|
75
|
+
|
76
|
+
- Adding href property to ButtonView for bindable functionality on href attributes.
|
77
|
+
|
78
|
+
- Properly order drop targets so that nested targets appear first.
|
79
|
+
|
80
|
+
|
9
81
|
== 0.9.8
|
10
82
|
|
11
83
|
* [FIX] collection views now update group views appropriately.
|
@@ -41,7 +41,7 @@
|
|
41
41
|
|
42
42
|
// All objects live in the SproutCore namespace, which is also availabe in the
|
43
43
|
// abreviation SC.
|
44
|
-
|
44
|
+
if (!SC) SC = {}; SproutCore = SC ;
|
45
45
|
|
46
46
|
// this makes for some nicer to read code
|
47
47
|
var YES = true ; var NO = false ;
|
@@ -117,7 +117,6 @@ Object.extend(SC,{
|
|
117
117
|
|
118
118
|
// To flush the callOnLoad queue, you need to set window.onload=SC.didLoad
|
119
119
|
didLoad: function() {
|
120
|
-
|
121
120
|
SC.app = SC.Application.create();
|
122
121
|
SC.app.run();
|
123
122
|
|
@@ -160,7 +159,7 @@ Object.extend(SC,{
|
|
160
159
|
} else if ((url.slice(0,5) == 'http:') || (url.slice(0,6) == 'https:')) {
|
161
160
|
// no change
|
162
161
|
} else {
|
163
|
-
url = window.location + '/' + url ;
|
162
|
+
url = window.location.href + '/' + url ;
|
164
163
|
}
|
165
164
|
return url ;
|
166
165
|
},
|
@@ -57,8 +57,9 @@ a.regular span.button-inner {
|
|
57
57
|
a.regular span.label {
|
58
58
|
display: block ;
|
59
59
|
text-align: center;
|
60
|
-
|
61
|
-
|
60
|
+
height: 22px;
|
61
|
+
line-height: 22px;
|
62
|
+
vertical-align: middle;
|
62
63
|
margin-left: 20px;
|
63
64
|
text-shadow: #f0f0f0 0px 1px 0px;
|
64
65
|
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
// NOTE: This file is named with a .javascript extension to avoid having this
|
2
|
+
// file combined into the joined javascript.js file for this framework.
|
3
|
+
|
4
|
+
// This bootstrap file can be included at the top of your index.html to detect
|
5
|
+
// the browser, language, and platform. You can then call
|
6
|
+
// SC.setupBrowserClassNames() in a script tag after the body is defined to
|
7
|
+
// load the class names into the body.
|
8
|
+
if (!SC) var SC = {} ;
|
9
|
+
SC.browser = (function() {
|
10
|
+
|
11
|
+
var userAgent = navigator.userAgent.toLowerCase();
|
12
|
+
var version = (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1] ;
|
13
|
+
|
14
|
+
var browser = {
|
15
|
+
version: version,
|
16
|
+
webkit: (/webkit/).test( userAgent ) ? version : 0,
|
17
|
+
opera: (/opera/).test( userAgent ) ? version : 0,
|
18
|
+
msie: (/msie/).test( userAgent ) && !(/opera/).test( userAgent ) ? version : 0,
|
19
|
+
mozilla: (/mozilla/).test( userAgent ) && !(/(compatible|webkit)/).test( userAgent ) ? version : 0,
|
20
|
+
mobileSafari: (/apple.*mobile.*safari/).test(userAgent) ? version : 0,
|
21
|
+
windows: !!(/(windows)/).test(userAgent),
|
22
|
+
mac: !!((/(macintosh)/).test(userAgent) || (/(mac os x)/).test(userAgent))
|
23
|
+
};
|
24
|
+
|
25
|
+
return browser ;
|
26
|
+
|
27
|
+
})();
|
28
|
+
|
29
|
+
SC.setupBodyClassNames = function() {
|
30
|
+
var el = document.body ;
|
31
|
+
if (!el) return ;
|
32
|
+
|
33
|
+
// Add class name for the current browser, platform, and language
|
34
|
+
var browser = (SC.browser.webkit) ? 'webkit' : (SC.browser.opera) ? 'opera' : (SC.browser.mozilla) ? 'mozilla' : (SC.browser.msie) ? 'msie' : 'unknown-browser' ;
|
35
|
+
var platform = (SC.browser.windows) ? 'windows' : (SC.browser.mac) ? 'mac' : 'other-platform' ;
|
36
|
+
|
37
|
+
var classNames = (el.className) ? el.className.split(' ') : [] ;
|
38
|
+
classNames.push(browser) ;
|
39
|
+
classNames.push(platform) ;
|
40
|
+
if (SC.browser.mobileSafari) classNames.push('mobile-safari') ;
|
41
|
+
el.className = classNames.join(' ') ;
|
42
|
+
} ;
|
43
|
+
|
44
|
+
|
@@ -36,7 +36,7 @@
|
|
36
36
|
function Animator(options) {
|
37
37
|
this.setOptions(options);
|
38
38
|
var _this = this;
|
39
|
-
this.timerDelegate = function(){_this.onTimerEvent()};
|
39
|
+
this.timerDelegate = function(){_this.onTimerEvent();};
|
40
40
|
this.subjects = [];
|
41
41
|
this.target = 0;
|
42
42
|
this.state = 0;
|
@@ -129,8 +129,8 @@ Animator.prototype = {
|
|
129
129
|
}
|
130
130
|
},
|
131
131
|
// shortcuts
|
132
|
-
play: function() {this.seekFromTo(0, 1)},
|
133
|
-
reverse: function() {this.seekFromTo(1, 0)},
|
132
|
+
play: function() {this.seekFromTo(0, 1);},
|
133
|
+
reverse: function() {this.seekFromTo(1, 0);},
|
134
134
|
// return a string describing this Animator, for debugging
|
135
135
|
inspect: function() {
|
136
136
|
var str = "#<Animator:\n";
|
@@ -140,14 +140,14 @@ Animator.prototype = {
|
|
140
140
|
str += ">";
|
141
141
|
return str;
|
142
142
|
}
|
143
|
-
}
|
143
|
+
};
|
144
144
|
// merge the properties of two objects
|
145
145
|
Animator.applyDefaults = function(defaults, prefs) {
|
146
146
|
prefs = prefs || {};
|
147
147
|
var prop, result = {};
|
148
148
|
for (prop in defaults) result[prop] = prefs[prop] !== undefined ? prefs[prop] : defaults[prop];
|
149
149
|
return result;
|
150
|
-
}
|
150
|
+
};
|
151
151
|
// make an array from any object
|
152
152
|
Animator.makeArray = function(o) {
|
153
153
|
if (o == null) return [];
|
@@ -155,7 +155,7 @@ Animator.makeArray = function(o) {
|
|
155
155
|
var result = [];
|
156
156
|
for (var i=0; i<o.length; i++) result[i] = o[i];
|
157
157
|
return result;
|
158
|
-
}
|
158
|
+
};
|
159
159
|
// convert a dash-delimited-property to a camelCaseProperty (c/o Prototype, thanks Sam!)
|
160
160
|
Animator.camelize = function(string) {
|
161
161
|
var oStringList = string.split('-');
|
@@ -170,35 +170,35 @@ Animator.camelize = function(string) {
|
|
170
170
|
camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
|
171
171
|
}
|
172
172
|
return camelizedString;
|
173
|
-
}
|
173
|
+
};
|
174
174
|
// syntactic sugar for creating CSSStyleSubjects
|
175
175
|
Animator.apply = function(el, style, options) {
|
176
176
|
if (style instanceof Array) {
|
177
177
|
return new Animator(options).addSubject(new CSSStyleSubject(el, style[0], style[1]));
|
178
178
|
}
|
179
179
|
return new Animator(options).addSubject(new CSSStyleSubject(el, style));
|
180
|
-
}
|
180
|
+
};
|
181
181
|
// make a transition function that gradually accelerates. pass a=1 for smooth
|
182
182
|
// gravitational acceleration, higher values for an exaggerated effect
|
183
183
|
Animator.makeEaseIn = function(a) {
|
184
184
|
return function(state) {
|
185
185
|
return Math.pow(state, a*2);
|
186
|
-
}
|
187
|
-
}
|
186
|
+
};
|
187
|
+
};
|
188
188
|
// as makeEaseIn but for deceleration
|
189
189
|
Animator.makeEaseOut = function(a) {
|
190
190
|
return function(state) {
|
191
191
|
return 1 - Math.pow(1 - state, a*2);
|
192
|
-
}
|
193
|
-
}
|
192
|
+
};
|
193
|
+
};
|
194
194
|
// make a transition function that, like an object with momentum being attracted to a point,
|
195
195
|
// goes past the target then returns
|
196
196
|
Animator.makeElastic = function(bounces) {
|
197
197
|
return function(state) {
|
198
198
|
state = Animator.tx.easeInOut(state);
|
199
199
|
return ((1-Math.cos(state * Math.PI * bounces)) * (1 - state)) + state;
|
200
|
-
}
|
201
|
-
}
|
200
|
+
};
|
201
|
+
};
|
202
202
|
// make an Attack Decay Sustain Release envelope that starts and finishes on the same level
|
203
203
|
//
|
204
204
|
Animator.makeADSR = function(attackEnd, decayEnd, sustainEnd, sustainLevel) {
|
@@ -214,8 +214,8 @@ Animator.makeADSR = function(attackEnd, decayEnd, sustainEnd, sustainLevel) {
|
|
214
214
|
return sustainLevel;
|
215
215
|
}
|
216
216
|
return sustainLevel * (1 - ((state - sustainEnd) / (1 - sustainEnd)));
|
217
|
-
}
|
218
|
-
}
|
217
|
+
};
|
218
|
+
};
|
219
219
|
// make a transition function that, like a ball falling to floor, reaches the target and/
|
220
220
|
// bounces back again
|
221
221
|
Animator.makeBounce = function(bounces) {
|
@@ -223,8 +223,8 @@ Animator.makeBounce = function(bounces) {
|
|
223
223
|
return function(state) {
|
224
224
|
state = fn(state);
|
225
225
|
return state <= 1 ? state : 2-state;
|
226
|
-
}
|
227
|
-
}
|
226
|
+
};
|
227
|
+
};
|
228
228
|
|
229
229
|
// pre-made transition functions to use with the 'transition' option
|
230
230
|
Animator.tx = {
|
@@ -242,7 +242,7 @@ Animator.tx = {
|
|
242
242
|
veryElastic: Animator.makeElastic(3),
|
243
243
|
bouncy: Animator.makeBounce(1),
|
244
244
|
veryBouncy: Animator.makeBounce(3)
|
245
|
-
}
|
245
|
+
};
|
246
246
|
|
247
247
|
// animates a pixel-based style property between two integer values
|
248
248
|
function NumericalStyleSubject(els, property, from, to, units) {
|
@@ -255,7 +255,7 @@ function NumericalStyleSubject(els, property, from, to, units) {
|
|
255
255
|
this.from = parseFloat(from);
|
256
256
|
this.to = parseFloat(to);
|
257
257
|
this.units = units != null ? units : 'px';
|
258
|
-
}
|
258
|
+
};
|
259
259
|
NumericalStyleSubject.prototype = {
|
260
260
|
setState: function(state) {
|
261
261
|
var style = this.getStyle(state);
|
@@ -280,7 +280,7 @@ NumericalStyleSubject.prototype = {
|
|
280
280
|
inspect: function() {
|
281
281
|
return "\t" + this.property + "(" + this.from + this.units + " to " + this.to + this.units + ")\n";
|
282
282
|
}
|
283
|
-
}
|
283
|
+
};
|
284
284
|
|
285
285
|
// animates a colour based style property between two hex values
|
286
286
|
function ColorStyleSubject(els, property, from, to) {
|
@@ -290,7 +290,7 @@ function ColorStyleSubject(els, property, from, to) {
|
|
290
290
|
this.from = this.expandColor(from);
|
291
291
|
this.origFrom = from;
|
292
292
|
this.origTo = to;
|
293
|
-
}
|
293
|
+
};
|
294
294
|
|
295
295
|
ColorStyleSubject.prototype = {
|
296
296
|
// parse "#FFFF00" to [256, 256, 0]
|
@@ -301,7 +301,7 @@ ColorStyleSubject.prototype = {
|
|
301
301
|
red = parseInt(hexColor.slice(1, 3), 16);
|
302
302
|
green = parseInt(hexColor.slice(3, 5), 16);
|
303
303
|
blue = parseInt(hexColor.slice(5, 7), 16);
|
304
|
-
return [red,green,blue]
|
304
|
+
return [red,green,blue];
|
305
305
|
}
|
306
306
|
if (window.DEBUG) {
|
307
307
|
alert("Invalid colour: '" + color + "'");
|
@@ -322,7 +322,7 @@ ColorStyleSubject.prototype = {
|
|
322
322
|
inspect: function() {
|
323
323
|
return "\t" + this.property + "(" + this.origFrom + " to " + this.origTo + ")\n";
|
324
324
|
}
|
325
|
-
}
|
325
|
+
};
|
326
326
|
|
327
327
|
// return a properly formatted 6-digit hex colour spec, or false
|
328
328
|
ColorStyleSubject.parseColor = function(string) {
|
@@ -330,7 +330,7 @@ ColorStyleSubject.parseColor = function(string) {
|
|
330
330
|
if(match = ColorStyleSubject.parseColor.rgbRe.exec(string)) {
|
331
331
|
var part;
|
332
332
|
for (var i=1; i<=3; i++) {
|
333
|
-
part = Math.max(0, Math.min(255, parseInt(match[i])));
|
333
|
+
part = Math.max(0, Math.min(255, parseInt(match[i],0)));
|
334
334
|
color += ColorStyleSubject.toColorPart(part);
|
335
335
|
}
|
336
336
|
return color;
|
@@ -345,14 +345,14 @@ ColorStyleSubject.parseColor = function(string) {
|
|
345
345
|
return '#' + match[1];
|
346
346
|
}
|
347
347
|
return false;
|
348
|
-
}
|
348
|
+
};
|
349
349
|
// convert a number to a 2 digit hex string
|
350
350
|
ColorStyleSubject.toColorPart = function(number) {
|
351
351
|
if (number > 255) number = 255;
|
352
352
|
var digits = number.toString(16);
|
353
353
|
if (number < 16) return '0' + digits;
|
354
354
|
return digits;
|
355
|
-
}
|
355
|
+
};
|
356
356
|
ColorStyleSubject.parseColor.rgbRe = /^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i;
|
357
357
|
ColorStyleSubject.parseColor.hexRe = /^\#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
|
358
358
|
|
@@ -364,7 +364,7 @@ function DiscreteStyleSubject(els, property, from, to, threshold) {
|
|
364
364
|
this.from = from;
|
365
365
|
this.to = to;
|
366
366
|
this.threshold = threshold || 0.5;
|
367
|
-
}
|
367
|
+
};
|
368
368
|
|
369
369
|
DiscreteStyleSubject.prototype = {
|
370
370
|
setState: function(state) {
|
@@ -376,7 +376,7 @@ DiscreteStyleSubject.prototype = {
|
|
376
376
|
inspect: function() {
|
377
377
|
return "\t" + this.property + "(" + this.from + " to " + this.to + " @ " + this.threshold + ")\n";
|
378
378
|
}
|
379
|
-
}
|
379
|
+
};
|
380
380
|
|
381
381
|
// animates between two styles defined using CSS.
|
382
382
|
// if style1 and style2 are present, animate between them, if only style1
|
@@ -446,7 +446,7 @@ function CSSStyleSubject(els, style1, style2) {
|
|
446
446
|
}
|
447
447
|
this.subjects[this.subjects.length] = new type(els, prop, from, to, units);
|
448
448
|
}
|
449
|
-
}
|
449
|
+
};
|
450
450
|
|
451
451
|
CSSStyleSubject.prototype = {
|
452
452
|
// parses "width: 400px; color: #FFBB2E" to {width: "400px", color: "#FFBB2E"}
|
@@ -491,7 +491,7 @@ CSSStyleSubject.prototype = {
|
|
491
491
|
}
|
492
492
|
return str;
|
493
493
|
}
|
494
|
-
}
|
494
|
+
};
|
495
495
|
// get the current value of a css property,
|
496
496
|
CSSStyleSubject.getStyle = function(el, property){
|
497
497
|
var style;
|
@@ -505,8 +505,8 @@ CSSStyleSubject.getStyle = function(el, property){
|
|
505
505
|
if(el.currentStyle){
|
506
506
|
style = el.currentStyle[property];
|
507
507
|
}
|
508
|
-
return style || el.style[property]
|
509
|
-
}
|
508
|
+
return style || el.style[property];
|
509
|
+
};
|
510
510
|
|
511
511
|
|
512
512
|
CSSStyleSubject.ruleRe = /^\s*([a-zA-Z\-]+)\s*:\s*(\S(.+\S)?)\s*$/;
|
@@ -538,7 +538,7 @@ function AnimatorChain(animators, options) {
|
|
538
538
|
}
|
539
539
|
this.forwards = false;
|
540
540
|
this.current = 0;
|
541
|
-
}
|
541
|
+
};
|
542
542
|
|
543
543
|
AnimatorChain.prototype = {
|
544
544
|
// apply defaults
|
@@ -588,7 +588,7 @@ AnimatorChain.prototype = {
|
|
588
588
|
animator.options.onComplete = function() {
|
589
589
|
if (oldOnComplete) oldOnComplete.call(animator);
|
590
590
|
_this.advance();
|
591
|
-
}
|
591
|
+
};
|
592
592
|
},
|
593
593
|
// play the next animator
|
594
594
|
advance: function() {
|
@@ -613,7 +613,7 @@ AnimatorChain.prototype = {
|
|
613
613
|
this.animators[this.current].seekTo(1);
|
614
614
|
}
|
615
615
|
}
|
616
|
-
}
|
616
|
+
};
|
617
617
|
|
618
618
|
// an Accordion is a class that creates and controls a number of Animators. An array of elements is passed in,
|
619
619
|
// and for each element an Animator and a activator button is created. When an Animator's activator button is
|
@@ -638,7 +638,7 @@ function Accordion(options) {
|
|
638
638
|
an.jumpTo(0);
|
639
639
|
var activator = this.options.getActivator(el);
|
640
640
|
activator.index = i;
|
641
|
-
activator.onclick = function(){_this.show(this.index)};
|
641
|
+
activator.onclick = function(){_this.show(this.index);};
|
642
642
|
this.ans[this.ans.length] = an;
|
643
643
|
this.rememberanceTexts[i] = activator.innerHTML.replace(/\s/g, "");
|
644
644
|
if (this.rememberanceTexts[i] === current) {
|
@@ -646,7 +646,7 @@ function Accordion(options) {
|
|
646
646
|
}
|
647
647
|
}
|
648
648
|
this.show(selected);
|
649
|
-
}
|
649
|
+
};
|
650
650
|
|
651
651
|
Accordion.prototype = {
|
652
652
|
// apply defaults
|
@@ -656,7 +656,7 @@ Accordion.prototype = {
|
|
656
656
|
sections: null,
|
657
657
|
// a function that locates an activator button element given a section element.
|
658
658
|
// by default it takes a button id from the section's "activator" attibute
|
659
|
-
getActivator: function(el) {return document.getElementById(el.getAttribute("activator"))},
|
659
|
+
getActivator: function(el) {return document.getElementById(el.getAttribute("activator"));},
|
660
660
|
// shifts each animator's range, for example with options {from:0,to:100,shift:20}
|
661
661
|
// the animators' ranges will be 0-100, 20-120, 40-140 etc.
|
662
662
|
shift: 0,
|
@@ -676,4 +676,4 @@ Accordion.prototype = {
|
|
676
676
|
document.location.hash = this.rememberanceTexts[section];
|
677
677
|
}
|
678
678
|
}
|
679
|
-
}
|
679
|
+
};
|