angular-gem 1.2.13 → 1.2.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,197 @@
1
+ /**
2
+ * @license AngularJS v1.2.14
3
+ * (c) 2010-2014 Google, Inc. http://angularjs.org
4
+ * License: MIT
5
+ */
6
+ (function(window, angular, undefined) {'use strict';
7
+
8
+ /**
9
+ * @ngdoc module
10
+ * @name ngCookies
11
+ * @description
12
+ *
13
+ * # ngCookies
14
+ *
15
+ * The `ngCookies` module provides a convenient wrapper for reading and writing browser cookies.
16
+ *
17
+ *
18
+ * <div doc-module-components="ngCookies"></div>
19
+ *
20
+ * See {@link ngCookies.$cookies `$cookies`} and
21
+ * {@link ngCookies.$cookieStore `$cookieStore`} for usage.
22
+ */
23
+
24
+
25
+ angular.module('ngCookies', ['ng']).
26
+ /**
27
+ * @ngdoc service
28
+ * @name $cookies
29
+ *
30
+ * @description
31
+ * Provides read/write access to browser's cookies.
32
+ *
33
+ * Only a simple Object is exposed and by adding or removing properties to/from
34
+ * this object, new cookies are created/deleted at the end of current $eval.
35
+ *
36
+ * Requires the {@link ngCookies `ngCookies`} module to be installed.
37
+ *
38
+ * @example
39
+ <example>
40
+ <file name="index.html">
41
+ <script>
42
+ function ExampleController($cookies) {
43
+ // Retrieving a cookie
44
+ var favoriteCookie = $cookies.myFavorite;
45
+ // Setting a cookie
46
+ $cookies.myFavorite = 'oatmeal';
47
+ }
48
+ </script>
49
+ </file>
50
+ </example>
51
+ */
52
+ factory('$cookies', ['$rootScope', '$browser', function ($rootScope, $browser) {
53
+ var cookies = {},
54
+ lastCookies = {},
55
+ lastBrowserCookies,
56
+ runEval = false,
57
+ copy = angular.copy,
58
+ isUndefined = angular.isUndefined;
59
+
60
+ //creates a poller fn that copies all cookies from the $browser to service & inits the service
61
+ $browser.addPollFn(function() {
62
+ var currentCookies = $browser.cookies();
63
+ if (lastBrowserCookies != currentCookies) { //relies on browser.cookies() impl
64
+ lastBrowserCookies = currentCookies;
65
+ copy(currentCookies, lastCookies);
66
+ copy(currentCookies, cookies);
67
+ if (runEval) $rootScope.$apply();
68
+ }
69
+ })();
70
+
71
+ runEval = true;
72
+
73
+ //at the end of each eval, push cookies
74
+ //TODO: this should happen before the "delayed" watches fire, because if some cookies are not
75
+ // strings or browser refuses to store some cookies, we update the model in the push fn.
76
+ $rootScope.$watch(push);
77
+
78
+ return cookies;
79
+
80
+
81
+ /**
82
+ * Pushes all the cookies from the service to the browser and verifies if all cookies were
83
+ * stored.
84
+ */
85
+ function push() {
86
+ var name,
87
+ value,
88
+ browserCookies,
89
+ updated;
90
+
91
+ //delete any cookies deleted in $cookies
92
+ for (name in lastCookies) {
93
+ if (isUndefined(cookies[name])) {
94
+ $browser.cookies(name, undefined);
95
+ }
96
+ }
97
+
98
+ //update all cookies updated in $cookies
99
+ for(name in cookies) {
100
+ value = cookies[name];
101
+ if (!angular.isString(value)) {
102
+ if (angular.isDefined(lastCookies[name])) {
103
+ cookies[name] = lastCookies[name];
104
+ } else {
105
+ delete cookies[name];
106
+ }
107
+ } else if (value !== lastCookies[name]) {
108
+ $browser.cookies(name, value);
109
+ updated = true;
110
+ }
111
+ }
112
+
113
+ //verify what was actually stored
114
+ if (updated){
115
+ updated = false;
116
+ browserCookies = $browser.cookies();
117
+
118
+ for (name in cookies) {
119
+ if (cookies[name] !== browserCookies[name]) {
120
+ //delete or reset all cookies that the browser dropped from $cookies
121
+ if (isUndefined(browserCookies[name])) {
122
+ delete cookies[name];
123
+ } else {
124
+ cookies[name] = browserCookies[name];
125
+ }
126
+ updated = true;
127
+ }
128
+ }
129
+ }
130
+ }
131
+ }]).
132
+
133
+
134
+ /**
135
+ * @ngdoc service
136
+ * @name $cookieStore
137
+ * @requires $cookies
138
+ *
139
+ * @description
140
+ * Provides a key-value (string-object) storage, that is backed by session cookies.
141
+ * Objects put or retrieved from this storage are automatically serialized or
142
+ * deserialized by angular's toJson/fromJson.
143
+ *
144
+ * Requires the {@link ngCookies `ngCookies`} module to be installed.
145
+ *
146
+ * @example
147
+ */
148
+ factory('$cookieStore', ['$cookies', function($cookies) {
149
+
150
+ return {
151
+ /**
152
+ * @ngdoc method
153
+ * @name $cookieStore#get
154
+ *
155
+ * @description
156
+ * Returns the value of given cookie key
157
+ *
158
+ * @param {string} key Id to use for lookup.
159
+ * @returns {Object} Deserialized cookie value.
160
+ */
161
+ get: function(key) {
162
+ var value = $cookies[key];
163
+ return value ? angular.fromJson(value) : value;
164
+ },
165
+
166
+ /**
167
+ * @ngdoc method
168
+ * @name $cookieStore#put
169
+ *
170
+ * @description
171
+ * Sets a value for given cookie key
172
+ *
173
+ * @param {string} key Id for the `value`.
174
+ * @param {Object} value Value to be stored.
175
+ */
176
+ put: function(key, value) {
177
+ $cookies[key] = angular.toJson(value);
178
+ },
179
+
180
+ /**
181
+ * @ngdoc method
182
+ * @name $cookieStore#remove
183
+ *
184
+ * @description
185
+ * Remove given cookie
186
+ *
187
+ * @param {string} key Id of the key-value pair to delete.
188
+ */
189
+ remove: function(key) {
190
+ delete $cookies[key];
191
+ }
192
+ };
193
+
194
+ }]);
195
+
196
+
197
+ })(window, window.angular);
@@ -0,0 +1,414 @@
1
+ /**
2
+ * @license AngularJS v1.2.14
3
+ * (c) 2010-2014 Google, Inc. http://angularjs.org
4
+ * License: MIT
5
+ */
6
+
7
+ (function() {'use strict';
8
+
9
+ /**
10
+ * @description
11
+ *
12
+ * This object provides a utility for producing rich Error messages within
13
+ * Angular. It can be called as follows:
14
+ *
15
+ * var exampleMinErr = minErr('example');
16
+ * throw exampleMinErr('one', 'This {0} is {1}', foo, bar);
17
+ *
18
+ * The above creates an instance of minErr in the example namespace. The
19
+ * resulting error will have a namespaced error code of example.one. The
20
+ * resulting error will replace {0} with the value of foo, and {1} with the
21
+ * value of bar. The object is not restricted in the number of arguments it can
22
+ * take.
23
+ *
24
+ * If fewer arguments are specified than necessary for interpolation, the extra
25
+ * interpolation markers will be preserved in the final string.
26
+ *
27
+ * Since data will be parsed statically during a build step, some restrictions
28
+ * are applied with respect to how minErr instances are created and called.
29
+ * Instances should have names of the form namespaceMinErr for a minErr created
30
+ * using minErr('namespace') . Error codes, namespaces and template strings
31
+ * should all be static strings, not variables or general expressions.
32
+ *
33
+ * @param {string} module The namespace to use for the new minErr instance.
34
+ * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance
35
+ */
36
+
37
+ function minErr(module) {
38
+ return function () {
39
+ var code = arguments[0],
40
+ prefix = '[' + (module ? module + ':' : '') + code + '] ',
41
+ template = arguments[1],
42
+ templateArgs = arguments,
43
+ stringify = function (obj) {
44
+ if (typeof obj === 'function') {
45
+ return obj.toString().replace(/ \{[\s\S]*$/, '');
46
+ } else if (typeof obj === 'undefined') {
47
+ return 'undefined';
48
+ } else if (typeof obj !== 'string') {
49
+ return JSON.stringify(obj);
50
+ }
51
+ return obj;
52
+ },
53
+ message, i;
54
+
55
+ message = prefix + template.replace(/\{\d+\}/g, function (match) {
56
+ var index = +match.slice(1, -1), arg;
57
+
58
+ if (index + 2 < templateArgs.length) {
59
+ arg = templateArgs[index + 2];
60
+ if (typeof arg === 'function') {
61
+ return arg.toString().replace(/ ?\{[\s\S]*$/, '');
62
+ } else if (typeof arg === 'undefined') {
63
+ return 'undefined';
64
+ } else if (typeof arg !== 'string') {
65
+ return toJson(arg);
66
+ }
67
+ return arg;
68
+ }
69
+ return match;
70
+ });
71
+
72
+ message = message + '\nhttp://errors.angularjs.org/1.2.14/' +
73
+ (module ? module + '/' : '') + code;
74
+ for (i = 2; i < arguments.length; i++) {
75
+ message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
76
+ encodeURIComponent(stringify(arguments[i]));
77
+ }
78
+
79
+ return new Error(message);
80
+ };
81
+ }
82
+
83
+ /**
84
+ * @ngdoc type
85
+ * @name angular.Module
86
+ * @module ng
87
+ * @description
88
+ *
89
+ * Interface for configuring angular {@link angular.module modules}.
90
+ */
91
+
92
+ function setupModuleLoader(window) {
93
+
94
+ var $injectorMinErr = minErr('$injector');
95
+ var ngMinErr = minErr('ng');
96
+
97
+ function ensure(obj, name, factory) {
98
+ return obj[name] || (obj[name] = factory());
99
+ }
100
+
101
+ var angular = ensure(window, 'angular', Object);
102
+
103
+ // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
104
+ angular.$$minErr = angular.$$minErr || minErr;
105
+
106
+ return ensure(angular, 'module', function() {
107
+ /** @type {Object.<string, angular.Module>} */
108
+ var modules = {};
109
+
110
+ /**
111
+ * @ngdoc function
112
+ * @name angular.module
113
+ * @module ng
114
+ * @description
115
+ *
116
+ * The `angular.module` is a global place for creating, registering and retrieving Angular
117
+ * modules.
118
+ * All modules (angular core or 3rd party) that should be available to an application must be
119
+ * registered using this mechanism.
120
+ *
121
+ * When passed two or more arguments, a new module is created. If passed only one argument, an
122
+ * existing module (the name passed as the first argument to `module`) is retrieved.
123
+ *
124
+ *
125
+ * # Module
126
+ *
127
+ * A module is a collection of services, directives, filters, and configuration information.
128
+ * `angular.module` is used to configure the {@link auto.$injector $injector}.
129
+ *
130
+ * ```js
131
+ * // Create a new module
132
+ * var myModule = angular.module('myModule', []);
133
+ *
134
+ * // register a new service
135
+ * myModule.value('appName', 'MyCoolApp');
136
+ *
137
+ * // configure existing services inside initialization blocks.
138
+ * myModule.config(function($locationProvider) {
139
+ * // Configure existing providers
140
+ * $locationProvider.hashPrefix('!');
141
+ * });
142
+ * ```
143
+ *
144
+ * Then you can create an injector and load your modules like this:
145
+ *
146
+ * ```js
147
+ * var injector = angular.injector(['ng', 'MyModule'])
148
+ * ```
149
+ *
150
+ * However it's more likely that you'll just use
151
+ * {@link ng.directive:ngApp ngApp} or
152
+ * {@link angular.bootstrap} to simplify this process for you.
153
+ *
154
+ * @param {!string} name The name of the module to create or retrieve.
155
+ * @param {Array.<string>=} requires If specified then new module is being created. If
156
+ * unspecified then the the module is being retrieved for further configuration.
157
+ * @param {Function} configFn Optional configuration function for the module. Same as
158
+ * {@link angular.Module#config Module#config()}.
159
+ * @returns {module} new module with the {@link angular.Module} api.
160
+ */
161
+ return function module(name, requires, configFn) {
162
+ var assertNotHasOwnProperty = function(name, context) {
163
+ if (name === 'hasOwnProperty') {
164
+ throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
165
+ }
166
+ };
167
+
168
+ assertNotHasOwnProperty(name, 'module');
169
+ if (requires && modules.hasOwnProperty(name)) {
170
+ modules[name] = null;
171
+ }
172
+ return ensure(modules, name, function() {
173
+ if (!requires) {
174
+ throw $injectorMinErr('nomod', "Module '{0}' is not available! You either misspelled " +
175
+ "the module name or forgot to load it. If registering a module ensure that you " +
176
+ "specify the dependencies as the second argument.", name);
177
+ }
178
+
179
+ /** @type {!Array.<Array.<*>>} */
180
+ var invokeQueue = [];
181
+
182
+ /** @type {!Array.<Function>} */
183
+ var runBlocks = [];
184
+
185
+ var config = invokeLater('$injector', 'invoke');
186
+
187
+ /** @type {angular.Module} */
188
+ var moduleInstance = {
189
+ // Private state
190
+ _invokeQueue: invokeQueue,
191
+ _runBlocks: runBlocks,
192
+
193
+ /**
194
+ * @ngdoc property
195
+ * @name angular.Module#requires
196
+ * @module ng
197
+ * @propertyOf angular.Module
198
+ * @returns {Array.<string>} List of module names which must be loaded before this module.
199
+ * @description
200
+ * Holds the list of modules which the injector will load before the current module is
201
+ * loaded.
202
+ */
203
+ requires: requires,
204
+
205
+ /**
206
+ * @ngdoc property
207
+ * @name angular.Module#name
208
+ * @module ng
209
+ * @propertyOf angular.Module
210
+ * @returns {string} Name of the module.
211
+ * @description
212
+ */
213
+ name: name,
214
+
215
+
216
+ /**
217
+ * @ngdoc method
218
+ * @name angular.Module#provider
219
+ * @module ng
220
+ * @param {string} name service name
221
+ * @param {Function} providerType Construction function for creating new instance of the
222
+ * service.
223
+ * @description
224
+ * See {@link auto.$provide#provider $provide.provider()}.
225
+ */
226
+ provider: invokeLater('$provide', 'provider'),
227
+
228
+ /**
229
+ * @ngdoc method
230
+ * @name angular.Module#factory
231
+ * @module ng
232
+ * @param {string} name service name
233
+ * @param {Function} providerFunction Function for creating new instance of the service.
234
+ * @description
235
+ * See {@link auto.$provide#factory $provide.factory()}.
236
+ */
237
+ factory: invokeLater('$provide', 'factory'),
238
+
239
+ /**
240
+ * @ngdoc method
241
+ * @name angular.Module#service
242
+ * @module ng
243
+ * @param {string} name service name
244
+ * @param {Function} constructor A constructor function that will be instantiated.
245
+ * @description
246
+ * See {@link auto.$provide#service $provide.service()}.
247
+ */
248
+ service: invokeLater('$provide', 'service'),
249
+
250
+ /**
251
+ * @ngdoc method
252
+ * @name angular.Module#value
253
+ * @module ng
254
+ * @param {string} name service name
255
+ * @param {*} object Service instance object.
256
+ * @description
257
+ * See {@link auto.$provide#value $provide.value()}.
258
+ */
259
+ value: invokeLater('$provide', 'value'),
260
+
261
+ /**
262
+ * @ngdoc method
263
+ * @name angular.Module#constant
264
+ * @module ng
265
+ * @param {string} name constant name
266
+ * @param {*} object Constant value.
267
+ * @description
268
+ * Because the constant are fixed, they get applied before other provide methods.
269
+ * See {@link auto.$provide#constant $provide.constant()}.
270
+ */
271
+ constant: invokeLater('$provide', 'constant', 'unshift'),
272
+
273
+ /**
274
+ * @ngdoc method
275
+ * @name angular.Module#animation
276
+ * @module ng
277
+ * @param {string} name animation name
278
+ * @param {Function} animationFactory Factory function for creating new instance of an
279
+ * animation.
280
+ * @description
281
+ *
282
+ * **NOTE**: animations take effect only if the **ngAnimate** module is loaded.
283
+ *
284
+ *
285
+ * Defines an animation hook that can be later used with
286
+ * {@link ngAnimate.$animate $animate} service and directives that use this service.
287
+ *
288
+ * ```js
289
+ * module.animation('.animation-name', function($inject1, $inject2) {
290
+ * return {
291
+ * eventName : function(element, done) {
292
+ * //code to run the animation
293
+ * //once complete, then run done()
294
+ * return function cancellationFunction(element) {
295
+ * //code to cancel the animation
296
+ * }
297
+ * }
298
+ * }
299
+ * })
300
+ * ```
301
+ *
302
+ * See {@link ngAnimate.$animateProvider#register $animateProvider.register()} and
303
+ * {@link ngAnimate ngAnimate module} for more information.
304
+ */
305
+ animation: invokeLater('$animateProvider', 'register'),
306
+
307
+ /**
308
+ * @ngdoc method
309
+ * @name angular.Module#filter
310
+ * @module ng
311
+ * @param {string} name Filter name.
312
+ * @param {Function} filterFactory Factory function for creating new instance of filter.
313
+ * @description
314
+ * See {@link ng.$filterProvider#register $filterProvider.register()}.
315
+ */
316
+ filter: invokeLater('$filterProvider', 'register'),
317
+
318
+ /**
319
+ * @ngdoc method
320
+ * @name angular.Module#controller
321
+ * @module ng
322
+ * @param {string|Object} name Controller name, or an object map of controllers where the
323
+ * keys are the names and the values are the constructors.
324
+ * @param {Function} constructor Controller constructor function.
325
+ * @description
326
+ * See {@link ng.$controllerProvider#register $controllerProvider.register()}.
327
+ */
328
+ controller: invokeLater('$controllerProvider', 'register'),
329
+
330
+ /**
331
+ * @ngdoc method
332
+ * @name angular.Module#directive
333
+ * @module ng
334
+ * @param {string|Object} name Directive name, or an object map of directives where the
335
+ * keys are the names and the values are the factories.
336
+ * @param {Function} directiveFactory Factory function for creating new instance of
337
+ * directives.
338
+ * @description
339
+ * See {@link ng.$compileProvider#directive $compileProvider.directive()}.
340
+ */
341
+ directive: invokeLater('$compileProvider', 'directive'),
342
+
343
+ /**
344
+ * @ngdoc method
345
+ * @name angular.Module#config
346
+ * @module ng
347
+ * @param {Function} configFn Execute this function on module load. Useful for service
348
+ * configuration.
349
+ * @description
350
+ * Use this method to register work which needs to be performed on module loading.
351
+ */
352
+ config: config,
353
+
354
+ /**
355
+ * @ngdoc method
356
+ * @name angular.Module#run
357
+ * @module ng
358
+ * @param {Function} initializationFn Execute this function after injector creation.
359
+ * Useful for application initialization.
360
+ * @description
361
+ * Use this method to register work which should be performed when the injector is done
362
+ * loading all modules.
363
+ */
364
+ run: function(block) {
365
+ runBlocks.push(block);
366
+ return this;
367
+ }
368
+ };
369
+
370
+ if (configFn) {
371
+ config(configFn);
372
+ }
373
+
374
+ return moduleInstance;
375
+
376
+ /**
377
+ * @param {string} provider
378
+ * @param {string} method
379
+ * @param {String=} insertMethod
380
+ * @returns {angular.Module}
381
+ */
382
+ function invokeLater(provider, method, insertMethod) {
383
+ return function() {
384
+ invokeQueue[insertMethod || 'push']([provider, method, arguments]);
385
+ return moduleInstance;
386
+ };
387
+ }
388
+ });
389
+ };
390
+ });
391
+
392
+ }
393
+
394
+ setupModuleLoader(window);
395
+ })(window);
396
+
397
+ /**
398
+ * Closure compiler type information
399
+ *
400
+ * @typedef { {
401
+ * requires: !Array.<string>,
402
+ * invokeQueue: !Array.<Array.<*>>,
403
+ *
404
+ * service: function(string, Function):angular.Module,
405
+ * factory: function(string, Function):angular.Module,
406
+ * value: function(string, *):angular.Module,
407
+ *
408
+ * filter: function(string, Function):angular.Module,
409
+ *
410
+ * init: function(Function):angular.Module
411
+ * } }
412
+ */
413
+ angular.Module;
414
+