sproutit-sproutcore 1.0.20090721145251 → 1.0.20090721145280
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/Rakefile +3 -3
- data/VERSION.yml +2 -2
- data/frameworks/sproutcore/Buildfile +0 -1
- data/gen/app/templates/apps/@target_name@/core.js +27 -0
- data/gen/app/templates/apps/@target_name@/english.lproj/loading.rhtml +9 -0
- data/gen/app/templates/apps/@target_name@/english.lproj/main_page.js +22 -0
- data/gen/app/templates/apps/@target_name@/english.lproj/strings.js +15 -0
- data/gen/app/templates/apps/@target_name@/main.js +30 -0
- data/gen/controller/templates/controllers/@filename@.js +18 -0
- data/gen/controller/templates/tests/controllers/@filename@.js +15 -0
- data/gen/framework/templates/frameworks/@target_name@/core.js +21 -0
- data/gen/framework/templates/frameworks/@target_name@/english.lproj/strings.js +15 -0
- data/gen/language/templates/@filename@/strings.js +14 -0
- data/gen/model/templates/fixtures/@filename@.js +35 -0
- data/gen/model/templates/models/@filename@.js +19 -0
- data/gen/model/templates/tests/models/@filename@.js +15 -0
- data/gen/project/templates/@filename@/Buildfile +7 -0
- data/gen/project/templates/@filename@/README +7 -0
- data/gen/test/templates/tests/@filename@.js +15 -0
- data/gen/theme/templates/themes/@target_name@/english.lproj/strings.js +15 -0
- data/gen/view/templates/tests/views/@filename@.js +15 -0
- data/gen/view/templates/views/@filename@.js +18 -0
- data/lib/sproutcore/models/generator.rb +2 -2
- metadata +21 -33
- data/frameworks/sproutcore/frameworks/deprecated/core.js +0 -59
- data/frameworks/sproutcore/frameworks/deprecated/lib/button_views.rb +0 -330
- data/frameworks/sproutcore/frameworks/deprecated/lib/collection_view.rb +0 -83
- data/frameworks/sproutcore/frameworks/deprecated/lib/core_views.rb +0 -326
- data/frameworks/sproutcore/frameworks/deprecated/lib/form_views.rb +0 -253
- data/frameworks/sproutcore/frameworks/deprecated/lib/index.rhtml +0 -75
- data/frameworks/sproutcore/frameworks/deprecated/lib/menu_views.rb +0 -93
- data/frameworks/sproutcore/frameworks/deprecated/server/rails_server.js +0 -80
- data/frameworks/sproutcore/frameworks/deprecated/server/rest_server.js +0 -178
- data/frameworks/sproutcore/frameworks/deprecated/server/server.js +0 -673
- data/frameworks/sproutcore/frameworks/deprecated/system/animator.js +0 -679
- data/frameworks/sproutcore/frameworks/deprecated/system/binding.js +0 -36
- data/frameworks/sproutcore/frameworks/deprecated/system/browser.js +0 -75
- data/frameworks/sproutcore/frameworks/deprecated/system/classic_responder.js +0 -312
- data/frameworks/sproutcore/frameworks/deprecated/system/event.js +0 -58
- data/frameworks/sproutcore/frameworks/deprecated/system/globals.js +0 -20
- data/frameworks/sproutcore/frameworks/deprecated/system/misc.js +0 -58
- data/frameworks/sproutcore/frameworks/deprecated/system/node_descriptor.js +0 -72
- data/frameworks/sproutcore/frameworks/deprecated/system/object.js +0 -122
- data/frameworks/sproutcore/frameworks/deprecated/system/path_module.js +0 -432
- data/frameworks/sproutcore/frameworks/deprecated/system/string.js +0 -107
- data/frameworks/sproutcore/frameworks/deprecated/tests/application/application.rhtml +0 -125
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/classic_view/clippingFrame.rhtml +0 -401
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/classic_view/frame.rhtml +0 -357
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/classic_view/isVisibleInWindow.rhtml +0 -147
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/collection/base.rhtml +0 -298
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/collection/incremental_rendering.rhtml +0 -260
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/collection/source_list_rendering.rhtml +0 -143
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/popup_button.rhtml +0 -128
- data/frameworks/sproutcore/frameworks/deprecated/tests/views/text_field.rhtml +0 -37
- data/frameworks/sproutcore/frameworks/deprecated/views/collection.js +0 -24
@@ -1,36 +0,0 @@
|
|
1
|
-
// ......................................
|
2
|
-
// DEPRECATED
|
3
|
-
//
|
4
|
-
// The transforms below are deprecated but still available for backwards
|
5
|
-
// compatibility. Instead of using these methods, however, you should use
|
6
|
-
// the helpers. For example, where before you would have done:
|
7
|
-
//
|
8
|
-
// contentBinding: SC.Binding.Single('MyApp.myController.count') ;
|
9
|
-
//
|
10
|
-
// you should do:
|
11
|
-
//
|
12
|
-
// contentBinding. SC.Binding.from('MyApp.myController.count').single();
|
13
|
-
//
|
14
|
-
// and for defaults:
|
15
|
-
//
|
16
|
-
// contentBindingDefault: SC.Binding.single()
|
17
|
-
//
|
18
|
-
SC.Binding.From = SC.Binding.NoChange = SC.Binding.builder();
|
19
|
-
|
20
|
-
SC.Binding.Single = SC.Binding.single().builder() ;
|
21
|
-
SC.Binding.SingleNull = SC.Binding.single(null).builder() ;
|
22
|
-
SC.Binding.SingleNoError = SC.Binding.Single.beget().noError().builder() ;
|
23
|
-
SC.Binding.SingleNullNoError = SC.Binding.SingleNull.beget().noError().builder() ;
|
24
|
-
SC.Binding.Multiple = SC.Binding.multiple().builder() ;
|
25
|
-
SC.Binding.MultipleNoError = SC.Binding.multiple().noError().builder() ;
|
26
|
-
|
27
|
-
SC.Binding.Bool = SC.Binding.bool().builder() ;
|
28
|
-
SC.Binding.Not = SC.Binding.bool().not().builder() ;
|
29
|
-
SC.Binding.NotNull = SC.Binding.isNull().not().builder() ;
|
30
|
-
SC.Binding.IsNull = SC.Binding.isNull().builder() ;
|
31
|
-
|
32
|
-
// No Error versions.
|
33
|
-
SC.Binding.BoolNoError = SC.Binding.Bool.beget().noError().builder();
|
34
|
-
SC.Binding.NotNullNoError = SC.Binding.NotNull.beget().noError().builder();
|
35
|
-
SC.Binding.NotNoError = SC.Binding.Not.beget().noError().builder();
|
36
|
-
SC.Binding.IsNullNoError = SC.Binding.IsNull.beget().noError().builder() ;
|
@@ -1,75 +0,0 @@
|
|
1
|
-
// ========================================================================
|
2
|
-
// SproutCore -- JavaScript Application Framework
|
3
|
-
// Copyright ©2006-2008, Sprout Systems, Inc. and contributors.
|
4
|
-
// Portions copyright ©2008 Apple, Inc. All rights reserved.
|
5
|
-
// ========================================================================
|
6
|
-
|
7
|
-
/**
|
8
|
-
@deprecated
|
9
|
-
|
10
|
-
API for detecting the current browser and platform. It is recommended that
|
11
|
-
you use the new SC.browser object instead as it does not require a function
|
12
|
-
call.
|
13
|
-
*/
|
14
|
-
SC.mixin({
|
15
|
-
Platform: {
|
16
|
-
/** The current IE version number or 0 if not IE. */
|
17
|
-
IE: SC.browser.msie,
|
18
|
-
/** The current Safari major version number of 0 if not Safari */
|
19
|
-
Safari: SC.browser.safari,
|
20
|
-
/** The current Firefox major version number or 0 if not Firefox */
|
21
|
-
Firefox: SC.browser.mozilla,
|
22
|
-
isWindows: SC.browser.isWindows,
|
23
|
-
isMac: SC.browser.isMac
|
24
|
-
},
|
25
|
-
|
26
|
-
// DEPRECATED. here for compatibility only.
|
27
|
-
/** @private */
|
28
|
-
isIE: function() {
|
29
|
-
return SC.browser.msie > 0 ;
|
30
|
-
},
|
31
|
-
|
32
|
-
/** @private */
|
33
|
-
isSafari: function() {
|
34
|
-
return SC.browser.safari > 0 ;
|
35
|
-
},
|
36
|
-
|
37
|
-
/** @private */
|
38
|
-
isSafari3: function() {
|
39
|
-
return SC.browser.safari >= 3 ;
|
40
|
-
},
|
41
|
-
|
42
|
-
/** @private */
|
43
|
-
isIE7: function() {
|
44
|
-
return SC.browser.msie >= 7 ;
|
45
|
-
},
|
46
|
-
|
47
|
-
/** @private */
|
48
|
-
isIE6: function() {
|
49
|
-
return (SC.browser.msie >= 6) && (SC.browser.msie < 7) ;
|
50
|
-
},
|
51
|
-
|
52
|
-
/** @private */
|
53
|
-
isWindows: function() {
|
54
|
-
return SC.browser.isWindows;
|
55
|
-
},
|
56
|
-
|
57
|
-
/** @private */
|
58
|
-
isMacOSX: function() {
|
59
|
-
return SC.browser.isMac ;
|
60
|
-
},
|
61
|
-
|
62
|
-
/** @private */
|
63
|
-
isFireFox: function() {
|
64
|
-
return SC.browser.mozilla > 0 ;
|
65
|
-
},
|
66
|
-
|
67
|
-
/** @private */
|
68
|
-
isFireFox2: function() {
|
69
|
-
return SC.browser.mozilla >= 2 ;
|
70
|
-
},
|
71
|
-
|
72
|
-
// Save the Platform.Browser name.
|
73
|
-
Browser: ((SC.browser.msie) ? "IE" : (SC.browser.safari) ? "Safari" : (SC.browser.mozilla) ? "Firefox" : null)
|
74
|
-
|
75
|
-
});
|
@@ -1,312 +0,0 @@
|
|
1
|
-
// ========================================================================
|
2
|
-
// SproutCore -- JavaScript Application Framework
|
3
|
-
// Copyright ©2006-2008, Sprout Systems, Inc. and contributors.
|
4
|
-
// Portions copyright ©2008 Apple, Inc. All rights reserved.
|
5
|
-
// ========================================================================
|
6
|
-
|
7
|
-
require('core') ;
|
8
|
-
|
9
|
-
/**
|
10
|
-
@class
|
11
|
-
|
12
|
-
A responder is capable of responding to events such as mouse clicks and key
|
13
|
-
presses.
|
14
|
-
|
15
|
-
All views are a type of responder, but you can extend this class yourself
|
16
|
-
as well to implement your own responders if you need to.
|
17
|
-
|
18
|
-
@extends SC.Object
|
19
|
-
|
20
|
-
*/
|
21
|
-
SC.ClassicResponder = SC.Object.extend(
|
22
|
-
/** @scope SC.ClassicResponder.prototype */
|
23
|
-
{
|
24
|
-
|
25
|
-
// .......................................................................
|
26
|
-
// Managing Responder States
|
27
|
-
//
|
28
|
-
|
29
|
-
/**
|
30
|
-
This method will be called just before you become first responder to see
|
31
|
-
if you want to be first responder. If you don't want to handle
|
32
|
-
keyboard events, return false. (this is the default). Note that this is
|
33
|
-
a property.
|
34
|
-
*/
|
35
|
-
acceptsFirstResponder: false,
|
36
|
-
|
37
|
-
/**
|
38
|
-
This property is the next responder that should be allowed to handle
|
39
|
-
events if you don't want to handle it. For views, this is automatically
|
40
|
-
set to your parentNode.
|
41
|
-
*/
|
42
|
-
nextResponder: null,
|
43
|
-
|
44
|
-
/**
|
45
|
-
This property is true whenever you are the first responder. Observable.
|
46
|
-
*/
|
47
|
-
isFirstResponder: false,
|
48
|
-
|
49
|
-
pane: null,
|
50
|
-
|
51
|
-
/**
|
52
|
-
Call this method to become the first responder. You will now be the
|
53
|
-
first to receive keyboard events, etc. Return false if you could not
|
54
|
-
be made first responder for some reason.
|
55
|
-
*/
|
56
|
-
becomeFirstResponder: function()
|
57
|
-
{
|
58
|
-
if (!this.get('acceptsFirstResponder')) return false; // responder doesn't want it
|
59
|
-
|
60
|
-
var pane = this.get('pane');
|
61
|
-
if (!pane) return false; // there's no pane of which to become FR.. doesn't matter if it *does* want it...
|
62
|
-
|
63
|
-
if (pane.get('firstResponder') == this) return true; // we already got it... and setting it again will trigger the willResign callback
|
64
|
-
|
65
|
-
pane.set('firstResponder',this);
|
66
|
-
return true;
|
67
|
-
},
|
68
|
-
|
69
|
-
/**
|
70
|
-
Call this method if you no longer want to be first responder. Normally
|
71
|
-
you don't need to do this since you will lose firstResponder status
|
72
|
-
when the user focuses a different view.
|
73
|
-
*/
|
74
|
-
resignFirstResponder: function()
|
75
|
-
{
|
76
|
-
var pane = this.get('pane');
|
77
|
-
if (!pane) return false;
|
78
|
-
|
79
|
-
if (pane.get('firstResponder') != this) return false;
|
80
|
-
|
81
|
-
pane.set('firstResponder',null);
|
82
|
-
return true;
|
83
|
-
},
|
84
|
-
|
85
|
-
noResponderFor: function() {},
|
86
|
-
|
87
|
-
/**
|
88
|
-
This method will be called just before you become the first responder
|
89
|
-
so you can make changes.
|
90
|
-
*/
|
91
|
-
didBecomeFirstResponder: function() {},
|
92
|
-
|
93
|
-
/**
|
94
|
-
This method will be called just before you lose first responder status.
|
95
|
-
*/
|
96
|
-
willLoseFirstResponder: function() {},
|
97
|
-
|
98
|
-
|
99
|
-
// .......................................................................
|
100
|
-
// Keyboard Events
|
101
|
-
//
|
102
|
-
|
103
|
-
/**
|
104
|
-
Set this value to an SC.InputManager instance if you want to use a
|
105
|
-
custom input manager for this specific instance. If you want to override
|
106
|
-
the input manager used for all responders, replace SC.ClassicResponder.inputManager.
|
107
|
-
*/
|
108
|
-
inputManager: function()
|
109
|
-
{
|
110
|
-
return SC.ClassicResponder.inputManager;
|
111
|
-
}.property(),
|
112
|
-
|
113
|
-
/**
|
114
|
-
this method is invoked on the firstResponder whenever the user presses
|
115
|
-
a key. You can interpret this yourself or call interpretKeyEvents()
|
116
|
-
which will use the inputManager to handle the event. The default
|
117
|
-
version just passes this onto the next responder.
|
118
|
-
*/
|
119
|
-
keyDown: function(evt) {
|
120
|
-
var nr = this.get('nextResponder') ;
|
121
|
-
return (nr && nr.keyDown) ? nr.keyDown(evt) : false;
|
122
|
-
},
|
123
|
-
|
124
|
-
/**
|
125
|
-
This method is invoked on the firstResponder whenever the user releases
|
126
|
-
a key. Default version just passes onto the next responder.
|
127
|
-
*/
|
128
|
-
keyUp: function(evt) {
|
129
|
-
var nr = this.get('nextResponder') ;
|
130
|
-
return (nr && nr.keyUp) ? nr.keyUp(evt) : false ;
|
131
|
-
},
|
132
|
-
|
133
|
-
/**
|
134
|
-
This method is invoked whenever the user changes the flag keys that are
|
135
|
-
pressed. pressedFlags is a hash. The default version passes on to the
|
136
|
-
nextRespoonder.
|
137
|
-
*/
|
138
|
-
flagsChanged: function(pressedFlags, evt) {
|
139
|
-
//var nr = this.get('nextResponder') || SC.window.get('firstResponder') ;
|
140
|
-
var nr = this.get('nextResponder') ;
|
141
|
-
return (nr && nr.flagsChanges) ? nr.flagsChanges(pressedFlags, evt) : false;
|
142
|
-
},
|
143
|
-
|
144
|
-
/**
|
145
|
-
This will be called if a keydown event isn't handled by the responder chain.
|
146
|
-
*/
|
147
|
-
performKeyEquivalent: function(keystring, evt) {
|
148
|
-
return false;
|
149
|
-
},
|
150
|
-
|
151
|
-
/*
|
152
|
-
call this method with one or more event objects to process the incoming
|
153
|
-
text. This will use the current inputManager (see above) to process
|
154
|
-
the event and then to make an appropriate call on the receiver.
|
155
|
-
*/
|
156
|
-
interpretKeyEvents: function(evts) {
|
157
|
-
var inputManager = this.get('inputManager');
|
158
|
-
if (inputManager) return inputManager.interpretKeyEvents(evts, this) ;
|
159
|
-
return false ;
|
160
|
-
},
|
161
|
-
|
162
|
-
/**
|
163
|
-
* Attempt to perform a method. If either the method does not exist, or the method returns false, send the request to the nextResponder.
|
164
|
-
* @param {String} method The name of the method to perform
|
165
|
-
* @return {SC.ClassicResponder} The responder that handled the command, or false
|
166
|
-
*/
|
167
|
-
doCommand: function(method)
|
168
|
-
{
|
169
|
-
var responder = this;
|
170
|
-
var args = SC.$A(arguments);
|
171
|
-
var aliases = this._commandAliases[method];
|
172
|
-
var handled = false;
|
173
|
-
method = args.shift();
|
174
|
-
|
175
|
-
do {
|
176
|
-
// attempt to handle the method
|
177
|
-
if (this._responderHandledCommand(responder, method, args)) return responder;
|
178
|
-
// perhaps under an alias?
|
179
|
-
if (aliases)
|
180
|
-
{
|
181
|
-
for (var i=0, n=aliases.length; i < n; i++)
|
182
|
-
{
|
183
|
-
if (this._responderHandledCommand(responder, aliases[i], args)) return responder;
|
184
|
-
}
|
185
|
-
}
|
186
|
-
// nope... next responder, please...
|
187
|
-
} while (responder = responder.get('nextResponder'));
|
188
|
-
// ran out of responders...
|
189
|
-
return false;
|
190
|
-
},
|
191
|
-
|
192
|
-
/** @private */
|
193
|
-
_responderHandledCommand: function( responder, method, args )
|
194
|
-
{
|
195
|
-
// if the method does not explicitly return a false-y value (false, "", 0), it's considered "handled"
|
196
|
-
// WARNING: returning null, or void is *not* == false
|
197
|
-
return (responder.respondsTo(method) && (responder[method].apply(responder, args) !== false));
|
198
|
-
},
|
199
|
-
/** @private */
|
200
|
-
_commandAliases: {
|
201
|
-
'mouseDown': ['didMouseDown'],
|
202
|
-
'mouseUp': ['didMouseUp'],
|
203
|
-
'doubleClick': ['didDoubleClick'],
|
204
|
-
'click': ['didClick'],
|
205
|
-
'mouseDown': ['didMouseDown']
|
206
|
-
}
|
207
|
-
|
208
|
-
// .......................................................................
|
209
|
-
// Mouse Event Handlers
|
210
|
-
//
|
211
|
-
// Implement any of these if you want them to be implemented.
|
212
|
-
|
213
|
-
// when the mouse is pressed.
|
214
|
-
// mouseDown: function(evt) {},
|
215
|
-
|
216
|
-
// when the mouse is releases
|
217
|
-
// mouseUp: function(evt) {},
|
218
|
-
|
219
|
-
// when the mouse is dragged
|
220
|
-
// mouseDragged: function(evt) {},
|
221
|
-
|
222
|
-
// when the mouse leaves the view responder
|
223
|
-
// mouseOut: function(evt) {},
|
224
|
-
|
225
|
-
// when the mouse enters the view.
|
226
|
-
// mouseOver: function(evt) {},
|
227
|
-
|
228
|
-
// when the mouse is moved.
|
229
|
-
// mouseMoved: function(evt) {},
|
230
|
-
|
231
|
-
// .......................................................................
|
232
|
-
// Event Handlers
|
233
|
-
//
|
234
|
-
// These methods are called by the input manager in response to keyboard
|
235
|
-
// events. Most of these methods are defined here for you, but not actually
|
236
|
-
// implemented in code.
|
237
|
-
|
238
|
-
// insert the text or act on the key.
|
239
|
-
// insertText: function(text) {},
|
240
|
-
|
241
|
-
// if the user presses a key-combination event, this will be called so you
|
242
|
-
// can run the command.
|
243
|
-
// performKeyEquivalent: function(charCode, evt) { return false; },
|
244
|
-
|
245
|
-
// this method is called if no other view in the current view hierarchy is
|
246
|
-
// bound to the escape or command-. key equivalent. You can use this to
|
247
|
-
// cancel whatever operation is running.
|
248
|
-
//
|
249
|
-
// cancel: function(sender, evt) {},
|
250
|
-
|
251
|
-
// delete the current selection or delete one element backward from the
|
252
|
-
// current selection.
|
253
|
-
// deleteBackward: function(sender, evt) {},
|
254
|
-
|
255
|
-
// delete the current selection or delete one element forward from the
|
256
|
-
// current selection.
|
257
|
-
// deleteForward: function(sender, evt) {},
|
258
|
-
|
259
|
-
// a field editor might respond by selecting the field before it.
|
260
|
-
// insertBacktab: function(sender, evt) {},
|
261
|
-
|
262
|
-
// insert a newline character or end editing of the receiver.
|
263
|
-
// insertNewline: function(sender, evt) {},
|
264
|
-
|
265
|
-
// insert a tab or move forward to the next field.
|
266
|
-
// insertTab: function(sender, evt) {},
|
267
|
-
|
268
|
-
// move insertion point/selection backward one. (i.e. left arrow key)
|
269
|
-
// moveLeft: function(sender, evt) {},
|
270
|
-
|
271
|
-
// move the insertion point/selection forward one (i.e. right arrow key)
|
272
|
-
// in left-to-right text, this could be the left arrow key.
|
273
|
-
// moveRight: function(sender, evt) {},
|
274
|
-
|
275
|
-
// move the insertion point/selection up one (i.e. up arrow key)
|
276
|
-
// moveUp: function(sender, evt) {},
|
277
|
-
|
278
|
-
// move the insertion point/selection down one (i.e. down arrow key)
|
279
|
-
// moveDown: function(sender, evt) {},
|
280
|
-
|
281
|
-
// move left, extending the selection. - shift || alt
|
282
|
-
// moveLeftAndModifySelection: function(sender, evt) {},
|
283
|
-
|
284
|
-
// move right, extending the seleciton - shift || alt
|
285
|
-
// moveRightAndModifySelection: function(sender, evt) {},
|
286
|
-
|
287
|
-
// move up, extending the selection - shift || alt
|
288
|
-
// moveUpAndModifySelection: function(sender, evt) {},
|
289
|
-
|
290
|
-
// move down, extending selection - shift || alt
|
291
|
-
// moveDownAndModifySelection: function(sender, evt) {},
|
292
|
-
|
293
|
-
// move insertion point/selection to beginning of document.
|
294
|
-
// moveToBeginningOfDocument: function(sender, evt) {},
|
295
|
-
|
296
|
-
// move insertion point/selection to end of document.
|
297
|
-
// moveToEndOfDocument: function(sender, evt) {},
|
298
|
-
|
299
|
-
// page down
|
300
|
-
// pageDown: function(sender, evt) {},
|
301
|
-
|
302
|
-
// page up
|
303
|
-
// pageUp: function(sender, evt) {},
|
304
|
-
|
305
|
-
// select all
|
306
|
-
// selectAll: function(sender, evt) {},
|
307
|
-
|
308
|
-
});
|
309
|
-
|
310
|
-
SC.ClassicResponder.mixin({
|
311
|
-
inputManager: SC.Object.create()
|
312
|
-
}) ;
|
@@ -1,58 +0,0 @@
|
|
1
|
-
// ========================================================================
|
2
|
-
// SproutCore -- JavaScript Application Framework
|
3
|
-
// Copyright ©2006-2008, Sprout Systems, Inc. and contributors.
|
4
|
-
// Portions copyright ©2008 Apple, Inc. All rights reserved.
|
5
|
-
// ========================================================================
|
6
|
-
|
7
|
-
// This file defines some basic extensions to the built-in Event object to
|
8
|
-
// provide some common utility functions.
|
9
|
-
|
10
|
-
SC.mixin(SC.Event, /** @scope SC.Event */ {
|
11
|
-
|
12
|
-
/** @deprecated
|
13
|
-
Returns the character code for the passed event. This is no longer needed
|
14
|
-
as you can now use the .which property on the event itself.
|
15
|
-
*/
|
16
|
-
getCharCode: function(e) {
|
17
|
-
return (e.keyCode) ? e.keyCode : ((e.which)?e.which:0) ;
|
18
|
-
},
|
19
|
-
|
20
|
-
/** @deprecated
|
21
|
-
Returns the pressed character as a string. You should instead use the
|
22
|
-
getCharString() method defined on the event itself.
|
23
|
-
*/
|
24
|
-
getCharString: function(e) {
|
25
|
-
return String.fromCharCode(Event.getCharCode(e)) ;
|
26
|
-
},
|
27
|
-
|
28
|
-
/** @deprecated
|
29
|
-
Returns the pointer location on the page for the passed event. You should
|
30
|
-
now use the pageX and pageY properties on the event instead.
|
31
|
-
*/
|
32
|
-
pointerLocation: function(event) {
|
33
|
-
var ret = {
|
34
|
-
x: event.pageX || (event.clientX +
|
35
|
-
(document.documentElement.scrollLeft || document.body.scrollLeft)),
|
36
|
-
y: event.pageY || (event.clientY +
|
37
|
-
(document.documentElement.scrollTop || document.body.scrollTop))
|
38
|
-
|
39
|
-
};
|
40
|
-
return ret ;
|
41
|
-
},
|
42
|
-
|
43
|
-
/** @deprecated
|
44
|
-
Stops an event both from performing the default action and from bubbling.
|
45
|
-
Instead all event.stop() directly on the event.
|
46
|
-
*/
|
47
|
-
stop: function(event) { return event.stop() ;},
|
48
|
-
|
49
|
-
ALT_KEY: '_ALT',
|
50
|
-
CTRL_KEY: '_CTRL',
|
51
|
-
SHIFT_KEY: '_SHIFT'
|
52
|
-
|
53
|
-
});
|
54
|
-
|
55
|
-
// These enhancements were once provided on the native Event class also.
|
56
|
-
"getCharCode getCharString pointerLocation ALT_KEY CTRL_KEY SHIFT_KEY".split(' ').forEach(function(key){
|
57
|
-
Event[key] = SC.Event[key] ;
|
58
|
-
}) ;
|