angular-rails-engine 1.2.0.2 → 1.2.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,34 @@
1
1
  /**
2
- * @license AngularJS v1.2.0
3
- * (c) 2010-2012 Google, Inc. http://angularjs.org
2
+ * @license AngularJS v1.2.3
3
+ * (c) 2010-2014 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
6
6
  (function(window, angular, undefined) {'use strict';
7
7
 
8
8
  var $resourceMinErr = angular.$$minErr('$resource');
9
9
 
10
+ // Helper functions and regex to lookup a dotted path on an object
11
+ // stopping at undefined/null. The path must be composed of ASCII
12
+ // identifiers (just like $parse)
13
+ var MEMBER_NAME_REGEX = /^(\.[a-zA-Z_$][0-9a-zA-Z_$]*)+$/;
14
+
15
+ function isValidDottedPath(path) {
16
+ return (path != null && path !== '' && path !== 'hasOwnProperty' &&
17
+ MEMBER_NAME_REGEX.test('.' + path));
18
+ }
19
+
20
+ function lookupDottedPath(obj, path) {
21
+ if (!isValidDottedPath(path)) {
22
+ throw $resourceMinErr('badmember', 'Dotted member path "@{0}" is invalid.', path);
23
+ }
24
+ var keys = path.split('.');
25
+ for (var i = 0, ii = keys.length; i < ii && obj !== undefined; i++) {
26
+ var key = keys[i];
27
+ obj = (obj !== null) ? obj[key] : undefined;
28
+ }
29
+ return obj;
30
+ }
31
+
10
32
  /**
11
33
  * @ngdoc overview
12
34
  * @name ngResource
@@ -134,7 +156,7 @@ var $resourceMinErr = angular.$$minErr('$resource');
134
156
  * usually the resource is assigned to a model which is then rendered by the view. Having an empty
135
157
  * object results in no rendering, once the data arrives from the server then the object is
136
158
  * populated with the data and the view automatically re-renders itself showing the new data. This
137
- * means that in most case one never has to write a callback function for the action methods.
159
+ * means that in most cases one never has to write a callback function for the action methods.
138
160
  *
139
161
  * The action methods on the class object or instance object can be invoked with the following
140
162
  * parameters:
@@ -236,61 +258,10 @@ var $resourceMinErr = angular.$$minErr('$resource');
236
258
  });
237
259
  });
238
260
  </pre>
239
-
240
- * # Buzz client
241
-
242
- Let's look at what a buzz client created with the `$resource` service looks like:
243
- <doc:example>
244
- <doc:source jsfiddle="false">
245
- <script>
246
- function BuzzController($resource) {
247
- this.userId = 'googlebuzz';
248
- this.Activity = $resource(
249
- 'https://www.googleapis.com/buzz/v1/activities/:userId/:visibility/:activityId/:comments',
250
- {alt:'json', callback:'JSON_CALLBACK'},
251
- {
252
- get:{method:'JSONP', params:{visibility:'@self'}},
253
- replies: {method:'JSONP', params:{visibility:'@self', comments:'@comments'}}
254
- }
255
- );
256
- }
257
-
258
- BuzzController.prototype = {
259
- fetch: function() {
260
- this.activities = this.Activity.get({userId:this.userId});
261
- },
262
- expandReplies: function(activity) {
263
- activity.replies = this.Activity.replies({userId:this.userId, activityId:activity.id});
264
- }
265
- };
266
- BuzzController.$inject = ['$resource'];
267
- </script>
268
-
269
- <div ng-controller="BuzzController">
270
- <input ng-model="userId"/>
271
- <button ng-click="fetch()">fetch</button>
272
- <hr/>
273
- <div ng-repeat="item in activities.data.items">
274
- <h1 style="font-size: 15px;">
275
- <img src="{{item.actor.thumbnailUrl}}" style="max-height:30px;max-width:30px;"/>
276
- <a href="{{item.actor.profileUrl}}">{{item.actor.name}}</a>
277
- <a href ng-click="expandReplies(item)" style="float: right;">Expand replies:
278
- {{item.links.replies[0].count}}</a>
279
- </h1>
280
- {{item.object.content | html}}
281
- <div ng-repeat="reply in item.replies.data.items" style="margin-left: 20px;">
282
- <img src="{{reply.actor.thumbnailUrl}}" style="max-height:30px;max-width:30px;"/>
283
- <a href="{{reply.actor.profileUrl}}">{{reply.actor.name}}</a>: {{reply.content | html}}
284
- </div>
285
- </div>
286
- </div>
287
- </doc:source>
288
- <doc:scenario>
289
- </doc:scenario>
290
- </doc:example>
291
261
  */
292
262
  angular.module('ngResource', ['ng']).
293
- factory('$resource', ['$http', '$parse', '$q', function($http, $parse, $q) {
263
+ factory('$resource', ['$http', '$q', function($http, $q) {
264
+
294
265
  var DEFAULT_ACTIONS = {
295
266
  'get': {method:'GET'},
296
267
  'save': {method:'POST'},
@@ -302,10 +273,7 @@ angular.module('ngResource', ['ng']).
302
273
  forEach = angular.forEach,
303
274
  extend = angular.extend,
304
275
  copy = angular.copy,
305
- isFunction = angular.isFunction,
306
- getter = function(obj, path) {
307
- return $parse(path)(obj);
308
- };
276
+ isFunction = angular.isFunction;
309
277
 
310
278
  /**
311
279
  * We need our custom method because encodeURIComponent is too aggressive and doesn't follow
@@ -420,7 +388,7 @@ angular.module('ngResource', ['ng']).
420
388
  forEach(actionParams, function(value, key){
421
389
  if (isFunction(value)) { value = value(); }
422
390
  ids[key] = value && value.charAt && value.charAt(0) == '@' ?
423
- getter(data, value.substr(1)) : value;
391
+ lookupDottedPath(data, value.substr(1)) : value;
424
392
  });
425
393
  return ids;
426
394
  }
@@ -476,7 +444,7 @@ angular.module('ngResource', ['ng']).
476
444
  }
477
445
  /* jshint +W086 */ /* (purposefully fall through case statements) */
478
446
 
479
- var isInstanceCall = data instanceof Resource;
447
+ var isInstanceCall = this instanceof Resource;
480
448
  var value = isInstanceCall ? data : (action.isArray ? [] : new Resource(data));
481
449
  var httpConfig = {};
482
450
  var responseInterceptor = action.interceptor && action.interceptor.response ||
@@ -559,7 +527,7 @@ angular.module('ngResource', ['ng']).
559
527
  if (isFunction(params)) {
560
528
  error = success; success = params; params = {};
561
529
  }
562
- var result = Resource[name](params, this, success, error);
530
+ var result = Resource[name].call(this, params, this, success, error);
563
531
  return result.$promise || result;
564
532
  };
565
533
  });
@@ -1,12 +1,12 @@
1
1
  /*
2
- AngularJS v1.2.0
3
- (c) 2010-2012 Google, Inc. http://angularjs.org
2
+ AngularJS v1.2.3
3
+ (c) 2010-2014 Google, Inc. http://angularjs.org
4
4
  License: MIT
5
5
  */
6
- (function(H,h,C){'use strict';var x=h.$$minErr("$resource");h.module("ngResource",["ng"]).factory("$resource",["$http","$parse","$q",function(D,y,E){function n(h,k){this.template=h;this.defaults=k||{};this.urlParams={}}function t(e,k,f){function q(b,c){var d={};c=u({},k,c);r(c,function(a,c){s(a)&&(a=a());var m;a&&a.charAt&&"@"==a.charAt(0)?(m=a.substr(1),m=y(m)(b)):m=a;d[c]=m});return d}function d(b){return b.resource}function g(b){z(b||{},this)}var F=new n(e);f=u({},G,f);r(f,function(b,c){var A=
7
- /^(POST|PUT|PATCH)$/i.test(b.method);g[c]=function(a,c,m,k){var p={},e,f,v;switch(arguments.length){case 4:v=k,f=m;case 3:case 2:if(s(c)){if(s(a)){f=a;v=c;break}f=c;v=m}else{p=a;e=c;f=m;break}case 1:s(a)?f=a:A?e=a:p=a;break;case 0:break;default:throw x("badargs",arguments.length);}var n=e instanceof g,l=n?e:b.isArray?[]:new g(e),w={},t=b.interceptor&&b.interceptor.response||d,y=b.interceptor&&b.interceptor.responseError||C;r(b,function(a,c){"params"!=c&&("isArray"!=c&&"interceptor"!=c)&&(w[c]=z(a))});
8
- A&&(w.data=e);F.setUrlParams(w,u({},q(e,b.params||{}),p),b.url);p=D(w).then(function(c){var a=c.data,d=l.$promise;if(a){if(h.isArray(a)!==!!b.isArray)throw x("badcfg",b.isArray?"array":"object",h.isArray(a)?"array":"object");b.isArray?(l.length=0,r(a,function(a){l.push(new g(a))})):(z(a,l),l.$promise=d)}l.$resolved=!0;c.resource=l;return c},function(a){l.$resolved=!0;(v||B)(a);return E.reject(a)});p=p.then(function(a){var c=t(a);(f||B)(c,a.headers);return c},y);return n?p:(l.$promise=p,l.$resolved=
9
- !1,l)};g.prototype["$"+c]=function(a,b,d){s(a)&&(d=b,b=a,a={});a=g[c](a,this,b,d);return a.$promise||a}});g.bind=function(b){return t(e,u({},k,b),f)};return g}var G={get:{method:"GET"},save:{method:"POST"},query:{method:"GET",isArray:!0},remove:{method:"DELETE"},"delete":{method:"DELETE"}},B=h.noop,r=h.forEach,u=h.extend,z=h.copy,s=h.isFunction;n.prototype={setUrlParams:function(e,k,f){var q=this,d=f||q.template,g,n,b=q.urlParams={};r(d.split(/\W/),function(c){if("hasOwnProperty"===c)throw x("badname");
10
- !/^\d+$/.test(c)&&(c&&RegExp("(^|[^\\\\]):"+c+"(\\W|$)").test(d))&&(b[c]=!0)});d=d.replace(/\\:/g,":");k=k||{};r(q.urlParams,function(c,b){g=k.hasOwnProperty(b)?k[b]:q.defaults[b];h.isDefined(g)&&null!==g?(n=encodeURIComponent(g).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"%20").replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+"),d=d.replace(RegExp(":"+b+"(\\W|$)","g"),n+"$1")):d=d.replace(RegExp("(/?):"+b+"(\\W|$)","g"),function(a,
11
- c,b){return"/"==b.charAt(0)?b:c+b})});d=d.replace(/\/+$/,"");d=d.replace(/\/\.(?=\w+($|\?))/,".");e.url=d.replace(/\/\\\./,"/.");r(k,function(c,b){q.urlParams[b]||(e.params=e.params||{},e.params[b]=c)})}};return t}])})(window,window.angular);
6
+ (function(H,f,z){'use strict';var u=f.$$minErr("$resource"),A=/^(\.[a-zA-Z_$][0-9a-zA-Z_$]*)+$/;f.module("ngResource",["ng"]).factory("$resource",["$http","$q",function(D,E){function n(f,h){this.template=f;this.defaults=h||{};this.urlParams={}}function v(m,h,k){function r(d,c){var e={};c=w({},h,c);s(c,function(a,c){t(a)&&(a=a());var g;if(a&&a.charAt&&"@"==a.charAt(0)){g=d;var b=a.substr(1);if(null==b||""===b||"hasOwnProperty"===b||!A.test("."+b))throw u("badmember",b);for(var b=b.split("."),f=0,h=
7
+ b.length;f<h&&g!==z;f++){var q=b[f];g=null!==g?g[q]:z}}else g=a;e[c]=g});return e}function e(b){return b.resource}function b(b){B(b||{},this)}var F=new n(m);k=w({},G,k);s(k,function(d,c){var h=/^(POST|PUT|PATCH)$/i.test(d.method);b[c]=function(a,c,g,m){var p={},k,q,x;switch(arguments.length){case 4:x=m,q=g;case 3:case 2:if(t(c)){if(t(a)){q=a;x=c;break}q=c;x=g}else{p=a;k=c;q=g;break}case 1:t(a)?q=a:h?k=a:p=a;break;case 0:break;default:throw u("badargs",arguments.length);}var n=this instanceof b,l=
8
+ n?k:d.isArray?[]:new b(k),y={},v=d.interceptor&&d.interceptor.response||e,A=d.interceptor&&d.interceptor.responseError||z;s(d,function(b,a){"params"!=a&&("isArray"!=a&&"interceptor"!=a)&&(y[a]=B(b))});h&&(y.data=k);F.setUrlParams(y,w({},r(k,d.params||{}),p),d.url);p=D(y).then(function(a){var c=a.data,g=l.$promise;if(c){if(f.isArray(c)!==!!d.isArray)throw u("badcfg",d.isArray?"array":"object",f.isArray(c)?"array":"object");d.isArray?(l.length=0,s(c,function(a){l.push(new b(a))})):(B(c,l),l.$promise=
9
+ g)}l.$resolved=!0;a.resource=l;return a},function(a){l.$resolved=!0;(x||C)(a);return E.reject(a)});p=p.then(function(a){var c=v(a);(q||C)(c,a.headers);return c},A);return n?p:(l.$promise=p,l.$resolved=!1,l)};b.prototype["$"+c]=function(a,d,g){t(a)&&(g=d,d=a,a={});a=b[c].call(this,a,this,d,g);return a.$promise||a}});b.bind=function(b){return v(m,w({},h,b),k)};return b}var G={get:{method:"GET"},save:{method:"POST"},query:{method:"GET",isArray:!0},remove:{method:"DELETE"},"delete":{method:"DELETE"}},
10
+ C=f.noop,s=f.forEach,w=f.extend,B=f.copy,t=f.isFunction;n.prototype={setUrlParams:function(m,h,k){var r=this,e=k||r.template,b,n,d=r.urlParams={};s(e.split(/\W/),function(c){if("hasOwnProperty"===c)throw u("badname");!/^\d+$/.test(c)&&(c&&RegExp("(^|[^\\\\]):"+c+"(\\W|$)").test(e))&&(d[c]=!0)});e=e.replace(/\\:/g,":");h=h||{};s(r.urlParams,function(c,d){b=h.hasOwnProperty(d)?h[d]:r.defaults[d];f.isDefined(b)&&null!==b?(n=encodeURIComponent(b).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,
11
+ "$").replace(/%2C/gi,",").replace(/%20/g,"%20").replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+"),e=e.replace(RegExp(":"+d+"(\\W|$)","g"),n+"$1")):e=e.replace(RegExp("(/?):"+d+"(\\W|$)","g"),function(a,c,b){return"/"==b.charAt(0)?b:c+b})});e=e.replace(/\/+$/,"");e=e.replace(/\/\.(?=\w+($|\?))/,".");m.url=e.replace(/\/\\\./,"/.");s(h,function(b,d){r.urlParams[d]||(m.params=m.params||{},m.params[d]=b)})}};return v}])})(window,window.angular);
12
12
  //# sourceMappingURL=angular-resource.min.js.map
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @license AngularJS v1.2.0
3
- * (c) 2010-2012 Google, Inc. http://angularjs.org
2
+ * @license AngularJS v1.2.3
3
+ * (c) 2010-2014 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
6
6
  (function(window, angular, undefined) {'use strict';
@@ -14,6 +14,9 @@
14
14
  *
15
15
  * The `ngRoute` module provides routing and deeplinking services and directives for angular apps.
16
16
  *
17
+ * ## Example
18
+ * See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
19
+ *
17
20
  * {@installModule route}
18
21
  *
19
22
  * <div doc-module-components="ngRoute"></div>
@@ -29,8 +32,12 @@ var ngRouteModule = angular.module('ngRoute', ['ng']).
29
32
  *
30
33
  * @description
31
34
  *
32
- * Used for configuring routes. See {@link ngRoute.$route $route} for an example.
35
+ * Used for configuring routes.
36
+ *
37
+ * ## Example
38
+ * See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
33
39
  *
40
+ * ## Dependencies
34
41
  * Requires the {@link ngRoute `ngRoute`} module to be installed.
35
42
  */
36
43
  function $RouteProvider(){
@@ -809,8 +816,7 @@ function ngViewFactory( $route, $anchorScroll, $compile, $controller,
809
816
  terminal: true,
810
817
  priority: 400,
811
818
  transclude: 'element',
812
- compile: function(element, attr, linker) {
813
- return function(scope, $element, attr) {
819
+ link: function(scope, $element, attr, ctrl, $transclude) {
814
820
  var currentScope,
815
821
  currentElement,
816
822
  autoScrollExp = attr.autoscroll,
@@ -836,42 +842,47 @@ function ngViewFactory( $route, $anchorScroll, $compile, $controller,
836
842
 
837
843
  if (template) {
838
844
  var newScope = scope.$new();
839
- linker(newScope, function(clone) {
840
- clone.html(template);
841
- $animate.enter(clone, null, currentElement || $element, function onNgViewEnter () {
842
- if (angular.isDefined(autoScrollExp)
843
- && (!autoScrollExp || scope.$eval(autoScrollExp))) {
844
- $anchorScroll();
845
- }
846
- });
847
845
 
848
- cleanupLastView();
846
+ // Note: This will also link all children of ng-view that were contained in the original
847
+ // html. If that content contains controllers, ... they could pollute/change the scope.
848
+ // However, using ng-view on an element with additional content does not make sense...
849
+ // Note: We can't remove them in the cloneAttchFn of $transclude as that
850
+ // function is called before linking the content, which would apply child
851
+ // directives to non existing elements.
852
+ var clone = $transclude(newScope, angular.noop);
853
+ clone.html(template);
854
+ $animate.enter(clone, null, currentElement || $element, function onNgViewEnter () {
855
+ if (angular.isDefined(autoScrollExp)
856
+ && (!autoScrollExp || scope.$eval(autoScrollExp))) {
857
+ $anchorScroll();
858
+ }
859
+ });
849
860
 
850
- var link = $compile(clone.contents()),
851
- current = $route.current;
861
+ cleanupLastView();
852
862
 
853
- currentScope = current.scope = newScope;
854
- currentElement = clone;
863
+ var link = $compile(clone.contents()),
864
+ current = $route.current;
855
865
 
856
- if (current.controller) {
857
- locals.$scope = currentScope;
858
- var controller = $controller(current.controller, locals);
859
- if (current.controllerAs) {
860
- currentScope[current.controllerAs] = controller;
861
- }
862
- clone.data('$ngControllerController', controller);
863
- clone.children().data('$ngControllerController', controller);
866
+ currentScope = current.scope = newScope;
867
+ currentElement = clone;
868
+
869
+ if (current.controller) {
870
+ locals.$scope = currentScope;
871
+ var controller = $controller(current.controller, locals);
872
+ if (current.controllerAs) {
873
+ currentScope[current.controllerAs] = controller;
864
874
  }
875
+ clone.data('$ngControllerController', controller);
876
+ clone.children().data('$ngControllerController', controller);
877
+ }
865
878
 
866
- link(currentScope);
867
- currentScope.$emit('$viewContentLoaded');
868
- currentScope.$eval(onloadExp);
869
- });
879
+ link(currentScope);
880
+ currentScope.$emit('$viewContentLoaded');
881
+ currentScope.$eval(onloadExp);
870
882
  } else {
871
883
  cleanupLastView();
872
884
  }
873
885
  }
874
- };
875
886
  }
876
887
  };
877
888
  }
@@ -1,14 +1,14 @@
1
1
  /*
2
- AngularJS v1.2.0
3
- (c) 2010-2012 Google, Inc. http://angularjs.org
2
+ AngularJS v1.2.3
3
+ (c) 2010-2014 Google, Inc. http://angularjs.org
4
4
  License: MIT
5
5
  */
6
- (function(t,c,B){'use strict';function w(s,r,g,a,h){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(k,d,A){return function(u,k,d){function v(){l&&(l.$destroy(),l=null);m&&(h.leave(m),m=null)}function x(){var f=s.current&&s.current.locals,y=f&&f.$template;if(y){var z=u.$new();A(z,function(e){e.html(y);h.enter(e,null,m||k,function(){!c.isDefined(n)||n&&!u.$eval(n)||r()});v();var p=g(e.contents()),q=s.current;l=q.scope=z;m=e;if(q.controller){f.$scope=l;var d=a(q.controller,
7
- f);q.controllerAs&&(l[q.controllerAs]=d);e.data("$ngControllerController",d);e.children().data("$ngControllerController",d)}p(l);l.$emit("$viewContentLoaded");l.$eval(b)})}else v()}var l,m,n=d.autoscroll,b=d.onload||"";u.$on("$routeChangeSuccess",x);x()}}}}t=c.module("ngRoute",["ng"]).provider("$route",function(){function s(a,h){return c.extend(new (c.extend(function(){},{prototype:a})),h)}function r(a,c){var k=c.caseInsensitiveMatch,d={originalPath:a,regexp:a},g=d.keys=[];a=a.replace(/([().])/g,
8
- "\\$1").replace(/(\/)?:(\w+)([\?|\*])?/g,function(a,c,h,d){a="?"===d?d:null;d="*"===d?d:null;g.push({name:h,optional:!!a});c=c||"";return""+(a?"":c)+"(?:"+(a?c:"")+(d&&"(.+?)"||"([^/]+)")+(a||"")+")"+(a||"")}).replace(/([\/$\*])/g,"\\$1");d.regexp=RegExp("^"+a+"$",k?"i":"");return d}var g={};this.when=function(a,h){g[a]=c.extend({reloadOnSearch:!0},h,a&&r(a,h));if(a){var k="/"==a[a.length-1]?a.substr(0,a.length-1):a+"/";g[k]=c.extend({redirectTo:a},r(k,h))}return this};this.otherwise=function(a){this.when(null,
9
- a);return this};this.$get=["$rootScope","$location","$routeParams","$q","$injector","$http","$templateCache","$sce",function(a,h,k,d,r,u,t,w){function v(){var b=x(),f=n.current;if(b&&f&&b.$$route===f.$$route&&c.equals(b.pathParams,f.pathParams)&&!b.reloadOnSearch&&!m)f.params=b.params,c.copy(f.params,k),a.$broadcast("$routeUpdate",f);else if(b||f)m=!1,a.$broadcast("$routeChangeStart",b,f),(n.current=b)&&b.redirectTo&&(c.isString(b.redirectTo)?h.path(l(b.redirectTo,b.params)).search(b.params).replace():
10
- h.url(b.redirectTo(b.pathParams,h.path(),h.search())).replace()),d.when(b).then(function(){if(b){var a=c.extend({},b.resolve),f,e;c.forEach(a,function(b,f){a[f]=c.isString(b)?r.get(b):r.invoke(b)});c.isDefined(f=b.template)?c.isFunction(f)&&(f=f(b.params)):c.isDefined(e=b.templateUrl)&&(c.isFunction(e)&&(e=e(b.params)),e=w.getTrustedResourceUrl(e),c.isDefined(e)&&(b.loadedTemplateUrl=e,f=u.get(e,{cache:t}).then(function(b){return b.data})));c.isDefined(f)&&(a.$template=f);return d.all(a)}}).then(function(d){b==
11
- n.current&&(b&&(b.locals=d,c.copy(b.params,k)),a.$broadcast("$routeChangeSuccess",b,f))},function(c){b==n.current&&a.$broadcast("$routeChangeError",b,f,c)})}function x(){var b,a;c.forEach(g,function(d,l){var e;if(e=!a){var p=h.path();e=d.keys;var q={};if(d.regexp)if(p=d.regexp.exec(p)){for(var g=1,k=p.length;g<k;++g){var m=e[g-1],n="string"==typeof p[g]?decodeURIComponent(p[g]):p[g];m&&n&&(q[m.name]=n)}e=q}else e=null;else e=null;e=b=e}e&&(a=s(d,{params:c.extend({},h.search(),b),pathParams:b}),a.$$route=
12
- d)});return a||g[null]&&s(g[null],{params:{},pathParams:{}})}function l(a,d){var g=[];c.forEach((a||"").split(":"),function(a,b){if(0===b)g.push(a);else{var c=a.match(/(\w+)(.*)/),h=c[1];g.push(d[h]);g.push(c[2]||"");delete d[h]}});return g.join("")}var m=!1,n={routes:g,reload:function(){m=!0;a.$evalAsync(v)}};a.$on("$locationChangeSuccess",v);return n}]});t.provider("$routeParams",function(){this.$get=function(){return{}}});t.directive("ngView",w);w.$inject=["$route","$anchorScroll","$compile","$controller",
13
- "$animate"]})(window,window.angular);
6
+ (function(t,c,A){'use strict';function x(r,m,d,b,h){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",link:function(l,z,k,B,w){function v(){g&&(g.$destroy(),g=null);q&&(h.leave(q),q=null)}function u(){var a=r.current&&r.current.locals,e=a&&a.$template;if(e){var y=l.$new(),s=w(y,c.noop);s.html(e);h.enter(s,null,q||z,function(){!c.isDefined(n)||n&&!l.$eval(n)||m()});v();var e=d(s.contents()),f=r.current;g=f.scope=y;q=s;f.controller&&(a.$scope=g,a=b(f.controller,a),f.controllerAs&&
7
+ (g[f.controllerAs]=a),s.data("$ngControllerController",a),s.children().data("$ngControllerController",a));e(g);g.$emit("$viewContentLoaded");g.$eval(p)}else v()}var g,q,n=k.autoscroll,p=k.onload||"";l.$on("$routeChangeSuccess",u);u()}}}t=c.module("ngRoute",["ng"]).provider("$route",function(){function r(b,h){return c.extend(new (c.extend(function(){},{prototype:b})),h)}function m(b,c){var l=c.caseInsensitiveMatch,d={originalPath:b,regexp:b},k=d.keys=[];b=b.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)([\?|\*])?/g,
8
+ function(b,c,h,d){b="?"===d?d:null;d="*"===d?d:null;k.push({name:h,optional:!!b});c=c||"";return""+(b?"":c)+"(?:"+(b?c:"")+(d&&"(.+?)"||"([^/]+)")+(b||"")+")"+(b||"")}).replace(/([\/$\*])/g,"\\$1");d.regexp=RegExp("^"+b+"$",l?"i":"");return d}var d={};this.when=function(b,h){d[b]=c.extend({reloadOnSearch:!0},h,b&&m(b,h));if(b){var l="/"==b[b.length-1]?b.substr(0,b.length-1):b+"/";d[l]=c.extend({redirectTo:b},m(l,h))}return this};this.otherwise=function(b){this.when(null,b);return this};this.$get=
9
+ ["$rootScope","$location","$routeParams","$q","$injector","$http","$templateCache","$sce",function(b,h,l,m,k,t,w,v){function u(){var a=g(),e=p.current;if(a&&e&&a.$$route===e.$$route&&c.equals(a.pathParams,e.pathParams)&&!a.reloadOnSearch&&!n)e.params=a.params,c.copy(e.params,l),b.$broadcast("$routeUpdate",e);else if(a||e)n=!1,b.$broadcast("$routeChangeStart",a,e),(p.current=a)&&a.redirectTo&&(c.isString(a.redirectTo)?h.path(q(a.redirectTo,a.params)).search(a.params).replace():h.url(a.redirectTo(a.pathParams,
10
+ h.path(),h.search())).replace()),m.when(a).then(function(){if(a){var b=c.extend({},a.resolve),e,f;c.forEach(b,function(a,e){b[e]=c.isString(a)?k.get(a):k.invoke(a)});c.isDefined(e=a.template)?c.isFunction(e)&&(e=e(a.params)):c.isDefined(f=a.templateUrl)&&(c.isFunction(f)&&(f=f(a.params)),f=v.getTrustedResourceUrl(f),c.isDefined(f)&&(a.loadedTemplateUrl=f,e=t.get(f,{cache:w}).then(function(a){return a.data})));c.isDefined(e)&&(b.$template=e);return m.all(b)}}).then(function(d){a==p.current&&(a&&(a.locals=
11
+ d,c.copy(a.params,l)),b.$broadcast("$routeChangeSuccess",a,e))},function(c){a==p.current&&b.$broadcast("$routeChangeError",a,e,c)})}function g(){var a,b;c.forEach(d,function(d,l){var f;if(f=!b){var g=h.path();f=d.keys;var m={};if(d.regexp)if(g=d.regexp.exec(g)){for(var k=1,q=g.length;k<q;++k){var n=f[k-1],p="string"==typeof g[k]?decodeURIComponent(g[k]):g[k];n&&p&&(m[n.name]=p)}f=m}else f=null;else f=null;f=a=f}f&&(b=r(d,{params:c.extend({},h.search(),a),pathParams:a}),b.$$route=d)});return b||d[null]&&
12
+ r(d[null],{params:{},pathParams:{}})}function q(a,b){var d=[];c.forEach((a||"").split(":"),function(a,c){if(0===c)d.push(a);else{var g=a.match(/(\w+)(.*)/),h=g[1];d.push(b[h]);d.push(g[2]||"");delete b[h]}});return d.join("")}var n=!1,p={routes:d,reload:function(){n=!0;b.$evalAsync(u)}};b.$on("$locationChangeSuccess",u);return p}]});t.provider("$routeParams",function(){this.$get=function(){return{}}});t.directive("ngView",x);x.$inject=["$route","$anchorScroll","$compile","$controller","$animate"]})(window,
13
+ window.angular);
14
14
  //# sourceMappingURL=angular-route.min.js.map
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @license AngularJS v1.2.0
3
- * (c) 2010-2012 Google, Inc. http://angularjs.org
2
+ * @license AngularJS v1.2.3
3
+ * (c) 2010-2014 Google, Inc. http://angularjs.org
4
4
  * License: MIT
5
5
  */
6
6
  (function(window, angular, undefined) {'use strict';
@@ -51,6 +51,8 @@ var $sanitizeMinErr = angular.$$minErr('$sanitize');
51
51
  * it into the returned string, however, since our parser is more strict than a typical browser
52
52
  * parser, it's possible that some obscure input, which would be recognized as valid HTML by a
53
53
  * browser, won't make it through the sanitizer.
54
+ * The whitelist is configured using the functions `aHrefSanitizationWhitelist` and
55
+ * `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider `$compileProvider`}.
54
56
  *
55
57
  * @param {string} html Html input.
56
58
  * @returns {string} Sanitized html.
@@ -133,11 +135,24 @@ var $sanitizeMinErr = angular.$$minErr('$sanitize');
133
135
  </doc:scenario>
134
136
  </doc:example>
135
137
  */
136
- var $sanitize = function(html) {
138
+ function $SanitizeProvider() {
139
+ this.$get = ['$$sanitizeUri', function($$sanitizeUri) {
140
+ return function(html) {
141
+ var buf = [];
142
+ htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) {
143
+ return !/^unsafe/.test($$sanitizeUri(uri, isImage));
144
+ }));
145
+ return buf.join('');
146
+ };
147
+ }];
148
+ }
149
+
150
+ function sanitizeText(chars) {
137
151
  var buf = [];
138
- htmlParser(html, htmlSanitizeWriter(buf));
139
- return buf.join('');
140
- };
152
+ var writer = htmlSanitizeWriter(buf, angular.noop);
153
+ writer.chars(chars);
154
+ return buf.join('');
155
+ }
141
156
 
142
157
 
143
158
  // Regular Expressions for parsing tags and attributes
@@ -150,7 +165,6 @@ var START_TAG_REGEXP =
150
165
  COMMENT_REGEXP = /<!--(.*?)-->/g,
151
166
  DOCTYPE_REGEXP = /<!DOCTYPE([^>]*?)>/i,
152
167
  CDATA_REGEXP = /<!\[CDATA\[(.*?)]]>/g,
153
- URI_REGEXP = /^((ftp|https?):\/\/|mailto:|tel:|#)/i,
154
168
  // Match everything outside of normal chars and " (quote character)
155
169
  NON_ALPHANUMERIC_REGEXP = /([^\#-~| |!])/g;
156
170
 
@@ -358,8 +372,18 @@ function htmlParser( html, handler ) {
358
372
  */
359
373
  var hiddenPre=document.createElement("pre");
360
374
  function decodeEntities(value) {
361
- hiddenPre.innerHTML=value.replace(/</g,"&lt;");
362
- return hiddenPre.innerText || hiddenPre.textContent || '';
375
+ if (!value) {
376
+ return '';
377
+ }
378
+ // Note: IE8 does not preserve spaces at the start/end of innerHTML
379
+ var spaceRe = /^(\s*)([\s\S]*?)(\s*)$/;
380
+ var parts = spaceRe.exec(value);
381
+ parts[0] = '';
382
+ if (parts[2]) {
383
+ hiddenPre.innerHTML=parts[2].replace(/</g,"&lt;");
384
+ parts[2] = hiddenPre.innerText || hiddenPre.textContent;
385
+ }
386
+ return parts.join('');
363
387
  }
364
388
 
365
389
  /**
@@ -389,7 +413,7 @@ function encodeEntities(value) {
389
413
  * comment: function(text) {}
390
414
  * }
391
415
  */
392
- function htmlSanitizeWriter(buf){
416
+ function htmlSanitizeWriter(buf, uriValidator){
393
417
  var ignore = false;
394
418
  var out = angular.bind(buf, buf.push);
395
419
  return {
@@ -403,7 +427,9 @@ function htmlSanitizeWriter(buf){
403
427
  out(tag);
404
428
  angular.forEach(attrs, function(value, key){
405
429
  var lkey=angular.lowercase(key);
406
- if (validAttrs[lkey]===true && (uriAttrs[lkey]!==true || value.match(URI_REGEXP))) {
430
+ var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background');
431
+ if (validAttrs[lkey] === true &&
432
+ (uriAttrs[lkey] !== true || uriValidator(value, isImage))) {
407
433
  out(' ');
408
434
  out(key);
409
435
  out('="');
@@ -435,9 +461,9 @@ function htmlSanitizeWriter(buf){
435
461
 
436
462
 
437
463
  // define ngSanitize module and register $sanitize service
438
- angular.module('ngSanitize', []).value('$sanitize', $sanitize);
464
+ angular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);
439
465
 
440
- /* global htmlSanitizeWriter: false */
466
+ /* global sanitizeText: false */
441
467
 
442
468
  /**
443
469
  * @ngdoc filter
@@ -537,7 +563,7 @@ angular.module('ngSanitize', []).value('$sanitize', $sanitize);
537
563
  </doc:scenario>
538
564
  </doc:example>
539
565
  */
540
- angular.module('ngSanitize').filter('linky', function() {
566
+ angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
541
567
  var LINKY_URL_REGEXP =
542
568
  /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>]/,
543
569
  MAILTO_REGEXP = /^mailto:/;
@@ -547,31 +573,43 @@ angular.module('ngSanitize').filter('linky', function() {
547
573
  var match;
548
574
  var raw = text;
549
575
  var html = [];
550
- // TODO(vojta): use $sanitize instead
551
- var writer = htmlSanitizeWriter(html);
552
576
  var url;
553
577
  var i;
554
- var properties = {};
555
- if (angular.isDefined(target)) {
556
- properties.target = target;
557
- }
558
578
  while ((match = raw.match(LINKY_URL_REGEXP))) {
559
579
  // We can not end in these as they are sometimes found at the end of the sentence
560
580
  url = match[0];
561
581
  // if we did not match ftp/http/mailto then assume mailto
562
582
  if (match[2] == match[3]) url = 'mailto:' + url;
563
583
  i = match.index;
564
- writer.chars(raw.substr(0, i));
565
- properties.href = url;
566
- writer.start('a', properties);
567
- writer.chars(match[0].replace(MAILTO_REGEXP, ''));
568
- writer.end('a');
584
+ addText(raw.substr(0, i));
585
+ addLink(url, match[0].replace(MAILTO_REGEXP, ''));
569
586
  raw = raw.substring(i + match[0].length);
570
587
  }
571
- writer.chars(raw);
572
- return html.join('');
588
+ addText(raw);
589
+ return $sanitize(html.join(''));
590
+
591
+ function addText(text) {
592
+ if (!text) {
593
+ return;
594
+ }
595
+ html.push(sanitizeText(text));
596
+ }
597
+
598
+ function addLink(url, text) {
599
+ html.push('<a ');
600
+ if (angular.isDefined(target)) {
601
+ html.push('target="');
602
+ html.push(target);
603
+ html.push('" ');
604
+ }
605
+ html.push('href="');
606
+ html.push(url);
607
+ html.push('">');
608
+ addText(text);
609
+ html.push('</a>');
610
+ }
573
611
  };
574
- });
612
+ }]);
575
613
 
576
614
 
577
615
  })(window, window.angular);