Commit 95e1f034 authored by bingchuan's avatar bingchuan

[dev] version 2.18.4

parent 944bd2db
/*! /*!
* angular-translate - v2.13.1 - 2016-12-06 * angular-translate - v2.18.4 - 2021-01-14
* *
* Copyright (c) 2016 The angular-translate team, Pascal Precht; Licensed MIT * Copyright (c) 2021 The angular-translate team, Pascal Precht; Licensed MIT
*/ */
(function (root, factory) { (function (root, factory) {
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
define([], function () { define([], function () {
return (factory()); return (factory());
}); });
} else if (typeof exports === 'object') { } else if (typeof module === 'object' && module.exports) {
// Node. Does not work with strict CommonJS, but // Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports, // only CommonJS-like environments that support module.exports,
// like Node. // like Node.
...@@ -19,79 +19,103 @@ ...@@ -19,79 +19,103 @@
} }
}(this, function () { }(this, function () {
$translateCookieStorageFactory.$inject = ['$cookieStore']; $translateCookieStorageFactory.$inject = ['$injector'];
angular.module('pascalprecht.translate') angular.module('pascalprecht.translate')
/** /**
* @ngdoc object * @ngdoc object
* @name pascalprecht.translate.$translateCookieStorage * @name pascalprecht.translate.$translateCookieStorage
* @requires $cookieStore * @requires $cookieStore
* *
* @description * @description
* Abstraction layer for cookieStore. This service is used when telling angular-translate * Abstraction layer for cookieStore. This service is used when telling angular-translate
* to use cookieStore as storage. * to use cookieStore as storage.
* *
*/ */
.factory('$translateCookieStorage', $translateCookieStorageFactory); .factory('$translateCookieStorage', $translateCookieStorageFactory);
function $translateCookieStorageFactory($cookieStore) { function $translateCookieStorageFactory($injector) {
'use strict'; 'use strict';
var $translateCookieStorage = { // 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, { samesite: 'lax' });
}
};
} 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 $cookieStore.get(name);
},
/** /**
* @ngdoc function * @ngdoc function
* @name pascalprecht.translate.$translateCookieStorage#set * @name pascalprecht.translate.$translateCookieStorage#get
* @methodOf pascalprecht.translate.$translateCookieStorage * @methodOf pascalprecht.translate.$translateCookieStorage
* *
* @description * @description
* Sets an item in cookieStorage by given name. * Returns an item from cookieStorage by given name.
* *
* @deprecated use #put * @param {string} name Item name
* * @return {string} Value of item name
* @param {string} name Item name */
* @param {string} value Item value get : function (name) {
*/ return delegate.get(name);
set: function (name, value) { },
$cookieStore.put(name, value);
},
/** /**
* @ngdoc function * @ngdoc function
* @name pascalprecht.translate.$translateCookieStorage#put * @name pascalprecht.translate.$translateCookieStorage#set
* @methodOf pascalprecht.translate.$translateCookieStorage * @methodOf pascalprecht.translate.$translateCookieStorage
* *
* @description * @description
* Sets an item in cookieStorage by given name. * Sets an item in cookieStorage by given name.
* *
* @param {string} name Item name * @deprecated use #put
* @param {string} value Item value *
*/ * @param {string} name Item name
put: function (name, value) { * @param {string} value Item value
$cookieStore.put(name, value); */
} set : function (name, value) {
}; delegate.put(name, value);
},
return $translateCookieStorage; /**
} * @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'; $translateCookieStorageFactory.displayName = '$translateCookieStorage';
return 'pascalprecht.translate'; return 'pascalprecht.translate';
})); }));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment