Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
angular-translate-storage-cookie
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Custom Issue Tracker
Custom Issue Tracker
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
angularjs
angular-translate-storage-cookie
Commits
95e1f034
Commit
95e1f034
authored
Mar 21, 2021
by
bingchuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[dev] version 2.18.4
parent
944bd2db
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
69 deletions
+93
-69
angular-translate-storage-cookie.js
angular-translate-storage-cookie.js
+93
-69
No files found.
angular-translate-storage-cookie.js
View file @
95e1f034
/*!
* angular-translate - v2.1
3.1 - 2016-12-06
*
* Copyright (c) 20
16
The angular-translate team, Pascal Precht; Licensed MIT
* angular-translate - v2.1
8.4 - 2021-01-14
*
* Copyright (c) 20
21
The angular-translate team, Pascal Precht; Licensed MIT
*/
(
function
(
root
,
factory
)
{
if
(
typeof
define
===
'function'
&&
define
.
amd
)
{
...
...
@@ -9,7 +9,7 @@
define
([],
function
()
{
return
(
factory
());
});
}
else
if
(
typeof
exports
===
'object'
)
{
}
else
if
(
typeof
module
===
'object'
&&
module
.
exports
)
{
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
...
...
@@ -19,79 +19,103 @@
}
}(
this
,
function
()
{
$translateCookieStorageFactory
.
$inject
=
[
'$cookieStore
'
];
angular
.
module
(
'pascalprecht.translate'
)
$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
);
/**
* @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
(
$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
);
}
};
}
/**
* @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
);
},
var
$translateCookieStorage
=
{
/**
* @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
)
{
$cookieStore
.
put
(
name
,
value
);
},
/**
* @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#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
)
{
$cookieStore
.
put
(
name
,
value
);
}
};
/**
* @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
);
},
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'
;
return
'pascalprecht.translate'
;
$translateCookieStorageFactory
.
displayName
=
'$translateCookieStorage'
;
return
'pascalprecht.translate'
;
}));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment