PageSourceSearch

https://www.silicon.eu/wp-content/themes/kamino/assets/js/cookie.js?ver=1790175121

js silicon.eu collected 2026-09-25 04:43:07 UTC 12,823 bytes, 209 lines download raw bytes

1(function ($) {
2
3    /**
4     * This class allow us to use cookies quickly
5     * @return [type] [description]
6     */
7    kaminoCookie = {
8        getItem: function (name) {
9            var cookies = document.cookie.split(';');
10            name += "=";
11            for (var i = 0, n = cookies.length; i < n; i++) {
12                var c = cookies[i];
13                while (' ' === c.charAt(0)) {
14                    c = c.substring(1);
15                }
16                if (0 === c.indexOf(name)) {
17                    return unescape(c.substring(name.length));
18                }
19            }
20            return null;
21        },
22        setItem: function (name, value, days, path, domain, secure) {
23            var expires;
24            if ('number' === typeof days) {
25                var date = new Date();
26                date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
27                expires = date.toGMTString();
28            }
29            document.cookie = name + "=" + escape(value) +
30                ((expires) ? "; expires=" + expires : "") +
31                ((path) ? "; path=" + path : "") +
32                ((domain) ? "; domain=" + domain : "") +
33                ((secure) ? "; secure" : "");
34        },
35        unset: function (name) {
36            this.setItem(name, '', 0);
37        },
38        getSubscriptionItem: function (name) {
39            var decodeCookie = decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(name).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1"));
40            if (decodeCookie) return decodeCookie;
41            else return null;
42        }
43    };
44
45
46    $(document).ready(function () {
47
48        /**
49         * Create a cookie class
50         * and ask a consentment for use of cookies
51         */       
52        var cookie_site_name = 'ct_echo',
53            is_logged = false,
54            old_cookie = true,
55            KAMINO_REFONTE_V3 = kamino_cookie_data.KAMINO_REFONTE_V3,
56            profileNewsletterTop = $("header #primary-bar .newsletter a"),
57            profileNewsletterBottom = $("footer .nav-menus .newsletter a"),
58            logout_button = '<span class="logoutbutton"><a href="' + kamino_cookie_data.KAMINO_SUBSCRIPTION_URL + '/profile/logout.php?continue=' + kamino_cookie_data.string_continue + '&continue_label=' + kamino_cookie_data.string_continue_label + '" id="profile-box-name" class="profile-box-logout"><span>' + kamino_cookie_data.string_disconnect + '</span></a></span>',
59            user_name = '',
60            user_surname = '';
61            if (KAMINO_REFONTE_V3 == true) {
62                var profileConnect = $(".nav-menus .btn-connexion a"),
63                profileConnectLogout = $(".nav-menus .btn-connexion");
64            }else{
65                var profileConnect = $(".nav-menus .connect a"),
66                profileConnectLogout = $(".nav-menus .connect");
67            }
68
69        var the_cookie = kaminoCookie.getItem(cookie_site_name);
70        the_cookie = jQuery.parseJSON(the_cookie);
71
72        if (the_cookie != null) {
73
74            // Check if user already is logged
75            if (typeof the_cookie['auid'] !== 'undefined' && the_cookie['auid'] !== null) {
76                is_logged = true;
77                old_cookie = false;
78            }
79
80            if (old_cookie == false) {
81                
82                if (is_logged == true) {
83
84                    
85                    
86                    if (typeof the_cookie['name'] !== 'undefined' && the_cookie['name'] !== null) {
87                        user_name = the_cookie['name'];
88                    }
89                    if (typeof the_cookie['surname'] !== 'undefined' && the_cookie['surname'] !== null) {
90                        user_surname = the_cookie['surname'];
91                    }
92
93                    // Add User Menu for silicon.fr
94                    if( document.getElementsByTagName('body')[0].matches(".france.silicon")) {
95                        $(profileConnectLogout).addClass("logged");
96
97                        if (KAMINO_REFONTE_V3 == false){
98                            $("#menu-top .connect > a").after('<ul id="profileOption" class="sub-menu"> <li><a href="#" class="profile">Mon compte</a></li> <li><a class="abonnements" href="/mesabonnements">Mes magazines numériques</a></li> <li><a class="logout" href="' + kamino_cookie_data.KAMINO_SUBSCRIPTION_URL + '/profile/logout.php?continue=' + kamino_cookie_data.string_continue + '&continue_label=' + kamino_cookie_data.string_continue_label + '">Déconnexion</a></li> </ul>');
99                            $(profileConnect).html(user_name + ' ' + user_surname);
100                            $(".nav-menus .connect .profile").attr('href', kamino_cookie_data.KAMINO_SUBSCRIPTION_URL + '/profile');
101                        }else{
102                            $("#menu-top_right-v3 .btn-connexion > a").after('<ul id="profileOption" class="sub-menu"> <li><a href="#" class="profile">Mon compte</a></li> <li><a class="abonnements" href="/mesabonnements">Mes magazines numériques</a></li> <li><a class="logout" href="' + kamino_cookie_data.KAMINO_SUBSCRIPTION_URL + '/profile/logout.php?continue=' + kamino_cookie_data.string_continue + '&continue_label=' + kamino_cookie_data.string_continue_label + '">Déconnexion</a></li> </ul>');    
103                            $("#menu-top_right-v3 .profile").attr('href', kamino_cookie_data.KAMINO_SUBSCRIPTION_URL + '/profile');
104                        }
105                        $(profileConnect).attr('href', '#');
106
107
108                            
109                    } else {
110                        $(profileConnect).attr('href', kamino_cookie_data.KAMINO_SUBSCRIPTION_URL + '/profile');
111                        if (KAMINO_REFONTE_V3 == false){
112                            $(profileConnect).html(user_name + ' ' + user_surname);
113                            $(profileConnectLogout).html($(profileConnectLogout).html() + logout_button);
114                        }
115                    }
116                   
117                    $(profileNewsletterTop).attr('href', kamino_cookie_data.KAMINO_SUBSCRIPTION_URL + '/profile/index.php?continue=' + kamino_cookie_data.string_continue + '&continue_label=' + kamino_cookie_data.string_continue_label + '&utm_source=kamino-newsletter-top');
118                    $(profileNewsletterTop).html('<span class="text">' + kamino_cookie_data.string_edit_your_profile + '</span>');
119
120                    $(profileNewsletterBottom).attr('href', kamino_cookie_data.KAMINO_SUBSCRIPTION_URL + '/profile/index.php?continue=' + kamino_cookie_data.string_continue + '&continue_label=' + kamino_cookie_data.string_continue_label + '&utm_source=kamino-newsletter-bottom');
121                    $(profileNewsletterBottom).html('<span class="text">' + kamino_cookie_data.string_edit_your_profile + '</span>');
122
123                } else {
124                    $(profileConnect).attr('href', kamino_cookie_data.KAMINO_SUBSCRIPTION_URL + '/profile/login.php?continue=' + kamino_cookie_data.string_continue + '&continue_label=' + kamino_cookie_data.string_continue_label);
125                    if (KAMINO_REFONTE_V3 == false){
126                        $(profileConnect).html(kamino_cookie_data.string_login);
127                    }
128
129                    $(profileNewsletterTop).attr('href', kamino_cookie_data.KAMINO_SUBSCRIPTION_URL + '/profile/new-profile-1.php?continue=' + kamino_cookie_data.string_continue + '&continue_label=' + kamino_cookie_data.string_continue_label + '&utm_source=kamino-newsletter-top');
130                    $(profileNewsletterTop).html(kamino_cookie_data.string_newsletter);
131
132                    $(profileNewsletterBottom).attr('href', kamino_cookie_data.KAMINO_SUBSCRIPTION_URL + '/profile/new-profile-1.php?continue=' + kamino_cookie_data.string_continue + '&continue_label=' + kamino_cookie_data.string_continue_label + '&utm_source=kamino-newsletter-bottom');
133                    $(profileNewsletterBottom).html(kamino_cookie_data.string_newsletter);
134
135                }
136
137            }
138
139
140        }
141
142        if (old_cookie == true) {
143
144            // Use old way
145            var subscription = JSON.parse(kaminoCookie.getSubscriptionItem(kamino_cookie_data.KAMINO_ANABOLIC_COOKIE_NAME));
146            if (subscription !== null) {
147                var ninja = subscription.ninja;
148                var status = subscription.status;
149            }
150
151
152            if (subscription !== null && ninja !== 1 && status !== 5) {
153
154                if( document.getElementsByTagName('body')[0].matches(".france.silicon") && KAMINO_REFONTE_V3 == false ) {
155                        // Add User Menu 
156                        $("#menu-top .connect > a").after('<ul id="profileOption" class="sub-menu"> <li><a href="#" class="profile">Mon compte</a></li> <li><a class="abonnements" href="/mesabonnements">Mes magazines numériques</a></li> <li><a class="logout" href="' + kamino_cookie_data.KAMINO_SUBSCRIPTION_URL + '/profile/logout.php?continue=' + kamino_cookie_data.string_continue + '&continue_label=' + kamino_cookie_data.string_continue_label + '">Déconnexion</a></li> </ul>');
157                }
158                
159                for (var i = 0; i < profileConnect.length; i++) {
160
161                    var surname = "";
162                    if(subscription.surname){
163                        surname = subscription.surname.substr(0, 1);
164                    }
165                   
166                    if ( document.getElementsByTagName('body')[0].matches(".france.silicon") && KAMINO_REFONTE_V3 == false ) {
167
168                        profileConnect[i].classList.add("logged");
169                        profileConnect[i].innerHTML = subscription.name + ' ' + surname;
170                        profileConnect[i].href = "#";
171                        $(".nav-menus .connect .profile").attr('href', kamino_cookie_data.KAMINO_SUBSCRIPTION_URL + '/profile');
172
173                    } else { 
174                        profileConnect[i].href = kamino_cookie_data.KAMINO_SUBSCRIPTION_URL + '/profile';
175                        if (KAMINO_REFONTE_V3 == false){
176                            profileConnect[i].innerHTML = subscription.name + ' ' + surname;
177
178                            var logoutButton = '<span class="logoutbutton"><a href="' + kamino_cookie_data.KAMINO_SUBSCRIPTION_URL + '/profile/logout.php?continue=' + kamino_cookie_data.string_continue + '&continue_label=' + kamino_cookie_data.string_continue_label + '" id="profile-box-name" class="profile-box-logout"><span>' + kamino_cookie_data.string_disconnect + '</span></a></span>';
179                            profileConnectLogout[i].innerHTML = profileConnectLogout[i].innerHTML + logoutButton;
180                        }
181                    }
182                }
183
184                $(profileNewsletterTop).attr('href', kamino_cookie_data.KAMINO_SUBSCRIPTION_URL + '/profile/index.php?continue=' + kamino_cookie_data.string_continue + '&continue_label=' + kamino_cookie_data.string_continue_label + '&utm_source=kamino-newsletter-top');
185                $(profileNewsletterTop).html('<span class="text">' + kamino_cookie_data.string_edit_your_profile + '</span>');
186
187                $(profileNewsletterBottom).attr('href', kamino_cookie_data.KAMINO_SUBSCRIPTION_URL + '/profile/index.php?continue=' + kamino_cookie_data.string_continue + '&continue_label=' + kamino_cookie_data.string_continue_label + '&utm_source=kamino-newsletter-bottom');
188                $(profileNewsletterBottom).html('<span class="text">' + kamino_cookie_data.string_edit_your_profile + '</span>');
189
190            } else {
191
192                for (var i = 0; i < profileConnect.length; i++) {
193                    profileConnect[i].href = kamino_cookie_data.KAMINO_SUBSCRIPTION_URL + '/profile/login.php?continue=' + kamino_cookie_data.string_continue + '&continue_label=' + kamino_cookie_data.string_continue_label;
194                    if (KAMINO_REFONTE_V3 == false){
195                        profileConnect[i].innerHTML = kamino_cookie_data.string_login;
196                    }
197                }
198
199                $(profileNewsletterTop).attr('href', kamino_cookie_data.KAMINO_SUBSCRIPTION_URL + '/profile/new-profile-1.php?continue=' + kamino_cookie_data.string_continue + '&continue_label=' + kamino_cookie_data.string_continue_label + '&utm_source=kamino-newsletter-top');
200                $(profileNewsletterTop).html(kamino_cookie_data.string_newsletter);
201
202                $(profileNewsletterBottom).attr('href', kamino_cookie_data.KAMINO_SUBSCRIPTION_URL + '/profile/new-profile-1.php?continue=' + kamino_cookie_data.string_continue + '&continue_label=' + kamino_cookie_data.string_continue_label + '&utm_source=kamino-newsletter-bottom');
203                $(profileNewsletterBottom).html(kamino_cookie_data.string_newsletter);
204            }
205
206        }
207    });
208
209}(jQuery));

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.