├── LICENSE
├── README.md
├── index.html
├── lib
├── angular-animate
│ ├── angular-animate.min.js
│ └── angular-animate.min.js.map
├── angular-aria
│ ├── angular-aria.min.js
│ └── angular-aria.min.js.map
├── angular-material
│ ├── acc-theme.css
│ ├── angular-material.min.css
│ ├── angular-material.min.css_
│ ├── angular-material.min.js
│ ├── angular-material.min.js_
│ └── theme.css
├── angular-route
│ ├── angular-route.js
│ ├── angular-route.min.js
│ └── angular-route.min.js.map
├── angular
│ ├── angular.min.js
│ └── angular.min.js.map
├── hammer
│ ├── hammer.min.js
│ └── hammer.min.map
└── jquery
│ ├── jquery-1.10.2.min.js
│ └── jquery-1.10.2.min.map
├── scripts
├── app.js
└── controllers
│ └── color_generator.js
├── styles
├── main.css
├── reset.css
└── responsive.css
└── templates
└── color_generator.html
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 fireflight1
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Material Design Color Generator
2 | @mbitson has improved this tool. See http://mcg.mbitson.com/ for an updated version of this project or visit his github repository https://github.com/mbitson/mcg
3 | More information and a demo can be found at http://knizia.biz/mcg
4 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Knizia.biz Material Color Generator
6 |
7 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
22 |
23 |
24 |
25 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/lib/angular-animate/angular-animate.min.js:
--------------------------------------------------------------------------------
1 | /*
2 | AngularJS v1.3.0
3 | (c) 2010-2014 Google, Inc. http://angularjs.org
4 | License: MIT
5 | */
6 | (function(M,f,S){'use strict';f.module("ngAnimate",["ng"]).directive("ngAnimateChildren",function(){return function(T,B,k){k=k.ngAnimateChildren;f.isString(k)&&0===k.length?B.data("$$ngAnimateChildren",!0):T.$watch(k,function(f){B.data("$$ngAnimateChildren",!!f)})}}).factory("$$animateReflow",["$$rAF","$document",function(f,B){return function(k){return f(function(){k()})}}]).config(["$provide","$animateProvider",function(T,B){function k(f){for(var g=0;g=A&&d>=x&&c()}var m=k(d);a=d.data("$$ngAnimateCSS3Data");if(-1!=m.getAttribute("class").indexOf(b)&&a){var q="",r="";g(b.split(" "),function(a,d){var b=(0
23 | */
24 | /* global -ngRouteModule */
25 | var ngRouteModule = angular.module('ngRoute', ['ng']).
26 | provider('$route', $RouteProvider);
27 |
28 | /**
29 | * @ngdoc object
30 | * @name ngRoute.$routeProvider
31 | * @function
32 | *
33 | * @description
34 | *
35 | * Used for configuring routes.
36 | *
37 | * ## Example
38 | * See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
39 | *
40 | * ## Dependencies
41 | * Requires the {@link ngRoute `ngRoute`} module to be installed.
42 | */
43 | function $RouteProvider(){
44 | function inherit(parent, extra) {
45 | return angular.extend(new (angular.extend(function() {}, {prototype:parent}))(), extra);
46 | }
47 |
48 | var routes = {};
49 |
50 | /**
51 | * @ngdoc method
52 | * @name ngRoute.$routeProvider#when
53 | * @methodOf ngRoute.$routeProvider
54 | *
55 | * @param {string} path Route path (matched against `$location.path`). If `$location.path`
56 | * contains redundant trailing slash or is missing one, the route will still match and the
57 | * `$location.path` will be updated to add or drop the trailing slash to exactly match the
58 | * route definition.
59 | *
60 | * * `path` can contain named groups starting with a colon: e.g. `:name`. All characters up
61 | * to the next slash are matched and stored in `$routeParams` under the given `name`
62 | * when the route matches.
63 | * * `path` can contain named groups starting with a colon and ending with a star:
64 | * e.g.`:name*`. All characters are eagerly stored in `$routeParams` under the given `name`
65 | * when the route matches.
66 | * * `path` can contain optional named groups with a question mark: e.g.`:name?`.
67 | *
68 | * For example, routes like `/color/:color/largecode/:largecode*\/edit` will match
69 | * `/color/brown/largecode/code/with/slashs/edit` and extract:
70 | *
71 | * * `color: brown`
72 | * * `largecode: code/with/slashs`.
73 | *
74 | *
75 | * @param {Object} route Mapping information to be assigned to `$route.current` on route
76 | * match.
77 | *
78 | * Object properties:
79 | *
80 | * - `controller` – `{(string|function()=}` – Controller fn that should be associated with
81 | * newly created scope or the name of a {@link angular.Module#controller registered
82 | * controller} if passed as a string.
83 | * - `controllerAs` – `{string=}` – A controller alias name. If present the controller will be
84 | * published to scope under the `controllerAs` name.
85 | * - `template` – `{string=|function()=}` – html template as a string or a function that
86 | * returns an html template as a string which should be used by {@link
87 | * ngRoute.directive:ngView ngView} or {@link ng.directive:ngInclude ngInclude} directives.
88 | * This property takes precedence over `templateUrl`.
89 | *
90 | * If `template` is a function, it will be called with the following parameters:
91 | *
92 | * - `{Array.}` - route parameters extracted from the current
93 | * `$location.path()` by applying the current route
94 | *
95 | * - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html
96 | * template that should be used by {@link ngRoute.directive:ngView ngView}.
97 | *
98 | * If `templateUrl` is a function, it will be called with the following parameters:
99 | *
100 | * - `{Array.}` - route parameters extracted from the current
101 | * `$location.path()` by applying the current route
102 | *
103 | * - `resolve` - `{Object.=}` - An optional map of dependencies which should
104 | * be injected into the controller. If any of these dependencies are promises, the router
105 | * will wait for them all to be resolved or one to be rejected before the controller is
106 | * instantiated.
107 | * If all the promises are resolved successfully, the values of the resolved promises are
108 | * injected and {@link ngRoute.$route#$routeChangeSuccess $routeChangeSuccess} event is
109 | * fired. If any of the promises are rejected the
110 | * {@link ngRoute.$route#$routeChangeError $routeChangeError} event is fired. The map object
111 | * is:
112 | *
113 | * - `key` – `{string}`: a name of a dependency to be injected into the controller.
114 | * - `factory` - `{string|function}`: If `string` then it is an alias for a service.
115 | * Otherwise if function, then it is {@link api/AUTO.$injector#invoke injected}
116 | * and the return value is treated as the dependency. If the result is a promise, it is
117 | * resolved before its value is injected into the controller. Be aware that
118 | * `ngRoute.$routeParams` will still refer to the previous route within these resolve
119 | * functions. Use `$route.current.params` to access the new route parameters, instead.
120 | *
121 | * - `redirectTo` – {(string|function())=} – value to update
122 | * {@link ng.$location $location} path with and trigger route redirection.
123 | *
124 | * If `redirectTo` is a function, it will be called with the following parameters:
125 | *
126 | * - `{Object.}` - route parameters extracted from the current
127 | * `$location.path()` by applying the current route templateUrl.
128 | * - `{string}` - current `$location.path()`
129 | * - `{Object}` - current `$location.search()`
130 | *
131 | * The custom `redirectTo` function is expected to return a string which will be used
132 | * to update `$location.path()` and `$location.search()`.
133 | *
134 | * - `[reloadOnSearch=true]` - {boolean=} - reload route when only `$location.search()`
135 | * or `$location.hash()` changes.
136 | *
137 | * If the option is set to `false` and url in the browser changes, then
138 | * `$routeUpdate` event is broadcasted on the root scope.
139 | *
140 | * - `[caseInsensitiveMatch=false]` - {boolean=} - match routes without being case sensitive
141 | *
142 | * If the option is set to `true`, then the particular route can be matched without being
143 | * case sensitive
144 | *
145 | * @returns {Object} self
146 | *
147 | * @description
148 | * Adds a new route definition to the `$route` service.
149 | */
150 | this.when = function(path, route) {
151 | routes[path] = angular.extend(
152 | {reloadOnSearch: true},
153 | route,
154 | path && pathRegExp(path, route)
155 | );
156 |
157 | // create redirection for trailing slashes
158 | if (path) {
159 | var redirectPath = (path[path.length-1] == '/')
160 | ? path.substr(0, path.length-1)
161 | : path +'/';
162 |
163 | routes[redirectPath] = angular.extend(
164 | {redirectTo: path},
165 | pathRegExp(redirectPath, route)
166 | );
167 | }
168 |
169 | return this;
170 | };
171 |
172 | /**
173 | * @param path {string} path
174 | * @param opts {Object} options
175 | * @return {?Object}
176 | *
177 | * @description
178 | * Normalizes the given path, returning a regular expression
179 | * and the original path.
180 | *
181 | * Inspired by pathRexp in visionmedia/express/lib/utils.js.
182 | */
183 | function pathRegExp(path, opts) {
184 | var insensitive = opts.caseInsensitiveMatch,
185 | ret = {
186 | originalPath: path,
187 | regexp: path
188 | },
189 | keys = ret.keys = [];
190 |
191 | path = path
192 | .replace(/([().])/g, '\\$1')
193 | .replace(/(\/)?:(\w+)([\?\*])?/g, function(_, slash, key, option){
194 | var optional = option === '?' ? option : null;
195 | var star = option === '*' ? option : null;
196 | keys.push({ name: key, optional: !!optional });
197 | slash = slash || '';
198 | return ''
199 | + (optional ? '' : slash)
200 | + '(?:'
201 | + (optional ? slash : '')
202 | + (star && '(.+?)' || '([^/]+)')
203 | + (optional || '')
204 | + ')'
205 | + (optional || '');
206 | })
207 | .replace(/([\/$\*])/g, '\\$1');
208 |
209 | ret.regexp = new RegExp('^' + path + '$', insensitive ? 'i' : '');
210 | return ret;
211 | }
212 |
213 | /**
214 | * @ngdoc method
215 | * @name ngRoute.$routeProvider#otherwise
216 | * @methodOf ngRoute.$routeProvider
217 | *
218 | * @description
219 | * Sets route definition that will be used on route change when no other route definition
220 | * is matched.
221 | *
222 | * @param {Object} params Mapping information to be assigned to `$route.current`.
223 | * @returns {Object} self
224 | */
225 | this.otherwise = function(params) {
226 | this.when(null, params);
227 | return this;
228 | };
229 |
230 |
231 | this.$get = ['$rootScope',
232 | '$location',
233 | '$routeParams',
234 | '$q',
235 | '$injector',
236 | '$http',
237 | '$templateCache',
238 | '$sce',
239 | function($rootScope, $location, $routeParams, $q, $injector, $http, $templateCache, $sce) {
240 |
241 | /**
242 | * @ngdoc object
243 | * @name ngRoute.$route
244 | * @requires $location
245 | * @requires $routeParams
246 | *
247 | * @property {Object} current Reference to the current route definition.
248 | * The route definition contains:
249 | *
250 | * - `controller`: The controller constructor as define in route definition.
251 | * - `locals`: A map of locals which is used by {@link ng.$controller $controller} service for
252 | * controller instantiation. The `locals` contain
253 | * the resolved values of the `resolve` map. Additionally the `locals` also contain:
254 | *
255 | * - `$scope` - The current route scope.
256 | * - `$template` - The current route template HTML.
257 | *
258 | * @property {Array.} routes Array of all configured routes.
259 | *
260 | * @description
261 | * `$route` is used for deep-linking URLs to controllers and views (HTML partials).
262 | * It watches `$location.url()` and tries to map the path to an existing route definition.
263 | *
264 | * Requires the {@link ngRoute `ngRoute`} module to be installed.
265 | *
266 | * You can define routes through {@link ngRoute.$routeProvider $routeProvider}'s API.
267 | *
268 | * The `$route` service is typically used in conjunction with the
269 | * {@link ngRoute.directive:ngView `ngView`} directive and the
270 | * {@link ngRoute.$routeParams `$routeParams`} service.
271 | *
272 | * @example
273 | This example shows how changing the URL hash causes the `$route` to match a route against the
274 | URL, and the `ngView` pulls in the partial.
275 |
276 | Note that this example is using {@link ng.directive:script inlined templates}
277 | to get it working on jsfiddle as well.
278 |
279 |
280 |
281 |
282 | Choose:
283 |
Moby |
284 |
Moby: Ch1 |
285 |
Gatsby |
286 |
Gatsby: Ch4 |
287 |
Scarlet Letter
288 |
289 |
290 |
291 |
292 |
$location.path() = {{$location.path()}}
293 |
$route.current.templateUrl = {{$route.current.templateUrl}}
294 |
$route.current.params = {{$route.current.params}}
295 |
$route.current.scope.name = {{$route.current.scope.name}}
296 |
$routeParams = {{$routeParams}}
297 |
298 |
299 |
300 |
301 | controller: {{name}}
302 | Book Id: {{params.bookId}}
303 |
304 |
305 |
306 | controller: {{name}}
307 | Book Id: {{params.bookId}}
308 | Chapter Id: {{params.chapterId}}
309 |
310 |
311 |
312 | angular.module('ngViewExample', ['ngRoute'])
313 |
314 | .config(function($routeProvider, $locationProvider) {
315 | $routeProvider.when('/Book/:bookId', {
316 | templateUrl: 'book.html',
317 | controller: BookCntl,
318 | resolve: {
319 | // I will cause a 1 second delay
320 | delay: function($q, $timeout) {
321 | var delay = $q.defer();
322 | $timeout(delay.resolve, 1000);
323 | return delay.promise;
324 | }
325 | }
326 | });
327 | $routeProvider.when('/Book/:bookId/ch/:chapterId', {
328 | templateUrl: 'chapter.html',
329 | controller: ChapterCntl
330 | });
331 |
332 | // configure html5 to get links working on jsfiddle
333 | $locationProvider.html5Mode(true);
334 | });
335 |
336 | function MainCntl($scope, $route, $routeParams, $location) {
337 | $scope.$route = $route;
338 | $scope.$location = $location;
339 | $scope.$routeParams = $routeParams;
340 | }
341 |
342 | function BookCntl($scope, $routeParams) {
343 | $scope.name = "BookCntl";
344 | $scope.params = $routeParams;
345 | }
346 |
347 | function ChapterCntl($scope, $routeParams) {
348 | $scope.name = "ChapterCntl";
349 | $scope.params = $routeParams;
350 | }
351 |
352 |
353 |
354 | it('should load and compile correct template', function() {
355 | element('a:contains("Moby: Ch1")').click();
356 | var content = element('.doc-example-live [ng-view]').text();
357 | expect(content).toMatch(/controller\: ChapterCntl/);
358 | expect(content).toMatch(/Book Id\: Moby/);
359 | expect(content).toMatch(/Chapter Id\: 1/);
360 |
361 | element('a:contains("Scarlet")').click();
362 | sleep(2); // promises are not part of scenario waiting
363 | content = element('.doc-example-live [ng-view]').text();
364 | expect(content).toMatch(/controller\: BookCntl/);
365 | expect(content).toMatch(/Book Id\: Scarlet/);
366 | });
367 |
368 |
369 | */
370 |
371 | /**
372 | * @ngdoc event
373 | * @name ngRoute.$route#$routeChangeStart
374 | * @eventOf ngRoute.$route
375 | * @eventType broadcast on root scope
376 | * @description
377 | * Broadcasted before a route change. At this point the route services starts
378 | * resolving all of the dependencies needed for the route change to occur.
379 | * Typically this involves fetching the view template as well as any dependencies
380 | * defined in `resolve` route property. Once all of the dependencies are resolved
381 | * `$routeChangeSuccess` is fired.
382 | *
383 | * @param {Object} angularEvent Synthetic event object.
384 | * @param {Route} next Future route information.
385 | * @param {Route} current Current route information.
386 | */
387 |
388 | /**
389 | * @ngdoc event
390 | * @name ngRoute.$route#$routeChangeSuccess
391 | * @eventOf ngRoute.$route
392 | * @eventType broadcast on root scope
393 | * @description
394 | * Broadcasted after a route dependencies are resolved.
395 | * {@link ngRoute.directive:ngView ngView} listens for the directive
396 | * to instantiate the controller and render the view.
397 | *
398 | * @param {Object} angularEvent Synthetic event object.
399 | * @param {Route} current Current route information.
400 | * @param {Route|Undefined} previous Previous route information, or undefined if current is
401 | * first route entered.
402 | */
403 |
404 | /**
405 | * @ngdoc event
406 | * @name ngRoute.$route#$routeChangeError
407 | * @eventOf ngRoute.$route
408 | * @eventType broadcast on root scope
409 | * @description
410 | * Broadcasted if any of the resolve promises are rejected.
411 | *
412 | * @param {Object} angularEvent Synthetic event object
413 | * @param {Route} current Current route information.
414 | * @param {Route} previous Previous route information.
415 | * @param {Route} rejection Rejection of the promise. Usually the error of the failed promise.
416 | */
417 |
418 | /**
419 | * @ngdoc event
420 | * @name ngRoute.$route#$routeUpdate
421 | * @eventOf ngRoute.$route
422 | * @eventType broadcast on root scope
423 | * @description
424 | *
425 | * The `reloadOnSearch` property has been set to false, and we are reusing the same
426 | * instance of the Controller.
427 | */
428 |
429 | var forceReload = false,
430 | $route = {
431 | routes: routes,
432 |
433 | /**
434 | * @ngdoc method
435 | * @name ngRoute.$route#reload
436 | * @methodOf ngRoute.$route
437 | *
438 | * @description
439 | * Causes `$route` service to reload the current route even if
440 | * {@link ng.$location $location} hasn't changed.
441 | *
442 | * As a result of that, {@link ngRoute.directive:ngView ngView}
443 | * creates new scope, reinstantiates the controller.
444 | */
445 | reload: function() {
446 | forceReload = true;
447 | $rootScope.$evalAsync(updateRoute);
448 | }
449 | };
450 |
451 | $rootScope.$on('$locationChangeSuccess', updateRoute);
452 |
453 | return $route;
454 |
455 | /////////////////////////////////////////////////////
456 |
457 | /**
458 | * @param on {string} current url
459 | * @param route {Object} route regexp to match the url against
460 | * @return {?Object}
461 | *
462 | * @description
463 | * Check if the route matches the current url.
464 | *
465 | * Inspired by match in
466 | * visionmedia/express/lib/router/router.js.
467 | */
468 | function switchRouteMatcher(on, route) {
469 | var keys = route.keys,
470 | params = {};
471 |
472 | if (!route.regexp) return null;
473 |
474 | var m = route.regexp.exec(on);
475 | if (!m) return null;
476 |
477 | for (var i = 1, len = m.length; i < len; ++i) {
478 | var key = keys[i - 1];
479 |
480 | var val = 'string' == typeof m[i]
481 | ? decodeURIComponent(m[i])
482 | : m[i];
483 |
484 | if (key && val) {
485 | params[key.name] = val;
486 | }
487 | }
488 | return params;
489 | }
490 |
491 | function updateRoute() {
492 | var next = parseRoute(),
493 | last = $route.current;
494 |
495 | if (next && last && next.$$route === last.$$route
496 | && angular.equals(next.pathParams, last.pathParams)
497 | && !next.reloadOnSearch && !forceReload) {
498 | last.params = next.params;
499 | angular.copy(last.params, $routeParams);
500 | $rootScope.$broadcast('$routeUpdate', last);
501 | } else if (next || last) {
502 | forceReload = false;
503 | $rootScope.$broadcast('$routeChangeStart', next, last);
504 | $route.current = next;
505 | if (next) {
506 | if (next.redirectTo) {
507 | if (angular.isString(next.redirectTo)) {
508 | $location.path(interpolate(next.redirectTo, next.params)).search(next.params)
509 | .replace();
510 | } else {
511 | $location.url(next.redirectTo(next.pathParams, $location.path(), $location.search()))
512 | .replace();
513 | }
514 | }
515 | }
516 |
517 | $q.when(next).
518 | then(function() {
519 | if (next) {
520 | var locals = angular.extend({}, next.resolve),
521 | template, templateUrl;
522 |
523 | angular.forEach(locals, function(value, key) {
524 | locals[key] = angular.isString(value) ?
525 | $injector.get(value) : $injector.invoke(value);
526 | });
527 |
528 | if (angular.isDefined(template = next.template)) {
529 | if (angular.isFunction(template)) {
530 | template = template(next.params);
531 | }
532 | } else if (angular.isDefined(templateUrl = next.templateUrl)) {
533 | if (angular.isFunction(templateUrl)) {
534 | templateUrl = templateUrl(next.params);
535 | }
536 | templateUrl = $sce.getTrustedResourceUrl(templateUrl);
537 | if (angular.isDefined(templateUrl)) {
538 | next.loadedTemplateUrl = templateUrl;
539 | template = $http.get(templateUrl, {cache: $templateCache}).
540 | then(function(response) { return response.data; });
541 | }
542 | }
543 | if (angular.isDefined(template)) {
544 | locals['$template'] = template;
545 | }
546 | return $q.all(locals);
547 | }
548 | }).
549 | // after route change
550 | then(function(locals) {
551 | if (next == $route.current) {
552 | if (next) {
553 | next.locals = locals;
554 | angular.copy(next.params, $routeParams);
555 | }
556 | $rootScope.$broadcast('$routeChangeSuccess', next, last);
557 | }
558 | }, function(error) {
559 | if (next == $route.current) {
560 | $rootScope.$broadcast('$routeChangeError', next, last, error);
561 | }
562 | });
563 | }
564 | }
565 |
566 |
567 | /**
568 | * @returns the current active route, by matching it against the URL
569 | */
570 | function parseRoute() {
571 | // Match a route
572 | var params, match;
573 | angular.forEach(routes, function(route, path) {
574 | if (!match && (params = switchRouteMatcher($location.path(), route))) {
575 | match = inherit(route, {
576 | params: angular.extend({}, $location.search(), params),
577 | pathParams: params});
578 | match.$$route = route;
579 | }
580 | });
581 | // No route matched; fallback to "otherwise" route
582 | return match || routes[null] && inherit(routes[null], {params: {}, pathParams:{}});
583 | }
584 |
585 | /**
586 | * @returns interpolation of the redirect path with the parameters
587 | */
588 | function interpolate(string, params) {
589 | var result = [];
590 | angular.forEach((string||'').split(':'), function(segment, i) {
591 | if (i === 0) {
592 | result.push(segment);
593 | } else {
594 | var segmentMatch = segment.match(/(\w+)(.*)/);
595 | var key = segmentMatch[1];
596 | result.push(params[key]);
597 | result.push(segmentMatch[2] || '');
598 | delete params[key];
599 | }
600 | });
601 | return result.join('');
602 | }
603 | }];
604 | }
605 |
606 | ngRouteModule.provider('$routeParams', $RouteParamsProvider);
607 |
608 |
609 | /**
610 | * @ngdoc object
611 | * @name ngRoute.$routeParams
612 | * @requires $route
613 | *
614 | * @description
615 | * The `$routeParams` service allows you to retrieve the current set of route parameters.
616 | *
617 | * Requires the {@link ngRoute `ngRoute`} module to be installed.
618 | *
619 | * The route parameters are a combination of {@link ng.$location `$location`}'s
620 | * {@link ng.$location#methods_search `search()`} and {@link ng.$location#methods_path `path()`}.
621 | * The `path` parameters are extracted when the {@link ngRoute.$route `$route`} path is matched.
622 | *
623 | * In case of parameter name collision, `path` params take precedence over `search` params.
624 | *
625 | * The service guarantees that the identity of the `$routeParams` object will remain unchanged
626 | * (but its properties will likely change) even when a route change occurs.
627 | *
628 | * Note that the `$routeParams` are only updated *after* a route change completes successfully.
629 | * This means that you cannot rely on `$routeParams` being correct in route resolve functions.
630 | * Instead you can use `$route.current.params` to access the new route's parameters.
631 | *
632 | * @example
633 | *
634 | * // Given:
635 | * // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
636 | * // Route: /Chapter/:chapterId/Section/:sectionId
637 | * //
638 | * // Then
639 | * $routeParams ==> {chapterId:1, sectionId:2, search:'moby'}
640 | *
641 | */
642 | function $RouteParamsProvider() {
643 | this.$get = function() { return {}; };
644 | }
645 |
646 | ngRouteModule.directive('ngView', ngViewFactory);
647 | ngRouteModule.directive('ngView', ngViewFillContentFactory);
648 |
649 |
650 | /**
651 | * @ngdoc directive
652 | * @name ngRoute.directive:ngView
653 | * @restrict ECA
654 | *
655 | * @description
656 | * # Overview
657 | * `ngView` is a directive that complements the {@link ngRoute.$route $route} service by
658 | * including the rendered template of the current route into the main layout (`index.html`) file.
659 | * Every time the current route changes, the included view changes with it according to the
660 | * configuration of the `$route` service.
661 | *
662 | * Requires the {@link ngRoute `ngRoute`} module to be installed.
663 | *
664 | * @animations
665 | * enter - animation is used to bring new content into the browser.
666 | * leave - animation is used to animate existing content away.
667 | *
668 | * The enter and leave animation occur concurrently.
669 | *
670 | * @scope
671 | * @priority 400
672 | * @param {string=} onload Expression to evaluate whenever the view updates.
673 | *
674 | * @param {string=} autoscroll Whether `ngView` should call {@link ng.$anchorScroll
675 | * $anchorScroll} to scroll the viewport after the view is updated.
676 | *
677 | * - If the attribute is not set, disable scrolling.
678 | * - If the attribute is set without value, enable scrolling.
679 | * - Otherwise enable scrolling only if the `autoscroll` attribute value evaluated
680 | * as an expression yields a truthy value.
681 | * @example
682 |
683 |
684 |
685 | Choose:
686 |
Moby |
687 |
Moby: Ch1 |
688 |
Gatsby |
689 |
Gatsby: Ch4 |
690 |
Scarlet Letter
691 |
692 |
695 |
696 |
697 |
$location.path() = {{main.$location.path()}}
698 |
$route.current.templateUrl = {{main.$route.current.templateUrl}}
699 |
$route.current.params = {{main.$route.current.params}}
700 |
$route.current.scope.name = {{main.$route.current.scope.name}}
701 |
$routeParams = {{main.$routeParams}}
702 |
703 |
704 |
705 |
706 |
707 | controller: {{book.name}}
708 | Book Id: {{book.params.bookId}}
709 |
710 |
711 |
712 |
713 |
714 | controller: {{chapter.name}}
715 | Book Id: {{chapter.params.bookId}}
716 | Chapter Id: {{chapter.params.chapterId}}
717 |
718 |
719 |
720 |
721 | .view-animate-container {
722 | position:relative;
723 | height:100px!important;
724 | position:relative;
725 | background:white;
726 | border:1px solid black;
727 | height:40px;
728 | overflow:hidden;
729 | }
730 |
731 | .view-animate {
732 | padding:10px;
733 | }
734 |
735 | .view-animate.ng-enter, .view-animate.ng-leave {
736 | -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
737 | transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
738 |
739 | display:block;
740 | width:100%;
741 | border-left:1px solid black;
742 |
743 | position:absolute;
744 | top:0;
745 | left:0;
746 | right:0;
747 | bottom:0;
748 | padding:10px;
749 | }
750 |
751 | .view-animate.ng-enter {
752 | left:100%;
753 | }
754 | .view-animate.ng-enter.ng-enter-active {
755 | left:0;
756 | }
757 | .view-animate.ng-leave.ng-leave-active {
758 | left:-100%;
759 | }
760 |
761 |
762 |
763 | angular.module('ngViewExample', ['ngRoute', 'ngAnimate'],
764 | function($routeProvider, $locationProvider) {
765 | $routeProvider.when('/Book/:bookId', {
766 | templateUrl: 'book.html',
767 | controller: BookCntl,
768 | controllerAs: 'book'
769 | });
770 | $routeProvider.when('/Book/:bookId/ch/:chapterId', {
771 | templateUrl: 'chapter.html',
772 | controller: ChapterCntl,
773 | controllerAs: 'chapter'
774 | });
775 |
776 | // configure html5 to get links working on jsfiddle
777 | $locationProvider.html5Mode(true);
778 | });
779 |
780 | function MainCntl($route, $routeParams, $location) {
781 | this.$route = $route;
782 | this.$location = $location;
783 | this.$routeParams = $routeParams;
784 | }
785 |
786 | function BookCntl($routeParams) {
787 | this.name = "BookCntl";
788 | this.params = $routeParams;
789 | }
790 |
791 | function ChapterCntl($routeParams) {
792 | this.name = "ChapterCntl";
793 | this.params = $routeParams;
794 | }
795 |
796 |
797 |
798 | it('should load and compile correct template', function() {
799 | element('a:contains("Moby: Ch1")').click();
800 | var content = element('.doc-example-live [ng-view]').text();
801 | expect(content).toMatch(/controller\: ChapterCntl/);
802 | expect(content).toMatch(/Book Id\: Moby/);
803 | expect(content).toMatch(/Chapter Id\: 1/);
804 |
805 | element('a:contains("Scarlet")').click();
806 | content = element('.doc-example-live [ng-view]').text();
807 | expect(content).toMatch(/controller\: BookCntl/);
808 | expect(content).toMatch(/Book Id\: Scarlet/);
809 | });
810 |
811 |
812 | */
813 |
814 |
815 | /**
816 | * @ngdoc event
817 | * @name ngRoute.directive:ngView#$viewContentLoaded
818 | * @eventOf ngRoute.directive:ngView
819 | * @eventType emit on the current ngView scope
820 | * @description
821 | * Emitted every time the ngView content is reloaded.
822 | */
823 | ngViewFactory.$inject = ['$route', '$anchorScroll', '$animate'];
824 | function ngViewFactory( $route, $anchorScroll, $animate) {
825 | return {
826 | restrict: 'ECA',
827 | terminal: true,
828 | priority: 400,
829 | transclude: 'element',
830 | link: function(scope, $element, attr, ctrl, $transclude) {
831 | var currentScope,
832 | currentElement,
833 | autoScrollExp = attr.autoscroll,
834 | onloadExp = attr.onload || '';
835 |
836 | scope.$on('$routeChangeSuccess', update);
837 | update();
838 |
839 | function cleanupLastView() {
840 | if (currentScope) {
841 | currentScope.$destroy();
842 | currentScope = null;
843 | }
844 | if(currentElement) {
845 | $animate.leave(currentElement);
846 | currentElement = null;
847 | }
848 | }
849 |
850 | function update() {
851 | var locals = $route.current && $route.current.locals,
852 | template = locals && locals.$template;
853 |
854 | if (angular.isDefined(template)) {
855 | var newScope = scope.$new();
856 | var current = $route.current;
857 |
858 | // Note: This will also link all children of ng-view that were contained in the original
859 | // html. If that content contains controllers, ... they could pollute/change the scope.
860 | // However, using ng-view on an element with additional content does not make sense...
861 | // Note: We can't remove them in the cloneAttchFn of $transclude as that
862 | // function is called before linking the content, which would apply child
863 | // directives to non existing elements.
864 | var clone = $transclude(newScope, function(clone) {
865 | $animate.enter(clone, null, currentElement || $element, function onNgViewEnter () {
866 | if (angular.isDefined(autoScrollExp)
867 | && (!autoScrollExp || scope.$eval(autoScrollExp))) {
868 | $anchorScroll();
869 | }
870 | });
871 | cleanupLastView();
872 | });
873 |
874 | currentElement = clone;
875 | currentScope = current.scope = newScope;
876 | currentScope.$emit('$viewContentLoaded');
877 | currentScope.$eval(onloadExp);
878 | } else {
879 | cleanupLastView();
880 | }
881 | }
882 | }
883 | };
884 | }
885 |
886 | // This directive is called during the $transclude call of the first `ngView` directive.
887 | // It will replace and compile the content of the element with the loaded template.
888 | // We need this directive so that the element content is already filled when
889 | // the link function of another directive on the same element as ngView
890 | // is called.
891 | ngViewFillContentFactory.$inject = ['$compile', '$controller', '$route'];
892 | function ngViewFillContentFactory($compile, $controller, $route) {
893 | return {
894 | restrict: 'ECA',
895 | priority: -400,
896 | link: function(scope, $element) {
897 | var current = $route.current,
898 | locals = current.locals;
899 |
900 | $element.html(locals.$template);
901 |
902 | var link = $compile($element.contents());
903 |
904 | if (current.controller) {
905 | locals.$scope = scope;
906 | var controller = $controller(current.controller, locals);
907 | if (current.controllerAs) {
908 | scope[current.controllerAs] = controller;
909 | }
910 | $element.data('$ngControllerController', controller);
911 | $element.children().data('$ngControllerController', controller);
912 | }
913 |
914 | link(scope);
915 | }
916 | };
917 | }
918 |
919 |
920 | })(window, window.angular);
921 |
--------------------------------------------------------------------------------
/lib/angular-route/angular-route.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @license AngularJS v1.3.7-build.3695+sha.aac3c4a
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 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 | *
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=}` – A controller alias name. If present the controller will be
82 | * 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.}` - 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.}` - route parameters extracted from the current
99 | * `$location.path()` by applying the current route
100 | *
101 | * - `resolve` - `{Object.=}` - 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.}` - 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 | *
296 | *
297 | *
298 | * Choose:
299 | *
Moby |
300 | *
Moby: Ch1 |
301 | *
Gatsby |
302 | *
Gatsby: Ch4 |
303 | *
Scarlet Letter
304 | *
305 | *
306 | *
307 | *
308 | *
309 | *
$location.path() = {{$location.path()}}
310 | *
$route.current.templateUrl = {{$route.current.templateUrl}}
311 | *
$route.current.params = {{$route.current.params}}
312 | *
$route.current.scope.name = {{$route.current.scope.name}}
313 | *
$routeParams = {{$routeParams}}
314 | *
315 | *
316 | *
317 | *
318 | * controller: {{name}}
319 | * Book Id: {{params.bookId}}
320 | *
321 | *
322 | *
323 | * controller: {{name}}
324 | * Book Id: {{params.bookId}}
325 | * Chapter Id: {{params.chapterId}}
326 | *
327 | *
328 | *
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 | *
371 | *
372 | *
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 | *
387 | *
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 dependencies are resolved.
416 | * {@link ngRoute.directive:ngView ngView} listens for the directive
417 | * to instantiate the controller and render the view.
418 | *
419 | * @param {Object} angularEvent Synthetic event object.
420 | * @param {Route} current Current route information.
421 | * @param {Route|Undefined} previous Previous route information, or undefined if current is
422 | * first route entered.
423 | */
424 |
425 | /**
426 | * @ngdoc event
427 | * @name $route#$routeChangeError
428 | * @eventType broadcast on root scope
429 | * @description
430 | * Broadcasted if any of the resolve promises are rejected.
431 | *
432 | * @param {Object} angularEvent Synthetic event object
433 | * @param {Route} current Current route information.
434 | * @param {Route} previous Previous route information.
435 | * @param {Route} rejection Rejection of the promise. Usually the error of the failed promise.
436 | */
437 |
438 | /**
439 | * @ngdoc event
440 | * @name $route#$routeUpdate
441 | * @eventType broadcast on root scope
442 | * @description
443 | *
444 | * The `reloadOnSearch` property has been set to false, and we are reusing the same
445 | * instance of the Controller.
446 | */
447 |
448 | var forceReload = false,
449 | preparedRoute,
450 | preparedRouteIsUpdateOnly,
451 | $route = {
452 | routes: routes,
453 |
454 | /**
455 | * @ngdoc method
456 | * @name $route#reload
457 | *
458 | * @description
459 | * Causes `$route` service to reload the current route even if
460 | * {@link ng.$location $location} hasn't changed.
461 | *
462 | * As a result of that, {@link ngRoute.directive:ngView ngView}
463 | * creates new scope and reinstantiates the controller.
464 | */
465 | reload: function() {
466 | forceReload = true;
467 | $rootScope.$evalAsync(function() {
468 | // Don't support cancellation of a reload for now...
469 | prepareRoute();
470 | commitRoute();
471 | });
472 | },
473 |
474 | /**
475 | * @ngdoc method
476 | * @name $route#updateParams
477 | *
478 | * @description
479 | * Causes `$route` service to update the current URL, replacing
480 | * current route parameters with those specified in `newParams`.
481 | * Provided property names that match the route's path segment
482 | * definitions will be interpolated into the location's path, while
483 | * remaining properties will be treated as query params.
484 | *
485 | * @param {Object} newParams mapping of URL parameter names to values
486 | */
487 | updateParams: function(newParams) {
488 | if (this.current && this.current.$$route) {
489 | var searchParams = {}, self=this;
490 |
491 | angular.forEach(Object.keys(newParams), function(key) {
492 | if (!self.current.pathParams[key]) searchParams[key] = newParams[key];
493 | });
494 |
495 | newParams = angular.extend({}, this.current.params, newParams);
496 | $location.path(interpolate(this.current.$$route.originalPath, newParams));
497 | $location.search(angular.extend({}, $location.search(), searchParams));
498 | }
499 | else {
500 | throw $routeMinErr('norout', 'Tried updating route when with no current route');
501 | }
502 | }
503 | };
504 |
505 | $rootScope.$on('$locationChangeStart', prepareRoute);
506 | $rootScope.$on('$locationChangeSuccess', commitRoute);
507 |
508 | return $route;
509 |
510 | /////////////////////////////////////////////////////
511 |
512 | /**
513 | * @param on {string} current url
514 | * @param route {Object} route regexp to match the url against
515 | * @return {?Object}
516 | *
517 | * @description
518 | * Check if the route matches the current url.
519 | *
520 | * Inspired by match in
521 | * visionmedia/express/lib/router/router.js.
522 | */
523 | function switchRouteMatcher(on, route) {
524 | var keys = route.keys,
525 | params = {};
526 |
527 | if (!route.regexp) return null;
528 |
529 | var m = route.regexp.exec(on);
530 | if (!m) return null;
531 |
532 | for (var i = 1, len = m.length; i < len; ++i) {
533 | var key = keys[i - 1];
534 |
535 | var val = m[i];
536 |
537 | if (key && val) {
538 | params[key.name] = val;
539 | }
540 | }
541 | return params;
542 | }
543 |
544 | function prepareRoute($locationEvent) {
545 | var lastRoute = $route.current;
546 |
547 | preparedRoute = parseRoute();
548 | preparedRouteIsUpdateOnly = preparedRoute && lastRoute && preparedRoute.$$route === lastRoute.$$route
549 | && angular.equals(preparedRoute.pathParams, lastRoute.pathParams)
550 | && !preparedRoute.reloadOnSearch && !forceReload;
551 |
552 | if (!preparedRouteIsUpdateOnly && (lastRoute || preparedRoute)) {
553 | if ($rootScope.$broadcast('$routeChangeStart', preparedRoute, lastRoute).defaultPrevented) {
554 | if ($locationEvent) {
555 | $locationEvent.preventDefault();
556 | }
557 | }
558 | }
559 | }
560 |
561 | function commitRoute() {
562 | var lastRoute = $route.current;
563 | var nextRoute = preparedRoute;
564 |
565 | if (preparedRouteIsUpdateOnly) {
566 | lastRoute.params = nextRoute.params;
567 | angular.copy(lastRoute.params, $routeParams);
568 | $rootScope.$broadcast('$routeUpdate', lastRoute);
569 | } else if (nextRoute || lastRoute) {
570 | forceReload = false;
571 | $route.current = nextRoute;
572 | if (nextRoute) {
573 | if (nextRoute.redirectTo) {
574 | if (angular.isString(nextRoute.redirectTo)) {
575 | $location.path(interpolate(nextRoute.redirectTo, nextRoute.params)).search(nextRoute.params)
576 | .replace();
577 | } else {
578 | $location.url(nextRoute.redirectTo(nextRoute.pathParams, $location.path(), $location.search()))
579 | .replace();
580 | }
581 | }
582 | }
583 |
584 | $q.when(nextRoute).
585 | then(function() {
586 | if (nextRoute) {
587 | var locals = angular.extend({}, nextRoute.resolve),
588 | template, templateUrl;
589 |
590 | angular.forEach(locals, function(value, key) {
591 | locals[key] = angular.isString(value) ?
592 | $injector.get(value) : $injector.invoke(value, null, null, key);
593 | });
594 |
595 | if (angular.isDefined(template = nextRoute.template)) {
596 | if (angular.isFunction(template)) {
597 | template = template(nextRoute.params);
598 | }
599 | } else if (angular.isDefined(templateUrl = nextRoute.templateUrl)) {
600 | if (angular.isFunction(templateUrl)) {
601 | templateUrl = templateUrl(nextRoute.params);
602 | }
603 | templateUrl = $sce.getTrustedResourceUrl(templateUrl);
604 | if (angular.isDefined(templateUrl)) {
605 | nextRoute.loadedTemplateUrl = templateUrl;
606 | template = $templateRequest(templateUrl);
607 | }
608 | }
609 | if (angular.isDefined(template)) {
610 | locals['$template'] = template;
611 | }
612 | return $q.all(locals);
613 | }
614 | }).
615 | // after route change
616 | then(function(locals) {
617 | if (nextRoute == $route.current) {
618 | if (nextRoute) {
619 | nextRoute.locals = locals;
620 | angular.copy(nextRoute.params, $routeParams);
621 | }
622 | $rootScope.$broadcast('$routeChangeSuccess', nextRoute, lastRoute);
623 | }
624 | }, function(error) {
625 | if (nextRoute == $route.current) {
626 | $rootScope.$broadcast('$routeChangeError', nextRoute, lastRoute, error);
627 | }
628 | });
629 | }
630 | }
631 |
632 |
633 | /**
634 | * @returns {Object} the current active route, by matching it against the URL
635 | */
636 | function parseRoute() {
637 | // Match a route
638 | var params, match;
639 | angular.forEach(routes, function(route, path) {
640 | if (!match && (params = switchRouteMatcher($location.path(), route))) {
641 | match = inherit(route, {
642 | params: angular.extend({}, $location.search(), params),
643 | pathParams: params});
644 | match.$$route = route;
645 | }
646 | });
647 | // No route matched; fallback to "otherwise" route
648 | return match || routes[null] && inherit(routes[null], {params: {}, pathParams:{}});
649 | }
650 |
651 | /**
652 | * @returns {string} interpolation of the redirect path with the parameters
653 | */
654 | function interpolate(string, params) {
655 | var result = [];
656 | angular.forEach((string || '').split(':'), function(segment, i) {
657 | if (i === 0) {
658 | result.push(segment);
659 | } else {
660 | var segmentMatch = segment.match(/(\w+)(?:[?*])?(.*)/);
661 | var key = segmentMatch[1];
662 | result.push(params[key]);
663 | result.push(segmentMatch[2] || '');
664 | delete params[key];
665 | }
666 | });
667 | return result.join('');
668 | }
669 | }];
670 | }
671 |
672 | ngRouteModule.provider('$routeParams', $RouteParamsProvider);
673 |
674 |
675 | /**
676 | * @ngdoc service
677 | * @name $routeParams
678 | * @requires $route
679 | *
680 | * @description
681 | * The `$routeParams` service allows you to retrieve the current set of route parameters.
682 | *
683 | * Requires the {@link ngRoute `ngRoute`} module to be installed.
684 | *
685 | * The route parameters are a combination of {@link ng.$location `$location`}'s
686 | * {@link ng.$location#search `search()`} and {@link ng.$location#path `path()`}.
687 | * The `path` parameters are extracted when the {@link ngRoute.$route `$route`} path is matched.
688 | *
689 | * In case of parameter name collision, `path` params take precedence over `search` params.
690 | *
691 | * The service guarantees that the identity of the `$routeParams` object will remain unchanged
692 | * (but its properties will likely change) even when a route change occurs.
693 | *
694 | * Note that the `$routeParams` are only updated *after* a route change completes successfully.
695 | * This means that you cannot rely on `$routeParams` being correct in route resolve functions.
696 | * Instead you can use `$route.current.params` to access the new route's parameters.
697 | *
698 | * @example
699 | * ```js
700 | * // Given:
701 | * // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
702 | * // Route: /Chapter/:chapterId/Section/:sectionId
703 | * //
704 | * // Then
705 | * $routeParams ==> {chapterId:'1', sectionId:'2', search:'moby'}
706 | * ```
707 | */
708 | function $RouteParamsProvider() {
709 | this.$get = function() { return {}; };
710 | }
711 |
712 | ngRouteModule.directive('ngView', ngViewFactory);
713 | ngRouteModule.directive('ngView', ngViewFillContentFactory);
714 |
715 |
716 | /**
717 | * @ngdoc directive
718 | * @name ngView
719 | * @restrict ECA
720 | *
721 | * @description
722 | * # Overview
723 | * `ngView` is a directive that complements the {@link ngRoute.$route $route} service by
724 | * including the rendered template of the current route into the main layout (`index.html`) file.
725 | * Every time the current route changes, the included view changes with it according to the
726 | * configuration of the `$route` service.
727 | *
728 | * Requires the {@link ngRoute `ngRoute`} module to be installed.
729 | *
730 | * @animations
731 | * enter - animation is used to bring new content into the browser.
732 | * leave - animation is used to animate existing content away.
733 | *
734 | * The enter and leave animation occur concurrently.
735 | *
736 | * @scope
737 | * @priority 400
738 | * @param {string=} onload Expression to evaluate whenever the view updates.
739 | *
740 | * @param {string=} autoscroll Whether `ngView` should call {@link ng.$anchorScroll
741 | * $anchorScroll} to scroll the viewport after the view is updated.
742 | *
743 | * - If the attribute is not set, disable scrolling.
744 | * - If the attribute is set without value, enable scrolling.
745 | * - Otherwise enable scrolling only if the `autoscroll` attribute value evaluated
746 | * as an expression yields a truthy value.
747 | * @example
748 |
751 |
752 |
753 | Choose:
754 |
Moby |
755 |
Moby: Ch1 |
756 |
Gatsby |
757 |
Gatsby: Ch4 |
758 |
Scarlet Letter
759 |
760 |
763 |
764 |
765 |
$location.path() = {{main.$location.path()}}
766 |
$route.current.templateUrl = {{main.$route.current.templateUrl}}
767 |
$route.current.params = {{main.$route.current.params}}
768 |
$routeParams = {{main.$routeParams}}
769 |
770 |
771 |
772 |
773 |
774 | controller: {{book.name}}
775 | Book Id: {{book.params.bookId}}
776 |
777 |
778 |
779 |
780 |
781 | controller: {{chapter.name}}
782 | Book Id: {{chapter.params.bookId}}
783 | Chapter Id: {{chapter.params.chapterId}}
784 |
785 |
786 |
787 |
788 | .view-animate-container {
789 | position:relative;
790 | height:100px!important;
791 | background:white;
792 | border:1px solid black;
793 | height:40px;
794 | overflow:hidden;
795 | }
796 |
797 | .view-animate {
798 | padding:10px;
799 | }
800 |
801 | .view-animate.ng-enter, .view-animate.ng-leave {
802 | -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
803 | transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
804 |
805 | display:block;
806 | width:100%;
807 | border-left:1px solid black;
808 |
809 | position:absolute;
810 | top:0;
811 | left:0;
812 | right:0;
813 | bottom:0;
814 | padding:10px;
815 | }
816 |
817 | .view-animate.ng-enter {
818 | left:100%;
819 | }
820 | .view-animate.ng-enter.ng-enter-active {
821 | left:0;
822 | }
823 | .view-animate.ng-leave.ng-leave-active {
824 | left:-100%;
825 | }
826 |
827 |
828 |
829 | angular.module('ngViewExample', ['ngRoute', 'ngAnimate'])
830 | .config(['$routeProvider', '$locationProvider',
831 | function($routeProvider, $locationProvider) {
832 | $routeProvider
833 | .when('/Book/:bookId', {
834 | templateUrl: 'book.html',
835 | controller: 'BookCtrl',
836 | controllerAs: 'book'
837 | })
838 | .when('/Book/:bookId/ch/:chapterId', {
839 | templateUrl: 'chapter.html',
840 | controller: 'ChapterCtrl',
841 | controllerAs: 'chapter'
842 | });
843 |
844 | $locationProvider.html5Mode(true);
845 | }])
846 | .controller('MainCtrl', ['$route', '$routeParams', '$location',
847 | function($route, $routeParams, $location) {
848 | this.$route = $route;
849 | this.$location = $location;
850 | this.$routeParams = $routeParams;
851 | }])
852 | .controller('BookCtrl', ['$routeParams', function($routeParams) {
853 | this.name = "BookCtrl";
854 | this.params = $routeParams;
855 | }])
856 | .controller('ChapterCtrl', ['$routeParams', function($routeParams) {
857 | this.name = "ChapterCtrl";
858 | this.params = $routeParams;
859 | }]);
860 |
861 |
862 |
863 |
864 | it('should load and compile correct template', function() {
865 | element(by.linkText('Moby: Ch1')).click();
866 | var content = element(by.css('[ng-view]')).getText();
867 | expect(content).toMatch(/controller\: ChapterCtrl/);
868 | expect(content).toMatch(/Book Id\: Moby/);
869 | expect(content).toMatch(/Chapter Id\: 1/);
870 |
871 | element(by.partialLinkText('Scarlet')).click();
872 |
873 | content = element(by.css('[ng-view]')).getText();
874 | expect(content).toMatch(/controller\: BookCtrl/);
875 | expect(content).toMatch(/Book Id\: Scarlet/);
876 | });
877 |
878 |
879 | */
880 |
881 |
882 | /**
883 | * @ngdoc event
884 | * @name ngView#$viewContentLoaded
885 | * @eventType emit on the current ngView scope
886 | * @description
887 | * Emitted every time the ngView content is reloaded.
888 | */
889 | ngViewFactory.$inject = ['$route', '$anchorScroll', '$animate'];
890 | function ngViewFactory($route, $anchorScroll, $animate) {
891 | return {
892 | restrict: 'ECA',
893 | terminal: true,
894 | priority: 400,
895 | transclude: 'element',
896 | link: function(scope, $element, attr, ctrl, $transclude) {
897 | var currentScope,
898 | currentElement,
899 | previousLeaveAnimation,
900 | autoScrollExp = attr.autoscroll,
901 | onloadExp = attr.onload || '';
902 |
903 | scope.$on('$routeChangeSuccess', update);
904 | update();
905 |
906 | function cleanupLastView() {
907 | if (previousLeaveAnimation) {
908 | $animate.cancel(previousLeaveAnimation);
909 | previousLeaveAnimation = null;
910 | }
911 |
912 | if (currentScope) {
913 | currentScope.$destroy();
914 | currentScope = null;
915 | }
916 | if (currentElement) {
917 | previousLeaveAnimation = $animate.leave(currentElement);
918 | previousLeaveAnimation.then(function() {
919 | previousLeaveAnimation = null;
920 | });
921 | currentElement = null;
922 | }
923 | }
924 |
925 | function update() {
926 | var locals = $route.current && $route.current.locals,
927 | template = locals && locals.$template;
928 |
929 | if (angular.isDefined(template)) {
930 | var newScope = scope.$new();
931 | var current = $route.current;
932 |
933 | // Note: This will also link all children of ng-view that were contained in the original
934 | // html. If that content contains controllers, ... they could pollute/change the scope.
935 | // However, using ng-view on an element with additional content does not make sense...
936 | // Note: We can't remove them in the cloneAttchFn of $transclude as that
937 | // function is called before linking the content, which would apply child
938 | // directives to non existing elements.
939 | var clone = $transclude(newScope, function(clone) {
940 | $animate.enter(clone, null, currentElement || $element).then(function onNgViewEnter() {
941 | if (angular.isDefined(autoScrollExp)
942 | && (!autoScrollExp || scope.$eval(autoScrollExp))) {
943 | $anchorScroll();
944 | }
945 | });
946 | cleanupLastView();
947 | });
948 |
949 | currentElement = clone;
950 | currentScope = current.scope = newScope;
951 | currentScope.$emit('$viewContentLoaded');
952 | currentScope.$eval(onloadExp);
953 | } else {
954 | cleanupLastView();
955 | }
956 | }
957 | }
958 | };
959 | }
960 |
961 | // This directive is called during the $transclude call of the first `ngView` directive.
962 | // It will replace and compile the content of the element with the loaded template.
963 | // We need this directive so that the element content is already filled when
964 | // the link function of another directive on the same element as ngView
965 | // is called.
966 | ngViewFillContentFactory.$inject = ['$compile', '$controller', '$route'];
967 | function ngViewFillContentFactory($compile, $controller, $route) {
968 | return {
969 | restrict: 'ECA',
970 | priority: -400,
971 | link: function(scope, $element) {
972 | var current = $route.current,
973 | locals = current.locals;
974 |
975 | $element.html(locals.$template);
976 |
977 | var link = $compile($element.contents());
978 |
979 | if (current.controller) {
980 | locals.$scope = scope;
981 | var controller = $controller(current.controller, locals);
982 | if (current.controllerAs) {
983 | scope[current.controllerAs] = controller;
984 | }
985 | $element.data('$ngControllerController', controller);
986 | $element.children().data('$ngControllerController', controller);
987 | }
988 |
989 | link(scope);
990 | }
991 | };
992 | }
993 |
994 |
995 | })(window, window.angular);
--------------------------------------------------------------------------------
/lib/angular-route/angular-route.min.js.map:
--------------------------------------------------------------------------------
1 | {
2 | "version":3,
3 | "file":"angular-route.min.js",
4 | "lineCount":14,
5 | "mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAA6B,CAo3BtCC,QAASA,EAAa,CAACC,CAAD,CAASC,CAAT,CAAwBC,CAAxB,CAAkC,CACtD,MAAO,CACLC,SAAU,KADL,CAELC,SAAU,CAAA,CAFL,CAGLC,SAAU,GAHL,CAILC,WAAY,SAJP,CAKLC,KAAMA,QAAQ,CAACC,CAAD,CAAQC,CAAR,CAAkBC,CAAlB,CAAwBC,CAAxB,CAA8BC,CAA9B,CAA2C,CAUrDC,QAASA,EAAe,EAAG,CACrBC,CAAJ,GACEZ,CAAAa,OAAA,CAAgBD,CAAhB,CACA,CAAAA,CAAA,CAAyB,IAF3B,CAKIE,EAAJ,GACEA,CAAAC,SAAA,EACA,CAAAD,CAAA,CAAe,IAFjB,CAIIE,EAAJ,GACEJ,CAIA,CAJyBZ,CAAAiB,MAAA,CAAeD,CAAf,CAIzB,CAHAJ,CAAAM,KAAA,CAA4B,QAAQ,EAAG,CACrCN,CAAA,CAAyB,IADY,CAAvC,CAGA,CAAAI,CAAA,CAAiB,IALnB,CAVyB,CAmB3BG,QAASA,EAAM,EAAG,CAAA,IACZC,EAAStB,CAAAuB,QAATD,EAA2BtB,CAAAuB,QAAAD,OAG/B,IAAIzB,CAAA2B,UAAA,CAFWF,CAEX,EAFqBA,CAAAG,UAErB,CAAJ,CAAiC,CAC3BC,IAAAA,EAAWlB,CAAAmB,KAAA,EAAXD,CACAH,EAAUvB,CAAAuB,QAkBdL,EAAA,CAVYN,CAAA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AOjH,EA3PgF,CAP7E,CAhNY,CAlBN,CAApB,KAEIsJ,EAAezJ,CAAA0J,SAAA,CAAiB,SAAjB,CAsoBnBvG,EAAAE,SAAA,CAAuB,cAAvB,CAoCAsG,QAA6B,EAAG,CAC9B,IAAA5D,KAAA,CAAY6D,QAAQ,EAAG,CAAE,MAAO,EAAT,CADO,CApChC,CAwCAzG,EAAA0G,UAAA,CAAwB,QAAxB,CAAkC3J,CAAlC,CACAiD,EAAA0G,UAAA,CAAwB,QAAxB,CAAkCpH,CAAlC,CAgLAvC,EAAA4J,QAAA,CAAwB,CAAC,QAAD,CAAW,eAAX,CAA4B,UAA5B,CA6ExBrH,EAAAqH,QAAA,CAAmC,CAAC,UAAD,CAAa,aAAb,CAA4B,QAA5B,CAh8BG,CAArC,CAAD,CA69BG/J,MA79BH,CA69BWA,MAAAC,QA79BX;",
6 | "sources":["angular-route.js"],
7 | "names":["window","angular","undefined","ngViewFactory","$route","$anchorScroll","$animate","restrict","terminal","priority","transclude","link","scope","$element","attr","ctrl","$transclude","cleanupLastView","previousLeaveAnimation","cancel","currentScope","$destroy","currentElement","leave","then","update","locals","current","isDefined","$template","newScope","$new","clone","enter","onNgViewEnter","autoScrollExp","$eval","$emit","onloadExp","autoscroll","onload","$on","ngViewFillContentFactory","$compile","$controller","html","contents","controller","$scope","controllerAs","data","children","ngRouteModule","module","provider","$RouteProvider","inherit","parent","extra","extend","Object","create","pathRegExp","path","opts","insensitive","caseInsensitiveMatch","ret","originalPath","regexp","keys","replace","_","slash","key","option","optional","star","push","name","RegExp","routes","when","this.when","route","routeCopy","copy","isUndefined","reloadOnSearch","redirectPath","length","substr","redirectTo","otherwise","this.otherwise","params","$get","$rootScope","$location","$routeParams","$q","$injector","$templateRequest","$sce","prepareRoute","$locationEvent","lastRoute","preparedRouteIsUpdateOnly","preparedRoute","parseRoute","$$route","equals","pathParams","forceReload","$broadcast","defaultPrevented","preventDefault","commitRoute","nextRoute","isString","interpolate","search","url","resolve","template","templateUrl","forEach","value","get","invoke","isFunction","getTrustedResourceUrl","loadedTemplateUrl","all","error","match","m","exec","on","i","len","val","string","result","split","segment","segmentMatch","join","reload","$evalAsync","updateParams","newParams","searchParams","self","$routeMinErr","$$minErr","$RouteParamsProvider","this.$get","directive","$inject"]
8 | }
--------------------------------------------------------------------------------
/lib/hammer/hammer.min.js:
--------------------------------------------------------------------------------
1 | /*! Hammer.JS - v2.0.4 - 2014-09-28
2 | * http://hammerjs.github.io/
3 | *
4 | * Copyright (c) 2014 Jorik Tangelder;
5 | * Licensed under the MIT license */
6 | !function(a,b,c,d){"use strict";function e(a,b,c){return setTimeout(k(a,c),b)}function f(a,b,c){return Array.isArray(a)?(g(a,c[b],c),!0):!1}function g(a,b,c){var e;if(a)if(a.forEach)a.forEach(b,c);else if(a.length!==d)for(e=0;e-1}function r(a){return a.trim().split(/\s+/g)}function s(a,b,c){if(a.indexOf&&!c)return a.indexOf(b);for(var d=0;dc[b]}):d.sort()),d}function v(a,b){for(var c,e,f=b[0].toUpperCase()+b.slice(1),g=0;g1&&!c.firstMultiple?c.firstMultiple=E(b):1===e&&(c.firstMultiple=!1);var f=c.firstInput,g=c.firstMultiple,h=g?g.center:f.center,i=b.center=F(d);b.timeStamp=nb(),b.deltaTime=b.timeStamp-f.timeStamp,b.angle=J(h,i),b.distance=I(h,i),C(c,b),b.offsetDirection=H(b.deltaX,b.deltaY),b.scale=g?L(g.pointers,d):1,b.rotation=g?K(g.pointers,d):0,D(c,b);var j=a.element;p(b.srcEvent.target,j)&&(j=b.srcEvent.target),b.target=j}function C(a,b){var c=b.center,d=a.offsetDelta||{},e=a.prevDelta||{},f=a.prevInput||{};(b.eventType===yb||f.eventType===Ab)&&(e=a.prevDelta={x:f.deltaX||0,y:f.deltaY||0},d=a.offsetDelta={x:c.x,y:c.y}),b.deltaX=e.x+(c.x-d.x),b.deltaY=e.y+(c.y-d.y)}function D(a,b){var c,e,f,g,h=a.lastInterval||b,i=b.timeStamp-h.timeStamp;if(b.eventType!=Bb&&(i>xb||h.velocity===d)){var j=h.deltaX-b.deltaX,k=h.deltaY-b.deltaY,l=G(i,j,k);e=l.x,f=l.y,c=mb(l.x)>mb(l.y)?l.x:l.y,g=H(j,k),a.lastInterval=b}else c=h.velocity,e=h.velocityX,f=h.velocityY,g=h.direction;b.velocity=c,b.velocityX=e,b.velocityY=f,b.direction=g}function E(a){for(var b=[],c=0;ce;)c+=a[e].clientX,d+=a[e].clientY,e++;return{x:lb(c/b),y:lb(d/b)}}function G(a,b,c){return{x:b/a||0,y:c/a||0}}function H(a,b){return a===b?Cb:mb(a)>=mb(b)?a>0?Db:Eb:b>0?Fb:Gb}function I(a,b,c){c||(c=Kb);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return Math.sqrt(d*d+e*e)}function J(a,b,c){c||(c=Kb);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return 180*Math.atan2(e,d)/Math.PI}function K(a,b){return J(b[1],b[0],Lb)-J(a[1],a[0],Lb)}function L(a,b){return I(b[0],b[1],Lb)/I(a[0],a[1],Lb)}function M(){this.evEl=Nb,this.evWin=Ob,this.allow=!0,this.pressed=!1,y.apply(this,arguments)}function N(){this.evEl=Rb,this.evWin=Sb,y.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function O(){this.evTarget=Ub,this.evWin=Vb,this.started=!1,y.apply(this,arguments)}function P(a,b){var c=t(a.touches),d=t(a.changedTouches);return b&(Ab|Bb)&&(c=u(c.concat(d),"identifier",!0)),[c,d]}function Q(){this.evTarget=Xb,this.targetIds={},y.apply(this,arguments)}function R(a,b){var c=t(a.touches),d=this.targetIds;if(b&(yb|zb)&&1===c.length)return d[c[0].identifier]=!0,[c,c];var e,f,g=t(a.changedTouches),h=[],i=this.target;if(f=c.filter(function(a){return p(a.target,i)}),b===yb)for(e=0;eh&&(b.push(a),h=b.length-1):e&(Ab|Bb)&&(c=!0),0>h||(b[h]=a,this.callback(this.manager,e,{pointers:b,changedPointers:[a],pointerType:f,srcEvent:a}),c&&b.splice(h,1))}});var Tb={touchstart:yb,touchmove:zb,touchend:Ab,touchcancel:Bb},Ub="touchstart",Vb="touchstart touchmove touchend touchcancel";j(O,y,{handler:function(a){var b=Tb[a.type];if(b===yb&&(this.started=!0),this.started){var c=P.call(this,a,b);b&(Ab|Bb)&&c[0].length-c[1].length===0&&(this.started=!1),this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:tb,srcEvent:a})}}});var Wb={touchstart:yb,touchmove:zb,touchend:Ab,touchcancel:Bb},Xb="touchstart touchmove touchend touchcancel";j(Q,y,{handler:function(a){var b=Wb[a.type],c=R.call(this,a,b);c&&this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:tb,srcEvent:a})}}),j(S,y,{handler:function(a,b,c){var d=c.pointerType==tb,e=c.pointerType==vb;if(d)this.mouse.allow=!1;else if(e&&!this.mouse.allow)return;b&(Ab|Bb)&&(this.mouse.allow=!0),this.callback(a,b,c)},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Yb=v(jb.style,"touchAction"),Zb=Yb!==d,$b="compute",_b="auto",ac="manipulation",bc="none",cc="pan-x",dc="pan-y";T.prototype={set:function(a){a==$b&&(a=this.compute()),Zb&&(this.manager.element.style[Yb]=a),this.actions=a.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var a=[];return g(this.manager.recognizers,function(b){l(b.options.enable,[b])&&(a=a.concat(b.getTouchAction()))}),U(a.join(" "))},preventDefaults:function(a){if(!Zb){var b=a.srcEvent,c=a.offsetDirection;if(this.manager.session.prevented)return void b.preventDefault();var d=this.actions,e=q(d,bc),f=q(d,dc),g=q(d,cc);return e||f&&c&Hb||g&&c&Ib?this.preventSrc(b):void 0}},preventSrc:function(a){this.manager.session.prevented=!0,a.preventDefault()}};var ec=1,fc=2,gc=4,hc=8,ic=hc,jc=16,kc=32;V.prototype={defaults:{},set:function(a){return h(this.options,a),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(a){if(f(a,"recognizeWith",this))return this;var b=this.simultaneous;return a=Y(a,this),b[a.id]||(b[a.id]=a,a.recognizeWith(this)),this},dropRecognizeWith:function(a){return f(a,"dropRecognizeWith",this)?this:(a=Y(a,this),delete this.simultaneous[a.id],this)},requireFailure:function(a){if(f(a,"requireFailure",this))return this;var b=this.requireFail;return a=Y(a,this),-1===s(b,a)&&(b.push(a),a.requireFailure(this)),this},dropRequireFailure:function(a){if(f(a,"dropRequireFailure",this))return this;a=Y(a,this);var b=s(this.requireFail,a);return b>-1&&this.requireFail.splice(b,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(a){function b(b){c.manager.emit(c.options.event+(b?W(d):""),a)}var c=this,d=this.state;hc>d&&b(!0),b(),d>=hc&&b(!0)},tryEmit:function(a){return this.canEmit()?this.emit(a):void(this.state=kc)},canEmit:function(){for(var a=0;af?Db:Eb,c=f!=this.pX,d=Math.abs(a.deltaX)):(e=0===g?Cb:0>g?Fb:Gb,c=g!=this.pY,d=Math.abs(a.deltaY))),a.direction=e,c&&d>b.threshold&&e&b.direction},attrTest:function(a){return Z.prototype.attrTest.call(this,a)&&(this.state&fc||!(this.state&fc)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var b=X(a.direction);b&&this.manager.emit(this.options.event+b,a),this._super.emit.call(this,a)}}),j(_,Z,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[bc]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||this.state&fc)},emit:function(a){if(this._super.emit.call(this,a),1!==a.scale){var b=a.scale<1?"in":"out";this.manager.emit(this.options.event+b,a)}}}),j(ab,V,{defaults:{event:"press",pointers:1,time:500,threshold:5},getTouchAction:function(){return[_b]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distanceb.time;if(this._input=a,!d||!c||a.eventType&(Ab|Bb)&&!f)this.reset();else if(a.eventType&yb)this.reset(),this._timer=e(function(){this.state=ic,this.tryEmit()},b.time,this);else if(a.eventType&Ab)return ic;return kc},reset:function(){clearTimeout(this._timer)},emit:function(a){this.state===ic&&(a&&a.eventType&Ab?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=nb(),this.manager.emit(this.options.event,this._input)))}}),j(bb,Z,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[bc]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||this.state&fc)}}),j(cb,Z,{defaults:{event:"swipe",threshold:10,velocity:.65,direction:Hb|Ib,pointers:1},getTouchAction:function(){return $.prototype.getTouchAction.call(this)},attrTest:function(a){var b,c=this.options.direction;return c&(Hb|Ib)?b=a.velocity:c&Hb?b=a.velocityX:c&Ib&&(b=a.velocityY),this._super.attrTest.call(this,a)&&c&a.direction&&a.distance>this.options.threshold&&mb(b)>this.options.velocity&&a.eventType&Ab},emit:function(a){var b=X(a.direction);b&&this.manager.emit(this.options.event+b,a),this.manager.emit(this.options.event,a)}}),j(db,V,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:2,posThreshold:10},getTouchAction:function(){return[ac]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance 360) { h = 360; }
125 | if (s > 100) { s = 100; }
126 | if (v > 100) { v = 100; }
127 |
128 | this.h = h;
129 | this.s = s;
130 | this.v = v;
131 | }
132 |
133 | function RGB(r, g, b) {
134 | if (r <= 0) { r = 0; }
135 | if (g <= 0) { g = 0; }
136 | if (b <= 0) { b = 0; }
137 |
138 | if (r > 255) { r = 255; }
139 | if (g > 255) { g = 255; }
140 | if (b > 255) { b = 255; }
141 |
142 | this.r = r;
143 | this.g = g;
144 | this.b = b;
145 | }
146 |
147 | function CMYK(c, m, y, k) {
148 | if (c <= 0) { c = 0; }
149 | if (m <= 0) { m = 0; }
150 | if (y <= 0) { y = 0; }
151 | if (k <= 0) { k = 0; }
152 |
153 | if (c > 100) { c = 100; }
154 | if (m > 100) { m = 100; }
155 | if (y > 100) { y = 100; }
156 | if (k > 100) { k = 100; }
157 |
158 | this.c = c;
159 | this.m = m;
160 | this.y = y;
161 | this.k = k;
162 | }
163 |
164 | var ColorConverter = {
165 |
166 | _RGBtoHSV : function (RGB) {
167 | var result = new HSV(0, 0, 0);
168 |
169 | var r = RGB.r / 255;
170 | var g = RGB.g / 255;
171 | var b = RGB.b / 255;
172 |
173 | var minVal = Math.min(r, g, b);
174 | var maxVal = Math.max(r, g, b);
175 | var delta = maxVal - minVal;
176 |
177 | result.v = maxVal;
178 |
179 | if (delta == 0) {
180 | result.h = 0;
181 | result.s = 0;
182 | } else {
183 | result.s = delta / maxVal;
184 | var del_R = (((maxVal - r) / 6) + (delta / 2)) / delta;
185 | var del_G = (((maxVal - g) / 6) + (delta / 2)) / delta;
186 | var del_B = (((maxVal - b) / 6) + (delta / 2)) / delta;
187 |
188 | if (r == maxVal) { result.h = del_B - del_G; }
189 | else if (g == maxVal) { result.h = (1 / 3) + del_R - del_B; }
190 | else if (b == maxVal) { result.h = (2 / 3) + del_G - del_R; }
191 |
192 | if (result.h < 0) { result.h += 1; }
193 | if (result.h > 1) { result.h -= 1; }
194 | }
195 |
196 | result.h = Math.round(result.h * 360);
197 | result.s = Math.round(result.s * 100);
198 | result.v = Math.round(result.v * 100);
199 |
200 | return result;
201 | },
202 |
203 | _HSVtoRGB : function (HSV) {
204 | var result = new RGB(0, 0, 0);
205 |
206 | var h = HSV.h / 360;
207 | var s = HSV.s / 100;
208 | var v = HSV.v / 100;
209 |
210 | if (s == 0) {
211 | result.r = v * 255;
212 | result.g = v * 255;
213 | result.v = v * 255;
214 | } else {
215 | var var_h = h * 6;
216 | var var_i = Math.floor(var_h);
217 | var var_1 = v * (1 - s);
218 | var var_2 = v * (1 - s * (var_h - var_i));
219 | var var_3 = v * (1 - s * (1 - (var_h - var_i)));
220 | var var_r;
221 | var var_g;
222 | var var_b;
223 |
224 | if (var_i == 0) {var_r = v; var_g = var_3; var_b = var_1}
225 | else if (var_i == 1) {var_r = var_2; var_g = v; var_b = var_1}
226 | else if (var_i == 2) {var_r = var_1; var_g = v; var_b = var_3}
227 | else if (var_i == 3) {var_r = var_1; var_g = var_2; var_b = v}
228 | else if (var_i == 4) {var_r = var_3; var_g = var_1; var_b = v}
229 | else {var_r = v; var_g = var_1; var_b = var_2};
230 |
231 | result.r = var_r * 255;
232 | result.g = var_g * 255;
233 | result.b = var_b * 255;
234 |
235 | result.r = Math.round(result.r);
236 | result.g = Math.round(result.g);
237 | result.b = Math.round(result.b);
238 | }
239 |
240 | return result;
241 | },
242 |
243 | _CMYKtoRGB : function (CMYK){
244 | var result = new RGB(0, 0, 0);
245 |
246 | c = CMYK.c / 100;
247 | m = CMYK.m / 100;
248 | y = CMYK.y / 100;
249 | k = CMYK.k / 100;
250 |
251 | result.r = 1 - Math.min( 1, c * ( 1 - k ) + k );
252 | result.g = 1 - Math.min( 1, m * ( 1 - k ) + k );
253 | result.b = 1 - Math.min( 1, y * ( 1 - k ) + k );
254 |
255 | result.r = Math.round( result.r * 255 );
256 | result.g = Math.round( result.g * 255 );
257 | result.b = Math.round( result.b * 255 );
258 |
259 | return result;
260 | },
261 |
262 | _RGBtoCMYK : function (RGB){
263 | var result = new CMYK(0, 0, 0, 0);
264 |
265 | r = RGB.r / 255;
266 | g = RGB.g / 255;
267 | b = RGB.b / 255;
268 |
269 | result.k = Math.min( 1 - r, 1 - g, 1 - b );
270 | result.c = ( 1 - r - result.k ) / ( 1 - result.k );
271 | result.m = ( 1 - g - result.k ) / ( 1 - result.k );
272 | result.y = ( 1 - b - result.k ) / ( 1 - result.k );
273 |
274 | result.c = Math.round( result.c * 100 );
275 | result.m = Math.round( result.m * 100 );
276 | result.y = Math.round( result.y * 100 );
277 | result.k = Math.round( result.k * 100 );
278 |
279 | return result;
280 | },
281 |
282 | toRGB : function (o) {
283 | if (o instanceof RGB) { return o; }
284 | if (o instanceof HSV) { return this._HSVtoRGB(o); }
285 | if (o instanceof CMYK) { return this._CMYKtoRGB(o); }
286 | },
287 |
288 | toHSV : function (o) {
289 | if (o instanceof HSV) { return o; }
290 | if (o instanceof RGB) { return this._RGBtoHSV(o); }
291 | if (o instanceof CMYK) { return this._RGBtoHSV(this._CMYKtoRGB(o)); }
292 | },
293 |
294 | toCMYK : function (o) {
295 | if (o instanceof CMYK) { return o; }
296 | if (o instanceof RGB) { return this._RGBtoCMYK(o); }
297 | if (o instanceof HSV) { return this._RGBtoCMYK(this._HSVtoRGB(o)); }
298 | }
299 |
300 | }
301 | });
302 |
303 |
--------------------------------------------------------------------------------
/styles/main.css:
--------------------------------------------------------------------------------
1 | body{
2 | color: #222;
3 | background-color: #444444;
4 | }
5 |
6 | html{
7 | background-color: #444444;
8 | }
9 |
10 | div{
11 | }
12 |
13 | h1{
14 | font-size: 70pt;
15 | }
16 |
17 | h2{
18 | font-weight: 300;
19 | font-size: 20pt;
20 | margin-bottom: 20px;
21 | }
22 |
23 | input{
24 | background-color: transparent;
25 | border: none;
26 | border-bottom: 1px solid #999;
27 | color: #999;
28 | font-size: 20pt;
29 | font-weight: 300;
30 | }
31 |
32 | a{
33 | text-decoration: none;
34 | -webkit-transition: all 0.2s linear;
35 | -moz-transition: all 0.2s linear;
36 | -o-transition: all 0.2s linear;
37 | transition: all 0.2s linear;
38 | color: #777;
39 | }
40 |
41 | a:hover{
42 | color: #aaa;
43 | }
--------------------------------------------------------------------------------
/styles/reset.css:
--------------------------------------------------------------------------------
1 | html, body, div, span, applet, object, iframe,
2 | h1, h2, h3, h4, h5, h6, p, blockquote, pre,
3 | a, abbr, acronym, address, big, cite, code,
4 | del, dfn, em, img, ins, kbd, q, s, samp,
5 | small, strike, strong, sub, sup, tt, var,
6 | b, u, i, center,
7 | dl, dt, dd, ol, ul, li,
8 | fieldset, form, label, legend,
9 | table, caption, tbody, tfoot, thead, tr, th, td,
10 | article, aside, canvas, details, embed,
11 | figure, figcaption, footer, header, hgroup,
12 | menu, nav, output, ruby, section, summary,
13 | time, mark, audio, video {
14 | margin: 0;
15 | padding: 0;
16 | border: 0;
17 | font-size: 100%;
18 | vertical-align: baseline;
19 | }
20 | /* HTML5 display-role reset for older browsers */
21 | article, aside, details, figcaption, figure,
22 | footer, header, hgroup, menu, nav, section {
23 | display: block;
24 | }
25 | body {
26 | line-height: 1;
27 | }
28 | ol, ul {
29 | list-style: none;
30 | }
31 | blockquote, q {
32 | quotes: none;
33 | }
34 | blockquote:before, blockquote:after,
35 | q:before, q:after {
36 | content: '';
37 | content: none;
38 | }
39 | table {
40 | border-collapse: collapse;
41 | border-spacing: 0;
42 | }
--------------------------------------------------------------------------------
/styles/responsive.css:
--------------------------------------------------------------------------------
1 | /*
2 | * Responsive layout for DCIM+
3 | */
4 |
5 | /* Table of Contents
6 | ==================================================
7 |
8 | #Mobile - 240px
9 | #Mobile - 320px
10 | #Mobile - 480px
11 | #Tablet - 768px
12 | */
13 |
14 |
15 | /* #Mobile - 240px
16 | ================================================== */
17 |
18 | @media only screen and (max-width: 319px) {
19 |
20 |
21 | }
22 |
23 |
24 | /* #Mobile - 320px
25 | ================================================== */
26 |
27 | @media only screen and (min-width: 320px) and (max-width: 479px) {
28 |
29 | }
30 |
31 |
32 | /* #Mobile - 480px
33 | ================================================== */
34 |
35 | @media only screen and (min-width: 480px) and (max-width: 767px) {
36 |
37 | }
38 |
39 |
40 |
41 | /* #Tablet - 768px
42 | ================================================== */
43 |
44 | @media only screen and (min-width: 768px) and (max-width: 1023px) {
45 |
46 | }
47 |
48 |
49 | @media only screen and (max-width: 768px) {
50 |
51 | }
52 |
53 |
54 |
55 | /* #Mobile < 1024 px
56 | ================================================== */
57 |
58 | @media only screen and (max-width: 1023px){
59 |
60 | }
61 |
62 | @media only screen and (max-width: 1100px){
63 |
64 | }
--------------------------------------------------------------------------------
/templates/color_generator.html:
--------------------------------------------------------------------------------
1 |
2 |
MCG Material Color Generator
3 |
This tool is far from finished.
4 | An external tool like ColorZilla is needed to get the color values.
5 | The colors below 500 (400, 300,...) are exactly the ones Google used as Material Color Palettes
6 | The ones greater than 500 are a little off from the ones Google used.
7 |
8 |
9 |
17 |
18 |
21 |
--------------------------------------------------------------------------------