tablo_connect 0.0.2

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.
Files changed (239) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +22 -0
  3. data/README.md +43 -0
  4. data/Rakefile +26 -0
  5. data/app/assets/fonts/tablo_connect/bootstrap/glyphicons-halflings-regular.eot +0 -0
  6. data/app/assets/fonts/tablo_connect/bootstrap/glyphicons-halflings-regular.svg +288 -0
  7. data/app/assets/fonts/tablo_connect/bootstrap/glyphicons-halflings-regular.ttf +0 -0
  8. data/app/assets/fonts/tablo_connect/bootstrap/glyphicons-halflings-regular.woff +0 -0
  9. data/app/assets/fonts/tablo_connect/bootstrap/glyphicons-halflings-regular.woff2 +0 -0
  10. data/app/assets/javascripts/tablo_connect/angular/angular-animate.js +3928 -0
  11. data/app/assets/javascripts/tablo_connect/angular/angular-animate.min.js +56 -0
  12. data/app/assets/javascripts/tablo_connect/angular/angular-animate.min.js.map +8 -0
  13. data/app/assets/javascripts/tablo_connect/angular/angular-aria.js +397 -0
  14. data/app/assets/javascripts/tablo_connect/angular/angular-aria.min.js +14 -0
  15. data/app/assets/javascripts/tablo_connect/angular/angular-aria.min.js.map +8 -0
  16. data/app/assets/javascripts/tablo_connect/angular/angular-cookies.js +321 -0
  17. data/app/assets/javascripts/tablo_connect/angular/angular-cookies.min.js +9 -0
  18. data/app/assets/javascripts/tablo_connect/angular/angular-cookies.min.js.map +8 -0
  19. data/app/assets/javascripts/tablo_connect/angular/angular-csp.css +21 -0
  20. data/app/assets/javascripts/tablo_connect/angular/angular-loader.js +443 -0
  21. data/app/assets/javascripts/tablo_connect/angular/angular-loader.min.js +10 -0
  22. data/app/assets/javascripts/tablo_connect/angular/angular-loader.min.js.map +8 -0
  23. data/app/assets/javascripts/tablo_connect/angular/angular-message-format.js +980 -0
  24. data/app/assets/javascripts/tablo_connect/angular/angular-message-format.min.js +26 -0
  25. data/app/assets/javascripts/tablo_connect/angular/angular-message-format.min.js.map +8 -0
  26. data/app/assets/javascripts/tablo_connect/angular/angular-messages.js +685 -0
  27. data/app/assets/javascripts/tablo_connect/angular/angular-messages.min.js +12 -0
  28. data/app/assets/javascripts/tablo_connect/angular/angular-messages.min.js.map +8 -0
  29. data/app/assets/javascripts/tablo_connect/angular/angular-mocks.js +2470 -0
  30. data/app/assets/javascripts/tablo_connect/angular/angular-resource.js +675 -0
  31. data/app/assets/javascripts/tablo_connect/angular/angular-resource.min.js +13 -0
  32. data/app/assets/javascripts/tablo_connect/angular/angular-resource.min.js.map +8 -0
  33. data/app/assets/javascripts/tablo_connect/angular/angular-route.js +991 -0
  34. data/app/assets/javascripts/tablo_connect/angular/angular-route.min.js +15 -0
  35. data/app/assets/javascripts/tablo_connect/angular/angular-route.min.js.map +8 -0
  36. data/app/assets/javascripts/tablo_connect/angular/angular-sanitize.js +683 -0
  37. data/app/assets/javascripts/tablo_connect/angular/angular-sanitize.min.js +16 -0
  38. data/app/assets/javascripts/tablo_connect/angular/angular-sanitize.min.js.map +8 -0
  39. data/app/assets/javascripts/tablo_connect/angular/angular-scenario.js +40324 -0
  40. data/app/assets/javascripts/tablo_connect/angular/angular-touch.js +628 -0
  41. data/app/assets/javascripts/tablo_connect/angular/angular-touch.min.js +13 -0
  42. data/app/assets/javascripts/tablo_connect/angular/angular-touch.min.js.map +8 -0
  43. data/app/assets/javascripts/tablo_connect/angular/angular-ui-router.js +4370 -0
  44. data/app/assets/javascripts/tablo_connect/angular/angular.js +28904 -0
  45. data/app/assets/javascripts/tablo_connect/angular/angular.min.js +294 -0
  46. data/app/assets/javascripts/tablo_connect/angular/angular.min.js.map +8 -0
  47. data/app/assets/javascripts/tablo_connect/angular/errors.json +1 -0
  48. data/app/assets/javascripts/tablo_connect/angular/version.json +1 -0
  49. data/app/assets/javascripts/tablo_connect/angular/version.txt +1 -0
  50. data/app/assets/javascripts/tablo_connect/application.js +21 -0
  51. data/app/assets/javascripts/tablo_connect/bootstrap/affix.js +162 -0
  52. data/app/assets/javascripts/tablo_connect/bootstrap/alert.js +94 -0
  53. data/app/assets/javascripts/tablo_connect/bootstrap/button.js +120 -0
  54. data/app/assets/javascripts/tablo_connect/bootstrap/carousel.js +237 -0
  55. data/app/assets/javascripts/tablo_connect/bootstrap/collapse.js +211 -0
  56. data/app/assets/javascripts/tablo_connect/bootstrap/dropdown.js +165 -0
  57. data/app/assets/javascripts/tablo_connect/bootstrap/modal.js +337 -0
  58. data/app/assets/javascripts/tablo_connect/bootstrap/popover.js +108 -0
  59. data/app/assets/javascripts/tablo_connect/bootstrap/scrollspy.js +172 -0
  60. data/app/assets/javascripts/tablo_connect/bootstrap/tab.js +155 -0
  61. data/app/assets/javascripts/tablo_connect/bootstrap/tooltip.js +514 -0
  62. data/app/assets/javascripts/tablo_connect/bootstrap/transition.js +59 -0
  63. data/app/assets/javascripts/tablo_connect/jquery/jquery.js +9210 -0
  64. data/app/assets/javascripts/tablo_connect/ng_app/app.js +39 -0
  65. data/app/assets/javascripts/tablo_connect/ng_app/controllers/episodes_controller.js +17 -0
  66. data/app/assets/javascripts/tablo_connect/ng_app/controllers/home_controller.js +9 -0
  67. data/app/assets/javascripts/tablo_connect/ng_app/controllers/movies_controller.js +17 -0
  68. data/app/assets/javascripts/tablo_connect/ng_app/controllers/shows_controller.js +9 -0
  69. data/app/assets/javascripts/tablo_connect/ng_app/filters/titleize_filter.js +17 -0
  70. data/app/assets/javascripts/tablo_connect/ng_app/filters/url_filter.js +19 -0
  71. data/app/assets/javascripts/tablo_connect/ng_app/modules/alerts/alerts.js +9 -0
  72. data/app/assets/javascripts/tablo_connect/ng_app/modules/alerts/directives/alerts_directive.js +19 -0
  73. data/app/assets/javascripts/tablo_connect/ng_app/modules/alerts/services/alerts_service.js +22 -0
  74. data/app/assets/javascripts/tablo_connect/ng_app/modules/alerts/templates/alerts.html +6 -0
  75. data/app/assets/javascripts/tablo_connect/ng_app/modules/tablo_sync/directives/tablo_sync_directive.js +31 -0
  76. data/app/assets/javascripts/tablo_connect/ng_app/modules/tablo_sync/services/tablo_sync_service.js +20 -0
  77. data/app/assets/javascripts/tablo_connect/ng_app/modules/tablo_sync/tablo_sync.js +9 -0
  78. data/app/assets/javascripts/tablo_connect/ng_app/modules/tablo_sync/templates/tablo_sync.html +4 -0
  79. data/app/assets/javascripts/tablo_connect/ng_app/services/tablo_service.js +98 -0
  80. data/app/assets/javascripts/tablo_connect/ng_app/templates/episodes.html +36 -0
  81. data/app/assets/javascripts/tablo_connect/ng_app/templates/index.html +3 -0
  82. data/app/assets/javascripts/tablo_connect/ng_app/templates/movies.html +33 -0
  83. data/app/assets/javascripts/tablo_connect/ng_app/templates/shows.html +13 -0
  84. data/app/assets/stylesheets/tablo_connect/_bootstrap.scss +56 -0
  85. data/app/assets/stylesheets/tablo_connect/_global.scss +19 -0
  86. data/app/assets/stylesheets/tablo_connect/_movies.scss +0 -0
  87. data/app/assets/stylesheets/tablo_connect/_shows.scss +30 -0
  88. data/app/assets/stylesheets/tablo_connect/application.scss +18 -0
  89. data/app/assets/stylesheets/tablo_connect/bootstrap/_alerts.scss +73 -0
  90. data/app/assets/stylesheets/tablo_connect/bootstrap/_badges.scss +68 -0
  91. data/app/assets/stylesheets/tablo_connect/bootstrap/_breadcrumbs.scss +26 -0
  92. data/app/assets/stylesheets/tablo_connect/bootstrap/_button-groups.scss +244 -0
  93. data/app/assets/stylesheets/tablo_connect/bootstrap/_buttons.scss +168 -0
  94. data/app/assets/stylesheets/tablo_connect/bootstrap/_carousel.scss +269 -0
  95. data/app/assets/stylesheets/tablo_connect/bootstrap/_close.scss +36 -0
  96. data/app/assets/stylesheets/tablo_connect/bootstrap/_code.scss +69 -0
  97. data/app/assets/stylesheets/tablo_connect/bootstrap/_component-animations.scss +37 -0
  98. data/app/assets/stylesheets/tablo_connect/bootstrap/_dropdowns.scss +216 -0
  99. data/app/assets/stylesheets/tablo_connect/bootstrap/_forms.scss +611 -0
  100. data/app/assets/stylesheets/tablo_connect/bootstrap/_glyphicons.scss +307 -0
  101. data/app/assets/stylesheets/tablo_connect/bootstrap/_grid.scss +84 -0
  102. data/app/assets/stylesheets/tablo_connect/bootstrap/_input-groups.scss +167 -0
  103. data/app/assets/stylesheets/tablo_connect/bootstrap/_jumbotron.scss +52 -0
  104. data/app/assets/stylesheets/tablo_connect/bootstrap/_labels.scss +66 -0
  105. data/app/assets/stylesheets/tablo_connect/bootstrap/_list-group.scss +130 -0
  106. data/app/assets/stylesheets/tablo_connect/bootstrap/_media.scss +66 -0
  107. data/app/assets/stylesheets/tablo_connect/bootstrap/_mixins.scss +40 -0
  108. data/app/assets/stylesheets/tablo_connect/bootstrap/_modals.scss +150 -0
  109. data/app/assets/stylesheets/tablo_connect/bootstrap/_navbar.scss +662 -0
  110. data/app/assets/stylesheets/tablo_connect/bootstrap/_navs.scss +242 -0
  111. data/app/assets/stylesheets/tablo_connect/bootstrap/_normalize.scss +424 -0
  112. data/app/assets/stylesheets/tablo_connect/bootstrap/_pager.scss +54 -0
  113. data/app/assets/stylesheets/tablo_connect/bootstrap/_pagination.scss +89 -0
  114. data/app/assets/stylesheets/tablo_connect/bootstrap/_panels.scss +271 -0
  115. data/app/assets/stylesheets/tablo_connect/bootstrap/_popovers.scss +131 -0
  116. data/app/assets/stylesheets/tablo_connect/bootstrap/_print.scss +101 -0
  117. data/app/assets/stylesheets/tablo_connect/bootstrap/_progress-bars.scss +87 -0
  118. data/app/assets/stylesheets/tablo_connect/bootstrap/_responsive-embed.scss +35 -0
  119. data/app/assets/stylesheets/tablo_connect/bootstrap/_responsive-utilities.scss +179 -0
  120. data/app/assets/stylesheets/tablo_connect/bootstrap/_scaffolding.scss +161 -0
  121. data/app/assets/stylesheets/tablo_connect/bootstrap/_tables.scss +234 -0
  122. data/app/assets/stylesheets/tablo_connect/bootstrap/_theme.scss +291 -0
  123. data/app/assets/stylesheets/tablo_connect/bootstrap/_thumbnails.scss +38 -0
  124. data/app/assets/stylesheets/tablo_connect/bootstrap/_tooltip.scss +101 -0
  125. data/app/assets/stylesheets/tablo_connect/bootstrap/_type.scss +298 -0
  126. data/app/assets/stylesheets/tablo_connect/bootstrap/_utilities.scss +55 -0
  127. data/app/assets/stylesheets/tablo_connect/bootstrap/_variables.scss +872 -0
  128. data/app/assets/stylesheets/tablo_connect/bootstrap/_wells.scss +29 -0
  129. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_alerts.scss +14 -0
  130. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_background-variant.scss +12 -0
  131. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_border-radius.scss +18 -0
  132. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_buttons.scss +68 -0
  133. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_center-block.scss +7 -0
  134. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_clearfix.scss +22 -0
  135. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_forms.scss +88 -0
  136. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_gradients.scss +58 -0
  137. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_grid-framework.scss +81 -0
  138. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_grid.scss +122 -0
  139. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_hide-text.scss +21 -0
  140. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_image.scss +33 -0
  141. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_labels.scss +12 -0
  142. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_list-group.scss +32 -0
  143. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_nav-divider.scss +10 -0
  144. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_nav-vertical-align.scss +9 -0
  145. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_opacity.scss +8 -0
  146. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_pagination.scss +24 -0
  147. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_panels.scss +24 -0
  148. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_progress-bar.scss +10 -0
  149. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_reset-filter.scss +8 -0
  150. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_reset-text.scss +18 -0
  151. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_resize.scss +6 -0
  152. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_responsive-visibility.scss +21 -0
  153. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_size.scss +10 -0
  154. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_tab-focus.scss +9 -0
  155. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_table-row.scss +28 -0
  156. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_text-emphasis.scss +12 -0
  157. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_text-overflow.scss +8 -0
  158. data/app/assets/stylesheets/tablo_connect/bootstrap/mixins/_vendor-prefixes.scss +222 -0
  159. data/app/controllers/tablo_connect/application_controller.rb +4 -0
  160. data/app/controllers/tablo_connect/copy_controller.rb +75 -0
  161. data/app/controllers/tablo_connect/home_controller.rb +6 -0
  162. data/app/controllers/tablo_connect/movies_controller.rb +9 -0
  163. data/app/controllers/tablo_connect/shows_controller.rb +11 -0
  164. data/app/controllers/tablo_connect/sync_controller.rb +73 -0
  165. data/app/helpers/tablo_connect/application_helper.rb +4 -0
  166. data/app/helpers/tablo_connect/movies_helper.rb +4 -0
  167. data/app/helpers/tablo_connect/shows_helper.rb +4 -0
  168. data/app/models/tablo_connect/movie.rb +14 -0
  169. data/app/models/tablo_connect/show.rb +23 -0
  170. data/app/views/layouts/tablo_connect/_header.html.erb +20 -0
  171. data/app/views/layouts/tablo_connect/application.html.erb +19 -0
  172. data/app/views/tablo_connect/home/index.html.erb +1 -0
  173. data/config/routes.rb +10 -0
  174. data/db/migrate/20151101164611_create_tablo_connect_movies.rb +18 -0
  175. data/db/migrate/20151101165020_create_tablo_connect_shows.rb +21 -0
  176. data/lib/tablo_connect.rb +7 -0
  177. data/lib/tablo_connect/engine.rb +28 -0
  178. data/lib/tablo_connect/version.rb +3 -0
  179. data/lib/tasks/tablo_connect_tasks.rake +4 -0
  180. data/spec/controllers/tablo_connect/copy_controller_spec.rb +244 -0
  181. data/spec/controllers/tablo_connect/movies_controller_spec.rb +27 -0
  182. data/spec/controllers/tablo_connect/shows_controller_spec.rb +45 -0
  183. data/spec/controllers/tablo_connect/sync_controller_spec.rb +209 -0
  184. data/spec/factories/tablo_connect_movies.rb +11 -0
  185. data/spec/factories/tablo_connect_shows.rb +15 -0
  186. data/spec/javascript/angular-environment.js +1 -0
  187. data/spec/javascript/karma.conf.js +48 -0
  188. data/spec/javascript/unit/controllers/episodes_controller_spec.js +49 -0
  189. data/spec/javascript/unit/controllers/home_controller_spec.js +34 -0
  190. data/spec/javascript/unit/controllers/movies_controller_spec.js +55 -0
  191. data/spec/javascript/unit/controllers/shows_controller_spec.js +33 -0
  192. data/spec/javascript/unit/filters/titleize_filter_spec.js +25 -0
  193. data/spec/javascript/unit/filters/url_filter_spec.js +33 -0
  194. data/spec/javascript/unit/modules/alerts/directives/alerts_directive_spec.js +39 -0
  195. data/spec/javascript/unit/modules/alerts/services/alerts_service_spec.js +51 -0
  196. data/spec/javascript/unit/modules/tablo_sync/directives/tablo_sync_directive_spec.js +68 -0
  197. data/spec/javascript/unit/modules/tablo_sync/services/tablo_sync_service_spec.js +26 -0
  198. data/spec/javascript/unit/services/tablo_service_spec.js +28 -0
  199. data/spec/models/tablo_connect/movie_spec.rb +32 -0
  200. data/spec/models/tablo_connect/show_spec.rb +65 -0
  201. data/spec/spec_helper.rb +86 -0
  202. data/spec/test_app/README.rdoc +28 -0
  203. data/spec/test_app/Rakefile +6 -0
  204. data/spec/test_app/app/assets/javascripts/application.js +13 -0
  205. data/spec/test_app/app/assets/stylesheets/application.css +15 -0
  206. data/spec/test_app/app/controllers/application_controller.rb +5 -0
  207. data/spec/test_app/app/helpers/application_helper.rb +2 -0
  208. data/spec/test_app/app/views/layouts/application.html.erb +14 -0
  209. data/spec/test_app/bin/bundle +3 -0
  210. data/spec/test_app/bin/rails +4 -0
  211. data/spec/test_app/bin/rake +4 -0
  212. data/spec/test_app/bin/setup +29 -0
  213. data/spec/test_app/config.ru +4 -0
  214. data/spec/test_app/config/application.rb +32 -0
  215. data/spec/test_app/config/boot.rb +5 -0
  216. data/spec/test_app/config/database.yml +25 -0
  217. data/spec/test_app/config/environment.rb +5 -0
  218. data/spec/test_app/config/environments/development.rb +41 -0
  219. data/spec/test_app/config/environments/production.rb +79 -0
  220. data/spec/test_app/config/environments/test.rb +42 -0
  221. data/spec/test_app/config/initializers/assets.rb +11 -0
  222. data/spec/test_app/config/initializers/backtrace_silencers.rb +7 -0
  223. data/spec/test_app/config/initializers/cookies_serializer.rb +3 -0
  224. data/spec/test_app/config/initializers/filter_parameter_logging.rb +4 -0
  225. data/spec/test_app/config/initializers/inflections.rb +16 -0
  226. data/spec/test_app/config/initializers/mime_types.rb +4 -0
  227. data/spec/test_app/config/initializers/session_store.rb +3 -0
  228. data/spec/test_app/config/initializers/wrap_parameters.rb +14 -0
  229. data/spec/test_app/config/locales/en.yml +23 -0
  230. data/spec/test_app/config/routes.rb +4 -0
  231. data/spec/test_app/config/secrets.yml +22 -0
  232. data/spec/test_app/db/schema.rb +49 -0
  233. data/spec/test_app/db/test.sqlite3 +0 -0
  234. data/spec/test_app/log/test.log +5561 -0
  235. data/spec/test_app/public/404.html +67 -0
  236. data/spec/test_app/public/422.html +67 -0
  237. data/spec/test_app/public/500.html +66 -0
  238. data/spec/test_app/public/favicon.ico +0 -0
  239. metadata +550 -0
@@ -0,0 +1,13 @@
1
+ /*
2
+ AngularJS v1.4.7
3
+ (c) 2010-2015 Google, Inc. http://angularjs.org
4
+ License: MIT
5
+ */
6
+ (function(I,f,C){'use strict';function D(t,e){e=e||{};f.forEach(e,function(f,k){delete e[k]});for(var k in t)!t.hasOwnProperty(k)||"$"===k.charAt(0)&&"$"===k.charAt(1)||(e[k]=t[k]);return e}var y=f.$$minErr("$resource"),B=/^(\.[a-zA-Z_$@][0-9a-zA-Z_$@]*)+$/;f.module("ngResource",["ng"]).provider("$resource",function(){var t=/^https?:\/\/[^\/]*/,e=this;this.defaults={stripTrailingSlashes:!0,actions:{get:{method:"GET"},save:{method:"POST"},query:{method:"GET",isArray:!0},remove:{method:"DELETE"},"delete":{method:"DELETE"}}};
7
+ this.$get=["$http","$q",function(k,F){function w(f,g){this.template=f;this.defaults=r({},e.defaults,g);this.urlParams={}}function z(l,g,s,h){function c(b,q){var c={};q=r({},g,q);u(q,function(a,q){x(a)&&(a=a());var m;if(a&&a.charAt&&"@"==a.charAt(0)){m=b;var d=a.substr(1);if(null==d||""===d||"hasOwnProperty"===d||!B.test("."+d))throw y("badmember",d);for(var d=d.split("."),n=0,g=d.length;n<g&&f.isDefined(m);n++){var e=d[n];m=null!==m?m[e]:C}}else m=a;c[q]=m});return c}function G(b){return b.resource}
8
+ function d(b){D(b||{},this)}var t=new w(l,h);s=r({},e.defaults.actions,s);d.prototype.toJSON=function(){var b=r({},this);delete b.$promise;delete b.$resolved;return b};u(s,function(b,q){var g=/^(POST|PUT|PATCH)$/i.test(b.method);d[q]=function(a,A,m,e){var n={},h,l,s;switch(arguments.length){case 4:s=e,l=m;case 3:case 2:if(x(A)){if(x(a)){l=a;s=A;break}l=A;s=m}else{n=a;h=A;l=m;break}case 1:x(a)?l=a:g?h=a:n=a;break;case 0:break;default:throw y("badargs",arguments.length);}var w=this instanceof d,p=w?
9
+ h:b.isArray?[]:new d(h),v={},z=b.interceptor&&b.interceptor.response||G,B=b.interceptor&&b.interceptor.responseError||C;u(b,function(b,a){"params"!=a&&"isArray"!=a&&"interceptor"!=a&&(v[a]=H(b))});g&&(v.data=h);t.setUrlParams(v,r({},c(h,b.params||{}),n),b.url);n=k(v).then(function(a){var c=a.data,m=p.$promise;if(c){if(f.isArray(c)!==!!b.isArray)throw y("badcfg",q,b.isArray?"array":"object",f.isArray(c)?"array":"object",v.method,v.url);b.isArray?(p.length=0,u(c,function(a){"object"===typeof a?p.push(new d(a)):
10
+ p.push(a)})):(D(c,p),p.$promise=m)}p.$resolved=!0;a.resource=p;return a},function(a){p.$resolved=!0;(s||E)(a);return F.reject(a)});n=n.then(function(a){var b=z(a);(l||E)(b,a.headers);return b},B);return w?n:(p.$promise=n,p.$resolved=!1,p)};d.prototype["$"+q]=function(a,b,c){x(a)&&(c=b,b=a,a={});a=d[q].call(this,a,this,b,c);return a.$promise||a}});d.bind=function(b){return z(l,r({},g,b),s)};return d}var E=f.noop,u=f.forEach,r=f.extend,H=f.copy,x=f.isFunction;w.prototype={setUrlParams:function(l,g,
11
+ e){var h=this,c=e||h.template,k,d,r="",b=h.urlParams={};u(c.split(/\W/),function(d){if("hasOwnProperty"===d)throw y("badname");!/^\d+$/.test(d)&&d&&(new RegExp("(^|[^\\\\]):"+d+"(\\W|$)")).test(c)&&(b[d]=!0)});c=c.replace(/\\:/g,":");c=c.replace(t,function(b){r=b;return""});g=g||{};u(h.urlParams,function(b,e){k=g.hasOwnProperty(e)?g[e]:h.defaults[e];f.isDefined(k)&&null!==k?(d=encodeURIComponent(k).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"%20").replace(/%26/gi,
12
+ "&").replace(/%3D/gi,"=").replace(/%2B/gi,"+"),c=c.replace(new RegExp(":"+e+"(\\W|$)","g"),function(a,b){return d+b})):c=c.replace(new RegExp("(/?):"+e+"(\\W|$)","g"),function(a,b,c){return"/"==c.charAt(0)?c:b+c})});h.defaults.stripTrailingSlashes&&(c=c.replace(/\/+$/,"")||"/");c=c.replace(/\/\.(?=\w+($|\?))/,".");l.url=r+c.replace(/\/\\\./,"/.");u(g,function(b,c){h.urlParams[c]||(l.params=l.params||{},l.params[c]=b)})}};return z}]})})(window,window.angular);
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C,CAoPlB,OAAOsB,EAzSuC,CAApC,CAlBmB,CADnC,CA5VsC,CAArC,CAAD,CA6pBG7B,MA7pBH,CA6pBWA,MAAAC,QA7pBX;",
6
+ "sources":["angular-resource.js"],
7
+ "names":["window","angular","undefined","shallowClearAndCopy","src","dst","forEach","value","key","hasOwnProperty","charAt","$resourceMinErr","$$minErr","MEMBER_NAME_REGEX","module","provider","PROTOCOL_AND_DOMAIN_REGEX","defaults","stripTrailingSlashes","actions","method","isArray","$get","$http","$q","Route","template","extend","urlParams","resourceFactory","url","paramDefaults","options","extractParams","data","actionParams","ids","isFunction","path","test","keys","split","i","ii","length","isDefined","obj","defaultResponseInterceptor","response","resource","Resource","route","prototype","toJSON","Resource.prototype.toJSON","$promise","$resolved","action","name","hasBody","a1","a2","a3","a4","params","success","error","arguments","isInstanceCall","httpConfig","responseInterceptor","interceptor","responseErrorInterceptor","responseError","copy","setUrlParams","promise","then","item","push","noop","reject","headers","result","call","bind","Resource.bind","additionalParamDefaults","config","actionUrl","self","val","encodedVal","protocolAndDomain","param","RegExp","replace","match","_","urlParam","encodeURIComponent","p1","leadingSlashes","tail"]
8
+ }
@@ -0,0 +1,991 @@
1
+ /**
2
+ * @license AngularJS v1.4.7
3
+ * (c) 2010-2015 Google, Inc. http://angularjs.org
4
+ * License: MIT
5
+ */
6
+ (function(window, angular, undefined) {'use strict';
7
+
8
+ /**
9
+ * @ngdoc module
10
+ * @name ngRoute
11
+ * @description
12
+ *
13
+ * # ngRoute
14
+ *
15
+ * The `ngRoute` module provides routing and deeplinking services and directives for angular apps.
16
+ *
17
+ * ## Example
18
+ * See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
19
+ *
20
+ *
21
+ * <div doc-module-components="ngRoute"></div>
22
+ */
23
+ /* global -ngRouteModule */
24
+ var ngRouteModule = angular.module('ngRoute', ['ng']).
25
+ provider('$route', $RouteProvider),
26
+ $routeMinErr = angular.$$minErr('ngRoute');
27
+
28
+ /**
29
+ * @ngdoc provider
30
+ * @name $routeProvider
31
+ *
32
+ * @description
33
+ *
34
+ * Used for configuring routes.
35
+ *
36
+ * ## Example
37
+ * See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
38
+ *
39
+ * ## Dependencies
40
+ * Requires the {@link ngRoute `ngRoute`} module to be installed.
41
+ */
42
+ function $RouteProvider() {
43
+ function inherit(parent, extra) {
44
+ return angular.extend(Object.create(parent), extra);
45
+ }
46
+
47
+ var routes = {};
48
+
49
+ /**
50
+ * @ngdoc method
51
+ * @name $routeProvider#when
52
+ *
53
+ * @param {string} path Route path (matched against `$location.path`). If `$location.path`
54
+ * contains redundant trailing slash or is missing one, the route will still match and the
55
+ * `$location.path` will be updated to add or drop the trailing slash to exactly match the
56
+ * route definition.
57
+ *
58
+ * * `path` can contain named groups starting with a colon: e.g. `:name`. All characters up
59
+ * to the next slash are matched and stored in `$routeParams` under the given `name`
60
+ * when the route matches.
61
+ * * `path` can contain named groups starting with a colon and ending with a star:
62
+ * e.g.`:name*`. All characters are eagerly stored in `$routeParams` under the given `name`
63
+ * when the route matches.
64
+ * * `path` can contain optional named groups with a question mark: e.g.`:name?`.
65
+ *
66
+ * For example, routes like `/color/:color/largecode/:largecode*\/edit` will match
67
+ * `/color/brown/largecode/code/with/slashes/edit` and extract:
68
+ *
69
+ * * `color: brown`
70
+ * * `largecode: code/with/slashes`.
71
+ *
72
+ *
73
+ * @param {Object} route Mapping information to be assigned to `$route.current` on route
74
+ * match.
75
+ *
76
+ * Object properties:
77
+ *
78
+ * - `controller` – `{(string|function()=}` – Controller fn that should be associated with
79
+ * newly created scope or the name of a {@link angular.Module#controller registered
80
+ * controller} if passed as a string.
81
+ * - `controllerAs` – `{string=}` – An identifier name for a reference to the controller.
82
+ * If present, the controller will be published to scope under the `controllerAs` name.
83
+ * - `template` – `{string=|function()=}` – html template as a string or a function that
84
+ * returns an html template as a string which should be used by {@link
85
+ * ngRoute.directive:ngView ngView} or {@link ng.directive:ngInclude ngInclude} directives.
86
+ * This property takes precedence over `templateUrl`.
87
+ *
88
+ * If `template` is a function, it will be called with the following parameters:
89
+ *
90
+ * - `{Array.<Object>}` - route parameters extracted from the current
91
+ * `$location.path()` by applying the current route
92
+ *
93
+ * - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html
94
+ * template that should be used by {@link ngRoute.directive:ngView ngView}.
95
+ *
96
+ * If `templateUrl` is a function, it will be called with the following parameters:
97
+ *
98
+ * - `{Array.<Object>}` - route parameters extracted from the current
99
+ * `$location.path()` by applying the current route
100
+ *
101
+ * - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should
102
+ * be injected into the controller. If any of these dependencies are promises, the router
103
+ * will wait for them all to be resolved or one to be rejected before the controller is
104
+ * instantiated.
105
+ * If all the promises are resolved successfully, the values of the resolved promises are
106
+ * injected and {@link ngRoute.$route#$routeChangeSuccess $routeChangeSuccess} event is
107
+ * fired. If any of the promises are rejected the
108
+ * {@link ngRoute.$route#$routeChangeError $routeChangeError} event is fired. The map object
109
+ * is:
110
+ *
111
+ * - `key` – `{string}`: a name of a dependency to be injected into the controller.
112
+ * - `factory` - `{string|function}`: If `string` then it is an alias for a service.
113
+ * Otherwise if function, then it is {@link auto.$injector#invoke injected}
114
+ * and the return value is treated as the dependency. If the result is a promise, it is
115
+ * resolved before its value is injected into the controller. Be aware that
116
+ * `ngRoute.$routeParams` will still refer to the previous route within these resolve
117
+ * functions. Use `$route.current.params` to access the new route parameters, instead.
118
+ *
119
+ * - `redirectTo` – {(string|function())=} – value to update
120
+ * {@link ng.$location $location} path with and trigger route redirection.
121
+ *
122
+ * If `redirectTo` is a function, it will be called with the following parameters:
123
+ *
124
+ * - `{Object.<string>}` - route parameters extracted from the current
125
+ * `$location.path()` by applying the current route templateUrl.
126
+ * - `{string}` - current `$location.path()`
127
+ * - `{Object}` - current `$location.search()`
128
+ *
129
+ * The custom `redirectTo` function is expected to return a string which will be used
130
+ * to update `$location.path()` and `$location.search()`.
131
+ *
132
+ * - `[reloadOnSearch=true]` - {boolean=} - reload route when only `$location.search()`
133
+ * or `$location.hash()` changes.
134
+ *
135
+ * If the option is set to `false` and url in the browser changes, then
136
+ * `$routeUpdate` event is broadcasted on the root scope.
137
+ *
138
+ * - `[caseInsensitiveMatch=false]` - {boolean=} - match routes without being case sensitive
139
+ *
140
+ * If the option is set to `true`, then the particular route can be matched without being
141
+ * case sensitive
142
+ *
143
+ * @returns {Object} self
144
+ *
145
+ * @description
146
+ * Adds a new route definition to the `$route` service.
147
+ */
148
+ this.when = function(path, route) {
149
+ //copy original route object to preserve params inherited from proto chain
150
+ var routeCopy = angular.copy(route);
151
+ if (angular.isUndefined(routeCopy.reloadOnSearch)) {
152
+ routeCopy.reloadOnSearch = true;
153
+ }
154
+ if (angular.isUndefined(routeCopy.caseInsensitiveMatch)) {
155
+ routeCopy.caseInsensitiveMatch = this.caseInsensitiveMatch;
156
+ }
157
+ routes[path] = angular.extend(
158
+ routeCopy,
159
+ path && pathRegExp(path, routeCopy)
160
+ );
161
+
162
+ // create redirection for trailing slashes
163
+ if (path) {
164
+ var redirectPath = (path[path.length - 1] == '/')
165
+ ? path.substr(0, path.length - 1)
166
+ : path + '/';
167
+
168
+ routes[redirectPath] = angular.extend(
169
+ {redirectTo: path},
170
+ pathRegExp(redirectPath, routeCopy)
171
+ );
172
+ }
173
+
174
+ return this;
175
+ };
176
+
177
+ /**
178
+ * @ngdoc property
179
+ * @name $routeProvider#caseInsensitiveMatch
180
+ * @description
181
+ *
182
+ * A boolean property indicating if routes defined
183
+ * using this provider should be matched using a case insensitive
184
+ * algorithm. Defaults to `false`.
185
+ */
186
+ this.caseInsensitiveMatch = false;
187
+
188
+ /**
189
+ * @param path {string} path
190
+ * @param opts {Object} options
191
+ * @return {?Object}
192
+ *
193
+ * @description
194
+ * Normalizes the given path, returning a regular expression
195
+ * and the original path.
196
+ *
197
+ * Inspired by pathRexp in visionmedia/express/lib/utils.js.
198
+ */
199
+ function pathRegExp(path, opts) {
200
+ var insensitive = opts.caseInsensitiveMatch,
201
+ ret = {
202
+ originalPath: path,
203
+ regexp: path
204
+ },
205
+ keys = ret.keys = [];
206
+
207
+ path = path
208
+ .replace(/([().])/g, '\\$1')
209
+ .replace(/(\/)?:(\w+)([\?\*])?/g, function(_, slash, key, option) {
210
+ var optional = option === '?' ? option : null;
211
+ var star = option === '*' ? option : null;
212
+ keys.push({ name: key, optional: !!optional });
213
+ slash = slash || '';
214
+ return ''
215
+ + (optional ? '' : slash)
216
+ + '(?:'
217
+ + (optional ? slash : '')
218
+ + (star && '(.+?)' || '([^/]+)')
219
+ + (optional || '')
220
+ + ')'
221
+ + (optional || '');
222
+ })
223
+ .replace(/([\/$\*])/g, '\\$1');
224
+
225
+ ret.regexp = new RegExp('^' + path + '$', insensitive ? 'i' : '');
226
+ return ret;
227
+ }
228
+
229
+ /**
230
+ * @ngdoc method
231
+ * @name $routeProvider#otherwise
232
+ *
233
+ * @description
234
+ * Sets route definition that will be used on route change when no other route definition
235
+ * is matched.
236
+ *
237
+ * @param {Object|string} params Mapping information to be assigned to `$route.current`.
238
+ * If called with a string, the value maps to `redirectTo`.
239
+ * @returns {Object} self
240
+ */
241
+ this.otherwise = function(params) {
242
+ if (typeof params === 'string') {
243
+ params = {redirectTo: params};
244
+ }
245
+ this.when(null, params);
246
+ return this;
247
+ };
248
+
249
+
250
+ this.$get = ['$rootScope',
251
+ '$location',
252
+ '$routeParams',
253
+ '$q',
254
+ '$injector',
255
+ '$templateRequest',
256
+ '$sce',
257
+ function($rootScope, $location, $routeParams, $q, $injector, $templateRequest, $sce) {
258
+
259
+ /**
260
+ * @ngdoc service
261
+ * @name $route
262
+ * @requires $location
263
+ * @requires $routeParams
264
+ *
265
+ * @property {Object} current Reference to the current route definition.
266
+ * The route definition contains:
267
+ *
268
+ * - `controller`: The controller constructor as define in route definition.
269
+ * - `locals`: A map of locals which is used by {@link ng.$controller $controller} service for
270
+ * controller instantiation. The `locals` contain
271
+ * the resolved values of the `resolve` map. Additionally the `locals` also contain:
272
+ *
273
+ * - `$scope` - The current route scope.
274
+ * - `$template` - The current route template HTML.
275
+ *
276
+ * @property {Object} routes Object with all route configuration Objects as its properties.
277
+ *
278
+ * @description
279
+ * `$route` is used for deep-linking URLs to controllers and views (HTML partials).
280
+ * It watches `$location.url()` and tries to map the path to an existing route definition.
281
+ *
282
+ * Requires the {@link ngRoute `ngRoute`} module to be installed.
283
+ *
284
+ * You can define routes through {@link ngRoute.$routeProvider $routeProvider}'s API.
285
+ *
286
+ * The `$route` service is typically used in conjunction with the
287
+ * {@link ngRoute.directive:ngView `ngView`} directive and the
288
+ * {@link ngRoute.$routeParams `$routeParams`} service.
289
+ *
290
+ * @example
291
+ * This example shows how changing the URL hash causes the `$route` to match a route against the
292
+ * URL, and the `ngView` pulls in the partial.
293
+ *
294
+ * <example name="$route-service" module="ngRouteExample"
295
+ * deps="angular-route.js" fixBase="true">
296
+ * <file name="index.html">
297
+ * <div ng-controller="MainController">
298
+ * Choose:
299
+ * <a href="Book/Moby">Moby</a> |
300
+ * <a href="Book/Moby/ch/1">Moby: Ch1</a> |
301
+ * <a href="Book/Gatsby">Gatsby</a> |
302
+ * <a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
303
+ * <a href="Book/Scarlet">Scarlet Letter</a><br/>
304
+ *
305
+ * <div ng-view></div>
306
+ *
307
+ * <hr />
308
+ *
309
+ * <pre>$location.path() = {{$location.path()}}</pre>
310
+ * <pre>$route.current.templateUrl = {{$route.current.templateUrl}}</pre>
311
+ * <pre>$route.current.params = {{$route.current.params}}</pre>
312
+ * <pre>$route.current.scope.name = {{$route.current.scope.name}}</pre>
313
+ * <pre>$routeParams = {{$routeParams}}</pre>
314
+ * </div>
315
+ * </file>
316
+ *
317
+ * <file name="book.html">
318
+ * controller: {{name}}<br />
319
+ * Book Id: {{params.bookId}}<br />
320
+ * </file>
321
+ *
322
+ * <file name="chapter.html">
323
+ * controller: {{name}}<br />
324
+ * Book Id: {{params.bookId}}<br />
325
+ * Chapter Id: {{params.chapterId}}
326
+ * </file>
327
+ *
328
+ * <file name="script.js">
329
+ * angular.module('ngRouteExample', ['ngRoute'])
330
+ *
331
+ * .controller('MainController', function($scope, $route, $routeParams, $location) {
332
+ * $scope.$route = $route;
333
+ * $scope.$location = $location;
334
+ * $scope.$routeParams = $routeParams;
335
+ * })
336
+ *
337
+ * .controller('BookController', function($scope, $routeParams) {
338
+ * $scope.name = "BookController";
339
+ * $scope.params = $routeParams;
340
+ * })
341
+ *
342
+ * .controller('ChapterController', function($scope, $routeParams) {
343
+ * $scope.name = "ChapterController";
344
+ * $scope.params = $routeParams;
345
+ * })
346
+ *
347
+ * .config(function($routeProvider, $locationProvider) {
348
+ * $routeProvider
349
+ * .when('/Book/:bookId', {
350
+ * templateUrl: 'book.html',
351
+ * controller: 'BookController',
352
+ * resolve: {
353
+ * // I will cause a 1 second delay
354
+ * delay: function($q, $timeout) {
355
+ * var delay = $q.defer();
356
+ * $timeout(delay.resolve, 1000);
357
+ * return delay.promise;
358
+ * }
359
+ * }
360
+ * })
361
+ * .when('/Book/:bookId/ch/:chapterId', {
362
+ * templateUrl: 'chapter.html',
363
+ * controller: 'ChapterController'
364
+ * });
365
+ *
366
+ * // configure html5 to get links working on jsfiddle
367
+ * $locationProvider.html5Mode(true);
368
+ * });
369
+ *
370
+ * </file>
371
+ *
372
+ * <file name="protractor.js" type="protractor">
373
+ * it('should load and compile correct template', function() {
374
+ * element(by.linkText('Moby: Ch1')).click();
375
+ * var content = element(by.css('[ng-view]')).getText();
376
+ * expect(content).toMatch(/controller\: ChapterController/);
377
+ * expect(content).toMatch(/Book Id\: Moby/);
378
+ * expect(content).toMatch(/Chapter Id\: 1/);
379
+ *
380
+ * element(by.partialLinkText('Scarlet')).click();
381
+ *
382
+ * content = element(by.css('[ng-view]')).getText();
383
+ * expect(content).toMatch(/controller\: BookController/);
384
+ * expect(content).toMatch(/Book Id\: Scarlet/);
385
+ * });
386
+ * </file>
387
+ * </example>
388
+ */
389
+
390
+ /**
391
+ * @ngdoc event
392
+ * @name $route#$routeChangeStart
393
+ * @eventType broadcast on root scope
394
+ * @description
395
+ * Broadcasted before a route change. At this point the route services starts
396
+ * resolving all of the dependencies needed for the route change to occur.
397
+ * Typically this involves fetching the view template as well as any dependencies
398
+ * defined in `resolve` route property. Once all of the dependencies are resolved
399
+ * `$routeChangeSuccess` is fired.
400
+ *
401
+ * The route change (and the `$location` change that triggered it) can be prevented
402
+ * by calling `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on}
403
+ * for more details about event object.
404
+ *
405
+ * @param {Object} angularEvent Synthetic event object.
406
+ * @param {Route} next Future route information.
407
+ * @param {Route} current Current route information.
408
+ */
409
+
410
+ /**
411
+ * @ngdoc event
412
+ * @name $route#$routeChangeSuccess
413
+ * @eventType broadcast on root scope
414
+ * @description
415
+ * Broadcasted after a route change has happened successfully.
416
+ * The `resolve` dependencies are now available in the `current.locals` property.
417
+ *
418
+ * {@link ngRoute.directive:ngView ngView} listens for the directive
419
+ * to instantiate the controller and render the view.
420
+ *
421
+ * @param {Object} angularEvent Synthetic event object.
422
+ * @param {Route} current Current route information.
423
+ * @param {Route|Undefined} previous Previous route information, or undefined if current is
424
+ * first route entered.
425
+ */
426
+
427
+ /**
428
+ * @ngdoc event
429
+ * @name $route#$routeChangeError
430
+ * @eventType broadcast on root scope
431
+ * @description
432
+ * Broadcasted if any of the resolve promises are rejected.
433
+ *
434
+ * @param {Object} angularEvent Synthetic event object
435
+ * @param {Route} current Current route information.
436
+ * @param {Route} previous Previous route information.
437
+ * @param {Route} rejection Rejection of the promise. Usually the error of the failed promise.
438
+ */
439
+
440
+ /**
441
+ * @ngdoc event
442
+ * @name $route#$routeUpdate
443
+ * @eventType broadcast on root scope
444
+ * @description
445
+ * The `reloadOnSearch` property has been set to false, and we are reusing the same
446
+ * instance of the Controller.
447
+ *
448
+ * @param {Object} angularEvent Synthetic event object
449
+ * @param {Route} current Current/previous route information.
450
+ */
451
+
452
+ var forceReload = false,
453
+ preparedRoute,
454
+ preparedRouteIsUpdateOnly,
455
+ $route = {
456
+ routes: routes,
457
+
458
+ /**
459
+ * @ngdoc method
460
+ * @name $route#reload
461
+ *
462
+ * @description
463
+ * Causes `$route` service to reload the current route even if
464
+ * {@link ng.$location $location} hasn't changed.
465
+ *
466
+ * As a result of that, {@link ngRoute.directive:ngView ngView}
467
+ * creates new scope and reinstantiates the controller.
468
+ */
469
+ reload: function() {
470
+ forceReload = true;
471
+ $rootScope.$evalAsync(function() {
472
+ // Don't support cancellation of a reload for now...
473
+ prepareRoute();
474
+ commitRoute();
475
+ });
476
+ },
477
+
478
+ /**
479
+ * @ngdoc method
480
+ * @name $route#updateParams
481
+ *
482
+ * @description
483
+ * Causes `$route` service to update the current URL, replacing
484
+ * current route parameters with those specified in `newParams`.
485
+ * Provided property names that match the route's path segment
486
+ * definitions will be interpolated into the location's path, while
487
+ * remaining properties will be treated as query params.
488
+ *
489
+ * @param {!Object<string, string>} newParams mapping of URL parameter names to values
490
+ */
491
+ updateParams: function(newParams) {
492
+ if (this.current && this.current.$$route) {
493
+ newParams = angular.extend({}, this.current.params, newParams);
494
+ $location.path(interpolate(this.current.$$route.originalPath, newParams));
495
+ // interpolate modifies newParams, only query params are left
496
+ $location.search(newParams);
497
+ } else {
498
+ throw $routeMinErr('norout', 'Tried updating route when with no current route');
499
+ }
500
+ }
501
+ };
502
+
503
+ $rootScope.$on('$locationChangeStart', prepareRoute);
504
+ $rootScope.$on('$locationChangeSuccess', commitRoute);
505
+
506
+ return $route;
507
+
508
+ /////////////////////////////////////////////////////
509
+
510
+ /**
511
+ * @param on {string} current url
512
+ * @param route {Object} route regexp to match the url against
513
+ * @return {?Object}
514
+ *
515
+ * @description
516
+ * Check if the route matches the current url.
517
+ *
518
+ * Inspired by match in
519
+ * visionmedia/express/lib/router/router.js.
520
+ */
521
+ function switchRouteMatcher(on, route) {
522
+ var keys = route.keys,
523
+ params = {};
524
+
525
+ if (!route.regexp) return null;
526
+
527
+ var m = route.regexp.exec(on);
528
+ if (!m) return null;
529
+
530
+ for (var i = 1, len = m.length; i < len; ++i) {
531
+ var key = keys[i - 1];
532
+
533
+ var val = m[i];
534
+
535
+ if (key && val) {
536
+ params[key.name] = val;
537
+ }
538
+ }
539
+ return params;
540
+ }
541
+
542
+ function prepareRoute($locationEvent) {
543
+ var lastRoute = $route.current;
544
+
545
+ preparedRoute = parseRoute();
546
+ preparedRouteIsUpdateOnly = preparedRoute && lastRoute && preparedRoute.$$route === lastRoute.$$route
547
+ && angular.equals(preparedRoute.pathParams, lastRoute.pathParams)
548
+ && !preparedRoute.reloadOnSearch && !forceReload;
549
+
550
+ if (!preparedRouteIsUpdateOnly && (lastRoute || preparedRoute)) {
551
+ if ($rootScope.$broadcast('$routeChangeStart', preparedRoute, lastRoute).defaultPrevented) {
552
+ if ($locationEvent) {
553
+ $locationEvent.preventDefault();
554
+ }
555
+ }
556
+ }
557
+ }
558
+
559
+ function commitRoute() {
560
+ var lastRoute = $route.current;
561
+ var nextRoute = preparedRoute;
562
+
563
+ if (preparedRouteIsUpdateOnly) {
564
+ lastRoute.params = nextRoute.params;
565
+ angular.copy(lastRoute.params, $routeParams);
566
+ $rootScope.$broadcast('$routeUpdate', lastRoute);
567
+ } else if (nextRoute || lastRoute) {
568
+ forceReload = false;
569
+ $route.current = nextRoute;
570
+ if (nextRoute) {
571
+ if (nextRoute.redirectTo) {
572
+ if (angular.isString(nextRoute.redirectTo)) {
573
+ $location.path(interpolate(nextRoute.redirectTo, nextRoute.params)).search(nextRoute.params)
574
+ .replace();
575
+ } else {
576
+ $location.url(nextRoute.redirectTo(nextRoute.pathParams, $location.path(), $location.search()))
577
+ .replace();
578
+ }
579
+ }
580
+ }
581
+
582
+ $q.when(nextRoute).
583
+ then(function() {
584
+ if (nextRoute) {
585
+ var locals = angular.extend({}, nextRoute.resolve),
586
+ template, templateUrl;
587
+
588
+ angular.forEach(locals, function(value, key) {
589
+ locals[key] = angular.isString(value) ?
590
+ $injector.get(value) : $injector.invoke(value, null, null, key);
591
+ });
592
+
593
+ if (angular.isDefined(template = nextRoute.template)) {
594
+ if (angular.isFunction(template)) {
595
+ template = template(nextRoute.params);
596
+ }
597
+ } else if (angular.isDefined(templateUrl = nextRoute.templateUrl)) {
598
+ if (angular.isFunction(templateUrl)) {
599
+ templateUrl = templateUrl(nextRoute.params);
600
+ }
601
+ if (angular.isDefined(templateUrl)) {
602
+ nextRoute.loadedTemplateUrl = $sce.valueOf(templateUrl);
603
+ template = $templateRequest(templateUrl);
604
+ }
605
+ }
606
+ if (angular.isDefined(template)) {
607
+ locals['$template'] = template;
608
+ }
609
+ return $q.all(locals);
610
+ }
611
+ }).
612
+ then(function(locals) {
613
+ // after route change
614
+ if (nextRoute == $route.current) {
615
+ if (nextRoute) {
616
+ nextRoute.locals = locals;
617
+ angular.copy(nextRoute.params, $routeParams);
618
+ }
619
+ $rootScope.$broadcast('$routeChangeSuccess', nextRoute, lastRoute);
620
+ }
621
+ }, function(error) {
622
+ if (nextRoute == $route.current) {
623
+ $rootScope.$broadcast('$routeChangeError', nextRoute, lastRoute, error);
624
+ }
625
+ });
626
+ }
627
+ }
628
+
629
+
630
+ /**
631
+ * @returns {Object} the current active route, by matching it against the URL
632
+ */
633
+ function parseRoute() {
634
+ // Match a route
635
+ var params, match;
636
+ angular.forEach(routes, function(route, path) {
637
+ if (!match && (params = switchRouteMatcher($location.path(), route))) {
638
+ match = inherit(route, {
639
+ params: angular.extend({}, $location.search(), params),
640
+ pathParams: params});
641
+ match.$$route = route;
642
+ }
643
+ });
644
+ // No route matched; fallback to "otherwise" route
645
+ return match || routes[null] && inherit(routes[null], {params: {}, pathParams:{}});
646
+ }
647
+
648
+ /**
649
+ * @returns {string} interpolation of the redirect path with the parameters
650
+ */
651
+ function interpolate(string, params) {
652
+ var result = [];
653
+ angular.forEach((string || '').split(':'), function(segment, i) {
654
+ if (i === 0) {
655
+ result.push(segment);
656
+ } else {
657
+ var segmentMatch = segment.match(/(\w+)(?:[?*])?(.*)/);
658
+ var key = segmentMatch[1];
659
+ result.push(params[key]);
660
+ result.push(segmentMatch[2] || '');
661
+ delete params[key];
662
+ }
663
+ });
664
+ return result.join('');
665
+ }
666
+ }];
667
+ }
668
+
669
+ ngRouteModule.provider('$routeParams', $RouteParamsProvider);
670
+
671
+
672
+ /**
673
+ * @ngdoc service
674
+ * @name $routeParams
675
+ * @requires $route
676
+ *
677
+ * @description
678
+ * The `$routeParams` service allows you to retrieve the current set of route parameters.
679
+ *
680
+ * Requires the {@link ngRoute `ngRoute`} module to be installed.
681
+ *
682
+ * The route parameters are a combination of {@link ng.$location `$location`}'s
683
+ * {@link ng.$location#search `search()`} and {@link ng.$location#path `path()`}.
684
+ * The `path` parameters are extracted when the {@link ngRoute.$route `$route`} path is matched.
685
+ *
686
+ * In case of parameter name collision, `path` params take precedence over `search` params.
687
+ *
688
+ * The service guarantees that the identity of the `$routeParams` object will remain unchanged
689
+ * (but its properties will likely change) even when a route change occurs.
690
+ *
691
+ * Note that the `$routeParams` are only updated *after* a route change completes successfully.
692
+ * This means that you cannot rely on `$routeParams` being correct in route resolve functions.
693
+ * Instead you can use `$route.current.params` to access the new route's parameters.
694
+ *
695
+ * @example
696
+ * ```js
697
+ * // Given:
698
+ * // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
699
+ * // Route: /Chapter/:chapterId/Section/:sectionId
700
+ * //
701
+ * // Then
702
+ * $routeParams ==> {chapterId:'1', sectionId:'2', search:'moby'}
703
+ * ```
704
+ */
705
+ function $RouteParamsProvider() {
706
+ this.$get = function() { return {}; };
707
+ }
708
+
709
+ ngRouteModule.directive('ngView', ngViewFactory);
710
+ ngRouteModule.directive('ngView', ngViewFillContentFactory);
711
+
712
+
713
+ /**
714
+ * @ngdoc directive
715
+ * @name ngView
716
+ * @restrict ECA
717
+ *
718
+ * @description
719
+ * # Overview
720
+ * `ngView` is a directive that complements the {@link ngRoute.$route $route} service by
721
+ * including the rendered template of the current route into the main layout (`index.html`) file.
722
+ * Every time the current route changes, the included view changes with it according to the
723
+ * configuration of the `$route` service.
724
+ *
725
+ * Requires the {@link ngRoute `ngRoute`} module to be installed.
726
+ *
727
+ * @animations
728
+ * enter - animation is used to bring new content into the browser.
729
+ * leave - animation is used to animate existing content away.
730
+ *
731
+ * The enter and leave animation occur concurrently.
732
+ *
733
+ * @scope
734
+ * @priority 400
735
+ * @param {string=} onload Expression to evaluate whenever the view updates.
736
+ *
737
+ * @param {string=} autoscroll Whether `ngView` should call {@link ng.$anchorScroll
738
+ * $anchorScroll} to scroll the viewport after the view is updated.
739
+ *
740
+ * - If the attribute is not set, disable scrolling.
741
+ * - If the attribute is set without value, enable scrolling.
742
+ * - Otherwise enable scrolling only if the `autoscroll` attribute value evaluated
743
+ * as an expression yields a truthy value.
744
+ * @example
745
+ <example name="ngView-directive" module="ngViewExample"
746
+ deps="angular-route.js;angular-animate.js"
747
+ animations="true" fixBase="true">
748
+ <file name="index.html">
749
+ <div ng-controller="MainCtrl as main">
750
+ Choose:
751
+ <a href="Book/Moby">Moby</a> |
752
+ <a href="Book/Moby/ch/1">Moby: Ch1</a> |
753
+ <a href="Book/Gatsby">Gatsby</a> |
754
+ <a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
755
+ <a href="Book/Scarlet">Scarlet Letter</a><br/>
756
+
757
+ <div class="view-animate-container">
758
+ <div ng-view class="view-animate"></div>
759
+ </div>
760
+ <hr />
761
+
762
+ <pre>$location.path() = {{main.$location.path()}}</pre>
763
+ <pre>$route.current.templateUrl = {{main.$route.current.templateUrl}}</pre>
764
+ <pre>$route.current.params = {{main.$route.current.params}}</pre>
765
+ <pre>$routeParams = {{main.$routeParams}}</pre>
766
+ </div>
767
+ </file>
768
+
769
+ <file name="book.html">
770
+ <div>
771
+ controller: {{book.name}}<br />
772
+ Book Id: {{book.params.bookId}}<br />
773
+ </div>
774
+ </file>
775
+
776
+ <file name="chapter.html">
777
+ <div>
778
+ controller: {{chapter.name}}<br />
779
+ Book Id: {{chapter.params.bookId}}<br />
780
+ Chapter Id: {{chapter.params.chapterId}}
781
+ </div>
782
+ </file>
783
+
784
+ <file name="animations.css">
785
+ .view-animate-container {
786
+ position:relative;
787
+ height:100px!important;
788
+ background:white;
789
+ border:1px solid black;
790
+ height:40px;
791
+ overflow:hidden;
792
+ }
793
+
794
+ .view-animate {
795
+ padding:10px;
796
+ }
797
+
798
+ .view-animate.ng-enter, .view-animate.ng-leave {
799
+ transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
800
+
801
+ display:block;
802
+ width:100%;
803
+ border-left:1px solid black;
804
+
805
+ position:absolute;
806
+ top:0;
807
+ left:0;
808
+ right:0;
809
+ bottom:0;
810
+ padding:10px;
811
+ }
812
+
813
+ .view-animate.ng-enter {
814
+ left:100%;
815
+ }
816
+ .view-animate.ng-enter.ng-enter-active {
817
+ left:0;
818
+ }
819
+ .view-animate.ng-leave.ng-leave-active {
820
+ left:-100%;
821
+ }
822
+ </file>
823
+
824
+ <file name="script.js">
825
+ angular.module('ngViewExample', ['ngRoute', 'ngAnimate'])
826
+ .config(['$routeProvider', '$locationProvider',
827
+ function($routeProvider, $locationProvider) {
828
+ $routeProvider
829
+ .when('/Book/:bookId', {
830
+ templateUrl: 'book.html',
831
+ controller: 'BookCtrl',
832
+ controllerAs: 'book'
833
+ })
834
+ .when('/Book/:bookId/ch/:chapterId', {
835
+ templateUrl: 'chapter.html',
836
+ controller: 'ChapterCtrl',
837
+ controllerAs: 'chapter'
838
+ });
839
+
840
+ $locationProvider.html5Mode(true);
841
+ }])
842
+ .controller('MainCtrl', ['$route', '$routeParams', '$location',
843
+ function($route, $routeParams, $location) {
844
+ this.$route = $route;
845
+ this.$location = $location;
846
+ this.$routeParams = $routeParams;
847
+ }])
848
+ .controller('BookCtrl', ['$routeParams', function($routeParams) {
849
+ this.name = "BookCtrl";
850
+ this.params = $routeParams;
851
+ }])
852
+ .controller('ChapterCtrl', ['$routeParams', function($routeParams) {
853
+ this.name = "ChapterCtrl";
854
+ this.params = $routeParams;
855
+ }]);
856
+
857
+ </file>
858
+
859
+ <file name="protractor.js" type="protractor">
860
+ it('should load and compile correct template', function() {
861
+ element(by.linkText('Moby: Ch1')).click();
862
+ var content = element(by.css('[ng-view]')).getText();
863
+ expect(content).toMatch(/controller\: ChapterCtrl/);
864
+ expect(content).toMatch(/Book Id\: Moby/);
865
+ expect(content).toMatch(/Chapter Id\: 1/);
866
+
867
+ element(by.partialLinkText('Scarlet')).click();
868
+
869
+ content = element(by.css('[ng-view]')).getText();
870
+ expect(content).toMatch(/controller\: BookCtrl/);
871
+ expect(content).toMatch(/Book Id\: Scarlet/);
872
+ });
873
+ </file>
874
+ </example>
875
+ */
876
+
877
+
878
+ /**
879
+ * @ngdoc event
880
+ * @name ngView#$viewContentLoaded
881
+ * @eventType emit on the current ngView scope
882
+ * @description
883
+ * Emitted every time the ngView content is reloaded.
884
+ */
885
+ ngViewFactory.$inject = ['$route', '$anchorScroll', '$animate'];
886
+ function ngViewFactory($route, $anchorScroll, $animate) {
887
+ return {
888
+ restrict: 'ECA',
889
+ terminal: true,
890
+ priority: 400,
891
+ transclude: 'element',
892
+ link: function(scope, $element, attr, ctrl, $transclude) {
893
+ var currentScope,
894
+ currentElement,
895
+ previousLeaveAnimation,
896
+ autoScrollExp = attr.autoscroll,
897
+ onloadExp = attr.onload || '';
898
+
899
+ scope.$on('$routeChangeSuccess', update);
900
+ update();
901
+
902
+ function cleanupLastView() {
903
+ if (previousLeaveAnimation) {
904
+ $animate.cancel(previousLeaveAnimation);
905
+ previousLeaveAnimation = null;
906
+ }
907
+
908
+ if (currentScope) {
909
+ currentScope.$destroy();
910
+ currentScope = null;
911
+ }
912
+ if (currentElement) {
913
+ previousLeaveAnimation = $animate.leave(currentElement);
914
+ previousLeaveAnimation.then(function() {
915
+ previousLeaveAnimation = null;
916
+ });
917
+ currentElement = null;
918
+ }
919
+ }
920
+
921
+ function update() {
922
+ var locals = $route.current && $route.current.locals,
923
+ template = locals && locals.$template;
924
+
925
+ if (angular.isDefined(template)) {
926
+ var newScope = scope.$new();
927
+ var current = $route.current;
928
+
929
+ // Note: This will also link all children of ng-view that were contained in the original
930
+ // html. If that content contains controllers, ... they could pollute/change the scope.
931
+ // However, using ng-view on an element with additional content does not make sense...
932
+ // Note: We can't remove them in the cloneAttchFn of $transclude as that
933
+ // function is called before linking the content, which would apply child
934
+ // directives to non existing elements.
935
+ var clone = $transclude(newScope, function(clone) {
936
+ $animate.enter(clone, null, currentElement || $element).then(function onNgViewEnter() {
937
+ if (angular.isDefined(autoScrollExp)
938
+ && (!autoScrollExp || scope.$eval(autoScrollExp))) {
939
+ $anchorScroll();
940
+ }
941
+ });
942
+ cleanupLastView();
943
+ });
944
+
945
+ currentElement = clone;
946
+ currentScope = current.scope = newScope;
947
+ currentScope.$emit('$viewContentLoaded');
948
+ currentScope.$eval(onloadExp);
949
+ } else {
950
+ cleanupLastView();
951
+ }
952
+ }
953
+ }
954
+ };
955
+ }
956
+
957
+ // This directive is called during the $transclude call of the first `ngView` directive.
958
+ // It will replace and compile the content of the element with the loaded template.
959
+ // We need this directive so that the element content is already filled when
960
+ // the link function of another directive on the same element as ngView
961
+ // is called.
962
+ ngViewFillContentFactory.$inject = ['$compile', '$controller', '$route'];
963
+ function ngViewFillContentFactory($compile, $controller, $route) {
964
+ return {
965
+ restrict: 'ECA',
966
+ priority: -400,
967
+ link: function(scope, $element) {
968
+ var current = $route.current,
969
+ locals = current.locals;
970
+
971
+ $element.html(locals.$template);
972
+
973
+ var link = $compile($element.contents());
974
+
975
+ if (current.controller) {
976
+ locals.$scope = scope;
977
+ var controller = $controller(current.controller, locals);
978
+ if (current.controllerAs) {
979
+ scope[current.controllerAs] = controller;
980
+ }
981
+ $element.data('$ngControllerController', controller);
982
+ $element.children().data('$ngControllerController', controller);
983
+ }
984
+
985
+ link(scope);
986
+ }
987
+ };
988
+ }
989
+
990
+
991
+ })(window, window.angular);