Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit 66f08ae

Browse files
committed
v1.2.17
1 parent ab52c52 commit 66f08ae

File tree

1,732 files changed

+207300
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,732 files changed

+207300
-0
lines changed

1.2.17/angular-1.2.17.zip

7.81 MB
Binary file not shown.

1.2.17/angular-animate.js

+1,633
Large diffs are not rendered by default.

1.2.17/angular-animate.min.js

+28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

1.2.17/angular-animate.min.js.map

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

1.2.17/angular-cookies.js

+204
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
/**
2+
* @license AngularJS v1.2.17
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 this object, new
34+
* cookies are created/deleted at the end of current $eval.
35+
* The object's properties can only be strings.
36+
*
37+
* Requires the {@link ngCookies `ngCookies`} module to be installed.
38+
*
39+
* @example
40+
*
41+
* ```js
42+
* function ExampleController($cookies) {
43+
* // Retrieving a cookie
44+
* var favoriteCookie = $cookies.myFavorite;
45+
* // Setting a cookie
46+
* $cookies.myFavorite = 'oatmeal';
47+
* }
48+
* ```
49+
*/
50+
factory('$cookies', ['$rootScope', '$browser', function ($rootScope, $browser) {
51+
var cookies = {},
52+
lastCookies = {},
53+
lastBrowserCookies,
54+
runEval = false,
55+
copy = angular.copy,
56+
isUndefined = angular.isUndefined;
57+
58+
//creates a poller fn that copies all cookies from the $browser to service & inits the service
59+
$browser.addPollFn(function() {
60+
var currentCookies = $browser.cookies();
61+
if (lastBrowserCookies != currentCookies) { //relies on browser.cookies() impl
62+
lastBrowserCookies = currentCookies;
63+
copy(currentCookies, lastCookies);
64+
copy(currentCookies, cookies);
65+
if (runEval) $rootScope.$apply();
66+
}
67+
})();
68+
69+
runEval = true;
70+
71+
//at the end of each eval, push cookies
72+
//TODO: this should happen before the "delayed" watches fire, because if some cookies are not
73+
// strings or browser refuses to store some cookies, we update the model in the push fn.
74+
$rootScope.$watch(push);
75+
76+
return cookies;
77+
78+
79+
/**
80+
* Pushes all the cookies from the service to the browser and verifies if all cookies were
81+
* stored.
82+
*/
83+
function push() {
84+
var name,
85+
value,
86+
browserCookies,
87+
updated;
88+
89+
//delete any cookies deleted in $cookies
90+
for (name in lastCookies) {
91+
if (isUndefined(cookies[name])) {
92+
$browser.cookies(name, undefined);
93+
}
94+
}
95+
96+
//update all cookies updated in $cookies
97+
for(name in cookies) {
98+
value = cookies[name];
99+
if (!angular.isString(value)) {
100+
value = '' + value;
101+
cookies[name] = value;
102+
}
103+
if (value !== lastCookies[name]) {
104+
$browser.cookies(name, value);
105+
updated = true;
106+
}
107+
}
108+
109+
//verify what was actually stored
110+
if (updated){
111+
updated = false;
112+
browserCookies = $browser.cookies();
113+
114+
for (name in cookies) {
115+
if (cookies[name] !== browserCookies[name]) {
116+
//delete or reset all cookies that the browser dropped from $cookies
117+
if (isUndefined(browserCookies[name])) {
118+
delete cookies[name];
119+
} else {
120+
cookies[name] = browserCookies[name];
121+
}
122+
updated = true;
123+
}
124+
}
125+
}
126+
}
127+
}]).
128+
129+
130+
/**
131+
* @ngdoc service
132+
* @name $cookieStore
133+
* @requires $cookies
134+
*
135+
* @description
136+
* Provides a key-value (string-object) storage, that is backed by session cookies.
137+
* Objects put or retrieved from this storage are automatically serialized or
138+
* deserialized by angular's toJson/fromJson.
139+
*
140+
* Requires the {@link ngCookies `ngCookies`} module to be installed.
141+
*
142+
* @example
143+
*
144+
* ```js
145+
* function ExampleController($cookies) {
146+
* // Put cookie
147+
* $cookieStore.put('myFavorite','oatmeal');
148+
* // Get cookie
149+
* var favoriteCookie = $cookieStore.get('myFavorite');
150+
* // Removing a cookie
151+
* $cookieStore.remove('myFavorite');
152+
* }
153+
* ```
154+
*/
155+
factory('$cookieStore', ['$cookies', function($cookies) {
156+
157+
return {
158+
/**
159+
* @ngdoc method
160+
* @name $cookieStore#get
161+
*
162+
* @description
163+
* Returns the value of given cookie key
164+
*
165+
* @param {string} key Id to use for lookup.
166+
* @returns {Object} Deserialized cookie value.
167+
*/
168+
get: function(key) {
169+
var value = $cookies[key];
170+
return value ? angular.fromJson(value) : value;
171+
},
172+
173+
/**
174+
* @ngdoc method
175+
* @name $cookieStore#put
176+
*
177+
* @description
178+
* Sets a value for given cookie key
179+
*
180+
* @param {string} key Id for the `value`.
181+
* @param {Object} value Value to be stored.
182+
*/
183+
put: function(key, value) {
184+
$cookies[key] = angular.toJson(value);
185+
},
186+
187+
/**
188+
* @ngdoc method
189+
* @name $cookieStore#remove
190+
*
191+
* @description
192+
* Remove given cookie
193+
*
194+
* @param {string} key Id of the key-value pair to delete.
195+
*/
196+
remove: function(key) {
197+
delete $cookies[key];
198+
}
199+
};
200+
201+
}]);
202+
203+
204+
})(window, window.angular);

1.2.17/angular-cookies.min.js

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

1.2.17/angular-cookies.min.js.map

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)