Last active
July 27, 2023 13:02
-
-
Save dragoncity17/db748a6a68537c2eb5206b113d649f83 to your computer and use it in GitHub Desktop.
AliExpress Modification cookie xman_us_f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name AliExpress Modification cookie xman_us_f | |
// @description Modifier le cookie xman_us_f sur AliExpress | |
// @match *://*.aliexpress.com/* | |
// ==/UserScript== | |
// Thanks AndShy for your help ! :) | |
(function() { | |
'use strict'; | |
// Nouvelle valeur du cookie xman_us_f à ajouter | |
var newValueToAdd = "&x_as_i=%7B%22channel%22%3A%22AFFILIATE%22%2C%22tagtime%22%3A1900000000000%7D"; | |
// Vérifier si le cookie existe déjà | |
var currentCookie = document.cookie; | |
var cookieName = "xman_us_f="; | |
var cookieStartIndex = currentCookie.indexOf(cookieName); | |
// Vérifier si le cookie contient déjà la nouvelle valeur | |
if (currentCookie.includes(newValueToAdd)) { | |
return; // Rien à faire, la nouvelle valeur existe déjà dans le cookie | |
} | |
if (cookieStartIndex === -1) { | |
// Si le cookie n'existe pas, ajouter la nouvelle valeur complète | |
document.cookie = "xman_us_f=" + newValueToAdd; | |
} else { | |
// Si le cookie existe, ajouter la nouvelle valeur à la fin sans remplacer l'ancienne valeur | |
var cookieEndIndex = currentCookie.indexOf(";", cookieStartIndex); | |
var cookieValue = ""; | |
if (cookieEndIndex === -1) { | |
cookieValue = currentCookie.substring(cookieStartIndex + cookieName.length); | |
} else { | |
cookieValue = currentCookie.substring(cookieStartIndex + cookieName.length, cookieEndIndex); | |
} | |
// Mettre à jour le cookie en ajoutant la nouvelle valeur à la fin | |
document.cookie = "xman_us_f=" + cookieValue + newValueToAdd; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You're welcome 🤗