PageSourceSearch

https://fxboss.firstcitizens.com/app/assets/angular-translate/angu…translate-storage-cookie.js?v=31082026-1758

js firstcitizens.com collected 2026-09-24 21:52:15 UTC 3,198 bytes, 121 lines download raw bytes

1/*!
2 * angular-translate - v2.18.4 - 2021-01-14
3 * 
4 * Copyright (c) 2021 The angular-translate team, Pascal Precht; Licensed MIT
5 */
6(function (root, factory) {
7  if (typeof define === 'function' && define.amd) {
8    // AMD. Register as an anonymous module unless amdModuleId is set
9    define([], function () {
10      return (factory());
11    });
12  } else if (typeof module === 'object' && module.exports) {
13    // Node. Does not work with strict CommonJS, but
14    // only CommonJS-like environments that support module.exports,
15    // like Node.
16    module.exports = factory();
17  } else {
18    factory();
19  }
20}(this, function () {
21
22$translateCookieStorageFactory.$inject = ['$injector'];
23angular.module('pascalprecht.translate')
24
25/**
26 * @ngdoc object
27 * @name pascalprecht.translate.$translateCookieStorage
28 * @requires $cookieStore
29 *
30 * @description
31 * Abstraction layer for cookieStore. This service is used when telling angular-translate
32 * to use cookieStore as storage.
33 *
34 */
35  .factory('$translateCookieStorage', $translateCookieStorageFactory);
36
37function $translateCookieStorageFactory($injector) {
38
39  'use strict';
40
41  // Since AngularJS 1.4, $cookieStore is deprecated
42  var delegate;
43  if (angular.version.major === 1 && angular.version.minor >= 4) {
44    var $cookies = $injector.get('$cookies');
45    delegate = {
46      get : function (key) {
47        return $cookies.get(key);
48      },
49      put : function (key, value) {
50        $cookies.put(key, value, { samesite: 'lax' });
51      }
52    };
53  } else {
54    var $cookieStore = $injector.get('$cookieStore');
55    delegate = {
56      get : function (key) {
57        return $cookieStore.get(key);
58      },
59      put : function (key, value) {
60        $cookieStore.put(key, value);
61      }
62    };
63  }
64
65  var $translateCookieStorage = {
66
67    /**
68     * @ngdoc function
69     * @name pascalprecht.translate.$translateCookieStorage#get
70     * @methodOf pascalprecht.translate.$translateCookieStorage
71     *
72     * @description
73     * Returns an item from cookieStorage by given name.
74     *
75     * @param {string} name Item name
76     * @return {string} Value of item name
77     */
78    get : function (name) {
79      return delegate.get(name);
80    },
81
82    /**
83     * @ngdoc function
84     * @name pascalprecht.translate.$translateCookieStorage#set
85     * @methodOf pascalprecht.translate.$translateCookieStorage
86     *
87     * @description
88     * Sets an item in cookieStorage by given name.
89     *
90     * @deprecated use #put
91     *
92     * @param {string} name Item name
93     * @param {string} value Item value
94     */
95    set : function (name, value) {
96      delegate.put(name, value);
97    },
98
99    /**
100     * @ngdoc function
101     * @name pascalprecht.translate.$translateCookieStorage#put
102     * @methodOf pascalprecht.translate.$translateCookieStorage
103     *
104     * @description
105     * Sets an item in cookieStorage by given name.
106     *
107     * @param {string} name Item name
108     * @param {string} value Item value
109     */
110    put : function (name, value) {
111      delegate.put(name, value);
112    }
113  };
114
115  return $translateCookieStorage;
116}
117
118$translateCookieStorageFactory.displayName = '$translateCookieStorage';
119return 'pascalprecht.translate';
120
121}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.