KEYCLOAK-6378 Clean themes common directory
@@ -0,0 +1 @@
|
||||
node
|
||||
@@ -130,52 +130,117 @@
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>npm-update</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Clean downloaded packages from NPM -->
|
||||
<plugin>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<configuration>
|
||||
<filesets>
|
||||
<fileset>
|
||||
<directory>src/main/resources/node_modules</directory>
|
||||
</fileset>
|
||||
<fileset>
|
||||
<directory>src/main/resources/theme/keycloak/common/resources/node_modules</directory>
|
||||
</fileset>
|
||||
</filesets>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Install NPM and download packages -->
|
||||
<plugin>
|
||||
<groupId>com.github.eirslett</groupId>
|
||||
<artifactId>frontend-maven-plugin</artifactId>
|
||||
<version>1.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>install-node-and-npm</id>
|
||||
<goals>
|
||||
<goal>install-node-and-npm</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm-install</id>
|
||||
<goals>
|
||||
<goal>npm</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<arguments>install</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<nodeVersion>v8.9.4</nodeVersion>
|
||||
<workingDirectory>src/main/resources</workingDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Copy files from NPM packages -->
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-resources</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
|
||||
<configuration>
|
||||
<outputDirectory>src/main/resources/theme/keycloak/common/resources/node_modules</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/node_modules</directory>
|
||||
<excludes>
|
||||
<exclude>minimist/**</exclude>
|
||||
<exclude>mkdirp/**</exclude>
|
||||
<exclude>**/*.json</exclude>
|
||||
<exclude>**/*.json</exclude>
|
||||
<exclude>**/*.markdown</exclude>
|
||||
<exclude>**/*.swf</exclude>
|
||||
<exclude>**/*.sh</exclude>
|
||||
<exclude>**/.bin/**</exclude>
|
||||
<exclude>**/bin/**</exclude>
|
||||
<exclude>**/build/**</exclude>
|
||||
<exclude>**/docs/**</exclude>
|
||||
<exclude>**/demo/**</exclude>
|
||||
<exclude>**/devtools/**</exclude>
|
||||
<exclude>**/example/**</exclude>
|
||||
<exclude>**/examples/**</exclude>
|
||||
<exclude>**/grunt/**</exclude>
|
||||
<exclude>**/less/**</exclude>
|
||||
<exclude>**/scss/**</exclude>
|
||||
<exclude>**/src/**</exclude>
|
||||
<exclude>**/test/**</exclude>
|
||||
<exclude>**/api.md</exclude>
|
||||
<exclude>**/AUTHORS.txt</exclude>
|
||||
<exclude>**/CHANGELOG.md</exclude>
|
||||
<exclude>**/CONTRIBUTING.md</exclude>
|
||||
<exclude>**/HELP-US-OUT.txt</exclude>
|
||||
<exclude>**/README.md</exclude>
|
||||
<exclude>**/Gruntfile.js</exclude>
|
||||
<exclude>**/index.js</exclude>
|
||||
<exclude>**/.*</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/node_modules</directory>
|
||||
<includes>
|
||||
<include>angular-ui-select2/src/select2.js</include>
|
||||
<include>filesaver/src/Filesaver.js</include>
|
||||
<include>filesaver/src/changename.js</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- KEYCLOAK-5391: Commented out until node_modules fetching issue is resolved.
|
||||
<plugin>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<configuration>
|
||||
<filesets>
|
||||
<fileset>
|
||||
<directory>src/main/resources/theme/keycloak/common/resources/node_modules</directory>
|
||||
</fileset>
|
||||
</filesets>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.github.eirslett</groupId>
|
||||
<artifactId>frontend-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>install node and yarn</id>
|
||||
<goals>
|
||||
<goal>install-node-and-yarn</goal>
|
||||
</goals>
|
||||
<phase>generate-resources</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>yarn install</id>
|
||||
<goals>
|
||||
<goal>yarn</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
vvv remove space vvv remove space on uncomment
|
||||
<arguments>install - -production=false - -frozen-lockfile</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<nodeVersion>v6.11.1</nodeVersion>
|
||||
<yarnVersion>v0.27.5</yarnVersion>
|
||||
<workingDirectory>src/main/resources/theme/keycloak/common/resources</workingDirectory>
|
||||
<installDirectory>target</installDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
-->
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
../mkdirp/bin/cmd.js
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Angular
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,331 @@
|
||||
/**
|
||||
* @license AngularJS v1.6.6
|
||||
* (c) 2010-2017 Google, Inc. http://angularjs.org
|
||||
* License: MIT
|
||||
*/
|
||||
(function(window, angular) {'use strict';
|
||||
|
||||
/**
|
||||
* @ngdoc module
|
||||
* @name ngCookies
|
||||
* @description
|
||||
*
|
||||
* # ngCookies
|
||||
*
|
||||
* The `ngCookies` module provides a convenient wrapper for reading and writing browser cookies.
|
||||
*
|
||||
*
|
||||
* <div doc-module-components="ngCookies"></div>
|
||||
*
|
||||
* See {@link ngCookies.$cookies `$cookies`} for usage.
|
||||
*/
|
||||
|
||||
|
||||
angular.module('ngCookies', ['ng']).
|
||||
info({ angularVersion: '1.6.6' }).
|
||||
/**
|
||||
* @ngdoc provider
|
||||
* @name $cookiesProvider
|
||||
* @description
|
||||
* Use `$cookiesProvider` to change the default behavior of the {@link ngCookies.$cookies $cookies} service.
|
||||
* */
|
||||
provider('$cookies', [/** @this */function $CookiesProvider() {
|
||||
/**
|
||||
* @ngdoc property
|
||||
* @name $cookiesProvider#defaults
|
||||
* @description
|
||||
*
|
||||
* Object containing default options to pass when setting cookies.
|
||||
*
|
||||
* The object may have following properties:
|
||||
*
|
||||
* - **path** - `{string}` - The cookie will be available only for this path and its
|
||||
* sub-paths. By default, this is the URL that appears in your `<base>` tag.
|
||||
* - **domain** - `{string}` - The cookie will be available only for this domain and
|
||||
* its sub-domains. For security reasons the user agent will not accept the cookie
|
||||
* if the current domain is not a sub-domain of this domain or equal to it.
|
||||
* - **expires** - `{string|Date}` - String of the form "Wdy, DD Mon YYYY HH:MM:SS GMT"
|
||||
* or a Date object indicating the exact date/time this cookie will expire.
|
||||
* - **secure** - `{boolean}` - If `true`, then the cookie will only be available through a
|
||||
* secured connection.
|
||||
*
|
||||
* Note: By default, the address that appears in your `<base>` tag will be used as the path.
|
||||
* This is important so that cookies will be visible for all routes when html5mode is enabled.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* angular.module('cookiesProviderExample', ['ngCookies'])
|
||||
* .config(['$cookiesProvider', function($cookiesProvider) {
|
||||
* // Setting default options
|
||||
* $cookiesProvider.defaults.domain = 'foo.com';
|
||||
* $cookiesProvider.defaults.secure = true;
|
||||
* }]);
|
||||
* ```
|
||||
**/
|
||||
var defaults = this.defaults = {};
|
||||
|
||||
function calcOptions(options) {
|
||||
return options ? angular.extend({}, defaults, options) : defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ngdoc service
|
||||
* @name $cookies
|
||||
*
|
||||
* @description
|
||||
* Provides read/write access to browser's cookies.
|
||||
*
|
||||
* <div class="alert alert-info">
|
||||
* Up until Angular 1.3, `$cookies` exposed properties that represented the
|
||||
* current browser cookie values. In version 1.4, this behavior has changed, and
|
||||
* `$cookies` now provides a standard api of getters, setters etc.
|
||||
* </div>
|
||||
*
|
||||
* Requires the {@link ngCookies `ngCookies`} module to be installed.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* angular.module('cookiesExample', ['ngCookies'])
|
||||
* .controller('ExampleController', ['$cookies', function($cookies) {
|
||||
* // Retrieving a cookie
|
||||
* var favoriteCookie = $cookies.get('myFavorite');
|
||||
* // Setting a cookie
|
||||
* $cookies.put('myFavorite', 'oatmeal');
|
||||
* }]);
|
||||
* ```
|
||||
*/
|
||||
this.$get = ['$$cookieReader', '$$cookieWriter', function($$cookieReader, $$cookieWriter) {
|
||||
return {
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name $cookies#get
|
||||
*
|
||||
* @description
|
||||
* Returns the value of given cookie key
|
||||
*
|
||||
* @param {string} key Id to use for lookup.
|
||||
* @returns {string} Raw cookie value.
|
||||
*/
|
||||
get: function(key) {
|
||||
return $$cookieReader()[key];
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name $cookies#getObject
|
||||
*
|
||||
* @description
|
||||
* Returns the deserialized value of given cookie key
|
||||
*
|
||||
* @param {string} key Id to use for lookup.
|
||||
* @returns {Object} Deserialized cookie value.
|
||||
*/
|
||||
getObject: function(key) {
|
||||
var value = this.get(key);
|
||||
return value ? angular.fromJson(value) : value;
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name $cookies#getAll
|
||||
*
|
||||
* @description
|
||||
* Returns a key value object with all the cookies
|
||||
*
|
||||
* @returns {Object} All cookies
|
||||
*/
|
||||
getAll: function() {
|
||||
return $$cookieReader();
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name $cookies#put
|
||||
*
|
||||
* @description
|
||||
* Sets a value for given cookie key
|
||||
*
|
||||
* @param {string} key Id for the `value`.
|
||||
* @param {string} value Raw value to be stored.
|
||||
* @param {Object=} options Options object.
|
||||
* See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults}
|
||||
*/
|
||||
put: function(key, value, options) {
|
||||
$$cookieWriter(key, value, calcOptions(options));
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name $cookies#putObject
|
||||
*
|
||||
* @description
|
||||
* Serializes and sets a value for given cookie key
|
||||
*
|
||||
* @param {string} key Id for the `value`.
|
||||
* @param {Object} value Value to be stored.
|
||||
* @param {Object=} options Options object.
|
||||
* See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults}
|
||||
*/
|
||||
putObject: function(key, value, options) {
|
||||
this.put(key, angular.toJson(value), options);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name $cookies#remove
|
||||
*
|
||||
* @description
|
||||
* Remove given cookie
|
||||
*
|
||||
* @param {string} key Id of the key-value pair to delete.
|
||||
* @param {Object=} options Options object.
|
||||
* See {@link ngCookies.$cookiesProvider#defaults $cookiesProvider.defaults}
|
||||
*/
|
||||
remove: function(key, options) {
|
||||
$$cookieWriter(key, undefined, calcOptions(options));
|
||||
}
|
||||
};
|
||||
}];
|
||||
}]);
|
||||
|
||||
angular.module('ngCookies').
|
||||
/**
|
||||
* @ngdoc service
|
||||
* @name $cookieStore
|
||||
* @deprecated
|
||||
* sinceVersion="v1.4.0"
|
||||
* Please use the {@link ngCookies.$cookies `$cookies`} service instead.
|
||||
*
|
||||
* @requires $cookies
|
||||
*
|
||||
* @description
|
||||
* Provides a key-value (string-object) storage, that is backed by session cookies.
|
||||
* Objects put or retrieved from this storage are automatically serialized or
|
||||
* deserialized by angular's toJson/fromJson.
|
||||
*
|
||||
* Requires the {@link ngCookies `ngCookies`} module to be installed.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* angular.module('cookieStoreExample', ['ngCookies'])
|
||||
* .controller('ExampleController', ['$cookieStore', function($cookieStore) {
|
||||
* // Put cookie
|
||||
* $cookieStore.put('myFavorite','oatmeal');
|
||||
* // Get cookie
|
||||
* var favoriteCookie = $cookieStore.get('myFavorite');
|
||||
* // Removing a cookie
|
||||
* $cookieStore.remove('myFavorite');
|
||||
* }]);
|
||||
* ```
|
||||
*/
|
||||
factory('$cookieStore', ['$cookies', function($cookies) {
|
||||
|
||||
return {
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name $cookieStore#get
|
||||
*
|
||||
* @description
|
||||
* Returns the value of given cookie key
|
||||
*
|
||||
* @param {string} key Id to use for lookup.
|
||||
* @returns {Object} Deserialized cookie value, undefined if the cookie does not exist.
|
||||
*/
|
||||
get: function(key) {
|
||||
return $cookies.getObject(key);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name $cookieStore#put
|
||||
*
|
||||
* @description
|
||||
* Sets a value for given cookie key
|
||||
*
|
||||
* @param {string} key Id for the `value`.
|
||||
* @param {Object} value Value to be stored.
|
||||
*/
|
||||
put: function(key, value) {
|
||||
$cookies.putObject(key, value);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name $cookieStore#remove
|
||||
*
|
||||
* @description
|
||||
* Remove given cookie
|
||||
*
|
||||
* @param {string} key Id of the key-value pair to delete.
|
||||
*/
|
||||
remove: function(key) {
|
||||
$cookies.remove(key);
|
||||
}
|
||||
};
|
||||
|
||||
}]);
|
||||
|
||||
/**
|
||||
* @name $$cookieWriter
|
||||
* @requires $document
|
||||
*
|
||||
* @description
|
||||
* This is a private service for writing cookies
|
||||
*
|
||||
* @param {string} name Cookie name
|
||||
* @param {string=} value Cookie value (if undefined, cookie will be deleted)
|
||||
* @param {Object=} options Object with options that need to be stored for the cookie.
|
||||
*/
|
||||
function $$CookieWriter($document, $log, $browser) {
|
||||
var cookiePath = $browser.baseHref();
|
||||
var rawDocument = $document[0];
|
||||
|
||||
function buildCookieString(name, value, options) {
|
||||
var path, expires;
|
||||
options = options || {};
|
||||
expires = options.expires;
|
||||
path = angular.isDefined(options.path) ? options.path : cookiePath;
|
||||
if (angular.isUndefined(value)) {
|
||||
expires = 'Thu, 01 Jan 1970 00:00:00 GMT';
|
||||
value = '';
|
||||
}
|
||||
if (angular.isString(expires)) {
|
||||
expires = new Date(expires);
|
||||
}
|
||||
|
||||
var str = encodeURIComponent(name) + '=' + encodeURIComponent(value);
|
||||
str += path ? ';path=' + path : '';
|
||||
str += options.domain ? ';domain=' + options.domain : '';
|
||||
str += expires ? ';expires=' + expires.toUTCString() : '';
|
||||
str += options.secure ? ';secure' : '';
|
||||
|
||||
// per http://www.ietf.org/rfc/rfc2109.txt browser must allow at minimum:
|
||||
// - 300 cookies
|
||||
// - 20 cookies per unique domain
|
||||
// - 4096 bytes per cookie
|
||||
var cookieLength = str.length + 1;
|
||||
if (cookieLength > 4096) {
|
||||
$log.warn('Cookie \'' + name +
|
||||
'\' possibly not set or overflowed because it was too large (' +
|
||||
cookieLength + ' > 4096 bytes)!');
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
return function(name, value, options) {
|
||||
rawDocument.cookie = buildCookieString(name, value, options);
|
||||
};
|
||||
}
|
||||
|
||||
$$CookieWriter.$inject = ['$document', '$log', '$browser'];
|
||||
|
||||
angular.module('ngCookies').provider('$$cookieWriter', /** @this */ function $$CookieWriterProvider() {
|
||||
this.$get = $$CookieWriter;
|
||||
});
|
||||
|
||||
|
||||
})(window, window.angular);
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
AngularJS v1.6.6
|
||||
(c) 2010-2017 Google, Inc. http://angularjs.org
|
||||
License: MIT
|
||||
*/
|
||||
(function(n,c){'use strict';function l(b,a,g){var d=g.baseHref(),k=b[0];return function(b,e,f){var g,h;f=f||{};h=f.expires;g=c.isDefined(f.path)?f.path:d;c.isUndefined(e)&&(h="Thu, 01 Jan 1970 00:00:00 GMT",e="");c.isString(h)&&(h=new Date(h));e=encodeURIComponent(b)+"="+encodeURIComponent(e);e=e+(g?";path="+g:"")+(f.domain?";domain="+f.domain:"");e+=h?";expires="+h.toUTCString():"";e+=f.secure?";secure":"";f=e.length+1;4096<f&&a.warn("Cookie '"+b+"' possibly not set or overflowed because it was too large ("+
|
||||
f+" > 4096 bytes)!");k.cookie=e}}c.module("ngCookies",["ng"]).info({angularVersion:"1.6.6"}).provider("$cookies",[function(){var b=this.defaults={};this.$get=["$$cookieReader","$$cookieWriter",function(a,g){return{get:function(d){return a()[d]},getObject:function(d){return(d=this.get(d))?c.fromJson(d):d},getAll:function(){return a()},put:function(d,a,m){g(d,a,m?c.extend({},b,m):b)},putObject:function(d,b,a){this.put(d,c.toJson(b),a)},remove:function(a,k){g(a,void 0,k?c.extend({},b,k):b)}}}]}]);c.module("ngCookies").factory("$cookieStore",
|
||||
["$cookies",function(b){return{get:function(a){return b.getObject(a)},put:function(a,c){b.putObject(a,c)},remove:function(a){b.remove(a)}}}]);l.$inject=["$document","$log","$browser"];c.module("ngCookies").provider("$$cookieWriter",function(){this.$get=l})})(window,window.angular);
|
||||
//# sourceMappingURL=angular-cookies.min.js.map
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"version":3,
|
||||
"file":"angular-cookies.min.js",
|
||||
"lineCount":8,
|
||||
"mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkB,CAoR3BC,QAASA,EAAc,CAACC,CAAD,CAAYC,CAAZ,CAAkBC,CAAlB,CAA4B,CACjD,IAAIC,EAAaD,CAAAE,SAAA,EAAjB,CACIC,EAAcL,CAAA,CAAU,CAAV,CAmClB,OAAO,SAAQ,CAACM,CAAD,CAAOC,CAAP,CAAcC,CAAd,CAAuB,CAjCW,IAC3CC,CAD2C,CACrCC,CACVF,EAAA,CAgCoDA,CAhCpD,EAAqB,EACrBE,EAAA,CAAUF,CAAAE,QACVD,EAAA,CAAOX,CAAAa,UAAA,CAAkBH,CAAAC,KAAlB,CAAA,CAAkCD,CAAAC,KAAlC,CAAiDN,CACpDL,EAAAc,YAAA,CAAoBL,CAApB,CAAJ,GACEG,CACA,CADU,+BACV,CAAAH,CAAA,CAAQ,EAFV,CAIIT,EAAAe,SAAA,CAAiBH,CAAjB,CAAJ,GACEA,CADF,CACY,IAAII,IAAJ,CAASJ,CAAT,CADZ,CAIIK,EAAAA,CAAMC,kBAAA,CAqB6BV,CArB7B,CAANS,CAAiC,GAAjCA,CAAuCC,kBAAA,CAAmBT,CAAnB,CAE3CQ,EAAA,CADAA,CACA,EADON,CAAA,CAAO,QAAP,CAAkBA,CAAlB,CAAyB,EAChC,GAAOD,CAAAS,OAAA,CAAiB,UAAjB,CAA8BT,CAAAS,OAA9B,CAA+C,EAAtD,CACAF,EAAA,EAAOL,CAAA,CAAU,WAAV,CAAwBA,CAAAQ,YAAA,EAAxB,CAAgD,EACvDH,EAAA,EAAOP,CAAAW,OAAA,CAAiB,SAAjB,CAA6B,EAMhCC,EAAAA,CAAeL,CAAAM,OAAfD,CAA4B,CACb,KAAnB,CAAIA,CAAJ,EACEnB,CAAAqB,KAAA,CAAU,UAAV,CASqChB,CATrC,CACE,6DADF;AAEEc,CAFF,CAEiB,iBAFjB,CASFf,EAAAkB,OAAA,CAJOR,CAG6B,CArCW,CAlQnDjB,CAAA0B,OAAA,CAAe,WAAf,CAA4B,CAAC,IAAD,CAA5B,CAAAC,KAAA,CACO,CAAEC,eAAgB,OAAlB,CADP,CAAAC,SAAA,CAQY,UARZ,CAQwB,CAAaC,QAAyB,EAAG,CAkC7D,IAAIC,EAAW,IAAAA,SAAXA,CAA2B,EAiC/B,KAAAC,KAAA,CAAY,CAAC,gBAAD,CAAmB,gBAAnB,CAAqC,QAAQ,CAACC,CAAD,CAAiBC,CAAjB,CAAiC,CACxF,MAAO,CAWLC,IAAKA,QAAQ,CAACC,CAAD,CAAM,CACjB,MAAOH,EAAA,EAAA,CAAiBG,CAAjB,CADU,CAXd,CAyBLC,UAAWA,QAAQ,CAACD,CAAD,CAAM,CAEvB,MAAO,CADH3B,CACG,CADK,IAAA0B,IAAA,CAASC,CAAT,CACL,EAAQpC,CAAAsC,SAAA,CAAiB7B,CAAjB,CAAR,CAAkCA,CAFlB,CAzBpB,CAuCL8B,OAAQA,QAAQ,EAAG,CACjB,MAAON,EAAA,EADU,CAvCd,CAuDLO,IAAKA,QAAQ,CAACJ,CAAD,CAAM3B,CAAN,CAAaC,CAAb,CAAsB,CACjCwB,CAAA,CAAeE,CAAf,CAAoB3B,CAApB,CAAuCC,CAvFpC,CAAUV,CAAAyC,OAAA,CAAe,EAAf,CAAmBV,CAAnB,CAuF0BrB,CAvF1B,CAAV,CAAkDqB,CAuFrD,CADiC,CAvD9B,CAuELW,UAAWA,QAAQ,CAACN,CAAD,CAAM3B,CAAN,CAAaC,CAAb,CAAsB,CACvC,IAAA8B,IAAA,CAASJ,CAAT,CAAcpC,CAAA2C,OAAA,CAAelC,CAAf,CAAd,CAAqCC,CAArC,CADuC,CAvEpC,CAsFLkC,OAAQA,QAAQ,CAACR,CAAD,CAAM1B,CAAN,CAAe,CAC7BwB,CAAA,CAAeE,CAAf,CAAoBS,IAAAA,EAApB,CAA2CnC,CAtHxC,CAAUV,CAAAyC,OAAA,CAAe,EAAf,CAAmBV,CAAnB,CAsH8BrB,CAtH9B,CAAV,CAAkDqB,CAsHrD,CAD6B,CAtF1B,CADiF,CAA9E,CAnEiD,CAAzC,CARxB,CAyKA/B,EAAA0B,OAAA,CAAe,WAAf,CAAAoB,QAAA,CA+BS,cA/BT;AA+ByB,CAAC,UAAD,CAAa,QAAQ,CAACC,CAAD,CAAW,CAErD,MAAO,CAWLZ,IAAKA,QAAQ,CAACC,CAAD,CAAM,CACjB,MAAOW,EAAAV,UAAA,CAAmBD,CAAnB,CADU,CAXd,CAyBLI,IAAKA,QAAQ,CAACJ,CAAD,CAAM3B,CAAN,CAAa,CACxBsC,CAAAL,UAAA,CAAmBN,CAAnB,CAAwB3B,CAAxB,CADwB,CAzBrB,CAsCLmC,OAAQA,QAAQ,CAACR,CAAD,CAAM,CACpBW,CAAAH,OAAA,CAAgBR,CAAhB,CADoB,CAtCjB,CAF8C,CAAhC,CA/BzB,CAmIAnC,EAAA+C,QAAA,CAAyB,CAAC,WAAD,CAAc,MAAd,CAAsB,UAAtB,CAEzBhD,EAAA0B,OAAA,CAAe,WAAf,CAAAG,SAAA,CAAqC,gBAArC,CAAoEoB,QAA+B,EAAG,CACpG,IAAAjB,KAAA,CAAY/B,CADwF,CAAtG,CAhU2B,CAA1B,CAAD,CAqUGF,MArUH,CAqUWA,MAAAC,QArUX;",
|
||||
"sources":["angular-cookies.js"],
|
||||
"names":["window","angular","$$CookieWriter","$document","$log","$browser","cookiePath","baseHref","rawDocument","name","value","options","path","expires","isDefined","isUndefined","isString","Date","str","encodeURIComponent","domain","toUTCString","secure","cookieLength","length","warn","cookie","module","info","angularVersion","provider","$CookiesProvider","defaults","$get","$$cookieReader","$$cookieWriter","get","key","getObject","fromJson","getAll","put","extend","putObject","toJson","remove","undefined","factory","$cookies","$inject","$$CookieWriterProvider"]
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"_from": "angular-cookies@1.6.6",
|
||||
"_id": "angular-cookies@1.6.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-MRZC2v28T/fNaSILiSW4g1n7oUg=",
|
||||
"_location": "/angular-cookies",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "angular-cookies@1.6.6",
|
||||
"name": "angular-cookies",
|
||||
"escapedName": "angular-cookies",
|
||||
"rawSpec": "1.6.6",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.6.6"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/angular-cookies/-/angular-cookies-1.6.6.tgz",
|
||||
"_shasum": "311642dafdbc4ff7cd69220b8925b88359fba148",
|
||||
"_spec": "angular-cookies@1.6.6",
|
||||
"_where": "/home/st/dev/keycloak/themes/src/main",
|
||||
"author": {
|
||||
"name": "Angular Core Team",
|
||||
"email": "angular-core+npm@google.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/angular/angular.js/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "AngularJS module for cookies",
|
||||
"homepage": "http://angularjs.org",
|
||||
"jspm": {
|
||||
"shim": {
|
||||
"angular-cookies": {
|
||||
"deps": [
|
||||
"angular"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
"angular",
|
||||
"framework",
|
||||
"browser",
|
||||
"cookies",
|
||||
"client-side"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "angular-cookies",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/angular/angular.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"version": "1.6.6"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Angular
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,609 @@
|
||||
/**
|
||||
* @license AngularJS v1.6.6
|
||||
* (c) 2010-2017 Google, Inc. http://angularjs.org
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
(function() {'use strict';
|
||||
// NOTE:
|
||||
// These functions are copied here from `src/Angular.js`, because they are needed inside the
|
||||
// `angular-loader.js` closure and need to be available before the main `angular.js` script has
|
||||
// been loaded.
|
||||
function isFunction(value) {return typeof value === 'function';}
|
||||
function isDefined(value) {return typeof value !== 'undefined';}
|
||||
function isNumber(value) {return typeof value === 'number';}
|
||||
function isObject(value) {return value !== null && typeof value === 'object';}
|
||||
function isScope(obj) {return obj && obj.$evalAsync && obj.$watch;}
|
||||
function isUndefined(value) {return typeof value === 'undefined';}
|
||||
function isWindow(obj) {return obj && obj.window === obj;}
|
||||
function sliceArgs(args, startIndex) {return Array.prototype.slice.call(args, startIndex || 0);}
|
||||
function toJsonReplacer(key, value) {
|
||||
var val = value;
|
||||
|
||||
if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') {
|
||||
val = undefined;
|
||||
} else if (isWindow(value)) {
|
||||
val = '$WINDOW';
|
||||
} else if (value && window.document === value) {
|
||||
val = '$DOCUMENT';
|
||||
} else if (isScope(value)) {
|
||||
val = '$SCOPE';
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
/* exported toDebugString */
|
||||
|
||||
function serializeObject(obj, maxDepth) {
|
||||
var seen = [];
|
||||
|
||||
// There is no direct way to stringify object until reaching a specific depth
|
||||
// and a very deep object can cause a performance issue, so we copy the object
|
||||
// based on this specific depth and then stringify it.
|
||||
if (isValidObjectMaxDepth(maxDepth)) {
|
||||
// This file is also included in `angular-loader`, so `copy()` might not always be available in
|
||||
// the closure. Therefore, it is lazily retrieved as `angular.copy()` when needed.
|
||||
obj = angular.copy(obj, null, maxDepth);
|
||||
}
|
||||
return JSON.stringify(obj, function(key, val) {
|
||||
val = toJsonReplacer(key, val);
|
||||
if (isObject(val)) {
|
||||
|
||||
if (seen.indexOf(val) >= 0) return '...';
|
||||
|
||||
seen.push(val);
|
||||
}
|
||||
return val;
|
||||
});
|
||||
}
|
||||
|
||||
function toDebugString(obj, maxDepth) {
|
||||
if (typeof obj === 'function') {
|
||||
return obj.toString().replace(/ \{[\s\S]*$/, '');
|
||||
} else if (isUndefined(obj)) {
|
||||
return 'undefined';
|
||||
} else if (typeof obj !== 'string') {
|
||||
return serializeObject(obj, maxDepth);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/* exported
|
||||
minErrConfig,
|
||||
errorHandlingConfig,
|
||||
isValidObjectMaxDepth
|
||||
*/
|
||||
|
||||
var minErrConfig = {
|
||||
objectMaxDepth: 5
|
||||
};
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.errorHandlingConfig
|
||||
* @module ng
|
||||
* @kind function
|
||||
*
|
||||
* @description
|
||||
* Configure several aspects of error handling in AngularJS if used as a setter or return the
|
||||
* current configuration if used as a getter. The following options are supported:
|
||||
*
|
||||
* - **objectMaxDepth**: The maximum depth to which objects are traversed when stringified for error messages.
|
||||
*
|
||||
* Omitted or undefined options will leave the corresponding configuration values unchanged.
|
||||
*
|
||||
* @param {Object=} config - The configuration object. May only contain the options that need to be
|
||||
* updated. Supported keys:
|
||||
*
|
||||
* * `objectMaxDepth` **{Number}** - The max depth for stringifying objects. Setting to a
|
||||
* non-positive or non-numeric value, removes the max depth limit.
|
||||
* Default: 5
|
||||
*/
|
||||
function errorHandlingConfig(config) {
|
||||
if (isObject(config)) {
|
||||
if (isDefined(config.objectMaxDepth)) {
|
||||
minErrConfig.objectMaxDepth = isValidObjectMaxDepth(config.objectMaxDepth) ? config.objectMaxDepth : NaN;
|
||||
}
|
||||
} else {
|
||||
return minErrConfig;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {Number} maxDepth
|
||||
* @return {boolean}
|
||||
*/
|
||||
function isValidObjectMaxDepth(maxDepth) {
|
||||
return isNumber(maxDepth) && maxDepth > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description
|
||||
*
|
||||
* This object provides a utility for producing rich Error messages within
|
||||
* Angular. It can be called as follows:
|
||||
*
|
||||
* var exampleMinErr = minErr('example');
|
||||
* throw exampleMinErr('one', 'This {0} is {1}', foo, bar);
|
||||
*
|
||||
* The above creates an instance of minErr in the example namespace. The
|
||||
* resulting error will have a namespaced error code of example.one. The
|
||||
* resulting error will replace {0} with the value of foo, and {1} with the
|
||||
* value of bar. The object is not restricted in the number of arguments it can
|
||||
* take.
|
||||
*
|
||||
* If fewer arguments are specified than necessary for interpolation, the extra
|
||||
* interpolation markers will be preserved in the final string.
|
||||
*
|
||||
* Since data will be parsed statically during a build step, some restrictions
|
||||
* are applied with respect to how minErr instances are created and called.
|
||||
* Instances should have names of the form namespaceMinErr for a minErr created
|
||||
* using minErr('namespace') . Error codes, namespaces and template strings
|
||||
* should all be static strings, not variables or general expressions.
|
||||
*
|
||||
* @param {string} module The namespace to use for the new minErr instance.
|
||||
* @param {function} ErrorConstructor Custom error constructor to be instantiated when returning
|
||||
* error from returned function, for cases when a particular type of error is useful.
|
||||
* @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance
|
||||
*/
|
||||
|
||||
function minErr(module, ErrorConstructor) {
|
||||
ErrorConstructor = ErrorConstructor || Error;
|
||||
return function() {
|
||||
var code = arguments[0],
|
||||
template = arguments[1],
|
||||
message = '[' + (module ? module + ':' : '') + code + '] ',
|
||||
templateArgs = sliceArgs(arguments, 2).map(function(arg) {
|
||||
return toDebugString(arg, minErrConfig.objectMaxDepth);
|
||||
}),
|
||||
paramPrefix, i;
|
||||
|
||||
message += template.replace(/\{\d+\}/g, function(match) {
|
||||
var index = +match.slice(1, -1);
|
||||
|
||||
if (index < templateArgs.length) {
|
||||
return templateArgs[index];
|
||||
}
|
||||
|
||||
return match;
|
||||
});
|
||||
|
||||
message += '\nhttp://errors.angularjs.org/1.6.6/' +
|
||||
(module ? module + '/' : '') + code;
|
||||
|
||||
for (i = 0, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
|
||||
message += paramPrefix + 'p' + i + '=' + encodeURIComponent(templateArgs[i]);
|
||||
}
|
||||
|
||||
return new ErrorConstructor(message);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @ngdoc type
|
||||
* @name angular.Module
|
||||
* @module ng
|
||||
* @description
|
||||
*
|
||||
* Interface for configuring angular {@link angular.module modules}.
|
||||
*/
|
||||
|
||||
function setupModuleLoader(window) {
|
||||
|
||||
var $injectorMinErr = minErr('$injector');
|
||||
var ngMinErr = minErr('ng');
|
||||
|
||||
function ensure(obj, name, factory) {
|
||||
return obj[name] || (obj[name] = factory());
|
||||
}
|
||||
|
||||
var angular = ensure(window, 'angular', Object);
|
||||
|
||||
// We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
|
||||
angular.$$minErr = angular.$$minErr || minErr;
|
||||
|
||||
return ensure(angular, 'module', function() {
|
||||
/** @type {Object.<string, angular.Module>} */
|
||||
var modules = {};
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module
|
||||
* @module ng
|
||||
* @description
|
||||
*
|
||||
* The `angular.module` is a global place for creating, registering and retrieving Angular
|
||||
* modules.
|
||||
* All modules (angular core or 3rd party) that should be available to an application must be
|
||||
* registered using this mechanism.
|
||||
*
|
||||
* Passing one argument retrieves an existing {@link angular.Module},
|
||||
* whereas passing more than one argument creates a new {@link angular.Module}
|
||||
*
|
||||
*
|
||||
* # Module
|
||||
*
|
||||
* A module is a collection of services, directives, controllers, filters, and configuration information.
|
||||
* `angular.module` is used to configure the {@link auto.$injector $injector}.
|
||||
*
|
||||
* ```js
|
||||
* // Create a new module
|
||||
* var myModule = angular.module('myModule', []);
|
||||
*
|
||||
* // register a new service
|
||||
* myModule.value('appName', 'MyCoolApp');
|
||||
*
|
||||
* // configure existing services inside initialization blocks.
|
||||
* myModule.config(['$locationProvider', function($locationProvider) {
|
||||
* // Configure existing providers
|
||||
* $locationProvider.hashPrefix('!');
|
||||
* }]);
|
||||
* ```
|
||||
*
|
||||
* Then you can create an injector and load your modules like this:
|
||||
*
|
||||
* ```js
|
||||
* var injector = angular.injector(['ng', 'myModule'])
|
||||
* ```
|
||||
*
|
||||
* However it's more likely that you'll just use
|
||||
* {@link ng.directive:ngApp ngApp} or
|
||||
* {@link angular.bootstrap} to simplify this process for you.
|
||||
*
|
||||
* @param {!string} name The name of the module to create or retrieve.
|
||||
* @param {!Array.<string>=} requires If specified then new module is being created. If
|
||||
* unspecified then the module is being retrieved for further configuration.
|
||||
* @param {Function=} configFn Optional configuration function for the module. Same as
|
||||
* {@link angular.Module#config Module#config()}.
|
||||
* @returns {angular.Module} new module with the {@link angular.Module} api.
|
||||
*/
|
||||
return function module(name, requires, configFn) {
|
||||
|
||||
var info = {};
|
||||
|
||||
var assertNotHasOwnProperty = function(name, context) {
|
||||
if (name === 'hasOwnProperty') {
|
||||
throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
|
||||
}
|
||||
};
|
||||
|
||||
assertNotHasOwnProperty(name, 'module');
|
||||
if (requires && modules.hasOwnProperty(name)) {
|
||||
modules[name] = null;
|
||||
}
|
||||
return ensure(modules, name, function() {
|
||||
if (!requires) {
|
||||
throw $injectorMinErr('nomod', 'Module \'{0}\' is not available! You either misspelled ' +
|
||||
'the module name or forgot to load it. If registering a module ensure that you ' +
|
||||
'specify the dependencies as the second argument.', name);
|
||||
}
|
||||
|
||||
/** @type {!Array.<Array.<*>>} */
|
||||
var invokeQueue = [];
|
||||
|
||||
/** @type {!Array.<Function>} */
|
||||
var configBlocks = [];
|
||||
|
||||
/** @type {!Array.<Function>} */
|
||||
var runBlocks = [];
|
||||
|
||||
var config = invokeLater('$injector', 'invoke', 'push', configBlocks);
|
||||
|
||||
/** @type {angular.Module} */
|
||||
var moduleInstance = {
|
||||
// Private state
|
||||
_invokeQueue: invokeQueue,
|
||||
_configBlocks: configBlocks,
|
||||
_runBlocks: runBlocks,
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.Module#info
|
||||
* @module ng
|
||||
*
|
||||
* @param {Object=} info Information about the module
|
||||
* @returns {Object|Module} The current info object for this module if called as a getter,
|
||||
* or `this` if called as a setter.
|
||||
*
|
||||
* @description
|
||||
* Read and write custom information about this module.
|
||||
* For example you could put the version of the module in here.
|
||||
*
|
||||
* ```js
|
||||
* angular.module('myModule', []).info({ version: '1.0.0' });
|
||||
* ```
|
||||
*
|
||||
* The version could then be read back out by accessing the module elsewhere:
|
||||
*
|
||||
* ```
|
||||
* var version = angular.module('myModule').info().version;
|
||||
* ```
|
||||
*
|
||||
* You can also retrieve this information during runtime via the
|
||||
* {@link $injector#modules `$injector.modules`} property:
|
||||
*
|
||||
* ```js
|
||||
* var version = $injector.modules['myModule'].info().version;
|
||||
* ```
|
||||
*/
|
||||
info: function(value) {
|
||||
if (isDefined(value)) {
|
||||
if (!isObject(value)) throw ngMinErr('aobj', 'Argument \'{0}\' must be an object', 'value');
|
||||
info = value;
|
||||
return this;
|
||||
}
|
||||
return info;
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc property
|
||||
* @name angular.Module#requires
|
||||
* @module ng
|
||||
*
|
||||
* @description
|
||||
* Holds the list of modules which the injector will load before the current module is
|
||||
* loaded.
|
||||
*/
|
||||
requires: requires,
|
||||
|
||||
/**
|
||||
* @ngdoc property
|
||||
* @name angular.Module#name
|
||||
* @module ng
|
||||
*
|
||||
* @description
|
||||
* Name of the module.
|
||||
*/
|
||||
name: name,
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.Module#provider
|
||||
* @module ng
|
||||
* @param {string} name service name
|
||||
* @param {Function} providerType Construction function for creating new instance of the
|
||||
* service.
|
||||
* @description
|
||||
* See {@link auto.$provide#provider $provide.provider()}.
|
||||
*/
|
||||
provider: invokeLaterAndSetModuleName('$provide', 'provider'),
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.Module#factory
|
||||
* @module ng
|
||||
* @param {string} name service name
|
||||
* @param {Function} providerFunction Function for creating new instance of the service.
|
||||
* @description
|
||||
* See {@link auto.$provide#factory $provide.factory()}.
|
||||
*/
|
||||
factory: invokeLaterAndSetModuleName('$provide', 'factory'),
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.Module#service
|
||||
* @module ng
|
||||
* @param {string} name service name
|
||||
* @param {Function} constructor A constructor function that will be instantiated.
|
||||
* @description
|
||||
* See {@link auto.$provide#service $provide.service()}.
|
||||
*/
|
||||
service: invokeLaterAndSetModuleName('$provide', 'service'),
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.Module#value
|
||||
* @module ng
|
||||
* @param {string} name service name
|
||||
* @param {*} object Service instance object.
|
||||
* @description
|
||||
* See {@link auto.$provide#value $provide.value()}.
|
||||
*/
|
||||
value: invokeLater('$provide', 'value'),
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.Module#constant
|
||||
* @module ng
|
||||
* @param {string} name constant name
|
||||
* @param {*} object Constant value.
|
||||
* @description
|
||||
* Because the constants are fixed, they get applied before other provide methods.
|
||||
* See {@link auto.$provide#constant $provide.constant()}.
|
||||
*/
|
||||
constant: invokeLater('$provide', 'constant', 'unshift'),
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.Module#decorator
|
||||
* @module ng
|
||||
* @param {string} name The name of the service to decorate.
|
||||
* @param {Function} decorFn This function will be invoked when the service needs to be
|
||||
* instantiated and should return the decorated service instance.
|
||||
* @description
|
||||
* See {@link auto.$provide#decorator $provide.decorator()}.
|
||||
*/
|
||||
decorator: invokeLaterAndSetModuleName('$provide', 'decorator', configBlocks),
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.Module#animation
|
||||
* @module ng
|
||||
* @param {string} name animation name
|
||||
* @param {Function} animationFactory Factory function for creating new instance of an
|
||||
* animation.
|
||||
* @description
|
||||
*
|
||||
* **NOTE**: animations take effect only if the **ngAnimate** module is loaded.
|
||||
*
|
||||
*
|
||||
* Defines an animation hook that can be later used with
|
||||
* {@link $animate $animate} service and directives that use this service.
|
||||
*
|
||||
* ```js
|
||||
* module.animation('.animation-name', function($inject1, $inject2) {
|
||||
* return {
|
||||
* eventName : function(element, done) {
|
||||
* //code to run the animation
|
||||
* //once complete, then run done()
|
||||
* return function cancellationFunction(element) {
|
||||
* //code to cancel the animation
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* See {@link ng.$animateProvider#register $animateProvider.register()} and
|
||||
* {@link ngAnimate ngAnimate module} for more information.
|
||||
*/
|
||||
animation: invokeLaterAndSetModuleName('$animateProvider', 'register'),
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.Module#filter
|
||||
* @module ng
|
||||
* @param {string} name Filter name - this must be a valid angular expression identifier
|
||||
* @param {Function} filterFactory Factory function for creating new instance of filter.
|
||||
* @description
|
||||
* See {@link ng.$filterProvider#register $filterProvider.register()}.
|
||||
*
|
||||
* <div class="alert alert-warning">
|
||||
* **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.
|
||||
* Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace
|
||||
* your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores
|
||||
* (`myapp_subsection_filterx`).
|
||||
* </div>
|
||||
*/
|
||||
filter: invokeLaterAndSetModuleName('$filterProvider', 'register'),
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.Module#controller
|
||||
* @module ng
|
||||
* @param {string|Object} name Controller name, or an object map of controllers where the
|
||||
* keys are the names and the values are the constructors.
|
||||
* @param {Function} constructor Controller constructor function.
|
||||
* @description
|
||||
* See {@link ng.$controllerProvider#register $controllerProvider.register()}.
|
||||
*/
|
||||
controller: invokeLaterAndSetModuleName('$controllerProvider', 'register'),
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.Module#directive
|
||||
* @module ng
|
||||
* @param {string|Object} name Directive name, or an object map of directives where the
|
||||
* keys are the names and the values are the factories.
|
||||
* @param {Function} directiveFactory Factory function for creating new instance of
|
||||
* directives.
|
||||
* @description
|
||||
* See {@link ng.$compileProvider#directive $compileProvider.directive()}.
|
||||
*/
|
||||
directive: invokeLaterAndSetModuleName('$compileProvider', 'directive'),
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.Module#component
|
||||
* @module ng
|
||||
* @param {string} name Name of the component in camel-case (i.e. myComp which will match as my-comp)
|
||||
* @param {Object} options Component definition object (a simplified
|
||||
* {@link ng.$compile#directive-definition-object directive definition object})
|
||||
*
|
||||
* @description
|
||||
* See {@link ng.$compileProvider#component $compileProvider.component()}.
|
||||
*/
|
||||
component: invokeLaterAndSetModuleName('$compileProvider', 'component'),
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.Module#config
|
||||
* @module ng
|
||||
* @param {Function} configFn Execute this function on module load. Useful for service
|
||||
* configuration.
|
||||
* @description
|
||||
* Use this method to register work which needs to be performed on module loading.
|
||||
* For more about how to configure services, see
|
||||
* {@link providers#provider-recipe Provider Recipe}.
|
||||
*/
|
||||
config: config,
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.Module#run
|
||||
* @module ng
|
||||
* @param {Function} initializationFn Execute this function after injector creation.
|
||||
* Useful for application initialization.
|
||||
* @description
|
||||
* Use this method to register work which should be performed when the injector is done
|
||||
* loading all modules.
|
||||
*/
|
||||
run: function(block) {
|
||||
runBlocks.push(block);
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
if (configFn) {
|
||||
config(configFn);
|
||||
}
|
||||
|
||||
return moduleInstance;
|
||||
|
||||
/**
|
||||
* @param {string} provider
|
||||
* @param {string} method
|
||||
* @param {String=} insertMethod
|
||||
* @returns {angular.Module}
|
||||
*/
|
||||
function invokeLater(provider, method, insertMethod, queue) {
|
||||
if (!queue) queue = invokeQueue;
|
||||
return function() {
|
||||
queue[insertMethod || 'push']([provider, method, arguments]);
|
||||
return moduleInstance;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} provider
|
||||
* @param {string} method
|
||||
* @returns {angular.Module}
|
||||
*/
|
||||
function invokeLaterAndSetModuleName(provider, method, queue) {
|
||||
if (!queue) queue = invokeQueue;
|
||||
return function(recipeName, factoryFunction) {
|
||||
if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name;
|
||||
queue.push([provider, method, arguments]);
|
||||
return moduleInstance;
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
setupModuleLoader(window);
|
||||
})(window);
|
||||
|
||||
/**
|
||||
* Closure compiler type information
|
||||
*
|
||||
* @typedef { {
|
||||
* requires: !Array.<string>,
|
||||
* invokeQueue: !Array.<Array.<*>>,
|
||||
*
|
||||
* service: function(string, Function):angular.Module,
|
||||
* factory: function(string, Function):angular.Module,
|
||||
* value: function(string, *):angular.Module,
|
||||
*
|
||||
* filter: function(string, Function):angular.Module,
|
||||
*
|
||||
* init: function(Function):angular.Module
|
||||
* } }
|
||||
*/
|
||||
angular.Module;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
AngularJS v1.6.6
|
||||
(c) 2010-2017 Google, Inc. http://angularjs.org
|
||||
License: MIT
|
||||
*/
|
||||
(function(){'use strict';function g(a,f){f=f||Error;return function(){var d=arguments[0],e;e="["+(a?a+":":"")+d+"] http://errors.angularjs.org/1.6.6/"+(a?a+"/":"")+d;for(d=1;d<arguments.length;d++){e=e+(1==d?"?":"&")+"p"+(d-1)+"=";var q=encodeURIComponent,b;b=arguments[d];b="function"==typeof b?b.toString().replace(/ \{[\s\S]*$/,""):"undefined"==typeof b?"undefined":"string"!=typeof b?JSON.stringify(b):b;e+=q(b)}return new f(e)}}(function(a){function f(a,b,d){return a[b]||(a[b]=d())}var d=g("$injector"),
|
||||
e=g("ng");a=f(a,"angular",Object);a.$$minErr=a.$$minErr||g;return f(a,"module",function(){var a={};return function(b,g,l){var m={};if("hasOwnProperty"===b)throw e("badname","module");g&&a.hasOwnProperty(b)&&(a[b]=null);return f(a,b,function(){function a(b,d,e,c){c||(c=f);return function(){c[e||"push"]([b,d,arguments]);return h}}function c(a,d,c){c||(c=f);return function(f,e){e&&"function"===typeof e&&(e.$$moduleName=b);c.push([a,d,arguments]);return h}}if(!g)throw d("nomod",b);var f=[],k=[],n=[],
|
||||
p=a("$injector","invoke","push",k),h={_invokeQueue:f,_configBlocks:k,_runBlocks:n,info:function(a){if("undefined"!==typeof a){if(null===a||"object"!==typeof a)throw e("aobj","value");m=a;return this}return m},requires:g,name:b,provider:c("$provide","provider"),factory:c("$provide","factory"),service:c("$provide","service"),value:a("$provide","value"),constant:a("$provide","constant","unshift"),decorator:c("$provide","decorator",k),animation:c("$animateProvider","register"),filter:c("$filterProvider",
|
||||
"register"),controller:c("$controllerProvider","register"),directive:c("$compileProvider","directive"),component:c("$compileProvider","component"),config:p,run:function(a){n.push(a);return this}};l&&p(l);return h})}})})(window)})(window);
|
||||
//# sourceMappingURL=angular-loader.min.js.map
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"version":3,
|
||||
"file":"angular-loader.min.js",
|
||||
"lineCount":9,
|
||||
"mappings":"A;;;;;aAMC,SAAQ,EAAG,CAiJZA,QAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,KAAAA,OAAAA,SAAAA,EAAAA,CAAAA,IAAAA,EAAAA,SAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,GAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,EAAAA,EAAAA,CAAAA,CAAAA,sCAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GAAAA,CAAAA,EAAAA,EAAAA,CAAAA,KAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,SAAAA,OAAAA,CAAAA,CAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAAA,CAAAA,CAAAA,GAAAA,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,CAAAA,CAAAA,CAAAA,EAAAA,GAAAA,KAAAA,EAAAA,kBAAAA,CAAAA,CAAAA,EAAAA,CAAAA,SAAAA,CAAAA,CAAAA,CAAAA,EAAAA,CAAAA,UAAAA,EAAAA,MAAAA,EAAAA,CAAAA,CAAAA,SAAAA,EAAAA,QAAAA,CAAAA,aAAAA,CAAAA,EAAAA,CAAAA,CAAAA,WAAAA,EAAAA,MAAAA,EAAAA,CAAAA,WAAAA,CAAAA,QAAAA,EAAAA,MAAAA,EAAAA,CAAAA,IAAAA,UAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,MAAAA,KAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAyCAC,SAA0B,CAACC,CAAD,CAAS,CAKjCC,QAASA,EAAM,CAACC,CAAD,CAAMC,CAAN,CAAYC,CAAZ,CAAqB,CAClC,MAAOF,EAAA,CAAIC,CAAJ,CAAP,GAAqBD,CAAA,CAAIC,CAAJ,CAArB,CAAiCC,CAAA,EAAjC,CADkC,CAHpC,IAAIC,EAAkBP,CAAA,CAAO,WAAP,CAAtB;AACIQ,EAAWR,CAAA,CAAO,IAAP,CAMXS,EAAAA,CAAUN,CAAA,CAAOD,CAAP,CAAe,SAAf,CAA0BQ,MAA1B,CAGdD,EAAAE,SAAA,CAAmBF,CAAAE,SAAnB,EAAuCX,CAEvC,OAAOG,EAAA,CAAOM,CAAP,CAAgB,QAAhB,CAA0B,QAAQ,EAAG,CAE1C,IAAIG,EAAU,EAqDd,OAAOC,SAAe,CAACR,CAAD,CAAOS,CAAP,CAAiBC,CAAjB,CAA2B,CAE/C,IAAIC,EAAO,EAGT,IAAa,gBAAb,GAKsBX,CALtB,CACE,KAAMG,EAAA,CAAS,SAAT,CAIoBS,QAJpB,CAAN,CAKAH,CAAJ,EAAgBF,CAAAM,eAAA,CAAuBb,CAAvB,CAAhB,GACEO,CAAA,CAAQP,CAAR,CADF,CACkB,IADlB,CAGA,OAAOF,EAAA,CAAOS,CAAP,CAAgBP,CAAhB,CAAsB,QAAQ,EAAG,CA8RtCc,QAASA,EAAW,CAACC,CAAD,CAAWC,CAAX,CAAmBC,CAAnB,CAAiCC,CAAjC,CAAwC,CACrDA,CAAL,GAAYA,CAAZ,CAAoBC,CAApB,CACA,OAAO,SAAQ,EAAG,CAChBD,CAAA,CAAMD,CAAN,EAAsB,MAAtB,CAAA,CAA8B,CAACF,CAAD,CAAWC,CAAX,CAAmBI,SAAnB,CAA9B,CACA,OAAOC,EAFS,CAFwC,CAa5DC,QAASA,EAA2B,CAACP,CAAD,CAAWC,CAAX,CAAmBE,CAAnB,CAA0B,CACvDA,CAAL,GAAYA,CAAZ,CAAoBC,CAApB,CACA,OAAO,SAAQ,CAACI,CAAD,CAAaC,CAAb,CAA8B,CACvCA,CAAJ,EAtjB4C,UAsjB5C,GAtjB2B,MAsjBOA,EAAlC,GAAoDA,CAAAC,aAApD,CAAmFzB,CAAnF,CACAkB,EAAAQ,KAAA,CAAW,CAACX,CAAD,CAAWC,CAAX,CAAmBI,SAAnB,CAAX,CACA,OAAOC,EAHoC,CAFe,CA1S9D,GAAKZ,CAAAA,CAAL,CACE,KAAMP,EAAA,CAAgB,OAAhB,CAEiDF,CAFjD,CAAN,CAMF,IAAImB,EAAc,EAAlB,CAGIQ,EAAe,EAHnB,CAMIC,EAAY,EANhB;AAQIC,EAASf,CAAA,CAAY,WAAZ,CAAyB,QAAzB,CAAmC,MAAnC,CAA2Ca,CAA3C,CARb,CAWIN,EAAiB,CAEnBS,aAAcX,CAFK,CAGnBY,cAAeJ,CAHI,CAInBK,WAAYJ,CAJO,CAoCnBjB,KAAMA,QAAQ,CAACsB,CAAD,CAAQ,CACpB,GA/T2C,WA+T3C,GA/T0B,MA+TZA,EAAd,CAAsB,CACpB,GA9TiC,IA8TjC,GAAcA,CAAd,EA9T0D,QA8T1D,GA9TyC,MA8T3BA,EAAd,CAAsB,KAAM9B,EAAA,CAAS,MAAT,CAAuD,OAAvD,CAAN,CACtBQ,CAAA,CAAOsB,CACP,OAAO,KAHa,CAKtB,MAAOtB,EANa,CApCH,CAsDnBF,SAAUA,CAtDS,CAgEnBT,KAAMA,CAhEa,CA6EnBe,SAAUO,CAAA,CAA4B,UAA5B,CAAwC,UAAxC,CA7ES,CAwFnBrB,QAASqB,CAAA,CAA4B,UAA5B,CAAwC,SAAxC,CAxFU,CAmGnBY,QAASZ,CAAA,CAA4B,UAA5B,CAAwC,SAAxC,CAnGU,CA8GnBW,MAAOnB,CAAA,CAAY,UAAZ,CAAwB,OAAxB,CA9GY,CA0HnBqB,SAAUrB,CAAA,CAAY,UAAZ,CAAwB,UAAxB,CAAoC,SAApC,CA1HS,CAsInBsB,UAAWd,CAAA,CAA4B,UAA5B,CAAwC,WAAxC,CAAqDK,CAArD,CAtIQ,CAwKnBU,UAAWf,CAAA,CAA4B,kBAA5B,CAAgD,UAAhD,CAxKQ,CA0LnBgB,OAAQhB,CAAA,CAA4B,iBAA5B;AAA+C,UAA/C,CA1LW,CAsMnBiB,WAAYjB,CAAA,CAA4B,qBAA5B,CAAmD,UAAnD,CAtMO,CAmNnBkB,UAAWlB,CAAA,CAA4B,kBAA5B,CAAgD,WAAhD,CAnNQ,CAgOnBmB,UAAWnB,CAAA,CAA4B,kBAA5B,CAAgD,WAAhD,CAhOQ,CA6OnBO,OAAQA,CA7OW,CAyPnBa,IAAKA,QAAQ,CAACC,CAAD,CAAQ,CACnBf,CAAAF,KAAA,CAAeiB,CAAf,CACA,OAAO,KAFY,CAzPF,CA+PjBjC,EAAJ,EACEmB,CAAA,CAAOnB,CAAP,CAGF,OAAOW,EAtR+B,CAAjC,CAdwC,CAvDP,CAArC,CAd0B,CAAnCzB,CA4YA,CAAkBC,MAAlB,CAtkBY,CAAX,CAAD,CAukBGA,MAvkBH;",
|
||||
"sources":["angular-loader.js"],
|
||||
"names":["minErr","setupModuleLoader","window","ensure","obj","name","factory","$injectorMinErr","ngMinErr","angular","Object","$$minErr","modules","module","requires","configFn","info","context","hasOwnProperty","invokeLater","provider","method","insertMethod","queue","invokeQueue","arguments","moduleInstance","invokeLaterAndSetModuleName","recipeName","factoryFunction","$$moduleName","push","configBlocks","runBlocks","config","_invokeQueue","_configBlocks","_runBlocks","value","service","constant","decorator","animation","filter","controller","directive","component","run","block"]
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"_from": "angular-loader@1.6.6",
|
||||
"_id": "angular-loader@1.6.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-7gtpoEB8y4vNBUbDPom6y8tdDZ8=",
|
||||
"_location": "/angular-loader",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "angular-loader@1.6.6",
|
||||
"name": "angular-loader",
|
||||
"escapedName": "angular-loader",
|
||||
"rawSpec": "1.6.6",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.6.6"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/angular-loader/-/angular-loader-1.6.6.tgz",
|
||||
"_shasum": "ee0b69a0407ccb8bcd0546c33e89bacbcb5d0d9f",
|
||||
"_spec": "angular-loader@1.6.6",
|
||||
"_where": "/home/st/dev/keycloak/themes/src/main",
|
||||
"author": {
|
||||
"name": "Angular Core Team",
|
||||
"email": "angular-core+npm@google.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/angular/angular.js/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "AngularJS module for asynchronously loading modules",
|
||||
"homepage": "http://angularjs.org",
|
||||
"jspm": {
|
||||
"shim": {
|
||||
"angular-loader": {
|
||||
"deps": [
|
||||
"angular"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
"angular",
|
||||
"framework",
|
||||
"browser",
|
||||
"loader",
|
||||
"client-side"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "angular-loader.js",
|
||||
"name": "angular-loader",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/angular/angular.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"version": "1.6.6"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Angular
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,867 @@
|
||||
/**
|
||||
* @license AngularJS v1.6.6
|
||||
* (c) 2010-2017 Google, Inc. http://angularjs.org
|
||||
* License: MIT
|
||||
*/
|
||||
(function(window, angular) {'use strict';
|
||||
|
||||
var $resourceMinErr = angular.$$minErr('$resource');
|
||||
|
||||
// Helper functions and regex to lookup a dotted path on an object
|
||||
// stopping at undefined/null. The path must be composed of ASCII
|
||||
// identifiers (just like $parse)
|
||||
var MEMBER_NAME_REGEX = /^(\.[a-zA-Z_$@][0-9a-zA-Z_$@]*)+$/;
|
||||
|
||||
function isValidDottedPath(path) {
|
||||
return (path != null && path !== '' && path !== 'hasOwnProperty' &&
|
||||
MEMBER_NAME_REGEX.test('.' + path));
|
||||
}
|
||||
|
||||
function lookupDottedPath(obj, path) {
|
||||
if (!isValidDottedPath(path)) {
|
||||
throw $resourceMinErr('badmember', 'Dotted member path "@{0}" is invalid.', path);
|
||||
}
|
||||
var keys = path.split('.');
|
||||
for (var i = 0, ii = keys.length; i < ii && angular.isDefined(obj); i++) {
|
||||
var key = keys[i];
|
||||
obj = (obj !== null) ? obj[key] : undefined;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a shallow copy of an object and clear other fields from the destination
|
||||
*/
|
||||
function shallowClearAndCopy(src, dst) {
|
||||
dst = dst || {};
|
||||
|
||||
angular.forEach(dst, function(value, key) {
|
||||
delete dst[key];
|
||||
});
|
||||
|
||||
for (var key in src) {
|
||||
if (src.hasOwnProperty(key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) {
|
||||
dst[key] = src[key];
|
||||
}
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ngdoc module
|
||||
* @name ngResource
|
||||
* @description
|
||||
*
|
||||
* # ngResource
|
||||
*
|
||||
* The `ngResource` module provides interaction support with RESTful services
|
||||
* via the $resource service.
|
||||
*
|
||||
*
|
||||
* <div doc-module-components="ngResource"></div>
|
||||
*
|
||||
* See {@link ngResource.$resourceProvider} and {@link ngResource.$resource} for usage.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ngdoc provider
|
||||
* @name $resourceProvider
|
||||
*
|
||||
* @description
|
||||
*
|
||||
* Use `$resourceProvider` to change the default behavior of the {@link ngResource.$resource}
|
||||
* service.
|
||||
*
|
||||
* ## Dependencies
|
||||
* Requires the {@link ngResource } module to be installed.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ngdoc service
|
||||
* @name $resource
|
||||
* @requires $http
|
||||
* @requires ng.$log
|
||||
* @requires $q
|
||||
* @requires ng.$timeout
|
||||
*
|
||||
* @description
|
||||
* A factory which creates a resource object that lets you interact with
|
||||
* [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) server-side data sources.
|
||||
*
|
||||
* The returned resource object has action methods which provide high-level behaviors without
|
||||
* the need to interact with the low level {@link ng.$http $http} service.
|
||||
*
|
||||
* Requires the {@link ngResource `ngResource`} module to be installed.
|
||||
*
|
||||
* By default, trailing slashes will be stripped from the calculated URLs,
|
||||
* which can pose problems with server backends that do not expect that
|
||||
* behavior. This can be disabled by configuring the `$resourceProvider` like
|
||||
* this:
|
||||
*
|
||||
* ```js
|
||||
app.config(['$resourceProvider', function($resourceProvider) {
|
||||
// Don't strip trailing slashes from calculated URLs
|
||||
$resourceProvider.defaults.stripTrailingSlashes = false;
|
||||
}]);
|
||||
* ```
|
||||
*
|
||||
* @param {string} url A parameterized URL template with parameters prefixed by `:` as in
|
||||
* `/user/:username`. If you are using a URL with a port number (e.g.
|
||||
* `http://example.com:8080/api`), it will be respected.
|
||||
*
|
||||
* If you are using a url with a suffix, just add the suffix, like this:
|
||||
* `$resource('http://example.com/resource.json')` or `$resource('http://example.com/:id.json')`
|
||||
* or even `$resource('http://example.com/resource/:resource_id.:format')`
|
||||
* If the parameter before the suffix is empty, :resource_id in this case, then the `/.` will be
|
||||
* collapsed down to a single `.`. If you need this sequence to appear and not collapse then you
|
||||
* can escape it with `/\.`.
|
||||
*
|
||||
* @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in
|
||||
* `actions` methods. If a parameter value is a function, it will be called every time
|
||||
* a param value needs to be obtained for a request (unless the param was overridden). The function
|
||||
* will be passed the current data value as an argument.
|
||||
*
|
||||
* Each key value in the parameter object is first bound to url template if present and then any
|
||||
* excess keys are appended to the url search query after the `?`.
|
||||
*
|
||||
* Given a template `/path/:verb` and parameter `{verb:'greet', salutation:'Hello'}` results in
|
||||
* URL `/path/greet?salutation=Hello`.
|
||||
*
|
||||
* If the parameter value is prefixed with `@`, then the value for that parameter will be
|
||||
* extracted from the corresponding property on the `data` object (provided when calling actions
|
||||
* with a request body).
|
||||
* For example, if the `defaultParam` object is `{someParam: '@someProp'}` then the value of
|
||||
* `someParam` will be `data.someProp`.
|
||||
* Note that the parameter will be ignored, when calling a "GET" action method (i.e. an action
|
||||
* method that does not accept a request body)
|
||||
*
|
||||
* @param {Object.<Object>=} actions Hash with declaration of custom actions that will be available
|
||||
* in addition to the default set of resource actions (see below). If a custom action has the same
|
||||
* key as a default action (e.g. `save`), then the default action will be *overwritten*, and not
|
||||
* extended.
|
||||
*
|
||||
* The declaration should be created in the format of {@link ng.$http#usage $http.config}:
|
||||
*
|
||||
* {action1: {method:?, params:?, isArray:?, headers:?, ...},
|
||||
* action2: {method:?, params:?, isArray:?, headers:?, ...},
|
||||
* ...}
|
||||
*
|
||||
* Where:
|
||||
*
|
||||
* - **`action`** – {string} – The name of action. This name becomes the name of the method on
|
||||
* your resource object.
|
||||
* - **`method`** – {string} – Case insensitive HTTP method (e.g. `GET`, `POST`, `PUT`,
|
||||
* `DELETE`, `JSONP`, etc).
|
||||
* - **`params`** – {Object=} – Optional set of pre-bound parameters for this action. If any of
|
||||
* the parameter value is a function, it will be called every time when a param value needs to
|
||||
* be obtained for a request (unless the param was overridden). The function will be passed the
|
||||
* current data value as an argument.
|
||||
* - **`url`** – {string} – action specific `url` override. The url templating is supported just
|
||||
* like for the resource-level urls.
|
||||
* - **`isArray`** – {boolean=} – If true then the returned object for this action is an array,
|
||||
* see `returns` section.
|
||||
* - **`transformRequest`** –
|
||||
* `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
|
||||
* transform function or an array of such functions. The transform function takes the http
|
||||
* request body and headers and returns its transformed (typically serialized) version.
|
||||
* By default, transformRequest will contain one function that checks if the request data is
|
||||
* an object and serializes it using `angular.toJson`. To prevent this behavior, set
|
||||
* `transformRequest` to an empty array: `transformRequest: []`
|
||||
* - **`transformResponse`** –
|
||||
* `{function(data, headersGetter, status)|Array.<function(data, headersGetter, status)>}` –
|
||||
* transform function or an array of such functions. The transform function takes the http
|
||||
* response body, headers and status and returns its transformed (typically deserialized)
|
||||
* version.
|
||||
* By default, transformResponse will contain one function that checks if the response looks
|
||||
* like a JSON string and deserializes it using `angular.fromJson`. To prevent this behavior,
|
||||
* set `transformResponse` to an empty array: `transformResponse: []`
|
||||
* - **`cache`** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
|
||||
* GET request, otherwise if a cache instance built with
|
||||
* {@link ng.$cacheFactory $cacheFactory} is supplied, this cache will be used for
|
||||
* caching.
|
||||
* - **`timeout`** – `{number}` – timeout in milliseconds.<br />
|
||||
* **Note:** In contrast to {@link ng.$http#usage $http.config}, {@link ng.$q promises} are
|
||||
* **not** supported in $resource, because the same value would be used for multiple requests.
|
||||
* If you are looking for a way to cancel requests, you should use the `cancellable` option.
|
||||
* - **`cancellable`** – `{boolean}` – if set to true, the request made by a "non-instance" call
|
||||
* will be cancelled (if not already completed) by calling `$cancelRequest()` on the call's
|
||||
* return value. Calling `$cancelRequest()` for a non-cancellable or an already
|
||||
* completed/cancelled request will have no effect.<br />
|
||||
* - **`withCredentials`** - `{boolean}` - whether to set the `withCredentials` flag on the
|
||||
* XHR object. See
|
||||
* [requests with credentials](https://developer.mozilla.org/en/http_access_control#section_5)
|
||||
* for more information.
|
||||
* - **`responseType`** - `{string}` - see
|
||||
* [requestType](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType).
|
||||
* - **`interceptor`** - `{Object=}` - The interceptor object has two optional methods -
|
||||
* `response` and `responseError`. Both `response` and `responseError` interceptors get called
|
||||
* with `http response` object. See {@link ng.$http $http interceptors}. In addition, the
|
||||
* resource instance or array object is accessible by the `resource` property of the
|
||||
* `http response` object.
|
||||
* Keep in mind that the associated promise will be resolved with the value returned by the
|
||||
* response interceptor, if one is specified. The default response interceptor returns
|
||||
* `response.resource` (i.e. the resource instance or array).
|
||||
* - **`hasBody`** - `{boolean}` - allows to specify if a request body should be included or not.
|
||||
* If not specified only POST, PUT and PATCH requests will have a body.
|
||||
*
|
||||
* @param {Object} options Hash with custom settings that should extend the
|
||||
* default `$resourceProvider` behavior. The supported options are:
|
||||
*
|
||||
* - **`stripTrailingSlashes`** – {boolean} – If true then the trailing
|
||||
* slashes from any calculated URL will be stripped. (Defaults to true.)
|
||||
* - **`cancellable`** – {boolean} – If true, the request made by a "non-instance" call will be
|
||||
* cancelled (if not already completed) by calling `$cancelRequest()` on the call's return value.
|
||||
* This can be overwritten per action. (Defaults to false.)
|
||||
*
|
||||
* @returns {Object} A resource "class" object with methods for the default set of resource actions
|
||||
* optionally extended with custom `actions`. The default set contains these actions:
|
||||
* ```js
|
||||
* { 'get': {method:'GET'},
|
||||
* 'save': {method:'POST'},
|
||||
* 'query': {method:'GET', isArray:true},
|
||||
* 'remove': {method:'DELETE'},
|
||||
* 'delete': {method:'DELETE'} };
|
||||
* ```
|
||||
*
|
||||
* Calling these methods invoke an {@link ng.$http} with the specified http method,
|
||||
* destination and parameters. When the data is returned from the server then the object is an
|
||||
* instance of the resource class. The actions `save`, `remove` and `delete` are available on it
|
||||
* as methods with the `$` prefix. This allows you to easily perform CRUD operations (create,
|
||||
* read, update, delete) on server-side data like this:
|
||||
* ```js
|
||||
* var User = $resource('/user/:userId', {userId:'@id'});
|
||||
* var user = User.get({userId:123}, function() {
|
||||
* user.abc = true;
|
||||
* user.$save();
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* It is important to realize that invoking a $resource object method immediately returns an
|
||||
* empty reference (object or array depending on `isArray`). Once the data is returned from the
|
||||
* server the existing reference is populated with the actual data. This is a useful trick since
|
||||
* usually the resource is assigned to a model which is then rendered by the view. Having an empty
|
||||
* object results in no rendering, once the data arrives from the server then the object is
|
||||
* populated with the data and the view automatically re-renders itself showing the new data. This
|
||||
* means that in most cases one never has to write a callback function for the action methods.
|
||||
*
|
||||
* The action methods on the class object or instance object can be invoked with the following
|
||||
* parameters:
|
||||
*
|
||||
* - "class" actions without a body: `Resource.action([parameters], [success], [error])`
|
||||
* - "class" actions with a body: `Resource.action([parameters], postData, [success], [error])`
|
||||
* - instance actions: `instance.$action([parameters], [success], [error])`
|
||||
*
|
||||
*
|
||||
* When calling instance methods, the instance itself is used as the request body (if the action
|
||||
* should have a body). By default, only actions using `POST`, `PUT` or `PATCH` have request
|
||||
* bodies, but you can use the `hasBody` configuration option to specify whether an action
|
||||
* should have a body or not (regardless of its HTTP method).
|
||||
*
|
||||
*
|
||||
* Success callback is called with (value (Object|Array), responseHeaders (Function),
|
||||
* status (number), statusText (string)) arguments, where the value is the populated resource
|
||||
* instance or collection object. The error callback is called with (httpResponse) argument.
|
||||
*
|
||||
* Class actions return empty instance (with additional properties below).
|
||||
* Instance actions return promise of the action.
|
||||
*
|
||||
* The Resource instances and collections have these additional properties:
|
||||
*
|
||||
* - `$promise`: the {@link ng.$q promise} of the original server interaction that created this
|
||||
* instance or collection.
|
||||
*
|
||||
* On success, the promise is resolved with the same resource instance or collection object,
|
||||
* updated with data from server. This makes it easy to use in
|
||||
* {@link ngRoute.$routeProvider resolve section of $routeProvider.when()} to defer view
|
||||
* rendering until the resource(s) are loaded.
|
||||
*
|
||||
* On failure, the promise is rejected with the {@link ng.$http http response} object.
|
||||
*
|
||||
* If an interceptor object was provided, the promise will instead be resolved with the value
|
||||
* returned by the interceptor.
|
||||
*
|
||||
* - `$resolved`: `true` after first server interaction is completed (either with success or
|
||||
* rejection), `false` before that. Knowing if the Resource has been resolved is useful in
|
||||
* data-binding.
|
||||
*
|
||||
* The Resource instances and collections have these additional methods:
|
||||
*
|
||||
* - `$cancelRequest`: If there is a cancellable, pending request related to the instance or
|
||||
* collection, calling this method will abort the request.
|
||||
*
|
||||
* The Resource instances have these additional methods:
|
||||
*
|
||||
* - `toJSON`: It returns a simple object without any of the extra properties added as part of
|
||||
* the Resource API. This object can be serialized through {@link angular.toJson} safely
|
||||
* without attaching Angular-specific fields. Notice that `JSON.stringify` (and
|
||||
* `angular.toJson`) automatically use this method when serializing a Resource instance
|
||||
* (see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON%28%29_behavior)).
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* # Credit card resource
|
||||
*
|
||||
* ```js
|
||||
// Define CreditCard class
|
||||
var CreditCard = $resource('/user/:userId/card/:cardId',
|
||||
{userId:123, cardId:'@id'}, {
|
||||
charge: {method:'POST', params:{charge:true}}
|
||||
});
|
||||
|
||||
// We can retrieve a collection from the server
|
||||
var cards = CreditCard.query(function() {
|
||||
// GET: /user/123/card
|
||||
// server returns: [ {id:456, number:'1234', name:'Smith'} ];
|
||||
|
||||
var card = cards[0];
|
||||
// each item is an instance of CreditCard
|
||||
expect(card instanceof CreditCard).toEqual(true);
|
||||
card.name = "J. Smith";
|
||||
// non GET methods are mapped onto the instances
|
||||
card.$save();
|
||||
// POST: /user/123/card/456 {id:456, number:'1234', name:'J. Smith'}
|
||||
// server returns: {id:456, number:'1234', name: 'J. Smith'};
|
||||
|
||||
// our custom method is mapped as well.
|
||||
card.$charge({amount:9.99});
|
||||
// POST: /user/123/card/456?amount=9.99&charge=true {id:456, number:'1234', name:'J. Smith'}
|
||||
});
|
||||
|
||||
// we can create an instance as well
|
||||
var newCard = new CreditCard({number:'0123'});
|
||||
newCard.name = "Mike Smith";
|
||||
newCard.$save();
|
||||
// POST: /user/123/card {number:'0123', name:'Mike Smith'}
|
||||
// server returns: {id:789, number:'0123', name: 'Mike Smith'};
|
||||
expect(newCard.id).toEqual(789);
|
||||
* ```
|
||||
*
|
||||
* The object returned from this function execution is a resource "class" which has "static" method
|
||||
* for each action in the definition.
|
||||
*
|
||||
* Calling these methods invoke `$http` on the `url` template with the given `method`, `params` and
|
||||
* `headers`.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* # User resource
|
||||
*
|
||||
* When the data is returned from the server then the object is an instance of the resource type and
|
||||
* all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD
|
||||
* operations (create, read, update, delete) on server-side data.
|
||||
|
||||
```js
|
||||
var User = $resource('/user/:userId', {userId:'@id'});
|
||||
User.get({userId:123}, function(user) {
|
||||
user.abc = true;
|
||||
user.$save();
|
||||
});
|
||||
```
|
||||
*
|
||||
* It's worth noting that the success callback for `get`, `query` and other methods gets passed
|
||||
* in the response that came from the server as well as $http header getter function, so one
|
||||
* could rewrite the above example and get access to http headers as:
|
||||
*
|
||||
```js
|
||||
var User = $resource('/user/:userId', {userId:'@id'});
|
||||
User.get({userId:123}, function(user, getResponseHeaders){
|
||||
user.abc = true;
|
||||
user.$save(function(user, putResponseHeaders) {
|
||||
//user => saved user object
|
||||
//putResponseHeaders => $http header getter
|
||||
});
|
||||
});
|
||||
```
|
||||
*
|
||||
* You can also access the raw `$http` promise via the `$promise` property on the object returned
|
||||
*
|
||||
```
|
||||
var User = $resource('/user/:userId', {userId:'@id'});
|
||||
User.get({userId:123})
|
||||
.$promise.then(function(user) {
|
||||
$scope.user = user;
|
||||
});
|
||||
```
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* # Creating a custom 'PUT' request
|
||||
*
|
||||
* In this example we create a custom method on our resource to make a PUT request
|
||||
* ```js
|
||||
* var app = angular.module('app', ['ngResource', 'ngRoute']);
|
||||
*
|
||||
* // Some APIs expect a PUT request in the format URL/object/ID
|
||||
* // Here we are creating an 'update' method
|
||||
* app.factory('Notes', ['$resource', function($resource) {
|
||||
* return $resource('/notes/:id', null,
|
||||
* {
|
||||
* 'update': { method:'PUT' }
|
||||
* });
|
||||
* }]);
|
||||
*
|
||||
* // In our controller we get the ID from the URL using ngRoute and $routeParams
|
||||
* // We pass in $routeParams and our Notes factory along with $scope
|
||||
* app.controller('NotesCtrl', ['$scope', '$routeParams', 'Notes',
|
||||
function($scope, $routeParams, Notes) {
|
||||
* // First get a note object from the factory
|
||||
* var note = Notes.get({ id:$routeParams.id });
|
||||
* $id = note.id;
|
||||
*
|
||||
* // Now call update passing in the ID first then the object you are updating
|
||||
* Notes.update({ id:$id }, note);
|
||||
*
|
||||
* // This will PUT /notes/ID with the note object in the request payload
|
||||
* }]);
|
||||
* ```
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* # Cancelling requests
|
||||
*
|
||||
* If an action's configuration specifies that it is cancellable, you can cancel the request related
|
||||
* to an instance or collection (as long as it is a result of a "non-instance" call):
|
||||
*
|
||||
```js
|
||||
// ...defining the `Hotel` resource...
|
||||
var Hotel = $resource('/api/hotel/:id', {id: '@id'}, {
|
||||
// Let's make the `query()` method cancellable
|
||||
query: {method: 'get', isArray: true, cancellable: true}
|
||||
});
|
||||
|
||||
// ...somewhere in the PlanVacationController...
|
||||
...
|
||||
this.onDestinationChanged = function onDestinationChanged(destination) {
|
||||
// We don't care about any pending request for hotels
|
||||
// in a different destination any more
|
||||
this.availableHotels.$cancelRequest();
|
||||
|
||||
// Let's query for hotels in '<destination>'
|
||||
// (calls: /api/hotel?location=<destination>)
|
||||
this.availableHotels = Hotel.query({location: destination});
|
||||
};
|
||||
```
|
||||
*
|
||||
*/
|
||||
angular.module('ngResource', ['ng']).
|
||||
info({ angularVersion: '1.6.6' }).
|
||||
provider('$resource', function ResourceProvider() {
|
||||
var PROTOCOL_AND_IPV6_REGEX = /^https?:\/\/\[[^\]]*][^/]*/;
|
||||
|
||||
var provider = this;
|
||||
|
||||
/**
|
||||
* @ngdoc property
|
||||
* @name $resourceProvider#defaults
|
||||
* @description
|
||||
* Object containing default options used when creating `$resource` instances.
|
||||
*
|
||||
* The default values satisfy a wide range of usecases, but you may choose to overwrite any of
|
||||
* them to further customize your instances. The available properties are:
|
||||
*
|
||||
* - **stripTrailingSlashes** – `{boolean}` – If true, then the trailing slashes from any
|
||||
* calculated URL will be stripped.<br />
|
||||
* (Defaults to true.)
|
||||
* - **cancellable** – `{boolean}` – If true, the request made by a "non-instance" call will be
|
||||
* cancelled (if not already completed) by calling `$cancelRequest()` on the call's return
|
||||
* value. For more details, see {@link ngResource.$resource}. This can be overwritten per
|
||||
* resource class or action.<br />
|
||||
* (Defaults to false.)
|
||||
* - **actions** - `{Object.<Object>}` - A hash with default actions declarations. Actions are
|
||||
* high-level methods corresponding to RESTful actions/methods on resources. An action may
|
||||
* specify what HTTP method to use, what URL to hit, if the return value will be a single
|
||||
* object or a collection (array) of objects etc. For more details, see
|
||||
* {@link ngResource.$resource}. The actions can also be enhanced or overwritten per resource
|
||||
* class.<br />
|
||||
* The default actions are:
|
||||
* ```js
|
||||
* {
|
||||
* get: {method: 'GET'},
|
||||
* save: {method: 'POST'},
|
||||
* query: {method: 'GET', isArray: true},
|
||||
* remove: {method: 'DELETE'},
|
||||
* delete: {method: 'DELETE'}
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* #### Example
|
||||
*
|
||||
* For example, you can specify a new `update` action that uses the `PUT` HTTP verb:
|
||||
*
|
||||
* ```js
|
||||
* angular.
|
||||
* module('myApp').
|
||||
* config(['$resourceProvider', function ($resourceProvider) {
|
||||
* $resourceProvider.defaults.actions.update = {
|
||||
* method: 'PUT'
|
||||
* };
|
||||
* }]);
|
||||
* ```
|
||||
*
|
||||
* Or you can even overwrite the whole `actions` list and specify your own:
|
||||
*
|
||||
* ```js
|
||||
* angular.
|
||||
* module('myApp').
|
||||
* config(['$resourceProvider', function ($resourceProvider) {
|
||||
* $resourceProvider.defaults.actions = {
|
||||
* create: {method: 'POST'},
|
||||
* get: {method: 'GET'},
|
||||
* getAll: {method: 'GET', isArray:true},
|
||||
* update: {method: 'PUT'},
|
||||
* delete: {method: 'DELETE'}
|
||||
* };
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
this.defaults = {
|
||||
// Strip slashes by default
|
||||
stripTrailingSlashes: true,
|
||||
|
||||
// Make non-instance requests cancellable (via `$cancelRequest()`)
|
||||
cancellable: false,
|
||||
|
||||
// Default actions configuration
|
||||
actions: {
|
||||
'get': {method: 'GET'},
|
||||
'save': {method: 'POST'},
|
||||
'query': {method: 'GET', isArray: true},
|
||||
'remove': {method: 'DELETE'},
|
||||
'delete': {method: 'DELETE'}
|
||||
}
|
||||
};
|
||||
|
||||
this.$get = ['$http', '$log', '$q', '$timeout', function($http, $log, $q, $timeout) {
|
||||
|
||||
var noop = angular.noop,
|
||||
forEach = angular.forEach,
|
||||
extend = angular.extend,
|
||||
copy = angular.copy,
|
||||
isArray = angular.isArray,
|
||||
isDefined = angular.isDefined,
|
||||
isFunction = angular.isFunction,
|
||||
isNumber = angular.isNumber,
|
||||
encodeUriQuery = angular.$$encodeUriQuery,
|
||||
encodeUriSegment = angular.$$encodeUriSegment;
|
||||
|
||||
function Route(template, defaults) {
|
||||
this.template = template;
|
||||
this.defaults = extend({}, provider.defaults, defaults);
|
||||
this.urlParams = {};
|
||||
}
|
||||
|
||||
Route.prototype = {
|
||||
setUrlParams: function(config, params, actionUrl) {
|
||||
var self = this,
|
||||
url = actionUrl || self.template,
|
||||
val,
|
||||
encodedVal,
|
||||
protocolAndIpv6 = '';
|
||||
|
||||
var urlParams = self.urlParams = Object.create(null);
|
||||
forEach(url.split(/\W/), function(param) {
|
||||
if (param === 'hasOwnProperty') {
|
||||
throw $resourceMinErr('badname', 'hasOwnProperty is not a valid parameter name.');
|
||||
}
|
||||
if (!(new RegExp('^\\d+$').test(param)) && param &&
|
||||
(new RegExp('(^|[^\\\\]):' + param + '(\\W|$)').test(url))) {
|
||||
urlParams[param] = {
|
||||
isQueryParamValue: (new RegExp('\\?.*=:' + param + '(?:\\W|$)')).test(url)
|
||||
};
|
||||
}
|
||||
});
|
||||
url = url.replace(/\\:/g, ':');
|
||||
url = url.replace(PROTOCOL_AND_IPV6_REGEX, function(match) {
|
||||
protocolAndIpv6 = match;
|
||||
return '';
|
||||
});
|
||||
|
||||
params = params || {};
|
||||
forEach(self.urlParams, function(paramInfo, urlParam) {
|
||||
val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam];
|
||||
if (isDefined(val) && val !== null) {
|
||||
if (paramInfo.isQueryParamValue) {
|
||||
encodedVal = encodeUriQuery(val, true);
|
||||
} else {
|
||||
encodedVal = encodeUriSegment(val);
|
||||
}
|
||||
url = url.replace(new RegExp(':' + urlParam + '(\\W|$)', 'g'), function(match, p1) {
|
||||
return encodedVal + p1;
|
||||
});
|
||||
} else {
|
||||
url = url.replace(new RegExp('(/?):' + urlParam + '(\\W|$)', 'g'), function(match,
|
||||
leadingSlashes, tail) {
|
||||
if (tail.charAt(0) === '/') {
|
||||
return tail;
|
||||
} else {
|
||||
return leadingSlashes + tail;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// strip trailing slashes and set the url (unless this behavior is specifically disabled)
|
||||
if (self.defaults.stripTrailingSlashes) {
|
||||
url = url.replace(/\/+$/, '') || '/';
|
||||
}
|
||||
|
||||
// Collapse `/.` if found in the last URL path segment before the query.
|
||||
// E.g. `http://url.com/id/.format?q=x` becomes `http://url.com/id.format?q=x`.
|
||||
url = url.replace(/\/\.(?=\w+($|\?))/, '.');
|
||||
// Replace escaped `/\.` with `/.`.
|
||||
// (If `\.` comes from a param value, it will be encoded as `%5C.`.)
|
||||
config.url = protocolAndIpv6 + url.replace(/\/(\\|%5C)\./, '/.');
|
||||
|
||||
|
||||
// set params - delegate param encoding to $http
|
||||
forEach(params, function(value, key) {
|
||||
if (!self.urlParams[key]) {
|
||||
config.params = config.params || {};
|
||||
config.params[key] = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function resourceFactory(url, paramDefaults, actions, options) {
|
||||
var route = new Route(url, options);
|
||||
|
||||
actions = extend({}, provider.defaults.actions, actions);
|
||||
|
||||
function extractParams(data, actionParams) {
|
||||
var ids = {};
|
||||
actionParams = extend({}, paramDefaults, actionParams);
|
||||
forEach(actionParams, function(value, key) {
|
||||
if (isFunction(value)) { value = value(data); }
|
||||
ids[key] = value && value.charAt && value.charAt(0) === '@' ?
|
||||
lookupDottedPath(data, value.substr(1)) : value;
|
||||
});
|
||||
return ids;
|
||||
}
|
||||
|
||||
function defaultResponseInterceptor(response) {
|
||||
return response.resource;
|
||||
}
|
||||
|
||||
function Resource(value) {
|
||||
shallowClearAndCopy(value || {}, this);
|
||||
}
|
||||
|
||||
Resource.prototype.toJSON = function() {
|
||||
var data = extend({}, this);
|
||||
delete data.$promise;
|
||||
delete data.$resolved;
|
||||
delete data.$cancelRequest;
|
||||
return data;
|
||||
};
|
||||
|
||||
forEach(actions, function(action, name) {
|
||||
var hasBody = action.hasBody === true || (action.hasBody !== false && /^(POST|PUT|PATCH)$/i.test(action.method));
|
||||
var numericTimeout = action.timeout;
|
||||
var cancellable = isDefined(action.cancellable) ?
|
||||
action.cancellable : route.defaults.cancellable;
|
||||
|
||||
if (numericTimeout && !isNumber(numericTimeout)) {
|
||||
$log.debug('ngResource:\n' +
|
||||
' Only numeric values are allowed as `timeout`.\n' +
|
||||
' Promises are not supported in $resource, because the same value would ' +
|
||||
'be used for multiple requests. If you are looking for a way to cancel ' +
|
||||
'requests, you should use the `cancellable` option.');
|
||||
delete action.timeout;
|
||||
numericTimeout = null;
|
||||
}
|
||||
|
||||
Resource[name] = function(a1, a2, a3, a4) {
|
||||
var params = {}, data, success, error;
|
||||
|
||||
switch (arguments.length) {
|
||||
case 4:
|
||||
error = a4;
|
||||
success = a3;
|
||||
// falls through
|
||||
case 3:
|
||||
case 2:
|
||||
if (isFunction(a2)) {
|
||||
if (isFunction(a1)) {
|
||||
success = a1;
|
||||
error = a2;
|
||||
break;
|
||||
}
|
||||
|
||||
success = a2;
|
||||
error = a3;
|
||||
// falls through
|
||||
} else {
|
||||
params = a1;
|
||||
data = a2;
|
||||
success = a3;
|
||||
break;
|
||||
}
|
||||
// falls through
|
||||
case 1:
|
||||
if (isFunction(a1)) success = a1;
|
||||
else if (hasBody) data = a1;
|
||||
else params = a1;
|
||||
break;
|
||||
case 0: break;
|
||||
default:
|
||||
throw $resourceMinErr('badargs',
|
||||
'Expected up to 4 arguments [params, data, success, error], got {0} arguments',
|
||||
arguments.length);
|
||||
}
|
||||
|
||||
var isInstanceCall = this instanceof Resource;
|
||||
var value = isInstanceCall ? data : (action.isArray ? [] : new Resource(data));
|
||||
var httpConfig = {};
|
||||
var responseInterceptor = action.interceptor && action.interceptor.response ||
|
||||
defaultResponseInterceptor;
|
||||
var responseErrorInterceptor = action.interceptor && action.interceptor.responseError ||
|
||||
undefined;
|
||||
var hasError = !!error;
|
||||
var hasResponseErrorInterceptor = !!responseErrorInterceptor;
|
||||
var timeoutDeferred;
|
||||
var numericTimeoutPromise;
|
||||
|
||||
forEach(action, function(value, key) {
|
||||
switch (key) {
|
||||
default:
|
||||
httpConfig[key] = copy(value);
|
||||
break;
|
||||
case 'params':
|
||||
case 'isArray':
|
||||
case 'interceptor':
|
||||
case 'cancellable':
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
if (!isInstanceCall && cancellable) {
|
||||
timeoutDeferred = $q.defer();
|
||||
httpConfig.timeout = timeoutDeferred.promise;
|
||||
|
||||
if (numericTimeout) {
|
||||
numericTimeoutPromise = $timeout(timeoutDeferred.resolve, numericTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
if (hasBody) httpConfig.data = data;
|
||||
route.setUrlParams(httpConfig,
|
||||
extend({}, extractParams(data, action.params || {}), params),
|
||||
action.url);
|
||||
|
||||
var promise = $http(httpConfig).then(function(response) {
|
||||
var data = response.data;
|
||||
|
||||
if (data) {
|
||||
// Need to convert action.isArray to boolean in case it is undefined
|
||||
if (isArray(data) !== (!!action.isArray)) {
|
||||
throw $resourceMinErr('badcfg',
|
||||
'Error in resource configuration for action `{0}`. Expected response to ' +
|
||||
'contain an {1} but got an {2} (Request: {3} {4})', name, action.isArray ? 'array' : 'object',
|
||||
isArray(data) ? 'array' : 'object', httpConfig.method, httpConfig.url);
|
||||
}
|
||||
if (action.isArray) {
|
||||
value.length = 0;
|
||||
forEach(data, function(item) {
|
||||
if (typeof item === 'object') {
|
||||
value.push(new Resource(item));
|
||||
} else {
|
||||
// Valid JSON values may be string literals, and these should not be converted
|
||||
// into objects. These items will not have access to the Resource prototype
|
||||
// methods, but unfortunately there
|
||||
value.push(item);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var promise = value.$promise; // Save the promise
|
||||
shallowClearAndCopy(data, value);
|
||||
value.$promise = promise; // Restore the promise
|
||||
}
|
||||
}
|
||||
response.resource = value;
|
||||
|
||||
return response;
|
||||
}, function(response) {
|
||||
response.resource = value;
|
||||
return $q.reject(response);
|
||||
});
|
||||
|
||||
promise = promise['finally'](function() {
|
||||
value.$resolved = true;
|
||||
if (!isInstanceCall && cancellable) {
|
||||
value.$cancelRequest = noop;
|
||||
$timeout.cancel(numericTimeoutPromise);
|
||||
timeoutDeferred = numericTimeoutPromise = httpConfig.timeout = null;
|
||||
}
|
||||
});
|
||||
|
||||
promise = promise.then(
|
||||
function(response) {
|
||||
var value = responseInterceptor(response);
|
||||
(success || noop)(value, response.headers, response.status, response.statusText);
|
||||
return value;
|
||||
},
|
||||
(hasError || hasResponseErrorInterceptor) ?
|
||||
function(response) {
|
||||
if (hasError && !hasResponseErrorInterceptor) {
|
||||
// Avoid `Possibly Unhandled Rejection` error,
|
||||
// but still fulfill the returned promise with a rejection
|
||||
promise.catch(noop);
|
||||
}
|
||||
if (hasError) error(response);
|
||||
return hasResponseErrorInterceptor ?
|
||||
responseErrorInterceptor(response) :
|
||||
$q.reject(response);
|
||||
} :
|
||||
undefined);
|
||||
|
||||
if (!isInstanceCall) {
|
||||
// we are creating instance / collection
|
||||
// - set the initial promise
|
||||
// - return the instance / collection
|
||||
value.$promise = promise;
|
||||
value.$resolved = false;
|
||||
if (cancellable) value.$cancelRequest = cancelRequest;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
// instance call
|
||||
return promise;
|
||||
|
||||
function cancelRequest(value) {
|
||||
promise.catch(noop);
|
||||
if (timeoutDeferred !== null) {
|
||||
timeoutDeferred.resolve(value);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Resource.prototype['$' + name] = function(params, success, error) {
|
||||
if (isFunction(params)) {
|
||||
error = success; success = params; params = {};
|
||||
}
|
||||
var result = Resource[name].call(this, params, this, success, error);
|
||||
return result.$promise || result;
|
||||
};
|
||||
});
|
||||
|
||||
Resource.bind = function(additionalParamDefaults) {
|
||||
var extendedParamDefaults = extend({}, paramDefaults, additionalParamDefaults);
|
||||
return resourceFactory(url, extendedParamDefaults, actions, options);
|
||||
};
|
||||
|
||||
return Resource;
|
||||
}
|
||||
|
||||
return resourceFactory;
|
||||
}];
|
||||
});
|
||||
|
||||
|
||||
})(window, window.angular);
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
AngularJS v1.6.6
|
||||
(c) 2010-2017 Google, Inc. http://angularjs.org
|
||||
License: MIT
|
||||
*/
|
||||
(function(W,b){'use strict';function L(q,g){g=g||{};b.forEach(g,function(b,h){delete g[h]});for(var h in q)!q.hasOwnProperty(h)||"$"===h.charAt(0)&&"$"===h.charAt(1)||(g[h]=q[h]);return g}var B=b.$$minErr("$resource"),Q=/^(\.[a-zA-Z_$@][0-9a-zA-Z_$@]*)+$/;b.module("ngResource",["ng"]).info({angularVersion:"1.6.6"}).provider("$resource",function(){var q=/^https?:\/\/\[[^\]]*][^/]*/,g=this;this.defaults={stripTrailingSlashes:!0,cancellable:!1,actions:{get:{method:"GET"},save:{method:"POST"},query:{method:"GET",
|
||||
isArray:!0},remove:{method:"DELETE"},"delete":{method:"DELETE"}}};this.$get=["$http","$log","$q","$timeout",function(h,P,G,M){function C(b,e){this.template=b;this.defaults=p({},g.defaults,e);this.urlParams={}}function y(D,e,u,n){function c(a,d){var c={};d=p({},e,d);t(d,function(d,l){z(d)&&(d=d(a));var f;if(d&&d.charAt&&"@"===d.charAt(0)){f=a;var k=d.substr(1);if(null==k||""===k||"hasOwnProperty"===k||!Q.test("."+k))throw B("badmember",k);for(var k=k.split("."),e=0,g=k.length;e<g&&b.isDefined(f);e++){var h=
|
||||
k[e];f=null!==f?f[h]:void 0}}else f=d;c[l]=f});return c}function R(a){return a.resource}function l(a){L(a||{},this)}var q=new C(D,n);u=p({},g.defaults.actions,u);l.prototype.toJSON=function(){var a=p({},this);delete a.$promise;delete a.$resolved;delete a.$cancelRequest;return a};t(u,function(a,d){var b=!0===a.hasBody||!1!==a.hasBody&&/^(POST|PUT|PATCH)$/i.test(a.method),e=a.timeout,g=N(a.cancellable)?a.cancellable:q.defaults.cancellable;e&&!S(e)&&(P.debug("ngResource:\n Only numeric values are allowed as `timeout`.\n Promises are not supported in $resource, because the same value would be used for multiple requests. If you are looking for a way to cancel requests, you should use the `cancellable` option."),
|
||||
delete a.timeout,e=null);l[d]=function(f,k,n,D){function u(a){r.catch(E);null!==v&&v.resolve(a)}var H={},w,x,A;switch(arguments.length){case 4:A=D,x=n;case 3:case 2:if(z(k)){if(z(f)){x=f;A=k;break}x=k;A=n}else{H=f;w=k;x=n;break}case 1:z(f)?x=f:b?w=f:H=f;break;case 0:break;default:throw B("badargs",arguments.length);}var F=this instanceof l,m=F?w:a.isArray?[]:new l(w),s={},C=a.interceptor&&a.interceptor.response||R,y=a.interceptor&&a.interceptor.responseError||void 0,I=!!A,J=!!y,v,K;t(a,function(a,
|
||||
d){switch(d){default:s[d]=T(a);case "params":case "isArray":case "interceptor":case "cancellable":}});!F&&g&&(v=G.defer(),s.timeout=v.promise,e&&(K=M(v.resolve,e)));b&&(s.data=w);q.setUrlParams(s,p({},c(w,a.params||{}),H),a.url);var r=h(s).then(function(f){var c=f.data;if(c){if(O(c)!==!!a.isArray)throw B("badcfg",d,a.isArray?"array":"object",O(c)?"array":"object",s.method,s.url);if(a.isArray)m.length=0,t(c,function(a){"object"===typeof a?m.push(new l(a)):m.push(a)});else{var b=m.$promise;L(c,m);m.$promise=
|
||||
b}}f.resource=m;return f},function(a){a.resource=m;return G.reject(a)}),r=r["finally"](function(){m.$resolved=!0;!F&&g&&(m.$cancelRequest=E,M.cancel(K),v=K=s.timeout=null)}),r=r.then(function(a){var d=C(a);(x||E)(d,a.headers,a.status,a.statusText);return d},I||J?function(a){I&&!J&&r.catch(E);I&&A(a);return J?y(a):G.reject(a)}:void 0);return F?r:(m.$promise=r,m.$resolved=!1,g&&(m.$cancelRequest=u),m)};l.prototype["$"+d]=function(a,c,b){z(a)&&(b=c,c=a,a={});a=l[d].call(this,a,this,c,b);return a.$promise||
|
||||
a}});l.bind=function(a){a=p({},e,a);return y(D,a,u,n)};return l}var E=b.noop,t=b.forEach,p=b.extend,T=b.copy,O=b.isArray,N=b.isDefined,z=b.isFunction,S=b.isNumber,U=b.$$encodeUriQuery,V=b.$$encodeUriSegment;C.prototype={setUrlParams:function(b,e,g){var n=this,c=g||n.template,h,l,p="",a=n.urlParams=Object.create(null);t(c.split(/\W/),function(d){if("hasOwnProperty"===d)throw B("badname");!/^\d+$/.test(d)&&d&&(new RegExp("(^|[^\\\\]):"+d+"(\\W|$)")).test(c)&&(a[d]={isQueryParamValue:(new RegExp("\\?.*=:"+
|
||||
d+"(?:\\W|$)")).test(c)})});c=c.replace(/\\:/g,":");c=c.replace(q,function(a){p=a;return""});e=e||{};t(n.urlParams,function(a,b){h=e.hasOwnProperty(b)?e[b]:n.defaults[b];N(h)&&null!==h?(l=a.isQueryParamValue?U(h,!0):V(h),c=c.replace(new RegExp(":"+b+"(\\W|$)","g"),function(a,b){return l+b})):c=c.replace(new RegExp("(/?):"+b+"(\\W|$)","g"),function(a,b,d){return"/"===d.charAt(0)?d:b+d})});n.defaults.stripTrailingSlashes&&(c=c.replace(/\/+$/,"")||"/");c=c.replace(/\/\.(?=\w+($|\?))/,".");b.url=p+c.replace(/\/(\\|%5C)\./,
|
||||
"/.");t(e,function(a,c){n.urlParams[c]||(b.params=b.params||{},b.params[c]=a)})}};return y}]})})(window,window.angular);
|
||||
//# sourceMappingURL=angular-resource.min.js.map
|
||||
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"_from": "angular-resource@1.6.6",
|
||||
"_id": "angular-resource@1.6.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-QwZg6WnD589AxeJH5eaQ8G1u/GE=",
|
||||
"_location": "/angular-resource",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "angular-resource@1.6.6",
|
||||
"name": "angular-resource",
|
||||
"escapedName": "angular-resource",
|
||||
"rawSpec": "1.6.6",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.6.6"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/angular-resource/-/angular-resource-1.6.6.tgz",
|
||||
"_shasum": "430660e969c3e7cf40c5e247e5e690f06d6efc61",
|
||||
"_spec": "angular-resource@1.6.6",
|
||||
"_where": "/home/st/dev/keycloak/themes/src/main",
|
||||
"author": {
|
||||
"name": "Angular Core Team",
|
||||
"email": "angular-core+npm@google.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/angular/angular.js/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "AngularJS module for interacting with RESTful server-side data sources",
|
||||
"homepage": "http://angularjs.org",
|
||||
"jspm": {
|
||||
"shim": {
|
||||
"angular-resource": {
|
||||
"deps": [
|
||||
"angular"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
"angular",
|
||||
"framework",
|
||||
"browser",
|
||||
"rest",
|
||||
"client-side"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "angular-resource",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/angular/angular.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"version": "1.6.6"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Angular
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
AngularJS v1.6.6
|
||||
(c) 2010-2017 Google, Inc. http://angularjs.org
|
||||
License: MIT
|
||||
*/
|
||||
(function(J,d){'use strict';function A(d){k&&d.get("$route")}function B(t,u,g){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",link:function(a,f,b,c,m){function v(){l&&(g.cancel(l),l=null);n&&(n.$destroy(),n=null);p&&(l=g.leave(p),l.done(function(a){!1!==a&&(l=null)}),p=null)}function E(){var b=t.current&&t.current.locals;if(d.isDefined(b&&b.$template)){var b=a.$new(),c=t.current;p=m(b,function(b){g.enter(b,null,p||f).done(function(b){!1===b||!d.isDefined(w)||w&&!a.$eval(w)||u()});
|
||||
v()});n=c.scope=b;n.$emit("$viewContentLoaded");n.$eval(k)}else v()}var n,p,l,w=b.autoscroll,k=b.onload||"";a.$on("$routeChangeSuccess",E);E()}}}function C(d,k,g){return{restrict:"ECA",priority:-400,link:function(a,f){var b=g.current,c=b.locals;f.html(c.$template);var m=d(f.contents());if(b.controller){c.$scope=a;var v=k(b.controller,c);b.controllerAs&&(a[b.controllerAs]=v);f.data("$ngControllerController",v);f.children().data("$ngControllerController",v)}a[b.resolveAs||"$resolve"]=c;m(a)}}}var x,
|
||||
y,F,G,z=d.module("ngRoute",[]).info({angularVersion:"1.6.6"}).provider("$route",function(){function t(a,f){return d.extend(Object.create(a),f)}function u(a,d){var b=d.caseInsensitiveMatch,c={originalPath:a,regexp:a},g=c.keys=[];a=a.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)(\*\?|[?*])?/g,function(a,b,d,c){a="?"===c||"*?"===c?"?":null;c="*"===c||"*?"===c?"*":null;g.push({name:d,optional:!!a});b=b||"";return""+(a?"":b)+"(?:"+(a?b:"")+(c&&"(.+?)"||"([^/]+)")+(a||"")+")"+(a||"")}).replace(/([/$*])/g,
|
||||
"\\$1");c.regexp=new RegExp("^"+a+"$",b?"i":"");return c}x=d.isArray;y=d.isObject;F=d.isDefined;G=d.noop;var g={};this.when=function(a,f){var b;b=void 0;if(x(f)){b=b||[];for(var c=0,m=f.length;c<m;c++)b[c]=f[c]}else if(y(f))for(c in b=b||{},f)if("$"!==c.charAt(0)||"$"!==c.charAt(1))b[c]=f[c];b=b||f;d.isUndefined(b.reloadOnSearch)&&(b.reloadOnSearch=!0);d.isUndefined(b.caseInsensitiveMatch)&&(b.caseInsensitiveMatch=this.caseInsensitiveMatch);g[a]=d.extend(b,a&&u(a,b));a&&(c="/"===a[a.length-1]?a.substr(0,
|
||||
a.length-1):a+"/",g[c]=d.extend({redirectTo:a},u(c,b)));return this};this.caseInsensitiveMatch=!1;this.otherwise=function(a){"string"===typeof a&&(a={redirectTo:a});this.when(null,a);return this};k=!0;this.eagerInstantiationEnabled=function(a){return F(a)?(k=a,this):k};this.$get=["$rootScope","$location","$routeParams","$q","$injector","$templateRequest","$sce","$browser",function(a,f,b,c,m,k,u,n){function p(e){var h=q.current;(y=(s=C())&&h&&s.$$route===h.$$route&&d.equals(s.pathParams,h.pathParams)&&
|
||||
!s.reloadOnSearch&&!D)||!h&&!s||a.$broadcast("$routeChangeStart",s,h).defaultPrevented&&e&&e.preventDefault()}function l(){var e=q.current,h=s;if(y)e.params=h.params,d.copy(e.params,b),a.$broadcast("$routeUpdate",e);else if(h||e){D=!1;q.current=h;var H=c.resolve(h);n.$$incOutstandingRequestCount();H.then(w).then(z).then(function(c){return c&&H.then(A).then(function(c){h===q.current&&(h&&(h.locals=c,d.copy(h.params,b)),a.$broadcast("$routeChangeSuccess",h,e))})}).catch(function(b){h===q.current&&a.$broadcast("$routeChangeError",
|
||||
h,e,b)}).finally(function(){n.$$completeOutstandingRequest(G)})}}function w(e){var a={route:e,hasRedirection:!1};if(e)if(e.redirectTo)if(d.isString(e.redirectTo))a.path=x(e.redirectTo,e.params),a.search=e.params,a.hasRedirection=!0;else{var b=f.path(),g=f.search();e=e.redirectTo(e.pathParams,b,g);d.isDefined(e)&&(a.url=e,a.hasRedirection=!0)}else if(e.resolveRedirectTo)return c.resolve(m.invoke(e.resolveRedirectTo)).then(function(e){d.isDefined(e)&&(a.url=e,a.hasRedirection=!0);return a});return a}
|
||||
function z(a){var b=!0;if(a.route!==q.current)b=!1;else if(a.hasRedirection){var d=f.url(),c=a.url;c?f.url(c).replace():c=f.path(a.path).search(a.search).replace().url();c!==d&&(b=!1)}return b}function A(a){if(a){var b=d.extend({},a.resolve);d.forEach(b,function(a,e){b[e]=d.isString(a)?m.get(a):m.invoke(a,null,null,e)});a=B(a);d.isDefined(a)&&(b.$template=a);return c.all(b)}}function B(a){var b,c;d.isDefined(b=a.template)?d.isFunction(b)&&(b=b(a.params)):d.isDefined(c=a.templateUrl)&&(d.isFunction(c)&&
|
||||
(c=c(a.params)),d.isDefined(c)&&(a.loadedTemplateUrl=u.valueOf(c),b=k(c)));return b}function C(){var a,b;d.forEach(g,function(c,g){var r;if(r=!b){var k=f.path();r=c.keys;var m={};if(c.regexp)if(k=c.regexp.exec(k)){for(var l=1,n=k.length;l<n;++l){var p=r[l-1],q=k[l];p&&q&&(m[p.name]=q)}r=m}else r=null;else r=null;r=a=r}r&&(b=t(c,{params:d.extend({},f.search(),a),pathParams:a}),b.$$route=c)});return b||g[null]&&t(g[null],{params:{},pathParams:{}})}function x(a,b){var c=[];d.forEach((a||"").split(":"),
|
||||
function(a,d){if(0===d)c.push(a);else{var e=a.match(/(\w+)(?:[?*])?(.*)/),f=e[1];c.push(b[f]);c.push(e[2]||"");delete b[f]}});return c.join("")}var D=!1,s,y,q={routes:g,reload:function(){D=!0;var b={defaultPrevented:!1,preventDefault:function(){this.defaultPrevented=!0;D=!1}};a.$evalAsync(function(){p(b);b.defaultPrevented||l()})},updateParams:function(a){if(this.current&&this.current.$$route)a=d.extend({},this.current.params,a),f.path(x(this.current.$$route.originalPath,a)),f.search(a);else throw I("norout");
|
||||
}};a.$on("$locationChangeStart",p);a.$on("$locationChangeSuccess",l);return q}]}).run(A),I=d.$$minErr("ngRoute"),k;A.$inject=["$injector"];z.provider("$routeParams",function(){this.$get=function(){return{}}});z.directive("ngView",B);z.directive("ngView",C);B.$inject=["$route","$anchorScroll","$animate"];C.$inject=["$compile","$controller","$route"]})(window,window.angular);
|
||||
//# sourceMappingURL=angular-route.min.js.map
|
||||
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"_from": "angular-route@1.6.6",
|
||||
"_id": "angular-route@1.6.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-jBF0iqGVxxexthWn50ZEK/x8YfQ=",
|
||||
"_location": "/angular-route",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "angular-route@1.6.6",
|
||||
"name": "angular-route",
|
||||
"escapedName": "angular-route",
|
||||
"rawSpec": "1.6.6",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.6.6"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/angular-route/-/angular-route-1.6.6.tgz",
|
||||
"_shasum": "8c11748aa195c717b1b615a7e746442bfc7c61f4",
|
||||
"_spec": "angular-route@1.6.6",
|
||||
"_where": "/home/st/dev/keycloak/themes/src/main",
|
||||
"author": {
|
||||
"name": "Angular Core Team",
|
||||
"email": "angular-core+npm@google.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/angular/angular.js/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "AngularJS router module",
|
||||
"homepage": "http://angularjs.org",
|
||||
"jspm": {
|
||||
"shim": {
|
||||
"angular-route": {
|
||||
"deps": [
|
||||
"angular"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
"angular",
|
||||
"framework",
|
||||
"browser",
|
||||
"router",
|
||||
"client-side"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "angular-route",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/angular/angular.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"version": "1.6.6"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Angular
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,806 @@
|
||||
/**
|
||||
* @license AngularJS v1.6.6
|
||||
* (c) 2010-2017 Google, Inc. http://angularjs.org
|
||||
* License: MIT
|
||||
*/
|
||||
(function(window, angular) {'use strict';
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Any commits to this file should be reviewed with security in mind. *
|
||||
* Changes to this file can potentially create security vulnerabilities. *
|
||||
* An approval from 2 Core members with history of modifying *
|
||||
* this file is required. *
|
||||
* *
|
||||
* Does the change somehow allow for arbitrary javascript to be executed? *
|
||||
* Or allows for someone to change the prototype of built-in objects? *
|
||||
* Or gives undesired access to variables likes document or window? *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
var $sanitizeMinErr = angular.$$minErr('$sanitize');
|
||||
var bind;
|
||||
var extend;
|
||||
var forEach;
|
||||
var isDefined;
|
||||
var lowercase;
|
||||
var noop;
|
||||
var nodeContains;
|
||||
var htmlParser;
|
||||
var htmlSanitizeWriter;
|
||||
|
||||
/**
|
||||
* @ngdoc module
|
||||
* @name ngSanitize
|
||||
* @description
|
||||
*
|
||||
* # ngSanitize
|
||||
*
|
||||
* The `ngSanitize` module provides functionality to sanitize HTML.
|
||||
*
|
||||
*
|
||||
* <div doc-module-components="ngSanitize"></div>
|
||||
*
|
||||
* See {@link ngSanitize.$sanitize `$sanitize`} for usage.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ngdoc service
|
||||
* @name $sanitize
|
||||
* @kind function
|
||||
*
|
||||
* @description
|
||||
* Sanitizes an html string by stripping all potentially dangerous tokens.
|
||||
*
|
||||
* The input is sanitized by parsing the HTML into tokens. All safe tokens (from a whitelist) are
|
||||
* then serialized back to properly escaped html string. This means that no unsafe input can make
|
||||
* it into the returned string.
|
||||
*
|
||||
* The whitelist for URL sanitization of attribute values is configured using the functions
|
||||
* `aHrefSanitizationWhitelist` and `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider
|
||||
* `$compileProvider`}.
|
||||
*
|
||||
* The input may also contain SVG markup if this is enabled via {@link $sanitizeProvider}.
|
||||
*
|
||||
* @param {string} html HTML input.
|
||||
* @returns {string} Sanitized HTML.
|
||||
*
|
||||
* @example
|
||||
<example module="sanitizeExample" deps="angular-sanitize.js" name="sanitize-service">
|
||||
<file name="index.html">
|
||||
<script>
|
||||
angular.module('sanitizeExample', ['ngSanitize'])
|
||||
.controller('ExampleController', ['$scope', '$sce', function($scope, $sce) {
|
||||
$scope.snippet =
|
||||
'<p style="color:blue">an html\n' +
|
||||
'<em onmouseover="this.textContent=\'PWN3D!\'">click here</em>\n' +
|
||||
'snippet</p>';
|
||||
$scope.deliberatelyTrustDangerousSnippet = function() {
|
||||
return $sce.trustAsHtml($scope.snippet);
|
||||
};
|
||||
}]);
|
||||
</script>
|
||||
<div ng-controller="ExampleController">
|
||||
Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Directive</td>
|
||||
<td>How</td>
|
||||
<td>Source</td>
|
||||
<td>Rendered</td>
|
||||
</tr>
|
||||
<tr id="bind-html-with-sanitize">
|
||||
<td>ng-bind-html</td>
|
||||
<td>Automatically uses $sanitize</td>
|
||||
<td><pre><div ng-bind-html="snippet"><br/></div></pre></td>
|
||||
<td><div ng-bind-html="snippet"></div></td>
|
||||
</tr>
|
||||
<tr id="bind-html-with-trust">
|
||||
<td>ng-bind-html</td>
|
||||
<td>Bypass $sanitize by explicitly trusting the dangerous value</td>
|
||||
<td>
|
||||
<pre><div ng-bind-html="deliberatelyTrustDangerousSnippet()">
|
||||
</div></pre>
|
||||
</td>
|
||||
<td><div ng-bind-html="deliberatelyTrustDangerousSnippet()"></div></td>
|
||||
</tr>
|
||||
<tr id="bind-default">
|
||||
<td>ng-bind</td>
|
||||
<td>Automatically escapes</td>
|
||||
<td><pre><div ng-bind="snippet"><br/></div></pre></td>
|
||||
<td><div ng-bind="snippet"></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</file>
|
||||
<file name="protractor.js" type="protractor">
|
||||
it('should sanitize the html snippet by default', function() {
|
||||
expect(element(by.css('#bind-html-with-sanitize div')).getAttribute('innerHTML')).
|
||||
toBe('<p>an html\n<em>click here</em>\nsnippet</p>');
|
||||
});
|
||||
|
||||
it('should inline raw snippet if bound to a trusted value', function() {
|
||||
expect(element(by.css('#bind-html-with-trust div')).getAttribute('innerHTML')).
|
||||
toBe("<p style=\"color:blue\">an html\n" +
|
||||
"<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
|
||||
"snippet</p>");
|
||||
});
|
||||
|
||||
it('should escape snippet without any filter', function() {
|
||||
expect(element(by.css('#bind-default div')).getAttribute('innerHTML')).
|
||||
toBe("<p style=\"color:blue\">an html\n" +
|
||||
"<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
|
||||
"snippet</p>");
|
||||
});
|
||||
|
||||
it('should update', function() {
|
||||
element(by.model('snippet')).clear();
|
||||
element(by.model('snippet')).sendKeys('new <b onclick="alert(1)">text</b>');
|
||||
expect(element(by.css('#bind-html-with-sanitize div')).getAttribute('innerHTML')).
|
||||
toBe('new <b>text</b>');
|
||||
expect(element(by.css('#bind-html-with-trust div')).getAttribute('innerHTML')).toBe(
|
||||
'new <b onclick="alert(1)">text</b>');
|
||||
expect(element(by.css('#bind-default div')).getAttribute('innerHTML')).toBe(
|
||||
"new <b onclick=\"alert(1)\">text</b>");
|
||||
});
|
||||
</file>
|
||||
</example>
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc provider
|
||||
* @name $sanitizeProvider
|
||||
* @this
|
||||
*
|
||||
* @description
|
||||
* Creates and configures {@link $sanitize} instance.
|
||||
*/
|
||||
function $SanitizeProvider() {
|
||||
var svgEnabled = false;
|
||||
|
||||
this.$get = ['$$sanitizeUri', function($$sanitizeUri) {
|
||||
if (svgEnabled) {
|
||||
extend(validElements, svgElements);
|
||||
}
|
||||
return function(html) {
|
||||
var buf = [];
|
||||
htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) {
|
||||
return !/^unsafe:/.test($$sanitizeUri(uri, isImage));
|
||||
}));
|
||||
return buf.join('');
|
||||
};
|
||||
}];
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name $sanitizeProvider#enableSvg
|
||||
* @kind function
|
||||
*
|
||||
* @description
|
||||
* Enables a subset of svg to be supported by the sanitizer.
|
||||
*
|
||||
* <div class="alert alert-warning">
|
||||
* <p>By enabling this setting without taking other precautions, you might expose your
|
||||
* application to click-hijacking attacks. In these attacks, sanitized svg elements could be positioned
|
||||
* outside of the containing element and be rendered over other elements on the page (e.g. a login
|
||||
* link). Such behavior can then result in phishing incidents.</p>
|
||||
*
|
||||
* <p>To protect against these, explicitly setup `overflow: hidden` css rule for all potential svg
|
||||
* tags within the sanitized content:</p>
|
||||
*
|
||||
* <br>
|
||||
*
|
||||
* <pre><code>
|
||||
* .rootOfTheIncludedContent svg {
|
||||
* overflow: hidden !important;
|
||||
* }
|
||||
* </code></pre>
|
||||
* </div>
|
||||
*
|
||||
* @param {boolean=} flag Enable or disable SVG support in the sanitizer.
|
||||
* @returns {boolean|ng.$sanitizeProvider} Returns the currently configured value if called
|
||||
* without an argument or self for chaining otherwise.
|
||||
*/
|
||||
this.enableSvg = function(enableSvg) {
|
||||
if (isDefined(enableSvg)) {
|
||||
svgEnabled = enableSvg;
|
||||
return this;
|
||||
} else {
|
||||
return svgEnabled;
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Private stuff
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bind = angular.bind;
|
||||
extend = angular.extend;
|
||||
forEach = angular.forEach;
|
||||
isDefined = angular.isDefined;
|
||||
lowercase = angular.lowercase;
|
||||
noop = angular.noop;
|
||||
|
||||
htmlParser = htmlParserImpl;
|
||||
htmlSanitizeWriter = htmlSanitizeWriterImpl;
|
||||
|
||||
nodeContains = window.Node.prototype.contains || /** @this */ function(arg) {
|
||||
// eslint-disable-next-line no-bitwise
|
||||
return !!(this.compareDocumentPosition(arg) & 16);
|
||||
};
|
||||
|
||||
// Regular Expressions for parsing tags and attributes
|
||||
var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
|
||||
// Match everything outside of normal chars and " (quote character)
|
||||
NON_ALPHANUMERIC_REGEXP = /([^#-~ |!])/g;
|
||||
|
||||
|
||||
// Good source of info about elements and attributes
|
||||
// http://dev.w3.org/html5/spec/Overview.html#semantics
|
||||
// http://simon.html5.org/html-elements
|
||||
|
||||
// Safe Void Elements - HTML5
|
||||
// http://dev.w3.org/html5/spec/Overview.html#void-elements
|
||||
var voidElements = toMap('area,br,col,hr,img,wbr');
|
||||
|
||||
// Elements that you can, intentionally, leave open (and which close themselves)
|
||||
// http://dev.w3.org/html5/spec/Overview.html#optional-tags
|
||||
var optionalEndTagBlockElements = toMap('colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr'),
|
||||
optionalEndTagInlineElements = toMap('rp,rt'),
|
||||
optionalEndTagElements = extend({},
|
||||
optionalEndTagInlineElements,
|
||||
optionalEndTagBlockElements);
|
||||
|
||||
// Safe Block Elements - HTML5
|
||||
var blockElements = extend({}, optionalEndTagBlockElements, toMap('address,article,' +
|
||||
'aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,' +
|
||||
'h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul'));
|
||||
|
||||
// Inline Elements - HTML5
|
||||
var inlineElements = extend({}, optionalEndTagInlineElements, toMap('a,abbr,acronym,b,' +
|
||||
'bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,' +
|
||||
'samp,small,span,strike,strong,sub,sup,time,tt,u,var'));
|
||||
|
||||
// SVG Elements
|
||||
// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Elements
|
||||
// Note: the elements animate,animateColor,animateMotion,animateTransform,set are intentionally omitted.
|
||||
// They can potentially allow for arbitrary javascript to be executed. See #11290
|
||||
var svgElements = toMap('circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,' +
|
||||
'hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,' +
|
||||
'radialGradient,rect,stop,svg,switch,text,title,tspan');
|
||||
|
||||
// Blocked Elements (will be stripped)
|
||||
var blockedElements = toMap('script,style');
|
||||
|
||||
var validElements = extend({},
|
||||
voidElements,
|
||||
blockElements,
|
||||
inlineElements,
|
||||
optionalEndTagElements);
|
||||
|
||||
//Attributes that have href and hence need to be sanitized
|
||||
var uriAttrs = toMap('background,cite,href,longdesc,src,xlink:href');
|
||||
|
||||
var htmlAttrs = toMap('abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,' +
|
||||
'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,' +
|
||||
'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,' +
|
||||
'scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,' +
|
||||
'valign,value,vspace,width');
|
||||
|
||||
// SVG attributes (without "id" and "name" attributes)
|
||||
// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Attributes
|
||||
var svgAttrs = toMap('accent-height,accumulate,additive,alphabetic,arabic-form,ascent,' +
|
||||
'baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,' +
|
||||
'cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,' +
|
||||
'font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,' +
|
||||
'height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,' +
|
||||
'marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,' +
|
||||
'max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,' +
|
||||
'path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,' +
|
||||
'requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,' +
|
||||
'stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,' +
|
||||
'stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,' +
|
||||
'stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,' +
|
||||
'underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,' +
|
||||
'width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,' +
|
||||
'xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan', true);
|
||||
|
||||
var validAttrs = extend({},
|
||||
uriAttrs,
|
||||
svgAttrs,
|
||||
htmlAttrs);
|
||||
|
||||
function toMap(str, lowercaseKeys) {
|
||||
var obj = {}, items = str.split(','), i;
|
||||
for (i = 0; i < items.length; i++) {
|
||||
obj[lowercaseKeys ? lowercase(items[i]) : items[i]] = true;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an inert document that contains the dirty HTML that needs sanitizing
|
||||
* Depending upon browser support we use one of three strategies for doing this.
|
||||
* Support: Safari 10.x -> XHR strategy
|
||||
* Support: Firefox -> DomParser strategy
|
||||
*/
|
||||
var getInertBodyElement /* function(html: string): HTMLBodyElement */ = (function(window, document) {
|
||||
var inertDocument;
|
||||
if (document && document.implementation) {
|
||||
inertDocument = document.implementation.createHTMLDocument('inert');
|
||||
} else {
|
||||
throw $sanitizeMinErr('noinert', 'Can\'t create an inert html document');
|
||||
}
|
||||
var inertBodyElement = (inertDocument.documentElement || inertDocument.getDocumentElement()).querySelector('body');
|
||||
|
||||
// Check for the Safari 10.1 bug - which allows JS to run inside the SVG G element
|
||||
inertBodyElement.innerHTML = '<svg><g onload="this.parentNode.remove()"></g></svg>';
|
||||
if (!inertBodyElement.querySelector('svg')) {
|
||||
return getInertBodyElement_XHR;
|
||||
} else {
|
||||
// Check for the Firefox bug - which prevents the inner img JS from being sanitized
|
||||
inertBodyElement.innerHTML = '<svg><p><style><img src="</style><img src=x onerror=alert(1)//">';
|
||||
if (inertBodyElement.querySelector('svg img')) {
|
||||
return getInertBodyElement_DOMParser;
|
||||
} else {
|
||||
return getInertBodyElement_InertDocument;
|
||||
}
|
||||
}
|
||||
|
||||
function getInertBodyElement_XHR(html) {
|
||||
// We add this dummy element to ensure that the rest of the content is parsed as expected
|
||||
// e.g. leading whitespace is maintained and tags like `<meta>` do not get hoisted to the `<head>` tag.
|
||||
html = '<remove></remove>' + html;
|
||||
try {
|
||||
html = encodeURI(html);
|
||||
} catch (e) {
|
||||
return undefined;
|
||||
}
|
||||
var xhr = new window.XMLHttpRequest();
|
||||
xhr.responseType = 'document';
|
||||
xhr.open('GET', 'data:text/html;charset=utf-8,' + html, false);
|
||||
xhr.send(null);
|
||||
var body = xhr.response.body;
|
||||
body.firstChild.remove();
|
||||
return body;
|
||||
}
|
||||
|
||||
function getInertBodyElement_DOMParser(html) {
|
||||
// We add this dummy element to ensure that the rest of the content is parsed as expected
|
||||
// e.g. leading whitespace is maintained and tags like `<meta>` do not get hoisted to the `<head>` tag.
|
||||
html = '<remove></remove>' + html;
|
||||
try {
|
||||
var body = new window.DOMParser().parseFromString(html, 'text/html').body;
|
||||
body.firstChild.remove();
|
||||
return body;
|
||||
} catch (e) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function getInertBodyElement_InertDocument(html) {
|
||||
inertBodyElement.innerHTML = html;
|
||||
|
||||
// Support: IE 9-11 only
|
||||
// strip custom-namespaced attributes on IE<=11
|
||||
if (document.documentMode) {
|
||||
stripCustomNsAttrs(inertBodyElement);
|
||||
}
|
||||
|
||||
return inertBodyElement;
|
||||
}
|
||||
})(window, window.document);
|
||||
|
||||
/**
|
||||
* @example
|
||||
* htmlParser(htmlString, {
|
||||
* start: function(tag, attrs) {},
|
||||
* end: function(tag) {},
|
||||
* chars: function(text) {},
|
||||
* comment: function(text) {}
|
||||
* });
|
||||
*
|
||||
* @param {string} html string
|
||||
* @param {object} handler
|
||||
*/
|
||||
function htmlParserImpl(html, handler) {
|
||||
if (html === null || html === undefined) {
|
||||
html = '';
|
||||
} else if (typeof html !== 'string') {
|
||||
html = '' + html;
|
||||
}
|
||||
|
||||
var inertBodyElement = getInertBodyElement(html);
|
||||
if (!inertBodyElement) return '';
|
||||
|
||||
//mXSS protection
|
||||
var mXSSAttempts = 5;
|
||||
do {
|
||||
if (mXSSAttempts === 0) {
|
||||
throw $sanitizeMinErr('uinput', 'Failed to sanitize html because the input is unstable');
|
||||
}
|
||||
mXSSAttempts--;
|
||||
|
||||
// trigger mXSS if it is going to happen by reading and writing the innerHTML
|
||||
html = inertBodyElement.innerHTML;
|
||||
inertBodyElement = getInertBodyElement(html);
|
||||
} while (html !== inertBodyElement.innerHTML);
|
||||
|
||||
var node = inertBodyElement.firstChild;
|
||||
while (node) {
|
||||
switch (node.nodeType) {
|
||||
case 1: // ELEMENT_NODE
|
||||
handler.start(node.nodeName.toLowerCase(), attrToMap(node.attributes));
|
||||
break;
|
||||
case 3: // TEXT NODE
|
||||
handler.chars(node.textContent);
|
||||
break;
|
||||
}
|
||||
|
||||
var nextNode;
|
||||
if (!(nextNode = node.firstChild)) {
|
||||
if (node.nodeType === 1) {
|
||||
handler.end(node.nodeName.toLowerCase());
|
||||
}
|
||||
nextNode = getNonDescendant('nextSibling', node);
|
||||
if (!nextNode) {
|
||||
while (nextNode == null) {
|
||||
node = getNonDescendant('parentNode', node);
|
||||
if (node === inertBodyElement) break;
|
||||
nextNode = getNonDescendant('nextSibling', node);
|
||||
if (node.nodeType === 1) {
|
||||
handler.end(node.nodeName.toLowerCase());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
node = nextNode;
|
||||
}
|
||||
|
||||
while ((node = inertBodyElement.firstChild)) {
|
||||
inertBodyElement.removeChild(node);
|
||||
}
|
||||
}
|
||||
|
||||
function attrToMap(attrs) {
|
||||
var map = {};
|
||||
for (var i = 0, ii = attrs.length; i < ii; i++) {
|
||||
var attr = attrs[i];
|
||||
map[attr.name] = attr.value;
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Escapes all potentially dangerous characters, so that the
|
||||
* resulting string can be safely inserted into attribute or
|
||||
* element text.
|
||||
* @param value
|
||||
* @returns {string} escaped text
|
||||
*/
|
||||
function encodeEntities(value) {
|
||||
return value.
|
||||
replace(/&/g, '&').
|
||||
replace(SURROGATE_PAIR_REGEXP, function(value) {
|
||||
var hi = value.charCodeAt(0);
|
||||
var low = value.charCodeAt(1);
|
||||
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
|
||||
}).
|
||||
replace(NON_ALPHANUMERIC_REGEXP, function(value) {
|
||||
return '&#' + value.charCodeAt(0) + ';';
|
||||
}).
|
||||
replace(/</g, '<').
|
||||
replace(/>/g, '>');
|
||||
}
|
||||
|
||||
/**
|
||||
* create an HTML/XML writer which writes to buffer
|
||||
* @param {Array} buf use buf.join('') to get out sanitized html string
|
||||
* @returns {object} in the form of {
|
||||
* start: function(tag, attrs) {},
|
||||
* end: function(tag) {},
|
||||
* chars: function(text) {},
|
||||
* comment: function(text) {}
|
||||
* }
|
||||
*/
|
||||
function htmlSanitizeWriterImpl(buf, uriValidator) {
|
||||
var ignoreCurrentElement = false;
|
||||
var out = bind(buf, buf.push);
|
||||
return {
|
||||
start: function(tag, attrs) {
|
||||
tag = lowercase(tag);
|
||||
if (!ignoreCurrentElement && blockedElements[tag]) {
|
||||
ignoreCurrentElement = tag;
|
||||
}
|
||||
if (!ignoreCurrentElement && validElements[tag] === true) {
|
||||
out('<');
|
||||
out(tag);
|
||||
forEach(attrs, function(value, key) {
|
||||
var lkey = lowercase(key);
|
||||
var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background');
|
||||
if (validAttrs[lkey] === true &&
|
||||
(uriAttrs[lkey] !== true || uriValidator(value, isImage))) {
|
||||
out(' ');
|
||||
out(key);
|
||||
out('="');
|
||||
out(encodeEntities(value));
|
||||
out('"');
|
||||
}
|
||||
});
|
||||
out('>');
|
||||
}
|
||||
},
|
||||
end: function(tag) {
|
||||
tag = lowercase(tag);
|
||||
if (!ignoreCurrentElement && validElements[tag] === true && voidElements[tag] !== true) {
|
||||
out('</');
|
||||
out(tag);
|
||||
out('>');
|
||||
}
|
||||
// eslint-disable-next-line eqeqeq
|
||||
if (tag == ignoreCurrentElement) {
|
||||
ignoreCurrentElement = false;
|
||||
}
|
||||
},
|
||||
chars: function(chars) {
|
||||
if (!ignoreCurrentElement) {
|
||||
out(encodeEntities(chars));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1' attribute to declare
|
||||
* ns1 namespace and prefixes the attribute with 'ns1' (e.g. 'ns1:xlink:foo'). This is undesirable since we don't want
|
||||
* to allow any of these custom attributes. This method strips them all.
|
||||
*
|
||||
* @param node Root element to process
|
||||
*/
|
||||
function stripCustomNsAttrs(node) {
|
||||
while (node) {
|
||||
if (node.nodeType === window.Node.ELEMENT_NODE) {
|
||||
var attrs = node.attributes;
|
||||
for (var i = 0, l = attrs.length; i < l; i++) {
|
||||
var attrNode = attrs[i];
|
||||
var attrName = attrNode.name.toLowerCase();
|
||||
if (attrName === 'xmlns:ns1' || attrName.lastIndexOf('ns1:', 0) === 0) {
|
||||
node.removeAttributeNode(attrNode);
|
||||
i--;
|
||||
l--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var nextNode = node.firstChild;
|
||||
if (nextNode) {
|
||||
stripCustomNsAttrs(nextNode);
|
||||
}
|
||||
|
||||
node = getNonDescendant('nextSibling', node);
|
||||
}
|
||||
}
|
||||
|
||||
function getNonDescendant(propName, node) {
|
||||
// An element is clobbered if its `propName` property points to one of its descendants
|
||||
var nextNode = node[propName];
|
||||
if (nextNode && nodeContains.call(node, nextNode)) {
|
||||
throw $sanitizeMinErr('elclob', 'Failed to sanitize html because the element is clobbered: {0}', node.outerHTML || node.outerText);
|
||||
}
|
||||
return nextNode;
|
||||
}
|
||||
}
|
||||
|
||||
function sanitizeText(chars) {
|
||||
var buf = [];
|
||||
var writer = htmlSanitizeWriter(buf, noop);
|
||||
writer.chars(chars);
|
||||
return buf.join('');
|
||||
}
|
||||
|
||||
|
||||
// define ngSanitize module and register $sanitize service
|
||||
angular.module('ngSanitize', [])
|
||||
.provider('$sanitize', $SanitizeProvider)
|
||||
.info({ angularVersion: '1.6.6' });
|
||||
|
||||
/**
|
||||
* @ngdoc filter
|
||||
* @name linky
|
||||
* @kind function
|
||||
*
|
||||
* @description
|
||||
* Finds links in text input and turns them into html links. Supports `http/https/ftp/mailto` and
|
||||
* plain email address links.
|
||||
*
|
||||
* Requires the {@link ngSanitize `ngSanitize`} module to be installed.
|
||||
*
|
||||
* @param {string} text Input text.
|
||||
* @param {string} target Window (`_blank|_self|_parent|_top`) or named frame to open links in.
|
||||
* @param {object|function(url)} [attributes] Add custom attributes to the link element.
|
||||
*
|
||||
* Can be one of:
|
||||
*
|
||||
* - `object`: A map of attributes
|
||||
* - `function`: Takes the url as a parameter and returns a map of attributes
|
||||
*
|
||||
* If the map of attributes contains a value for `target`, it overrides the value of
|
||||
* the target parameter.
|
||||
*
|
||||
*
|
||||
* @returns {string} Html-linkified and {@link $sanitize sanitized} text.
|
||||
*
|
||||
* @usage
|
||||
<span ng-bind-html="linky_expression | linky"></span>
|
||||
*
|
||||
* @example
|
||||
<example module="linkyExample" deps="angular-sanitize.js" name="linky-filter">
|
||||
<file name="index.html">
|
||||
<div ng-controller="ExampleController">
|
||||
Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Filter</th>
|
||||
<th>Source</th>
|
||||
<th>Rendered</th>
|
||||
</tr>
|
||||
<tr id="linky-filter">
|
||||
<td>linky filter</td>
|
||||
<td>
|
||||
<pre><div ng-bind-html="snippet | linky"><br></div></pre>
|
||||
</td>
|
||||
<td>
|
||||
<div ng-bind-html="snippet | linky"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="linky-target">
|
||||
<td>linky target</td>
|
||||
<td>
|
||||
<pre><div ng-bind-html="snippetWithSingleURL | linky:'_blank'"><br></div></pre>
|
||||
</td>
|
||||
<td>
|
||||
<div ng-bind-html="snippetWithSingleURL | linky:'_blank'"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="linky-custom-attributes">
|
||||
<td>linky custom attributes</td>
|
||||
<td>
|
||||
<pre><div ng-bind-html="snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}"><br></div></pre>
|
||||
</td>
|
||||
<td>
|
||||
<div ng-bind-html="snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="escaped-html">
|
||||
<td>no filter</td>
|
||||
<td><pre><div ng-bind="snippet"><br></div></pre></td>
|
||||
<td><div ng-bind="snippet"></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
</file>
|
||||
<file name="script.js">
|
||||
angular.module('linkyExample', ['ngSanitize'])
|
||||
.controller('ExampleController', ['$scope', function($scope) {
|
||||
$scope.snippet =
|
||||
'Pretty text with some links:\n' +
|
||||
'http://angularjs.org/,\n' +
|
||||
'mailto:us@somewhere.org,\n' +
|
||||
'another@somewhere.org,\n' +
|
||||
'and one more: ftp://127.0.0.1/.';
|
||||
$scope.snippetWithSingleURL = 'http://angularjs.org/';
|
||||
}]);
|
||||
</file>
|
||||
<file name="protractor.js" type="protractor">
|
||||
it('should linkify the snippet with urls', function() {
|
||||
expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
|
||||
toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' +
|
||||
'another@somewhere.org, and one more: ftp://127.0.0.1/.');
|
||||
expect(element.all(by.css('#linky-filter a')).count()).toEqual(4);
|
||||
});
|
||||
|
||||
it('should not linkify snippet without the linky filter', function() {
|
||||
expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()).
|
||||
toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' +
|
||||
'another@somewhere.org, and one more: ftp://127.0.0.1/.');
|
||||
expect(element.all(by.css('#escaped-html a')).count()).toEqual(0);
|
||||
});
|
||||
|
||||
it('should update', function() {
|
||||
element(by.model('snippet')).clear();
|
||||
element(by.model('snippet')).sendKeys('new http://link.');
|
||||
expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
|
||||
toBe('new http://link.');
|
||||
expect(element.all(by.css('#linky-filter a')).count()).toEqual(1);
|
||||
expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText())
|
||||
.toBe('new http://link.');
|
||||
});
|
||||
|
||||
it('should work with the target property', function() {
|
||||
expect(element(by.id('linky-target')).
|
||||
element(by.binding("snippetWithSingleURL | linky:'_blank'")).getText()).
|
||||
toBe('http://angularjs.org/');
|
||||
expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank');
|
||||
});
|
||||
|
||||
it('should optionally add custom attributes', function() {
|
||||
expect(element(by.id('linky-custom-attributes')).
|
||||
element(by.binding("snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}")).getText()).
|
||||
toBe('http://angularjs.org/');
|
||||
expect(element(by.css('#linky-custom-attributes a')).getAttribute('rel')).toEqual('nofollow');
|
||||
});
|
||||
</file>
|
||||
</example>
|
||||
*/
|
||||
angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
|
||||
var LINKY_URL_REGEXP =
|
||||
/((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i,
|
||||
MAILTO_REGEXP = /^mailto:/i;
|
||||
|
||||
var linkyMinErr = angular.$$minErr('linky');
|
||||
var isDefined = angular.isDefined;
|
||||
var isFunction = angular.isFunction;
|
||||
var isObject = angular.isObject;
|
||||
var isString = angular.isString;
|
||||
|
||||
return function(text, target, attributes) {
|
||||
if (text == null || text === '') return text;
|
||||
if (!isString(text)) throw linkyMinErr('notstring', 'Expected string but received: {0}', text);
|
||||
|
||||
var attributesFn =
|
||||
isFunction(attributes) ? attributes :
|
||||
isObject(attributes) ? function getAttributesObject() {return attributes;} :
|
||||
function getEmptyAttributesObject() {return {};};
|
||||
|
||||
var match;
|
||||
var raw = text;
|
||||
var html = [];
|
||||
var url;
|
||||
var i;
|
||||
while ((match = raw.match(LINKY_URL_REGEXP))) {
|
||||
// We can not end in these as they are sometimes found at the end of the sentence
|
||||
url = match[0];
|
||||
// if we did not match ftp/http/www/mailto then assume mailto
|
||||
if (!match[2] && !match[4]) {
|
||||
url = (match[3] ? 'http://' : 'mailto:') + url;
|
||||
}
|
||||
i = match.index;
|
||||
addText(raw.substr(0, i));
|
||||
addLink(url, match[0].replace(MAILTO_REGEXP, ''));
|
||||
raw = raw.substring(i + match[0].length);
|
||||
}
|
||||
addText(raw);
|
||||
return $sanitize(html.join(''));
|
||||
|
||||
function addText(text) {
|
||||
if (!text) {
|
||||
return;
|
||||
}
|
||||
html.push(sanitizeText(text));
|
||||
}
|
||||
|
||||
function addLink(url, text) {
|
||||
var key, linkAttributes = attributesFn(url);
|
||||
html.push('<a ');
|
||||
|
||||
for (key in linkAttributes) {
|
||||
html.push(key + '="' + linkAttributes[key] + '" ');
|
||||
}
|
||||
|
||||
if (isDefined(target) && !('target' in linkAttributes)) {
|
||||
html.push('target="',
|
||||
target,
|
||||
'" ');
|
||||
}
|
||||
html.push('href="',
|
||||
url.replace(/"/g, '"'),
|
||||
'">');
|
||||
addText(text);
|
||||
html.push('</a>');
|
||||
}
|
||||
};
|
||||
}]);
|
||||
|
||||
|
||||
})(window, window.angular);
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
AngularJS v1.6.6
|
||||
(c) 2010-2017 Google, Inc. http://angularjs.org
|
||||
License: MIT
|
||||
*/
|
||||
(function(s,d){'use strict';function J(d){var k=[];w(k,B).chars(d);return k.join("")}var x=d.$$minErr("$sanitize"),C,k,D,E,p,B,F,G,w;d.module("ngSanitize",[]).provider("$sanitize",function(){function g(a,e){var c={},b=a.split(","),f;for(f=0;f<b.length;f++)c[e?p(b[f]):b[f]]=!0;return c}function K(a){for(var e={},c=0,b=a.length;c<b;c++){var f=a[c];e[f.name]=f.value}return e}function H(a){return a.replace(/&/g,"&").replace(L,function(a){var c=a.charCodeAt(0);a=a.charCodeAt(1);return"&#"+(1024*(c-
|
||||
55296)+(a-56320)+65536)+";"}).replace(M,function(a){return"&#"+a.charCodeAt(0)+";"}).replace(/</g,"<").replace(/>/g,">")}function I(a){for(;a;){if(a.nodeType===s.Node.ELEMENT_NODE)for(var e=a.attributes,c=0,b=e.length;c<b;c++){var f=e[c],h=f.name.toLowerCase();if("xmlns:ns1"===h||0===h.lastIndexOf("ns1:",0))a.removeAttributeNode(f),c--,b--}(e=a.firstChild)&&I(e);a=t("nextSibling",a)}}function t(a,e){var c=e[a];if(c&&F.call(e,c))throw x("elclob",e.outerHTML||e.outerText);return c}var y=!1;this.$get=
|
||||
["$$sanitizeUri",function(a){y&&k(n,z);return function(e){var c=[];G(e,w(c,function(b,c){return!/^unsafe:/.test(a(b,c))}));return c.join("")}}];this.enableSvg=function(a){return E(a)?(y=a,this):y};C=d.bind;k=d.extend;D=d.forEach;E=d.isDefined;p=d.lowercase;B=d.noop;G=function(a,e){null===a||void 0===a?a="":"string"!==typeof a&&(a=""+a);var c=u(a);if(!c)return"";var b=5;do{if(0===b)throw x("uinput");b--;a=c.innerHTML;c=u(a)}while(a!==c.innerHTML);for(b=c.firstChild;b;){switch(b.nodeType){case 1:e.start(b.nodeName.toLowerCase(),
|
||||
K(b.attributes));break;case 3:e.chars(b.textContent)}var f;if(!(f=b.firstChild)&&(1===b.nodeType&&e.end(b.nodeName.toLowerCase()),f=t("nextSibling",b),!f))for(;null==f;){b=t("parentNode",b);if(b===c)break;f=t("nextSibling",b);1===b.nodeType&&e.end(b.nodeName.toLowerCase())}b=f}for(;b=c.firstChild;)c.removeChild(b)};w=function(a,e){var c=!1,b=C(a,a.push);return{start:function(a,h){a=p(a);!c&&A[a]&&(c=a);c||!0!==n[a]||(b("<"),b(a),D(h,function(c,h){var d=p(h),g="img"===a&&"src"===d||"background"===
|
||||
d;!0!==v[d]||!0===m[d]&&!e(c,g)||(b(" "),b(h),b('="'),b(H(c)),b('"'))}),b(">"))},end:function(a){a=p(a);c||!0!==n[a]||!0===h[a]||(b("</"),b(a),b(">"));a==c&&(c=!1)},chars:function(a){c||b(H(a))}}};F=s.Node.prototype.contains||function(a){return!!(this.compareDocumentPosition(a)&16)};var L=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,M=/([^#-~ |!])/g,h=g("area,br,col,hr,img,wbr"),q=g("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),l=g("rp,rt"),r=k({},l,q),q=k({},q,g("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul")),
|
||||
l=k({},l,g("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")),z=g("circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,radialGradient,rect,stop,svg,switch,text,title,tspan"),A=g("script,style"),n=k({},h,q,l,r),m=g("background,cite,href,longdesc,src,xlink:href"),r=g("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,valign,value,vspace,width"),
|
||||
l=g("accent-height,accumulate,additive,alphabetic,arabic-form,ascent,baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan",
|
||||
!0),v=k({},m,l,r),u=function(a,e){function c(b){b="<remove></remove>"+b;try{var c=(new a.DOMParser).parseFromString(b,"text/html").body;c.firstChild.remove();return c}catch(e){}}function b(a){d.innerHTML=a;e.documentMode&&I(d);return d}var h;if(e&&e.implementation)h=e.implementation.createHTMLDocument("inert");else throw x("noinert");var d=(h.documentElement||h.getDocumentElement()).querySelector("body");d.innerHTML='<svg><g onload="this.parentNode.remove()"></g></svg>';return d.querySelector("svg")?
|
||||
(d.innerHTML='<svg><p><style><img src="</style><img src=x onerror=alert(1)//">',d.querySelector("svg img")?c:b):function(b){b="<remove></remove>"+b;try{b=encodeURI(b)}catch(c){return}var e=new a.XMLHttpRequest;e.responseType="document";e.open("GET","data:text/html;charset=utf-8,"+b,!1);e.send(null);b=e.response.body;b.firstChild.remove();return b}}(s,s.document)}).info({angularVersion:"1.6.6"});d.module("ngSanitize").filter("linky",["$sanitize",function(g){var k=/((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i,
|
||||
p=/^mailto:/i,s=d.$$minErr("linky"),t=d.isDefined,y=d.isFunction,w=d.isObject,x=d.isString;return function(d,q,l){function r(a){a&&m.push(J(a))}function z(a,d){var c,b=A(a);m.push("<a ");for(c in b)m.push(c+'="'+b[c]+'" ');!t(q)||"target"in b||m.push('target="',q,'" ');m.push('href="',a.replace(/"/g,"""),'">');r(d);m.push("</a>")}if(null==d||""===d)return d;if(!x(d))throw s("notstring",d);for(var A=y(l)?l:w(l)?function(){return l}:function(){return{}},n=d,m=[],v,u;d=n.match(k);)v=d[0],d[2]||
|
||||
d[4]||(v=(d[3]?"http://":"mailto:")+v),u=d.index,r(n.substr(0,u)),z(v,d[0].replace(p,"")),n=n.substring(u+d[0].length);r(n);return g(m.join(""))}}])})(window,window.angular);
|
||||
//# sourceMappingURL=angular-sanitize.min.js.map
|
||||
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"_from": "angular-sanitize@1.6.6",
|
||||
"_id": "angular-sanitize@1.6.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-D9BloZkxUX++zmZZbTJdcrbgYEE=",
|
||||
"_location": "/angular-sanitize",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "angular-sanitize@1.6.6",
|
||||
"name": "angular-sanitize",
|
||||
"escapedName": "angular-sanitize",
|
||||
"rawSpec": "1.6.6",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.6.6"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/angular-sanitize/-/angular-sanitize-1.6.6.tgz",
|
||||
"_shasum": "0fd065a19931517fbece66596d325d72b6e06041",
|
||||
"_spec": "angular-sanitize@1.6.6",
|
||||
"_where": "/home/st/dev/keycloak/themes/src/main",
|
||||
"author": {
|
||||
"name": "Angular Core Team",
|
||||
"email": "angular-core+npm@google.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/angular/angular.js/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "AngularJS module for sanitizing HTML",
|
||||
"homepage": "http://angularjs.org",
|
||||
"jspm": {
|
||||
"shim": {
|
||||
"angular-sanitize": {
|
||||
"deps": [
|
||||
"angular"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"keywords": [
|
||||
"angular",
|
||||
"framework",
|
||||
"browser",
|
||||
"html",
|
||||
"client-side"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "angular-sanitize",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/angular/angular.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"version": "1.6.6"
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*!
|
||||
* angular-translate - v2.15.1 - 2017-03-04
|
||||
*
|
||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
||||
*/
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module unless amdModuleId is set
|
||||
define([], function () {
|
||||
return (factory());
|
||||
});
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node. Does not work with strict CommonJS, but
|
||||
// only CommonJS-like environments that support module.exports,
|
||||
// like Node.
|
||||
module.exports = factory();
|
||||
} else {
|
||||
factory();
|
||||
}
|
||||
}(this, function () {
|
||||
|
||||
$translateUrlLoader.$inject = ['$q', '$http'];
|
||||
angular.module('pascalprecht.translate')
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name pascalprecht.translate.$translateUrlLoader
|
||||
* @requires $q
|
||||
* @requires $http
|
||||
*
|
||||
* @description
|
||||
* Creates a loading function for a typical dynamic url pattern:
|
||||
* "locale.php?lang=en_US", "locale.php?lang=de_DE", "locale.php?language=nl_NL" etc.
|
||||
* Prefixing the specified url, the current requested, language id will be applied
|
||||
* with "?{queryParameter}={key}".
|
||||
* Using this service, the response of these urls must be an object of
|
||||
* key-value pairs.
|
||||
*
|
||||
* @param {object} options Options object, which gets the url, key and
|
||||
* optional queryParameter ('lang' is used by default).
|
||||
*/
|
||||
.factory('$translateUrlLoader', $translateUrlLoader);
|
||||
|
||||
function $translateUrlLoader($q, $http) {
|
||||
|
||||
'use strict';
|
||||
|
||||
return function (options) {
|
||||
|
||||
if (!options || !options.url) {
|
||||
throw new Error('Couldn\'t use urlLoader since no url is given!');
|
||||
}
|
||||
|
||||
var requestParams = {};
|
||||
|
||||
requestParams[options.queryParameter || 'lang'] = options.key;
|
||||
|
||||
return $http(angular.extend({
|
||||
url: options.url,
|
||||
params: requestParams,
|
||||
method: 'GET'
|
||||
}, options.$http))
|
||||
.then(function(result) {
|
||||
return result.data;
|
||||
}, function () {
|
||||
return $q.reject(options.key);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
$translateUrlLoader.displayName = '$translateUrlLoader';
|
||||
return 'pascalprecht.translate';
|
||||
|
||||
}));
|
||||
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* angular-translate - v2.15.1 - 2017-03-04
|
||||
*
|
||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
||||
*/
|
||||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(a,b){"use strict";return function(c){if(!c||!c.url)throw new Error("Couldn't use urlLoader since no url is given!");var d={};return d[c.queryParameter||"lang"]=c.key,b(angular.extend({url:c.url,params:d,method:"GET"},c.$http)).then(function(a){return a.data},function(){return a.reject(c.key)})}}return a.$inject=["$q","$http"],angular.module("pascalprecht.translate").factory("$translateUrlLoader",a),a.displayName="$translateUrlLoader","pascalprecht.translate"});
|
||||
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"_from": "angular-translate-loader-url@2.15.1",
|
||||
"_id": "angular-translate-loader-url@2.15.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-MdZ4WlnYE/59ihmQ2L4Whk/1niQ=",
|
||||
"_location": "/angular-translate-loader-url",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "angular-translate-loader-url@2.15.1",
|
||||
"name": "angular-translate-loader-url",
|
||||
"escapedName": "angular-translate-loader-url",
|
||||
"rawSpec": "2.15.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.15.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/angular-translate-loader-url/-/angular-translate-loader-url-2.15.1.tgz",
|
||||
"_shasum": "31d6785a59d813fe7d8a1990d8be16864ff59e24",
|
||||
"_spec": "angular-translate-loader-url@2.15.1",
|
||||
"_where": "/home/st/dev/keycloak/themes/src/main",
|
||||
"author": {
|
||||
"name": "Pascal Precht"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/angular-translate/angular-translate/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"angular-translate": "~2.15.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Creates a loading function for a typical dynamic url pattern: \"locale.php?lang=en_US\", \"locale.php?lang=de_DE\", \"locale.php?language=nl_NL\" etc. Prefixing the specified url, the current requested, language id will be applied with \"?{queryParameter}={key}\". Using this service, the response of these urls must be an object of key-value pairs.",
|
||||
"homepage": "https://angular-translate.github.io",
|
||||
"keywords": [
|
||||
"angular",
|
||||
"translate",
|
||||
"loader"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "angular-translate-loader-url.js",
|
||||
"name": "angular-translate-loader-url",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/angular-translate/bower-angular-translate-loader-url.git"
|
||||
},
|
||||
"version": "2.15.1"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2017 The angular-translate team and Pascal Precht
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -0,0 +1,50 @@
|
||||
/*!
|
||||
* angular-translate - v2.15.1 - 2017-03-04
|
||||
*
|
||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
||||
*/
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module unless amdModuleId is set
|
||||
define([], function () {
|
||||
return (factory());
|
||||
});
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node. Does not work with strict CommonJS, but
|
||||
// only CommonJS-like environments that support module.exports,
|
||||
// like Node.
|
||||
module.exports = factory();
|
||||
} else {
|
||||
factory();
|
||||
}
|
||||
}(this, function () {
|
||||
|
||||
$translateMissingTranslationHandlerLog.$inject = ['$log'];
|
||||
angular.module('pascalprecht.translate')
|
||||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name pascalprecht.translate.$translateMissingTranslationHandlerLog
|
||||
* @requires $log
|
||||
*
|
||||
* @description
|
||||
* Uses angular's `$log` service to give a warning when trying to translate a
|
||||
* translation id which doesn't exist.
|
||||
*
|
||||
* @returns {function} Handler function
|
||||
*/
|
||||
.factory('$translateMissingTranslationHandlerLog', $translateMissingTranslationHandlerLog);
|
||||
|
||||
function $translateMissingTranslationHandlerLog ($log) {
|
||||
|
||||
'use strict';
|
||||
|
||||
return function (translationId) {
|
||||
$log.warn('Translation for ' + translationId + ' doesn\'t exist');
|
||||
};
|
||||
}
|
||||
|
||||
$translateMissingTranslationHandlerLog.displayName = '$translateMissingTranslationHandlerLog';
|
||||
return 'pascalprecht.translate';
|
||||
|
||||
}));
|
||||
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* angular-translate - v2.15.1 - 2017-03-04
|
||||
*
|
||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
||||
*/
|
||||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(a){"use strict";return function(b){a.warn("Translation for "+b+" doesn't exist")}}return a.$inject=["$log"],angular.module("pascalprecht.translate").factory("$translateMissingTranslationHandlerLog",a),a.displayName="$translateMissingTranslationHandlerLog","pascalprecht.translate"});
|
||||
@@ -0,0 +1,197 @@
|
||||
/*!
|
||||
* angular-translate - v2.15.1 - 2017-03-04
|
||||
*
|
||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
||||
*/
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module unless amdModuleId is set
|
||||
define(["messageformat"], function (a0) {
|
||||
return (factory(a0));
|
||||
});
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node. Does not work with strict CommonJS, but
|
||||
// only CommonJS-like environments that support module.exports,
|
||||
// like Node.
|
||||
module.exports = factory(require("messageformat"));
|
||||
} else {
|
||||
factory(root["MessageFormat"]);
|
||||
}
|
||||
}(this, function (MessageFormat) {
|
||||
|
||||
angular.module('pascalprecht.translate')
|
||||
|
||||
/**
|
||||
* @ngdoc property
|
||||
* @name pascalprecht.translate.TRANSLATE_MF_INTERPOLATION_CACHE
|
||||
* @requires TRANSLATE_MF_INTERPOLATION_CACHE
|
||||
*
|
||||
* @description
|
||||
* Uses MessageFormat.js to interpolate strings against some values.
|
||||
*/
|
||||
.constant('TRANSLATE_MF_INTERPOLATION_CACHE', '$translateMessageFormatInterpolation')
|
||||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name pascalprecht.translate.$translateMessageFormatInterpolationProvider
|
||||
*
|
||||
* @description
|
||||
* Configurations for $translateMessageFormatInterpolation
|
||||
*/
|
||||
.provider('$translateMessageFormatInterpolation', $translateMessageFormatInterpolationProvider);
|
||||
|
||||
function $translateMessageFormatInterpolationProvider() {
|
||||
|
||||
'use strict';
|
||||
|
||||
var configurer;
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name pascalprecht.translate.$translateMessageFormatInterpolationProvider#messageFormatConfigurer
|
||||
* @methodOf pascalprecht.translate.$translateMessageFormatInterpolationProvider
|
||||
*
|
||||
* @description
|
||||
* Defines an optional configurer for the MessageFormat instance.
|
||||
*
|
||||
* Note: This hook will be called whenever a new instance of MessageFormat will be created.
|
||||
*
|
||||
* @param {function} fn callback with the instance as argument
|
||||
*/
|
||||
this.messageFormatConfigurer = function (fn) {
|
||||
configurer = fn;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name pascalprecht.translate.$translateMessageFormatInterpolation
|
||||
* @requires pascalprecht.translate.TRANSLATE_MF_INTERPOLATION_CACHE
|
||||
*
|
||||
* @description
|
||||
* Uses MessageFormat.js to interpolate strings against some values.
|
||||
*
|
||||
* Be aware to configure a proper sanitization strategy.
|
||||
*
|
||||
* See also:
|
||||
* * {@link pascalprecht.translate.$translateSanitization}
|
||||
* * {@link https://github.com/SlexAxton/messageformat.js}
|
||||
*
|
||||
* @return {object} $translateMessageFormatInterpolation Interpolator service
|
||||
*/
|
||||
this.$get = ['$translateSanitization', '$cacheFactory', 'TRANSLATE_MF_INTERPOLATION_CACHE', function ($translateSanitization, $cacheFactory, TRANSLATE_MF_INTERPOLATION_CACHE) {
|
||||
return $translateMessageFormatInterpolation($translateSanitization, $cacheFactory, TRANSLATE_MF_INTERPOLATION_CACHE, configurer);
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
function $translateMessageFormatInterpolation($translateSanitization, $cacheFactory, TRANSLATE_MF_INTERPOLATION_CACHE, messageFormatConfigurer) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var $translateInterpolator = {},
|
||||
$cache = $cacheFactory.get(TRANSLATE_MF_INTERPOLATION_CACHE),
|
||||
// instantiate with default locale (which is 'en')
|
||||
$mf = new MessageFormat('en'),
|
||||
$identifier = 'messageformat';
|
||||
|
||||
if (angular.isFunction(messageFormatConfigurer)) {
|
||||
messageFormatConfigurer($mf);
|
||||
}
|
||||
|
||||
if (!$cache) {
|
||||
// create cache if it doesn't exist already
|
||||
$cache = $cacheFactory(TRANSLATE_MF_INTERPOLATION_CACHE);
|
||||
}
|
||||
|
||||
$cache.put('en', $mf);
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name pascalprecht.translate.$translateMessageFormatInterpolation#setLocale
|
||||
* @methodOf pascalprecht.translate.$translateMessageFormatInterpolation
|
||||
*
|
||||
* @description
|
||||
* Sets current locale (this is currently not use in this interpolation).
|
||||
*
|
||||
* @param {string} locale Language key or locale.
|
||||
*/
|
||||
$translateInterpolator.setLocale = function (locale) {
|
||||
$mf = $cache.get(locale);
|
||||
if (!$mf) {
|
||||
$mf = new MessageFormat(locale);
|
||||
if (angular.isFunction(messageFormatConfigurer)) {
|
||||
messageFormatConfigurer($mf);
|
||||
}
|
||||
$cache.put(locale, $mf);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name pascalprecht.translate.$translateMessageFormatInterpolation#getInterpolationIdentifier
|
||||
* @methodOf pascalprecht.translate.$translateMessageFormatInterpolation
|
||||
*
|
||||
* @description
|
||||
* Returns an identifier for this interpolation service.
|
||||
*
|
||||
* @returns {string} $identifier
|
||||
*/
|
||||
$translateInterpolator.getInterpolationIdentifier = function () {
|
||||
return $identifier;
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in 3.0
|
||||
* @see {@link pascalprecht.translate.$translateSanitization}
|
||||
*/
|
||||
$translateInterpolator.useSanitizeValueStrategy = function (value) {
|
||||
$translateSanitization.useStrategy(value);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name pascalprecht.translate.$translateMessageFormatInterpolation#interpolate
|
||||
* @methodOf pascalprecht.translate.$translateMessageFormatInterpolation
|
||||
*
|
||||
* @description
|
||||
* Interpolates given string against given interpolate params using MessageFormat.js.
|
||||
*
|
||||
* @returns {string} interpolated string.
|
||||
*/
|
||||
$translateInterpolator.interpolate = function (string, interpolationParams, context, sanitizeStrategy) {
|
||||
interpolationParams = interpolationParams || {};
|
||||
interpolationParams = $translateSanitization.sanitize(interpolationParams, 'params', sanitizeStrategy);
|
||||
|
||||
var compiledFunction = $cache.get('mf:' + string);
|
||||
|
||||
// if given string wasn't compiled yet, we do so now and never have to do it again
|
||||
if (!compiledFunction) {
|
||||
|
||||
// Ensure explicit type if possible
|
||||
// MessageFormat checks the actual type (i.e. for amount based conditions)
|
||||
for (var key in interpolationParams) {
|
||||
if (interpolationParams.hasOwnProperty(key)) {
|
||||
// ensure number
|
||||
var number = parseInt(interpolationParams[key], 10);
|
||||
if (angular.isNumber(number) && ('' + number) === interpolationParams[key]) {
|
||||
interpolationParams[key] = number;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
compiledFunction = $mf.compile(string);
|
||||
$cache.put('mf:' + string, compiledFunction);
|
||||
}
|
||||
|
||||
var interpolatedText = compiledFunction(interpolationParams);
|
||||
return $translateSanitization.sanitize(interpolatedText, 'text', sanitizeStrategy);
|
||||
};
|
||||
|
||||
return $translateInterpolator;
|
||||
}
|
||||
|
||||
$translateMessageFormatInterpolation.displayName = '$translateMessageFormatInterpolation';
|
||||
return 'pascalprecht.translate';
|
||||
|
||||
}));
|
||||
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* angular-translate - v2.15.1 - 2017-03-04
|
||||
*
|
||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
||||
*/
|
||||
!function(a,b){"function"==typeof define&&define.amd?define(["messageformat"],function(a){return b(a)}):"object"==typeof exports?module.exports=b(require("messageformat")):b(a.MessageFormat)}(this,function(a){function b(){"use strict";var a;this.messageFormatConfigurer=function(b){a=b},this.$get=["$translateSanitization","$cacheFactory","TRANSLATE_MF_INTERPOLATION_CACHE",function(b,d,e){return c(b,d,e,a)}]}function c(b,c,d,e){"use strict";var f={},g=c.get(d),h=new a("en"),i="messageformat";return angular.isFunction(e)&&e(h),g||(g=c(d)),g.put("en",h),f.setLocale=function(b){h=g.get(b),h||(h=new a(b),angular.isFunction(e)&&e(h),g.put(b,h))},f.getInterpolationIdentifier=function(){return i},f.useSanitizeValueStrategy=function(a){return b.useStrategy(a),this},f.interpolate=function(a,c,d,e){c=c||{},c=b.sanitize(c,"params",e);var f=g.get("mf:"+a);if(!f){for(var i in c)if(c.hasOwnProperty(i)){var j=parseInt(c[i],10);angular.isNumber(j)&&""+j===c[i]&&(c[i]=j)}f=h.compile(a),g.put("mf:"+a,f)}var k=f(c);return b.sanitize(k,"text",e)},f}return angular.module("pascalprecht.translate").constant("TRANSLATE_MF_INTERPOLATION_CACHE","$translateMessageFormatInterpolation").provider("$translateMessageFormatInterpolation",b),c.displayName="$translateMessageFormatInterpolation","pascalprecht.translate"});
|
||||
@@ -0,0 +1,557 @@
|
||||
/*!
|
||||
* angular-translate - v2.15.1 - 2017-03-04
|
||||
*
|
||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
||||
*/
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module unless amdModuleId is set
|
||||
define([], function () {
|
||||
return (factory());
|
||||
});
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node. Does not work with strict CommonJS, but
|
||||
// only CommonJS-like environments that support module.exports,
|
||||
// like Node.
|
||||
module.exports = factory();
|
||||
} else {
|
||||
factory();
|
||||
}
|
||||
}(this, function () {
|
||||
|
||||
angular.module('pascalprecht.translate')
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name pascalprecht.translate.$translatePartialLoaderProvider
|
||||
*
|
||||
* @description
|
||||
* By using a $translatePartialLoaderProvider you can configure a list of a needed
|
||||
* translation parts directly during the configuration phase of your application's
|
||||
* lifetime. All parts you add by using this provider would be loaded by
|
||||
* angular-translate at the startup as soon as possible.
|
||||
*/
|
||||
.provider('$translatePartialLoader', $translatePartialLoader);
|
||||
|
||||
function $translatePartialLoader() {
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @name Part
|
||||
*
|
||||
* @description
|
||||
* Represents Part object to add and set parts at runtime.
|
||||
*/
|
||||
function Part(name, priority) {
|
||||
this.name = name;
|
||||
this.isActive = true;
|
||||
this.tables = {};
|
||||
this.priority = priority || 0;
|
||||
this.langPromises = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* @name parseUrl
|
||||
* @method
|
||||
*
|
||||
* @description
|
||||
* Returns a parsed url template string and replaces given target lang
|
||||
* and part name it.
|
||||
*
|
||||
* @param {string|function} urlTemplate - Either a string containing an url pattern (with
|
||||
* '{part}' and '{lang}') or a function(part, lang)
|
||||
* returning a string.
|
||||
* @param {string} targetLang - Language key for language to be used.
|
||||
* @return {string} Parsed url template string
|
||||
*/
|
||||
Part.prototype.parseUrl = function (urlTemplate, targetLang) {
|
||||
if (angular.isFunction(urlTemplate)) {
|
||||
return urlTemplate(this.name, targetLang);
|
||||
}
|
||||
return urlTemplate.replace(/\{part\}/g, this.name).replace(/\{lang\}/g, targetLang);
|
||||
};
|
||||
|
||||
Part.prototype.getTable = function (lang, $q, $http, $httpOptions, urlTemplate, errorHandler) {
|
||||
|
||||
//locals
|
||||
var self = this;
|
||||
var lastLangPromise = this.langPromises[lang];
|
||||
var deferred = $q.defer();
|
||||
|
||||
//private helper helpers
|
||||
var fetchData = function () {
|
||||
return $http(
|
||||
angular.extend({
|
||||
method : 'GET',
|
||||
url : self.parseUrl(urlTemplate, lang)
|
||||
},
|
||||
$httpOptions)
|
||||
);
|
||||
};
|
||||
|
||||
//private helper
|
||||
var handleNewData = function (data) {
|
||||
self.tables[lang] = data;
|
||||
deferred.resolve(data);
|
||||
};
|
||||
|
||||
//private helper
|
||||
var rejectDeferredWithPartName = function () {
|
||||
deferred.reject(self.name);
|
||||
};
|
||||
|
||||
//private helper
|
||||
var tryGettingThisTable = function () {
|
||||
//data fetching logic
|
||||
fetchData().then(
|
||||
function (result) {
|
||||
handleNewData(result.data);
|
||||
},
|
||||
function (errorResponse) {
|
||||
if (errorHandler) {
|
||||
errorHandler(self.name, lang, errorResponse).then(handleNewData, rejectDeferredWithPartName);
|
||||
} else {
|
||||
rejectDeferredWithPartName();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
//loading logic
|
||||
if (!this.tables[lang]) {
|
||||
//let's try loading the data
|
||||
if (!lastLangPromise) {
|
||||
//this is the first request - just go ahead and hit the server
|
||||
tryGettingThisTable();
|
||||
} else {
|
||||
//this is an additional request after one or more unfinished or failed requests
|
||||
//chain the deferred off the previous request's promise so that this request conditionally executes
|
||||
//if the previous request succeeds then the result will be passed through, but if it fails then this request will try again and hit the server
|
||||
lastLangPromise.then(deferred.resolve, tryGettingThisTable);
|
||||
}
|
||||
//retain a reference to the last promise so we can continue the chain if another request is made before any succeed
|
||||
//you can picture the promise chain as a singly-linked list (formed by the .then handler queues) that's traversed by the execution context
|
||||
this.langPromises[lang] = deferred.promise;
|
||||
}
|
||||
else {
|
||||
//the part has already been loaded - if lastLangPromise is also undefined then the table has been populated using setPart
|
||||
//this breaks the promise chain because we're not tying langDeferred's outcome to a previous call's promise handler queues, but we don't care because there's no asynchronous execution context to keep track of anymore
|
||||
deferred.resolve(this.tables[lang]);
|
||||
}
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
var parts = {};
|
||||
|
||||
function hasPart(name) {
|
||||
return Object.prototype.hasOwnProperty.call(parts, name);
|
||||
}
|
||||
|
||||
function isStringValid(str) {
|
||||
return angular.isString(str) && str !== '';
|
||||
}
|
||||
|
||||
function isPartAvailable(name) {
|
||||
if (!isStringValid(name)) {
|
||||
throw new TypeError('Invalid type of a first argument, a non-empty string expected.');
|
||||
}
|
||||
|
||||
return (hasPart(name) && parts[name].isActive);
|
||||
}
|
||||
|
||||
function deepExtend(dst, src) {
|
||||
for (var property in src) {
|
||||
if (src[property] && src[property].constructor &&
|
||||
src[property].constructor === Object) {
|
||||
dst[property] = dst[property] || {};
|
||||
deepExtend(dst[property], src[property]);
|
||||
} else {
|
||||
dst[property] = src[property];
|
||||
}
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
function getPrioritizedParts() {
|
||||
var prioritizedParts = [];
|
||||
for (var part in parts) {
|
||||
if (parts[part].isActive) {
|
||||
prioritizedParts.push(parts[part]);
|
||||
}
|
||||
}
|
||||
prioritizedParts.sort(function (a, b) {
|
||||
return a.priority - b.priority;
|
||||
});
|
||||
return prioritizedParts;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name pascalprecht.translate.$translatePartialLoaderProvider#addPart
|
||||
* @methodOf pascalprecht.translate.$translatePartialLoaderProvider
|
||||
*
|
||||
* @description
|
||||
* Registers a new part of the translation table to be loaded once the
|
||||
* `angular-translate` gets into runtime phase. It does not actually load any
|
||||
* translation data, but only registers a part to be loaded in the future.
|
||||
*
|
||||
* @param {string} name A name of the part to add
|
||||
* @param {int} [priority=0] Sets the load priority of this part.
|
||||
*
|
||||
* @returns {object} $translatePartialLoaderProvider, so this method is chainable
|
||||
* @throws {TypeError} The method could throw a **TypeError** if you pass the param
|
||||
* of the wrong type. Please, note that the `name` param has to be a
|
||||
* non-empty **string**.
|
||||
*/
|
||||
this.addPart = function (name, priority) {
|
||||
if (!isStringValid(name)) {
|
||||
throw new TypeError('Couldn\'t add part, part name has to be a string!');
|
||||
}
|
||||
|
||||
if (!hasPart(name)) {
|
||||
parts[name] = new Part(name, priority);
|
||||
}
|
||||
parts[name].isActive = true;
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ngdocs function
|
||||
* @name pascalprecht.translate.$translatePartialLoaderProvider#setPart
|
||||
* @methodOf pascalprecht.translate.$translatePartialLoaderProvider
|
||||
*
|
||||
* @description
|
||||
* Sets a translation table to the specified part. This method does not make the
|
||||
* specified part available, but only avoids loading this part from the server.
|
||||
*
|
||||
* @param {string} lang A language of the given translation table
|
||||
* @param {string} part A name of the target part
|
||||
* @param {object} table A translation table to set to the specified part
|
||||
*
|
||||
* @return {object} $translatePartialLoaderProvider, so this method is chainable
|
||||
* @throws {TypeError} The method could throw a **TypeError** if you pass params
|
||||
* of the wrong type. Please, note that the `lang` and `part` params have to be a
|
||||
* non-empty **string**s and the `table` param has to be an object.
|
||||
*/
|
||||
this.setPart = function (lang, part, table) {
|
||||
if (!isStringValid(lang)) {
|
||||
throw new TypeError('Couldn\'t set part.`lang` parameter has to be a string!');
|
||||
}
|
||||
if (!isStringValid(part)) {
|
||||
throw new TypeError('Couldn\'t set part.`part` parameter has to be a string!');
|
||||
}
|
||||
if (typeof table !== 'object' || table === null) {
|
||||
throw new TypeError('Couldn\'t set part. `table` parameter has to be an object!');
|
||||
}
|
||||
|
||||
if (!hasPart(part)) {
|
||||
parts[part] = new Part(part);
|
||||
parts[part].isActive = false;
|
||||
}
|
||||
|
||||
parts[part].tables[lang] = table;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name pascalprecht.translate.$translatePartialLoaderProvider#deletePart
|
||||
* @methodOf pascalprecht.translate.$translatePartialLoaderProvider
|
||||
*
|
||||
* @description
|
||||
* Removes the previously added part of the translation data. So, `angular-translate` will not
|
||||
* load it at the startup.
|
||||
*
|
||||
* @param {string} name A name of the part to delete
|
||||
*
|
||||
* @returns {object} $translatePartialLoaderProvider, so this method is chainable
|
||||
*
|
||||
* @throws {TypeError} The method could throw a **TypeError** if you pass the param of the wrong
|
||||
* type. Please, note that the `name` param has to be a non-empty **string**.
|
||||
*/
|
||||
this.deletePart = function (name) {
|
||||
if (!isStringValid(name)) {
|
||||
throw new TypeError('Couldn\'t delete part, first arg has to be string.');
|
||||
}
|
||||
|
||||
if (hasPart(name)) {
|
||||
parts[name].isActive = false;
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name pascalprecht.translate.$translatePartialLoaderProvider#isPartAvailable
|
||||
* @methodOf pascalprecht.translate.$translatePartialLoaderProvider
|
||||
*
|
||||
* @description
|
||||
* Checks if the specific part is available. A part becomes available after it was added by the
|
||||
* `addPart` method. Available parts would be loaded from the server once the `angular-translate`
|
||||
* asks the loader to that.
|
||||
*
|
||||
* @param {string} name A name of the part to check
|
||||
*
|
||||
* @returns {boolean} Returns **true** if the part is available now and **false** if not.
|
||||
*
|
||||
* @throws {TypeError} The method could throw a **TypeError** if you pass the param of the wrong
|
||||
* type. Please, note that the `name` param has to be a non-empty **string**.
|
||||
*/
|
||||
this.isPartAvailable = isPartAvailable;
|
||||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name pascalprecht.translate.$translatePartialLoader
|
||||
*
|
||||
* @requires $q
|
||||
* @requires $http
|
||||
* @requires $injector
|
||||
* @requires $rootScope
|
||||
* @requires $translate
|
||||
*
|
||||
* @description
|
||||
*
|
||||
* @param {object} options Options object
|
||||
*
|
||||
* @throws {TypeError}
|
||||
*/
|
||||
this.$get = ['$rootScope', '$injector', '$q', '$http',
|
||||
function ($rootScope, $injector, $q, $http) {
|
||||
|
||||
/**
|
||||
* @ngdoc event
|
||||
* @name pascalprecht.translate.$translatePartialLoader#$translatePartialLoaderStructureChanged
|
||||
* @eventOf pascalprecht.translate.$translatePartialLoader
|
||||
* @eventType broadcast on root scope
|
||||
*
|
||||
* @description
|
||||
* A $translatePartialLoaderStructureChanged event is called when a state of the loader was
|
||||
* changed somehow. It could mean either some part is added or some part is deleted. Anyway when
|
||||
* you get this event the translation table is not longer current and has to be updated.
|
||||
*
|
||||
* @param {string} name A name of the part which is a reason why the event was fired
|
||||
*/
|
||||
|
||||
var service = function (options) {
|
||||
if (!isStringValid(options.key)) {
|
||||
throw new TypeError('Unable to load data, a key is not a non-empty string.');
|
||||
}
|
||||
|
||||
if (!isStringValid(options.urlTemplate) && !angular.isFunction(options.urlTemplate)) {
|
||||
throw new TypeError('Unable to load data, a urlTemplate is not a non-empty string or not a function.');
|
||||
}
|
||||
|
||||
var errorHandler = options.loadFailureHandler;
|
||||
if (errorHandler !== undefined) {
|
||||
if (!angular.isString(errorHandler)) {
|
||||
throw new Error('Unable to load data, a loadFailureHandler is not a string.');
|
||||
} else {
|
||||
errorHandler = $injector.get(errorHandler);
|
||||
}
|
||||
}
|
||||
|
||||
var loaders = [],
|
||||
prioritizedParts = getPrioritizedParts();
|
||||
|
||||
angular.forEach(prioritizedParts, function (part) {
|
||||
loaders.push(
|
||||
part.getTable(options.key, $q, $http, options.$http, options.urlTemplate, errorHandler)
|
||||
);
|
||||
part.urlTemplate = options.urlTemplate;
|
||||
});
|
||||
|
||||
return $q.all(loaders)
|
||||
.then(function () {
|
||||
var table = {};
|
||||
prioritizedParts = getPrioritizedParts();
|
||||
angular.forEach(prioritizedParts, function (part) {
|
||||
deepExtend(table, part.tables[options.key]);
|
||||
});
|
||||
return table;
|
||||
}, function () {
|
||||
return $q.reject(options.key);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name pascalprecht.translate.$translatePartialLoader#addPart
|
||||
* @methodOf pascalprecht.translate.$translatePartialLoader
|
||||
*
|
||||
* @description
|
||||
* Registers a new part of the translation table. This method does not actually perform any xhr
|
||||
* requests to get translation data. The new parts will be loaded in order of priority from the server next time
|
||||
* `angular-translate` asks the loader to load translations.
|
||||
*
|
||||
* @param {string} name A name of the part to add
|
||||
* @param {int} [priority=0] Sets the load priority of this part.
|
||||
*
|
||||
* @returns {object} $translatePartialLoader, so this method is chainable
|
||||
*
|
||||
* @fires {$translatePartialLoaderStructureChanged} The $translatePartialLoaderStructureChanged
|
||||
* event would be fired by this method in case the new part affected somehow on the loaders
|
||||
* state. This way it means that there are a new translation data available to be loaded from
|
||||
* the server.
|
||||
*
|
||||
* @throws {TypeError} The method could throw a **TypeError** if you pass the param of the wrong
|
||||
* type. Please, note that the `name` param has to be a non-empty **string**.
|
||||
*/
|
||||
service.addPart = function (name, priority) {
|
||||
if (!isStringValid(name)) {
|
||||
throw new TypeError('Couldn\'t add part, first arg has to be a string');
|
||||
}
|
||||
|
||||
if (!hasPart(name)) {
|
||||
parts[name] = new Part(name, priority);
|
||||
$rootScope.$emit('$translatePartialLoaderStructureChanged', name);
|
||||
} else if (!parts[name].isActive) {
|
||||
parts[name].isActive = true;
|
||||
$rootScope.$emit('$translatePartialLoaderStructureChanged', name);
|
||||
}
|
||||
|
||||
return service;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name pascalprecht.translate.$translatePartialLoader#deletePart
|
||||
* @methodOf pascalprecht.translate.$translatePartialLoader
|
||||
*
|
||||
* @description
|
||||
* Deletes the previously added part of the translation data. The target part could be deleted
|
||||
* either logically or physically. When the data is deleted logically it is not actually deleted
|
||||
* from the browser, but the loader marks it as not active and prevents it from affecting on the
|
||||
* translations. If the deleted in such way part is added again, the loader will use the
|
||||
* previously loaded data rather than loading it from the server once more time. But if the data
|
||||
* is deleted physically, the loader will completely remove all information about it. So in case
|
||||
* of recycling this part will be loaded from the server again.
|
||||
*
|
||||
* @param {string} name A name of the part to delete
|
||||
* @param {boolean=} [removeData=false] An indicator if the loader has to remove a loaded
|
||||
* translation data physically. If the `removeData` if set to **false** the loaded data will not be
|
||||
* deleted physically and might be reused in the future to prevent an additional xhr requests.
|
||||
*
|
||||
* @returns {object} $translatePartialLoader, so this method is chainable
|
||||
*
|
||||
* @fires {$translatePartialLoaderStructureChanged} The $translatePartialLoaderStructureChanged
|
||||
* event would be fired by this method in case a part deletion process affects somehow on the
|
||||
* loaders state. This way it means that some part of the translation data is now deprecated and
|
||||
* the translation table has to be recompiled with the remaining translation parts.
|
||||
*
|
||||
* @throws {TypeError} The method could throw a **TypeError** if you pass some param of the
|
||||
* wrong type. Please, note that the `name` param has to be a non-empty **string** and
|
||||
* the `removeData` param has to be either **undefined** or **boolean**.
|
||||
*/
|
||||
service.deletePart = function (name, removeData) {
|
||||
if (!isStringValid(name)) {
|
||||
throw new TypeError('Couldn\'t delete part, first arg has to be string');
|
||||
}
|
||||
|
||||
if (removeData === undefined) {
|
||||
removeData = false;
|
||||
} else if (typeof removeData !== 'boolean') {
|
||||
throw new TypeError('Invalid type of a second argument, a boolean expected.');
|
||||
}
|
||||
|
||||
if (hasPart(name)) {
|
||||
var wasActive = parts[name].isActive;
|
||||
if (removeData) {
|
||||
var $translate = $injector.get('$translate');
|
||||
var cache = $translate.loaderCache();
|
||||
if (typeof(cache) === 'string') {
|
||||
// getting on-demand instance of loader
|
||||
cache = $injector.get(cache);
|
||||
}
|
||||
// Purging items from cache...
|
||||
if (typeof(cache) === 'object') {
|
||||
angular.forEach(parts[name].tables, function (value, key) {
|
||||
cache.remove(parts[name].parseUrl(parts[name].urlTemplate, key));
|
||||
});
|
||||
}
|
||||
delete parts[name];
|
||||
} else {
|
||||
parts[name].isActive = false;
|
||||
}
|
||||
if (wasActive) {
|
||||
$rootScope.$emit('$translatePartialLoaderStructureChanged', name);
|
||||
}
|
||||
}
|
||||
|
||||
return service;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name pascalprecht.translate.$translatePartialLoader#isPartLoaded
|
||||
* @methodOf pascalprecht.translate.$translatePartialLoader
|
||||
*
|
||||
* @description
|
||||
* Checks if the registered translation part is loaded into the translation table.
|
||||
*
|
||||
* @param {string} name A name of the part
|
||||
* @param {string} lang A key of the language
|
||||
*
|
||||
* @returns {boolean} Returns **true** if the translation of the part is loaded to the translation table and **false** if not.
|
||||
*
|
||||
* @throws {TypeError} The method could throw a **TypeError** if you pass the param of the wrong
|
||||
* type. Please, note that the `name` and `lang` params have to be non-empty **string**.
|
||||
*/
|
||||
service.isPartLoaded = function (name, lang) {
|
||||
return angular.isDefined(parts[name]) && angular.isDefined(parts[name].tables[lang]);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name pascalprecht.translate.$translatePartialLoader#getRegisteredParts
|
||||
* @methodOf pascalprecht.translate.$translatePartialLoader
|
||||
*
|
||||
* @description
|
||||
* Gets names of the parts that were added with the `addPart`.
|
||||
*
|
||||
* @returns {array} Returns array of registered parts, if none were registered then an empty array is returned.
|
||||
*/
|
||||
service.getRegisteredParts = function () {
|
||||
var registeredParts = [];
|
||||
angular.forEach(parts, function (p) {
|
||||
if (p.isActive) {
|
||||
registeredParts.push(p.name);
|
||||
}
|
||||
});
|
||||
return registeredParts;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name pascalprecht.translate.$translatePartialLoader#isPartAvailable
|
||||
* @methodOf pascalprecht.translate.$translatePartialLoader
|
||||
*
|
||||
* @description
|
||||
* Checks if a target translation part is available. The part becomes available just after it was
|
||||
* added by the `addPart` method. Part's availability does not mean that it was loaded from the
|
||||
* server, but only that it was added to the loader. The available part might be loaded next
|
||||
* time the loader is called.
|
||||
*
|
||||
* @param {string} name A name of the part to delete
|
||||
*
|
||||
* @returns {boolean} Returns **true** if the part is available now and **false** if not.
|
||||
*
|
||||
* @throws {TypeError} The method could throw a **TypeError** if you pass the param of the wrong
|
||||
* type. Please, note that the `name` param has to be a non-empty **string**.
|
||||
*/
|
||||
service.isPartAvailable = isPartAvailable;
|
||||
|
||||
return service;
|
||||
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
$translatePartialLoader.displayName = '$translatePartialLoader';
|
||||
return 'pascalprecht.translate';
|
||||
|
||||
}));
|
||||
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* angular-translate - v2.15.1 - 2017-03-04
|
||||
*
|
||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
||||
*/
|
||||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(){"use strict";function a(a,b){this.name=a,this.isActive=!0,this.tables={},this.priority=b||0,this.langPromises={}}function b(a){return Object.prototype.hasOwnProperty.call(g,a)}function c(a){return angular.isString(a)&&""!==a}function d(a){if(!c(a))throw new TypeError("Invalid type of a first argument, a non-empty string expected.");return b(a)&&g[a].isActive}function e(a,b){for(var c in b)b[c]&&b[c].constructor&&b[c].constructor===Object?(a[c]=a[c]||{},e(a[c],b[c])):a[c]=b[c];return a}function f(){var a=[];for(var b in g)g[b].isActive&&a.push(g[b]);return a.sort(function(a,b){return a.priority-b.priority}),a}a.prototype.parseUrl=function(a,b){return angular.isFunction(a)?a(this.name,b):a.replace(/\{part\}/g,this.name).replace(/\{lang\}/g,b)},a.prototype.getTable=function(a,b,c,d,e,f){var g=this,h=this.langPromises[a],i=b.defer(),j=function(){return c(angular.extend({method:"GET",url:g.parseUrl(e,a)},d))},k=function(b){g.tables[a]=b,i.resolve(b)},l=function(){i.reject(g.name)},m=function(){j().then(function(a){k(a.data)},function(b){f?f(g.name,a,b).then(k,l):l()})};return this.tables[a]?i.resolve(this.tables[a]):(h?h.then(i.resolve,m):m(),this.langPromises[a]=i.promise),i.promise};var g={};this.addPart=function(d,e){if(!c(d))throw new TypeError("Couldn't add part, part name has to be a string!");return b(d)||(g[d]=new a(d,e)),g[d].isActive=!0,this},this.setPart=function(d,e,f){if(!c(d))throw new TypeError("Couldn't set part.`lang` parameter has to be a string!");if(!c(e))throw new TypeError("Couldn't set part.`part` parameter has to be a string!");if("object"!=typeof f||null===f)throw new TypeError("Couldn't set part. `table` parameter has to be an object!");return b(e)||(g[e]=new a(e),g[e].isActive=!1),g[e].tables[d]=f,this},this.deletePart=function(a){if(!c(a))throw new TypeError("Couldn't delete part, first arg has to be string.");return b(a)&&(g[a].isActive=!1),this},this.isPartAvailable=d,this.$get=["$rootScope","$injector","$q","$http",function(h,i,j,k){var l=function(a){if(!c(a.key))throw new TypeError("Unable to load data, a key is not a non-empty string.");if(!c(a.urlTemplate)&&!angular.isFunction(a.urlTemplate))throw new TypeError("Unable to load data, a urlTemplate is not a non-empty string or not a function.");var b=a.loadFailureHandler;if(void 0!==b){if(!angular.isString(b))throw new Error("Unable to load data, a loadFailureHandler is not a string.");b=i.get(b)}var d=[],g=f();return angular.forEach(g,function(c){d.push(c.getTable(a.key,j,k,a.$http,a.urlTemplate,b)),c.urlTemplate=a.urlTemplate}),j.all(d).then(function(){var b={};return g=f(),angular.forEach(g,function(c){e(b,c.tables[a.key])}),b},function(){return j.reject(a.key)})};return l.addPart=function(d,e){if(!c(d))throw new TypeError("Couldn't add part, first arg has to be a string");return b(d)?g[d].isActive||(g[d].isActive=!0,h.$emit("$translatePartialLoaderStructureChanged",d)):(g[d]=new a(d,e),h.$emit("$translatePartialLoaderStructureChanged",d)),l},l.deletePart=function(a,d){if(!c(a))throw new TypeError("Couldn't delete part, first arg has to be string");if(void 0===d)d=!1;else if("boolean"!=typeof d)throw new TypeError("Invalid type of a second argument, a boolean expected.");if(b(a)){var e=g[a].isActive;if(d){var f=i.get("$translate"),j=f.loaderCache();"string"==typeof j&&(j=i.get(j)),"object"==typeof j&&angular.forEach(g[a].tables,function(b,c){j.remove(g[a].parseUrl(g[a].urlTemplate,c))}),delete g[a]}else g[a].isActive=!1;e&&h.$emit("$translatePartialLoaderStructureChanged",a)}return l},l.isPartLoaded=function(a,b){return angular.isDefined(g[a])&&angular.isDefined(g[a].tables[b])},l.getRegisteredParts=function(){var a=[];return angular.forEach(g,function(b){b.isActive&&a.push(b.name)}),a},l.isPartAvailable=d,l}]}return angular.module("pascalprecht.translate").provider("$translatePartialLoader",a),a.displayName="$translatePartialLoader","pascalprecht.translate"});
|
||||
@@ -0,0 +1,112 @@
|
||||
/*!
|
||||
* angular-translate - v2.15.1 - 2017-03-04
|
||||
*
|
||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
||||
*/
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module unless amdModuleId is set
|
||||
define([], function () {
|
||||
return (factory());
|
||||
});
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node. Does not work with strict CommonJS, but
|
||||
// only CommonJS-like environments that support module.exports,
|
||||
// like Node.
|
||||
module.exports = factory();
|
||||
} else {
|
||||
factory();
|
||||
}
|
||||
}(this, function () {
|
||||
|
||||
$translateStaticFilesLoader.$inject = ['$q', '$http'];
|
||||
angular.module('pascalprecht.translate')
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name pascalprecht.translate.$translateStaticFilesLoader
|
||||
* @requires $q
|
||||
* @requires $http
|
||||
*
|
||||
* @description
|
||||
* Creates a loading function for a typical static file url pattern:
|
||||
* "lang-en_US.json", "lang-de_DE.json", etc. Using this builder,
|
||||
* the response of these urls must be an object of key-value pairs.
|
||||
*
|
||||
* @param {object} options Options object, which gets prefix, suffix, key, and fileMap
|
||||
*/
|
||||
.factory('$translateStaticFilesLoader', $translateStaticFilesLoader);
|
||||
|
||||
function $translateStaticFilesLoader($q, $http) {
|
||||
|
||||
'use strict';
|
||||
|
||||
return function (options) {
|
||||
|
||||
if (!options || (!angular.isArray(options.files) && (!angular.isString(options.prefix) || !angular.isString(options.suffix)))) {
|
||||
throw new Error('Couldn\'t load static files, no files and prefix or suffix specified!');
|
||||
}
|
||||
|
||||
if (!options.files) {
|
||||
options.files = [{
|
||||
prefix: options.prefix,
|
||||
suffix: options.suffix
|
||||
}];
|
||||
}
|
||||
|
||||
var load = function (file) {
|
||||
if (!file || (!angular.isString(file.prefix) || !angular.isString(file.suffix))) {
|
||||
throw new Error('Couldn\'t load static file, no prefix or suffix specified!');
|
||||
}
|
||||
|
||||
var fileUrl = [
|
||||
file.prefix,
|
||||
options.key,
|
||||
file.suffix
|
||||
].join('');
|
||||
|
||||
if (angular.isObject(options.fileMap) && options.fileMap[fileUrl]) {
|
||||
fileUrl = options.fileMap[fileUrl];
|
||||
}
|
||||
|
||||
return $http(angular.extend({
|
||||
url: fileUrl,
|
||||
method: 'GET'
|
||||
}, options.$http))
|
||||
.then(function(result) {
|
||||
return result.data;
|
||||
}, function () {
|
||||
return $q.reject(options.key);
|
||||
});
|
||||
};
|
||||
|
||||
var promises = [],
|
||||
length = options.files.length;
|
||||
|
||||
for (var i = 0; i < length; i++) {
|
||||
promises.push(load({
|
||||
prefix: options.files[i].prefix,
|
||||
key: options.key,
|
||||
suffix: options.files[i].suffix
|
||||
}));
|
||||
}
|
||||
|
||||
return $q.all(promises)
|
||||
.then(function (data) {
|
||||
var length = data.length,
|
||||
mergedData = {};
|
||||
|
||||
for (var i = 0; i < length; i++) {
|
||||
for (var key in data[i]) {
|
||||
mergedData[key] = data[i][key];
|
||||
}
|
||||
}
|
||||
|
||||
return mergedData;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
$translateStaticFilesLoader.displayName = '$translateStaticFilesLoader';
|
||||
return 'pascalprecht.translate';
|
||||
|
||||
}));
|
||||
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* angular-translate - v2.15.1 - 2017-03-04
|
||||
*
|
||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
||||
*/
|
||||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(a,b){"use strict";return function(c){if(!(c&&(angular.isArray(c.files)||angular.isString(c.prefix)&&angular.isString(c.suffix))))throw new Error("Couldn't load static files, no files and prefix or suffix specified!");c.files||(c.files=[{prefix:c.prefix,suffix:c.suffix}]);for(var d=function(d){if(!d||!angular.isString(d.prefix)||!angular.isString(d.suffix))throw new Error("Couldn't load static file, no prefix or suffix specified!");var e=[d.prefix,c.key,d.suffix].join("");return angular.isObject(c.fileMap)&&c.fileMap[e]&&(e=c.fileMap[e]),b(angular.extend({url:e,method:"GET"},c.$http)).then(function(a){return a.data},function(){return a.reject(c.key)})},e=[],f=c.files.length,g=0;g<f;g++)e.push(d({prefix:c.files[g].prefix,key:c.key,suffix:c.files[g].suffix}));return a.all(e).then(function(a){for(var b=a.length,c={},d=0;d<b;d++)for(var e in a[d])c[e]=a[d][e];return c})}}return a.$inject=["$q","$http"],angular.module("pascalprecht.translate").factory("$translateStaticFilesLoader",a),a.displayName="$translateStaticFilesLoader","pascalprecht.translate"});
|
||||
@@ -0,0 +1,73 @@
|
||||
/*!
|
||||
* angular-translate - v2.15.1 - 2017-03-04
|
||||
*
|
||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
||||
*/
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module unless amdModuleId is set
|
||||
define([], function () {
|
||||
return (factory());
|
||||
});
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node. Does not work with strict CommonJS, but
|
||||
// only CommonJS-like environments that support module.exports,
|
||||
// like Node.
|
||||
module.exports = factory();
|
||||
} else {
|
||||
factory();
|
||||
}
|
||||
}(this, function () {
|
||||
|
||||
$translateUrlLoader.$inject = ['$q', '$http'];
|
||||
angular.module('pascalprecht.translate')
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name pascalprecht.translate.$translateUrlLoader
|
||||
* @requires $q
|
||||
* @requires $http
|
||||
*
|
||||
* @description
|
||||
* Creates a loading function for a typical dynamic url pattern:
|
||||
* "locale.php?lang=en_US", "locale.php?lang=de_DE", "locale.php?language=nl_NL" etc.
|
||||
* Prefixing the specified url, the current requested, language id will be applied
|
||||
* with "?{queryParameter}={key}".
|
||||
* Using this service, the response of these urls must be an object of
|
||||
* key-value pairs.
|
||||
*
|
||||
* @param {object} options Options object, which gets the url, key and
|
||||
* optional queryParameter ('lang' is used by default).
|
||||
*/
|
||||
.factory('$translateUrlLoader', $translateUrlLoader);
|
||||
|
||||
function $translateUrlLoader($q, $http) {
|
||||
|
||||
'use strict';
|
||||
|
||||
return function (options) {
|
||||
|
||||
if (!options || !options.url) {
|
||||
throw new Error('Couldn\'t use urlLoader since no url is given!');
|
||||
}
|
||||
|
||||
var requestParams = {};
|
||||
|
||||
requestParams[options.queryParameter || 'lang'] = options.key;
|
||||
|
||||
return $http(angular.extend({
|
||||
url: options.url,
|
||||
params: requestParams,
|
||||
method: 'GET'
|
||||
}, options.$http))
|
||||
.then(function(result) {
|
||||
return result.data;
|
||||
}, function () {
|
||||
return $q.reject(options.key);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
$translateUrlLoader.displayName = '$translateUrlLoader';
|
||||
return 'pascalprecht.translate';
|
||||
|
||||
}));
|
||||
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* angular-translate - v2.15.1 - 2017-03-04
|
||||
*
|
||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
||||
*/
|
||||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(a,b){"use strict";return function(c){if(!c||!c.url)throw new Error("Couldn't use urlLoader since no url is given!");var d={};return d[c.queryParameter||"lang"]=c.key,b(angular.extend({url:c.url,params:d,method:"GET"},c.$http)).then(function(a){return a.data},function(){return a.reject(c.key)})}}return a.$inject=["$q","$http"],angular.module("pascalprecht.translate").factory("$translateUrlLoader",a),a.displayName="$translateUrlLoader","pascalprecht.translate"});
|
||||
@@ -0,0 +1,121 @@
|
||||
/*!
|
||||
* angular-translate - v2.15.1 - 2017-03-04
|
||||
*
|
||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
||||
*/
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module unless amdModuleId is set
|
||||
define([], function () {
|
||||
return (factory());
|
||||
});
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node. Does not work with strict CommonJS, but
|
||||
// only CommonJS-like environments that support module.exports,
|
||||
// like Node.
|
||||
module.exports = factory();
|
||||
} else {
|
||||
factory();
|
||||
}
|
||||
}(this, function () {
|
||||
|
||||
$translateCookieStorageFactory.$inject = ['$injector'];
|
||||
angular.module('pascalprecht.translate')
|
||||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name pascalprecht.translate.$translateCookieStorage
|
||||
* @requires $cookieStore
|
||||
*
|
||||
* @description
|
||||
* Abstraction layer for cookieStore. This service is used when telling angular-translate
|
||||
* to use cookieStore as storage.
|
||||
*
|
||||
*/
|
||||
.factory('$translateCookieStorage', $translateCookieStorageFactory);
|
||||
|
||||
function $translateCookieStorageFactory($injector) {
|
||||
|
||||
'use strict';
|
||||
|
||||
// Since AngularJS 1.4, $cookieStore is deprecated
|
||||
var delegate;
|
||||
if (angular.version.major === 1 && angular.version.minor >= 4) {
|
||||
var $cookies = $injector.get('$cookies');
|
||||
delegate = {
|
||||
get : function (key) {
|
||||
return $cookies.get(key);
|
||||
},
|
||||
put : function (key, value) {
|
||||
$cookies.put(key, value);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
var $cookieStore = $injector.get('$cookieStore');
|
||||
delegate = {
|
||||
get : function (key) {
|
||||
return $cookieStore.get(key);
|
||||
},
|
||||
put : function (key, value) {
|
||||
$cookieStore.put(key, value);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var $translateCookieStorage = {
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name pascalprecht.translate.$translateCookieStorage#get
|
||||
* @methodOf pascalprecht.translate.$translateCookieStorage
|
||||
*
|
||||
* @description
|
||||
* Returns an item from cookieStorage by given name.
|
||||
*
|
||||
* @param {string} name Item name
|
||||
* @return {string} Value of item name
|
||||
*/
|
||||
get : function (name) {
|
||||
return delegate.get(name);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name pascalprecht.translate.$translateCookieStorage#set
|
||||
* @methodOf pascalprecht.translate.$translateCookieStorage
|
||||
*
|
||||
* @description
|
||||
* Sets an item in cookieStorage by given name.
|
||||
*
|
||||
* @deprecated use #put
|
||||
*
|
||||
* @param {string} name Item name
|
||||
* @param {string} value Item value
|
||||
*/
|
||||
set : function (name, value) {
|
||||
delegate.put(name, value);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name pascalprecht.translate.$translateCookieStorage#put
|
||||
* @methodOf pascalprecht.translate.$translateCookieStorage
|
||||
*
|
||||
* @description
|
||||
* Sets an item in cookieStorage by given name.
|
||||
*
|
||||
* @param {string} name Item name
|
||||
* @param {string} value Item value
|
||||
*/
|
||||
put : function (name, value) {
|
||||
delegate.put(name, value);
|
||||
}
|
||||
};
|
||||
|
||||
return $translateCookieStorage;
|
||||
}
|
||||
|
||||
$translateCookieStorageFactory.displayName = '$translateCookieStorage';
|
||||
return 'pascalprecht.translate';
|
||||
|
||||
}));
|
||||
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* angular-translate - v2.15.1 - 2017-03-04
|
||||
*
|
||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
||||
*/
|
||||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(a){"use strict";var b;if(1===angular.version.major&&angular.version.minor>=4){var c=a.get("$cookies");b={get:function(a){return c.get(a)},put:function(a,b){c.put(a,b)}}}else{var d=a.get("$cookieStore");b={get:function(a){return d.get(a)},put:function(a,b){d.put(a,b)}}}var e={get:function(a){return b.get(a)},set:function(a,c){b.put(a,c)},put:function(a,c){b.put(a,c)}};return e}return a.$inject=["$injector"],angular.module("pascalprecht.translate").factory("$translateCookieStorage",a),a.displayName="$translateCookieStorage","pascalprecht.translate"});
|
||||
@@ -0,0 +1,123 @@
|
||||
/*!
|
||||
* angular-translate - v2.15.1 - 2017-03-04
|
||||
*
|
||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
||||
*/
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module unless amdModuleId is set
|
||||
define([], function () {
|
||||
return (factory());
|
||||
});
|
||||
} else if (typeof exports === 'object') {
|
||||
// Node. Does not work with strict CommonJS, but
|
||||
// only CommonJS-like environments that support module.exports,
|
||||
// like Node.
|
||||
module.exports = factory();
|
||||
} else {
|
||||
factory();
|
||||
}
|
||||
}(this, function () {
|
||||
|
||||
$translateLocalStorageFactory.$inject = ['$window', '$translateCookieStorage'];
|
||||
angular.module('pascalprecht.translate')
|
||||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name pascalprecht.translate.$translateLocalStorage
|
||||
* @requires $window
|
||||
* @requires $translateCookieStorage
|
||||
*
|
||||
* @description
|
||||
* Abstraction layer for localStorage. This service is used when telling angular-translate
|
||||
* to use localStorage as storage.
|
||||
*
|
||||
*/
|
||||
.factory('$translateLocalStorage', $translateLocalStorageFactory);
|
||||
|
||||
function $translateLocalStorageFactory($window, $translateCookieStorage) {
|
||||
|
||||
'use strict';
|
||||
|
||||
// Setup adapter
|
||||
var localStorageAdapter = (function(){
|
||||
var langKey;
|
||||
return {
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name pascalprecht.translate.$translateLocalStorage#get
|
||||
* @methodOf pascalprecht.translate.$translateLocalStorage
|
||||
*
|
||||
* @description
|
||||
* Returns an item from localStorage by given name.
|
||||
*
|
||||
* @param {string} name Item name
|
||||
* @return {string} Value of item name
|
||||
*/
|
||||
get: function (name) {
|
||||
if(!langKey) {
|
||||
langKey = $window.localStorage.getItem(name);
|
||||
}
|
||||
|
||||
return langKey;
|
||||
},
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name pascalprecht.translate.$translateLocalStorage#set
|
||||
* @methodOf pascalprecht.translate.$translateLocalStorage
|
||||
*
|
||||
* @description
|
||||
* Sets an item in localStorage by given name.
|
||||
*
|
||||
* @deprecated use #put
|
||||
*
|
||||
* @param {string} name Item name
|
||||
* @param {string} value Item value
|
||||
*/
|
||||
set: function (name, value) {
|
||||
langKey=value;
|
||||
$window.localStorage.setItem(name, value);
|
||||
},
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name pascalprecht.translate.$translateLocalStorage#put
|
||||
* @methodOf pascalprecht.translate.$translateLocalStorage
|
||||
*
|
||||
* @description
|
||||
* Sets an item in localStorage by given name.
|
||||
*
|
||||
* @param {string} name Item name
|
||||
* @param {string} value Item value
|
||||
*/
|
||||
put: function (name, value) {
|
||||
langKey=value;
|
||||
$window.localStorage.setItem(name, value);
|
||||
}
|
||||
};
|
||||
}());
|
||||
|
||||
var hasLocalStorageSupport = 'localStorage' in $window;
|
||||
if (hasLocalStorageSupport) {
|
||||
var testKey = 'pascalprecht.translate.storageTest';
|
||||
try {
|
||||
// this check have to be wrapped within a try/catch because on
|
||||
// a SecurityError: Dom Exception 18 on iOS
|
||||
if ($window.localStorage !== null) {
|
||||
$window.localStorage.setItem(testKey, 'foo');
|
||||
$window.localStorage.removeItem(testKey);
|
||||
hasLocalStorageSupport = true;
|
||||
} else {
|
||||
hasLocalStorageSupport = false;
|
||||
}
|
||||
} catch (e){
|
||||
hasLocalStorageSupport = false;
|
||||
}
|
||||
}
|
||||
var $translateLocalStorage = hasLocalStorageSupport ? localStorageAdapter : $translateCookieStorage;
|
||||
return $translateLocalStorage;
|
||||
}
|
||||
|
||||
$translateLocalStorageFactory.displayName = '$translateLocalStorageFactory';
|
||||
return 'pascalprecht.translate';
|
||||
|
||||
}));
|
||||
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* angular-translate - v2.15.1 - 2017-03-04
|
||||
*
|
||||
* Copyright (c) 2017 The angular-translate team, Pascal Precht; Licensed MIT
|
||||
*/
|
||||
!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(a,b){"use strict";var c=function(){var b;return{get:function(c){return b||(b=a.localStorage.getItem(c)),b},set:function(c,d){b=d,a.localStorage.setItem(c,d)},put:function(c,d){b=d,a.localStorage.setItem(c,d)}}}(),d="localStorage"in a;if(d){var e="pascalprecht.translate.storageTest";try{null!==a.localStorage?(a.localStorage.setItem(e,"foo"),a.localStorage.removeItem(e),d=!0):d=!1}catch(a){d=!1}}var f=d?c:b;return f}return a.$inject=["$window","$translateCookieStorage"],angular.module("pascalprecht.translate").factory("$translateLocalStorage",a),a.displayName="$translateLocalStorageFactory","pascalprecht.translate"});
|
||||
@@ -1,46 +1,35 @@
|
||||
{
|
||||
"name": "angular-translate",
|
||||
"version": "2.15.1",
|
||||
"description": "A translation module for AngularJS",
|
||||
"main": "dist/angular-translate.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/angular-translate/angular-translate"
|
||||
"_from": "angular-translate@2.15.1",
|
||||
"_id": "angular-translate@2.15.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-kg99K4d4GeHA+ogXgbm2dfNkgM4=",
|
||||
"_location": "/angular-translate",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "angular-translate@2.15.1",
|
||||
"name": "angular-translate",
|
||||
"escapedName": "angular-translate",
|
||||
"rawSpec": "2.15.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.15.1"
|
||||
},
|
||||
"keywords": [
|
||||
"angular-translate",
|
||||
"angular",
|
||||
"AngularJS",
|
||||
"translation"
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
"/angular-translate-loader-url"
|
||||
],
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"devEngines": {
|
||||
"node": ">=6.9",
|
||||
"npm": ">=3"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "bower install",
|
||||
"check-env": "node node_modules/fbjs-scripts/node/check-dev-engines.js package.json",
|
||||
"shipit": "npm run-script -s check-env && bower install && bower update && grunt prepare-release",
|
||||
"lint": "grunt lint",
|
||||
"test": "npm run-script -s check-env && grunt install-test && grunt test",
|
||||
"test-headless": "npm run-script -s check-env && grunt test-headless",
|
||||
"test-scopes": "npm run-script -s check-env && grunt install-test && for f in test_scopes/*; do TEST_SCOPE=\"`basename $f`\" grunt test; done",
|
||||
"clean-test-scopes": "for f in test_scopes/*; do (cd $f; rm -rf bower_components); done",
|
||||
"compile": "npm run-script -s check-env && grunt compile",
|
||||
"build": "npm run-script -s check-env && grunt build",
|
||||
"build-site": "npm run -s build-site-all-languages; npm run -s build-site-plato-report",
|
||||
"build-site-all-languages": "./build_tools/generate_site.sh",
|
||||
"build-site-by-language": "./build_tools/generate_site_by_language.sh",
|
||||
"build-site-plato-report": "rm -rf ./site/plato && plato -d plato -l .jshintrc src/*.js src/**/*.js && mv plato site",
|
||||
"upload-github-release": "node build_tools/upload-github-release.js",
|
||||
"start-demo": "node build_tools/server.js"
|
||||
},
|
||||
"_resolved": "https://registry.npmjs.org/angular-translate/-/angular-translate-2.15.1.tgz",
|
||||
"_shasum": "920f7d2b877819e1c0fa881781b9b675f36480ce",
|
||||
"_spec": "angular-translate@2.15.1",
|
||||
"_where": "/home/st/dev/keycloak/themes/src/main",
|
||||
"author": {
|
||||
"name": "Pascal Precht"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/angular-translate/angular-translate/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jan Philipp",
|
||||
@@ -54,7 +43,11 @@
|
||||
"name": "Thorsten S"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"angular": ">=1.2.26 <=1.6"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "A translation module for AngularJS",
|
||||
"devDependencies": {
|
||||
"adm-zip": "^0.4.7",
|
||||
"body-parser": "^1.16.0",
|
||||
@@ -101,7 +94,44 @@
|
||||
"serve-favicon": "^2.3.2",
|
||||
"tar.gz": "^1.0.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"angular": ">=1.2.26 <=1.6"
|
||||
}
|
||||
"devEngines": {
|
||||
"node": ">=6.9",
|
||||
"npm": ">=3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"homepage": "https://github.com/angular-translate/angular-translate#readme",
|
||||
"keywords": [
|
||||
"angular-translate",
|
||||
"angular",
|
||||
"AngularJS",
|
||||
"translation"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "dist/angular-translate.js",
|
||||
"name": "angular-translate",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/angular-translate/angular-translate.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run-script -s check-env && grunt build",
|
||||
"build-site": "npm run -s build-site-all-languages; npm run -s build-site-plato-report",
|
||||
"build-site-all-languages": "./build_tools/generate_site.sh",
|
||||
"build-site-by-language": "./build_tools/generate_site_by_language.sh",
|
||||
"build-site-plato-report": "rm -rf ./site/plato && plato -d plato -l .jshintrc src/*.js src/**/*.js && mv plato site",
|
||||
"check-env": "node node_modules/fbjs-scripts/node/check-dev-engines.js package.json",
|
||||
"clean-test-scopes": "for f in test_scopes/*; do (cd $f; rm -rf bower_components); done",
|
||||
"compile": "npm run-script -s check-env && grunt compile",
|
||||
"lint": "grunt lint",
|
||||
"prepublish": "bower install",
|
||||
"shipit": "npm run-script -s check-env && bower install && bower update && grunt prepare-release",
|
||||
"start-demo": "node build_tools/server.js",
|
||||
"test": "npm run-script -s check-env && grunt install-test && grunt test",
|
||||
"test-headless": "npm run-script -s check-env && grunt test-headless",
|
||||
"test-scopes": "npm run-script -s check-env && grunt install-test && for f in test_scopes/*; do TEST_SCOPE=\"`basename $f`\" grunt test; done",
|
||||
"upload-github-release": "node build_tools/upload-github-release.js"
|
||||
},
|
||||
"version": "2.15.1"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016 it-ailen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"_from": "angular-treeview@0.1.5",
|
||||
"_id": "angular-treeview@0.1.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-7Hl9TQAbIBcsmD5l2FXrzYFStPo=",
|
||||
"_location": "/angular-treeview",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "angular-treeview@0.1.5",
|
||||
"name": "angular-treeview",
|
||||
"escapedName": "angular-treeview",
|
||||
"rawSpec": "0.1.5",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.1.5"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/angular-treeview/-/angular-treeview-0.1.5.tgz",
|
||||
"_shasum": "ec797d4d001b20172c983e65d855ebcd8152b4fa",
|
||||
"_spec": "angular-treeview@0.1.5",
|
||||
"_where": "/home/st/dev/keycloak/themes/src/main",
|
||||
"author": {
|
||||
"name": "Allen Zou"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/it-ailen/angular-treeview/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Treeview with angular.",
|
||||
"devDependencies": {
|
||||
"css-loader": "^0.25.0",
|
||||
"html-loader": "^0.4.4",
|
||||
"less": "^2.7.1",
|
||||
"less-loader": "^2.2.3",
|
||||
"style-loader": "^0.13.1",
|
||||
"url-loader": "^0.5.7",
|
||||
"webpack": "^1.13.2"
|
||||
},
|
||||
"homepage": "https://github.com/it-ailen/angular-treeview#readme",
|
||||
"keywords": [
|
||||
"angular",
|
||||
"treeview"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "angular-treeview",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/it-ailen/angular-treeview.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "webpack --config build/webpack.config.base.js"
|
||||
},
|
||||
"version": "0.1.5"
|
||||
}
|
||||
|
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 263 B |
|
Before Width: | Height: | Size: 281 B After Width: | Height: | Size: 281 B |
|
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 289 B |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
@@ -0,0 +1,21 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2012 the AngularUI Team, http://angular-ui.github.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||