Skip to content

Instantly share code, notes, and snippets.

@dragoncity17
Last active July 27, 2023 13:02
Show Gist options
  • Save dragoncity17/db748a6a68537c2eb5206b113d649f83 to your computer and use it in GitHub Desktop.
Save dragoncity17/db748a6a68537c2eb5206b113d649f83 to your computer and use it in GitHub Desktop.

Revisions

  1. dragoncity17 revised this gist Jul 25, 2023. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions ali_xman_us_f.user.js
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,8 @@
    // @match *://*.aliexpress.com/*
    // ==/UserScript==

    // Thanks AndShy for your help ! :)

    (function() {
    'use strict';

  2. dragoncity17 revised this gist Jul 25, 2023. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions ali_xman_us_f.user.js
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,9 @@
    // ==UserScript==
    // @name AliExpress Modification cookie xman_us_f
    // @author DragonCity
    // @description Modifier le cookie xman_us_f sur AliExpress
    // @version 1
    // @match *://*.aliexpress.com/*
    // @grant none
    // ==/UserScript==

    // Thanks AndShy for your help ! :)

    (function() {
    'use strict';

    @@ -20,6 +15,11 @@
    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;
    @@ -37,4 +37,4 @@
    // Mettre à jour le cookie en ajoutant la nouvelle valeur à la fin
    document.cookie = "xman_us_f=" + cookieValue + newValueToAdd;
    }
    })();
    })();
  3. dragoncity17 revised this gist Jul 24, 2023. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions ali_xman_us_f.user.js
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,8 @@
    // @grant none
    // ==/UserScript==

    // Thanks AndShy for your help ! :)

    (function() {
    'use strict';

  4. dragoncity17 renamed this gist Jul 24, 2023. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. dragoncity17 renamed this gist Jul 24, 2023. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. dragoncity17 revised this gist Jul 24, 2023. 1 changed file with 0 additions and 4 deletions.
    4 changes: 0 additions & 4 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -3,10 +3,6 @@
    // @author DragonCity
    // @description Modifier le cookie xman_us_f sur AliExpress
    // @version 1
    // @license GPL-3.0
    // @namespace https://github.com/AndShy
    // @homepageURL https://github.com/AndShy/Ali-Total-Price
    // @downloadURL https://github.com/AndShy/Ali-Total-Price/raw/master/Ali_Total_Price.user.js
    // @match *://*.aliexpress.com/*
    // @grant none
    // ==/UserScript==
  7. dragoncity17 revised this gist Jul 24, 2023. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,14 @@
    // ==UserScript==
    // @name AliExpress Modification cookie xman_us_f
    // @author DragonCity
    // @description Modifier le cookie xman_us_f sur AliExpress
    // @version 1
    // @license GPL-3.0
    // @namespace https://github.com/AndShy
    // @homepageURL https://github.com/AndShy/Ali-Total-Price
    // @downloadURL https://github.com/AndShy/Ali-Total-Price/raw/master/Ali_Total_Price.user.js
    // @match *://*.aliexpress.com/*
    // @grant none
    // ==/UserScript==

    (function() {
  8. dragoncity17 created this gist Jul 24, 2023.
    35 changes: 35 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    // ==UserScript==
    // @name AliExpress Modification cookie xman_us_f
    // @description Modifier le cookie xman_us_f sur AliExpress
    // @match *://*.aliexpress.com/*
    // ==/UserScript==

    (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);

    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;
    }
    })();