Скрипты на JavaScript для Алиэкспресс

Тема закреплена бессрочно

Пользуетесь ли этими скриптами?

  • Да

    Голосов: 289 64,5%
  • Нет

    Голосов: 159 35,5%

  • Всего проголосовало
    448
Скрипт переключения валюты в КОРЗИНЕ. Появляются две кнопки - USD и RUB - переключают на соответствующую валюту. Также в скрипте осталось изменение страны. Если указать стану пустую строку "", то страна меняться не будет. Если указать страну, например KZ, то страна будет меняться на указанную.

Код:
// ==UserScript==
// @name         Aliexpress in Cart Currency Changer
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Изменяет валюту в корзине
// @author       Andronio
// @match        https://shoppingcart.aliexpress.ru/shopcart/shopcartDetail.htm*
// @match        https://shoppingcart.aliexpress.com/shopcart/shopcartDetail.htm*
// @grant        none
// ==/UserScript==

let myCountry = "";

(function repeat() {
    'use strict';
    let cart = document.querySelector(".captain h2");
    if (!cart) return setTimeout(repeat, 200);
    let btnBox = document.createElement("div");
    btnBox.id = "btn-box";
    btnBox.style.display = "inline-block";
    cart.style.display = "inline-block";
    cart.after(btnBox);
    btnBox.innerHTML = `<div class="currency-button" data-curr="USD"><span class="css_flag css_us" style="display:inline"><span class="shipping-text" style="display:inline">USD</span></span></div>
                        <div class="currency-button" data-curr="RUB"><span class="css_flag css_ru" style="display:inline"><span class="shipping-text" style="display:inline">RUB</span></span></div>`;
    let style = document.createElement("style");
    style.innerHTML = `.currency-button {
                            display: inline-block;
                            padding: 5px 10px;
                            margin-left: 20px;
                            border: 2px solid black;
                            border-radius: 0.5em;
                            cursor:pointer;
                        }

                        .no-modify-btn {background-color: OrangeRed;}

                        .yes-modify-btn {background-color: Lime;}
                            `;
    document.head.append(style);
    btnBox.addEventListener("click", btnClickHandler);
})();



function btnClickHandler(event) {
    'use strict';

    let btn = event.target.closest(".currency-button");
    if (!btn) return;
    let currency = btn.dataset.curr;
    let cookies = document.cookie.split('; ');
    let isNeedModif = false;
    let str;
    for (let i = 0; i < cookies.length; i++) {
        if (cookies[i].startsWith("aep_usuc_f=")) { // Если нашел нужную куку
            let cookie = cookies[i].slice(11).split('&'); // Убираем aep_usuc_f= и разделяем
            cookie = cookie.map(elem => { // Смотрим, что в куке
                if (elem.startsWith("c_tp=")) {
                    if (elem.slice(5) == currency)
                        return elem;
                    else {
                    isNeedModif = true;
                    return "c_tp=" + currency;
                    }
                } else if (elem.startsWith("region=")) {
                    let currCountry = elem.slice(7);
                    if (myCountry == "")
                        return elem;
                    else if (currCountry == myCountry)
                        return elem
                    else {
                        isNeedModif = true;
                        return "region=" + myCountry;
                    }

                } else return elem;
            });
            str = cookie.join("&");
            break;
        }
    }
    if (isNeedModif) {
        if (window.location.hostname.includes("aliexpress.ru")) {
            let str2 = `aep_usuc_f=${str}; path=/; expires=Tue, 19 Jan 2088 03:14:07 GMT; domain=.aliexpress.ru`;
            document.cookie = str2;
            window.location.reload();
        } else if (window.location.hostname.includes("aliexpress.com")) {
            let str2 = `aep_usuc_f=${str}; path=/; expires=Tue, 19 Jan 2088 03:14:07 GMT; domain=.aliexpress.com`;
            document.cookie = str2;
            window.location.reload();
        } else {alert("Ошибка в скрипте")};
        window.mybtn = btn;
        window.mybtn.classList.add("yes-modify-btn");
        setTimeout(() => window.mybtn.classList.remove("yes-modify-btn"), 300);
        window.location.reload();
    } else {
        window.mybtn = btn;
        window.mybtn.classList.add("no-modify-btn");
        setTimeout(() => window.mybtn.classList.remove("no-modify-btn"), 300);
    }
}
 
Скрипт автоматически меняет страну доставки на выбранную и валюту. Зачем он нужен - не знаю, кто-то просил.

Спасибо, скрипт очень актуален.
А можно как-то сделать чтобы еще и язык меняло на английский(или же меняло с ру версии на английскую).
 
  • Like
Реакции: hameleon050 и zet17
Как писал Schotout
Andronio сделаете?
Steamapps сделай пожалуйста вывод в таблицу для его
По данному вопросу постучался в личку @Steamapps . Но его уже, к сожалению, как 4 месяца тут не было видно.
Попросил рассмотреть возможность внесения правки в Коверкатель и предусмотреть дополнительную кнопку, которая сразу будет копировать текущий вариант коверки в формате под этот скрипт Andronio. Т.е. теоретически возможно получится реализовать, что Коверкатель делает новую коверку всех данных, а по нажатию спец. кнопки копирует в буфер имя, адрес и телефон в нужном формате, а дальше уже делает свою работу сам скрипт.
Хотелось бы верить, что это реализуемо.
UPD Steamapps ответил, что если появится свободное время, то возможно и попробует реализовать.
 
Последнее редактирование:
  • Like
Реакции: Author и zet17
Спасибо, скрипт очень актуален.
А можно как-то сделать чтобы еще и язык меняло на английский(или же меняло с ру версии на английскую).
да, этого не хватает, было бы отлично!
 
Скрипт для форума Miped.ru. Добавляет курс купона на экран вверху. Скрипт проверяет время, если последняя проверка цены была до 6 МСК (вроде бы в это время изменяется курс на али), то цена перезапрашивается. В другое время автоматически не пересчитывается. Если надо обновить принудительно, то нажать кнопку "Обновить". Забиты три готовых купона, если надо другую цену, то в поле вводим верхнюю цену купона и получаем сумму срабатывания.

Нужно указать номер айтема для получения цены, чем больше цена, том точнее будет посчитано.
Код:
let itemNumber = "32915345420";
Если у товара несколько позиций, то будет выбрана с максимальной ценой.

время смены курса валют
Код:
let changeTime = 6;  // MSK

Код:
// ==UserScript==
// @name         Miped.ru coupon currency show
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Показывает курс купона
// @author       Andronio
// @match        https://mipped.com/f/threads/obsuzhdenie-kuponov-aliexpress*
// @match        https://aliexpress.ru/item/*.html?mydata=123*
// @grant        none
// @run-at       document-end
// ==/UserScript==

let itemNumber = "32915345420";
let changeTime = 6;  // MSK

// далее не трогать
let coef = 0;

(function() {
    'use strict';
    if (location.href.startsWith("https://mipped.com/f/threads/")) {
        showMiped();
        let couponCurrency = localStorage.getItem("couponCurrency");
        if (!couponCurrency) return requestCurrency();
        try {
            couponCurrency = JSON.parse(couponCurrency);
        } catch {
            return requestCurrency();
        }
        let thresholdTime = new Date();
        thresholdTime.setHours(thresholdTime.getHours() - changeTime - 6);
        let oldDate = new Date(couponCurrency.date);
        if (oldDate.getDate() < thresholdTime.getDate()) return requestCurrency();
        coef = couponCurrency.coef;
        fillTable();
        document.getElementById('couponrequest').dispatchEvent(new Event("input"));

    }

// Сторона Алиэкспресс
    if (location.href.startsWith(`https://aliexpress.ru/item/${itemNumber}.html`) && window.opener != null) {
        let cookies = document.cookie.split('; ');
        let isFound = false;
        let str;
        for (let i = 0; i < cookies.length; i++) {
            if (cookies[i].startsWith("aep_usuc_f=")) { // Если нашел нужную куку
                let cookie = cookies[i].slice(11).split('&'); // Убираем aep_usuc_f= и разделяем
                cookie = cookie.map(elem => { // Смотрим, что в куке
                    if (elem.startsWith("c_tp=")) {
                        if (elem.slice(5) == "RUB")
                            return elem;
                        else {
                        isFound = true;
                        return "c_tp=RUB";
                        }
                    } else return elem;
                });
                str = cookie.join("&");
                break;
            }
        }
        if (isFound) {
            let str2 = `aep_usuc_f=${str}; path=/; expires=Tue, 19 Jan 2088 03:14:07 GMT; domain=.aliexpress.ru`;
            document.cookie = str2;
            window.location.reload();
            return;
        }

        let items = Array.from(window.runParams.data.skuModule.skuPriceList);
        items.sort(function(a, b) {
            let actPriceField = a.skuVal.actSkuMultiCurrencyCalPrice ? 'actSkuMultiCurrencyCalPrice' : 'skuMultiCurrencyCalPrice';

            let keyA = parseFloat(a.skuVal[actPriceField]),
                keyB = parseFloat(b.skuVal[actPriceField]);

            return keyA == keyB ? 0 : keyA > keyB ? -1 : 1;
        });

        let mydata = {};
        let item = items[0];
        let priceField = item.skuVal.actSkuCalPrice ? 'actSkuCalPrice' : 'skuCalPrice';
        mydata.priceUSD = parseFloat(item.skuVal[priceField].replace(",",""));
        priceField = item.skuVal.actSkuMultiCurrencyCalPrice ? 'actSkuMultiCurrencyCalPrice' : 'skuMultiCurrencyCalPrice';
        mydata.priceRUB = parseFloat(item.skuVal[priceField]);
        mydata.currency = item.skuVal.skuAmount.currency;
        window.opener.postMessage(JSON.stringify(mydata), "*");
    }
})();

function requestCurrency() {
    setTimeout(() => {
        let params = "menubar=no,toolbar=no,location=no,status=no,scrollbars=no,width=10,height=10";
        window.newwin = window.open(`https://aliexpress.ru/item/${itemNumber}.html?mydata=123`, "myali", params);
        window.newwin.blur();
        window.focus();
        return;
    }, 500);
    window.addEventListener("message", messageHandler);
}

function messageHandler(event) {
    if (event.origin != 'https://aliexpress.ru') {
    // что-то пришло с неизвестного домена. Давайте проигнорируем это
    return;
    }
    if (window.newwin && !window.newwin.closed) {
        window.newwin.close();
        console.log( "received: " + event.data );
        let mydata = JSON.parse(event.data);
        coef = 4484.66 * mydata.priceUSD * 10 / 7 / mydata.priceRUB;
        fillTable();
        let couponCurrency = {};
        couponCurrency.date = new Date();
        couponCurrency.coef = coef;
        localStorage.setItem("couponCurrency", JSON.stringify(couponCurrency));
    }
    window.removeEventListener("message", messageHandler);

}

function showMiped() {
    let div = document.createElement('div');
    div.className = 'currency';
    div.innerHTML = `
        <div style="display: inline-block; color: green; font-size: 1.2em;">
            <table border="1" cellpadding="2">
                <tr><th>Купон</th><th>цена</th></tr>
                <tr><td>3,99/4,99</td><td id="coupon1">0</td></tr>
                <tr><td>4/5</td><td id="coupon2">0</td></tr>
                <tr><td>5/10</td><td id="coupon3">0</td></tr>
            </table>
        </div>
        <div style="display: inline-block; width: 100px; margin-left: 50px">
            <span id="showCalCoupon" style="width:90px; font-size: 2em">10</span><br>
            <input type="text" id="couponrequest" value="10" style="width:90px; font-size: 2em">
        </div>
        <div style="display: inline-block; margin-left: 50px">
            <button id="refreshCoupon" style="height:50px;width:100px">Обновить</button>
        </div>`;
    div.style.cssText = 'display: flex;';
    document.getElementById('logo').after(div);
    let inputCoupon = document.getElementById('couponrequest');
    inputCoupon.addEventListener("input", (event) => {
        if (!isNaN(Number(event.target.value))) {
            let couponPrice = document.getElementById('showCalCoupon');
            couponPrice.innerText = Math.ceil(event.target.value * coef) / 100;
        }
    });
    let refreshBtn = document.getElementById('refreshCoupon');
    refreshBtn.addEventListener("click", requestCurrency);

}

function fillTable() {
    let coupon1 = document.getElementById("coupon1");
    coupon1.innerText = Math.ceil(4.99 * coef) / 100;
    let coupon2 = document.getElementById("coupon2");
    coupon2.innerText = Math.ceil(5 * coef) / 100;
    let coupon3 = document.getElementById("coupon3");
    coupon3.innerText = Math.ceil(10 * coef) / 100;
}
 
Последнее редактирование:
@Andronio
а нельзя ли сделать скриптик чтоб в корзине или при плате вебмани не совершалась оплата свыше заданой суммы а то иногда бывает что купишь за полную стоимость еще и барахло какое-то без купона. или что б предупреждение какое-то было. думаю было бы очень полезно. на БАСе такое точно было.
 
Скрипт для форума Miped.ru. Добавляет курс купона на экран вверху. Скрипт проверяет время, если последняя проверка цены была до 6 МСК (вроде бы в это время изменяется курс на али), то цена перезапрашивается. В другое время автоматически не пересчитывается. Если надо обновить принудительно, то нажать кнопку "Обновить". Забиты три готовых купона, если надо другую цену, то в поле вводим верхнюю цену купона и получаем сумму срабатывания.

У меня при добавлении скрипта открывается всплывающее окно с товаром для получения курса и уходит в вечное обновление страницы, то есть она грузиться по кругу. Tempermonkey 3.10.61.12 в мозилле 76.0.1. Я что-то у себя не так сделал или баг?

Идея отличная, буду пользоваться, если заработает.
 
У меня при добавлении скрипта открывается всплывающее окно с товаром для получения курса и уходит в вечное обновление страницы, то есть она грузиться по кругу. Tempermonkey 3.10.61.12 в мозилле 76.0.1. Я что-то у себя не так сделал или баг?
Идея отличная, буду пользоваться, если заработает.
Это конфликтуют два скрипта, скрипт установки страны и валюты. Один ставит рубли, другой другую валюту. Отключи временно второй скрипт.
 
  • Like
Реакции: Qant
Приветствую, скрипт очень удобным оказался, спасибо! Большая просьба, можешь сделать вариант этого скрипта с кнопкой включения. Кнопка какая нибудь, чтобы скрипт не срабатывал сразу а по запросу?
Скрипт работает на всех страницах алиэкпресса, воткнуть кнопку на каждую страницу невозможно, а делать плавающую - не эргономично, и так уже всяких кнопок на каждой странице.

Спасибо, скрипт очень актуален.
А можно как-то сделать чтобы еще и язык меняло на английский(или же меняло с ру версии на английскую).
Это надо проводить исследования, на которые у меня нет времени.

Скрипт автоматически меняет страну доставки на выбранную и валюту. Исправленная версия, не должен конфликтовать со скриптом мипеда. Можно выбирать что менять, если параметр оставить пустым, то он меняться не будет, вот так:
Код:
let myCurrency    = "";
let myCountry    = "";

Код:
// ==UserScript==
// @name         Aliexpress Country Changer
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Изменяет страну и валюту
// @author       Andronio
// @match        https://*.aliexpress.ru/*
// @match        https://*.aliexpress.com/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

let myCurrency    = "USD";
let myCountry    = "KZ";

(function () {
    'use strict';

    if (!location.href.includes("mydata=123")) {
        let cookies = document.cookie.split('; ');
        let isNeedModif = false;
        let str;
        for (let i = 0; i < cookies.length; i++) {
            if (cookies[i].startsWith("aep_usuc_f=")) { // Если нашел нужную куку
                let cookie = cookies[i].slice(11).split('&'); // Убираем aep_usuc_f=
                cookie = cookie.map(elem => { // Смотрим, что в куке
                    if (elem.startsWith("c_tp=")) {
                        if (myCurrency != "" && elem.slice(5) != myCurrency) {
                            isNeedModif= true;
                            return "c_tp=" + myCurrency;
                        } else return elem;
                    }
                    if (elem.startsWith("region=")) {
                        if (myCountry != "" && elem.slice(7) != myCountry) {
                            isNeedModif= true;
                            return "region=" + myCountry;
                        } else return elem;
                    }
                    return elem;
                });
                str = cookie.join("&");
            }
        };
        if (isNeedModif) {
            if (location.hostname.includes("aliexpress.ru")) {
                document.cookie = `aep_usuc_f=${str}; path=/; expires=Tue, 19 Jan 2038 03:14:07 GMT; domain=.aliexpress.ru`;
            } else if (location.hostname.includes("aliexpress.com")) {
                document.cookie = `aep_usuc_f=${str}; path=/; expires=Tue, 19 Jan 2038 03:14:07 GMT; domain=.aliexpress.com`;
            } else {alert("Ошибка в скрипте")};
            location.reload();
        }
    }
})();
 
добрый день ) сможет кто-нибудь написать скрипт на заказ от начала до конца на основании имеющихся скриптов. можно 2 скрипта с частями:
1)
- регистрация аккаунта на сайте - ввод ФИО и адреса на выбранные страны (около 10 стран)
- смена на страну и адрес как в оформленном адресе, и смена валюты на доллары
- выбор товаров из файла-списка
- доведение заказа до оплаты с ВМ
- смена IP из файла-списка с прокси
2)
- оплата заказов с ВМ
- использование сервиса с вводом каптчи для входа в аккаунт

стоимость обсудим в личке )
 
Последнее редактирование:
Скрипт авторизации на cash4brands

Код:
// ==UserScript==
// @name         Cash4Brands login
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       Andronio
// @match        https://cash4brands.ru/
// @match        https://cash4brands.ru/cashback/aliexpress/
// @match        https://cash4brands.ru/gotoshop/25/
// @grant        none
// ==/UserScript==

let loginEmail = "login@ligin.com";
let loginPassw = "Password";

(function repeat() {
    'use strict';
    if (location.href == "https://cash4brands.ru/") {
        let avatar = document.querySelector(".avatar");
        let register = document.querySelectorAll(".login-wrap__reg-link");
        if (!avatar && !register.length) setTimeout(repeat, 100);

        if (register.length) {
            let step = localStorage.getItem("step");
            if (!step || step == "0") {
                localStorage.setItem("step", "1");
                document.querySelector(".login-wrap__login-link").click();
                return setTimeout(repeat, 200);
            }
            if (step == "1") {
                localStorage.setItem("step", "2");
                document.querySelectorAll('[data-form="email_enter"]')[1].click();
                return setTimeout(repeat, 200);
            }
            if (step == "2") {
                localStorage.setItem("step", "0");
                document.querySelectorAll('input[name="email"]')[3].value = loginEmail;
                document.querySelectorAll('input[name="pass"]')[2].value = loginPassw;
                document.querySelectorAll('.btn_group input')[0].click();
            }
        }
        if (avatar) {
            location.href = "https://cash4brands.ru/gotoshop/25/";
            return;
        }
    }
    if (location.href == "https://cash4brands.ru/cashback/aliexpress/") {
        document.querySelector('.goshop_btn_wrap .button.tooltip').click();
    }
    if (location.href == "https://cash4brands.ru/gotoshop/25/") {
        document.querySelector('.button').click();
    }
})();
---------Двойное сообщение соединено: ---------
Скрипт авторизации на bonus.webmoney.ru

Код:
// ==UserScript==
// @name         Bonus WM login
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       Andronio
// @match        https://bonus.webmoney.ru/
// @match        https://login.wmtransfer.com/GateKeeper/Password/*
// @match        https://bonus.webmoney.ru/shop/aliexpress-com/*
// @grant        none
// ==/UserScript==

let wmID   = "000000000000";
let wmPass = "000000000";


(function repeat() {
    'use strict';
    if (location.href.startsWith("https://bonus.webmoney.ru/shop/aliexpress-com/")) {
        let gotoBtn = document.querySelector('.goToShopLink');
        if (!gotoBtn) return setTimeout(repeat, 200);
        location.href = gotoBtn.href;
    }
    if (location.href == "https://bonus.webmoney.ru/") {
        let loginBnt = document.querySelector('.login');
        let avatarBnt = document.getElementById("avatar");
        if (!loginBnt && !avatarBnt) return setTimeout(repeat, 200);
        if (loginBnt) loginBnt.click();
        if (avatarBnt) {
            let shops = document.querySelectorAll('.shopItem');
            if (shops.length == 0) return setTimeout(repeat, 200);
            shops.forEach(elem => {
                if (elem.getAttribute("title").includes("AliExpress")) {
                    elem.querySelector(".shopMoreInfoBtn").click();
                }
            });
            return setTimeout(repeat, 200);
        }
    }
    if (location.href.startsWith("https://login.wmtransfer.com/GateKeeper/Password/")) {
        document.getElementById("Login").value = wmID;
        document.getElementById("Password").value = wmPass;
        document.querySelector("#Captcha").focus();
    }
})();
 
Скрипт авторизации на cash4brands

Код:
// ==UserScript==
// @name         Cash4Brands login
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       Andronio
// @match        https://cash4brands.ru/
// @match        https://cash4brands.ru/cashback/aliexpress/
// @match        https://cash4brands.ru/gotoshop/25/
// @grant        none
// ==/UserScript==

let loginEmail = "login@ligin.com";
let loginPassw = "Password";

(function repeat() {
    'use strict';
    if (location.href == "https://cash4brands.ru/") {
        let avatar = document.querySelector(".avatar");
        let register = document.querySelectorAll(".login-wrap__reg-link");
        if (!avatar && !register.length) setTimeout(repeat, 100);

        if (register.length) {
            let step = localStorage.getItem("step");
            if (!step || step == "0") {
                localStorage.setItem("step", "1");
                document.querySelector(".login-wrap__login-link").click();
                return setTimeout(repeat, 200);
            }
            if (step == "1") {
                localStorage.setItem("step", "2");
                document.querySelectorAll('[data-form="email_enter"]')[1].click();
                return setTimeout(repeat, 200);
            }
            if (step == "2") {
                localStorage.setItem("step", "0");
                document.querySelectorAll('input[name="email"]')[3].value = loginEmail;
                document.querySelectorAll('input[name="pass"]')[2].value = loginPassw;
                document.querySelectorAll('.btn_group input')[0].click();
            }
        }
        if (avatar) {
            location.href = "https://cash4brands.ru/gotoshop/25/";
            return;
        }
    }
    if (location.href == "https://cash4brands.ru/cashback/aliexpress/") {
        document.querySelector('.goshop_btn_wrap .button.tooltip').click();
    }
    if (location.href == "https://cash4brands.ru/gotoshop/25/") {
        document.querySelector('.button').click();
    }
})();
---------Двойное сообщение соединено: ---------
Скрипт авторизации на bonus.webmoney.ru

Код:
// ==UserScript==
// @name         Bonus WM login
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       Andronio
// @match        https://bonus.webmoney.ru/
// @match        https://login.wmtransfer.com/GateKeeper/Password/*
// @match        https://bonus.webmoney.ru/shop/aliexpress-com/*
// @grant        none
// ==/UserScript==

let wmID   = "000000000000";
let wmPass = "000000000";


(function repeat() {
    'use strict';
    if (location.href.startsWith("https://bonus.webmoney.ru/shop/aliexpress-com/")) {
        let gotoBtn = document.querySelector('.goToShopLink');
        if (!gotoBtn) return setTimeout(repeat, 200);
        location.href = gotoBtn.href;
    }
    if (location.href == "https://bonus.webmoney.ru/") {
        let loginBnt = document.querySelector('.login');
        let avatarBnt = document.getElementById("avatar");
        if (!loginBnt && !avatarBnt) return setTimeout(repeat, 200);
        if (loginBnt) loginBnt.click();
        if (avatarBnt) {
            let shops = document.querySelectorAll('.shopItem');
            if (shops.length == 0) return setTimeout(repeat, 200);
            shops.forEach(elem => {
                if (elem.getAttribute("title").includes("AliExpress")) {
                    elem.querySelector(".shopMoreInfoBtn").click();
                }
            });
            return setTimeout(repeat, 200);
        }
    }
    if (location.href.startsWith("https://login.wmtransfer.com/GateKeeper/Password/")) {
        document.getElementById("Login").value = wmID;
        document.getElementById("Password").value = wmPass;
        document.querySelector("#Captcha").focus();
    }
})();
Огромная просьба, сделай пожалуйста авторизацию в бонус вебмани через яндекс, как это было реализовано в скрипте логина в вебмани.
 
Приветствую, скрипт очень удобным оказался, спасибо! Большая просьба, можешь сделать вариант этого скрипта с кнопкой включения. Кнопка какая нибудь, чтобы скрипт не срабатывал сразу а по запросу?
Настрой действие скрипта на разные страницы. На одной включает одну комбинацию, на другой другую. Например при открытии купонов, включается RU + RUB.
 
Настрой действие скрипта на разные страницы. На одной включает одну комбинацию, на другой другую. Например при открытии купонов, включается RU + RUB.
Я думаю что это немного не то, что нужно человеку. Иногда на одной и той же странице используешь разные валюты.
 
Я думаю что это немного не то, что нужно человеку. Иногда на одной и той же странице используешь разные валюты.
1. Делаешь ссылку, скажем на спецкупоны. Жмякаешь, открываются спецкупоны с нужной валютой, затем переход на нужную страницу.
2. Делаешь ссылку, скажем на купоны. Жмякаешь, открываются купоны с нужной валютой, затем переход на нужную страницу.
Да, это не кнопка, но всё решается в один клик. Думаю сделаю так себе.
 
1. Делаешь ссылку, скажем на спецкупоны. Жмякаешь, открываются спецкупоны с нужной валютой, затем переход на нужную страницу.
2. Делаешь ссылку, скажем на купоны. Жмякаешь, открываются купоны с нужной валютой, затем переход на нужную страницу.
Да, это не кнопка, но всё решается в один клик. Думаю сделаю так себе.
Ну как бы да, как вариант, но иногда нужно на одной и той же странице видеть стоимость в разной валюте. Вобщем кнопка тут лучший вариант и не нужно будет танцы танцевать. Но это авторский проект и захочет он ее делать, или нет, это только ему решать.

ПС По поводу твоей схемы выше, это можно сделать в одном скрипте, или создать отдельный скрипт на каждую отдельную страницу, имеешь ввиду ?
 
Огромная просьба, сделай пожалуйста авторизацию в бонус вебмани через яндекс, как это было реализовано в скрипте логина в вебмани.

Скрипт авторизации на bonus.webmoney.ru через Яндекс
Код:
// ==UserScript==
// @name         Bonus WM login Yandex
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       Andronio
// @match        https://bonus.webmoney.ru/
// @match        https://login.wmtransfer.com/GateKeeper/*
// @match        https://bonus.webmoney.ru/shop/aliexpress-com/*
// @match        https://passport.yandex.ru/auth*
// @grant        none
// ==/UserScript==

let yandexLogin = "login";
let yandexPass  = "pass";

// далее не трогать
let onGoing = false;

(function repeat() {
    'use strict';
    if (location.href.startsWith("https://bonus.webmoney.ru/shop/aliexpress-com/")) {
        let gotoBtn = document.querySelector('.goToShopLink');
        if (!gotoBtn) return setTimeout(repeat, 200);
        location.href = gotoBtn.href;
    }

    if (location.href == "https://bonus.webmoney.ru/") {
        let loginBnt = document.querySelector('.login');
        let avatarBnt = document.getElementById("avatar");
        if (!loginBnt && !avatarBnt) return setTimeout(repeat, 200);
        if (loginBnt) loginBnt.click();
        if (avatarBnt) {
            let shops = document.querySelectorAll('.shopItem');
            if (shops.length == 0) return setTimeout(repeat, 200);
            shops.forEach(elem => {
                if (elem.getAttribute("title").includes("AliExpress")) {
                    elem.querySelector(".shopMoreInfoBtn").click();
                }
            });
            return setTimeout(repeat, 200);
        }
    }

    if (location.href.startsWith("https://login.wmtransfer.com/GateKeeper/Password/")) {
        if (!onGoing) {
            onGoing = true;
            setTimeout(SocialAuthWith('Yandex'), 300);
        }
        return setTimeout(repeat, 200);
    }

    if (location.href.startsWith("https://login.wmtransfer.com/GateKeeper/Factor2/")) {
        document.querySelectorAll('.auth-option input[type="submit"]')[0].click();

    }

    if (location.href.startsWith("https://passport.yandex.ru/auth")) {
        let nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set;
        if (document.getElementById("passp-field-login")) {
            let loginField = document.getElementById("passp-field-login");
            nativeInputValueSetter.call(loginField, yandexLogin);
            loginField.dispatchEvent(new Event('change', {bubbles: true}));
            document.querySelector(".button2_type_submit.passp-form-button").click();
            return setTimeout(repeat, 200);
        } else if (document.getElementById("passp-field-passwd")) {
            let enterLogin = document.querySelector(".passp-current-account__display-name");
            if (enterLogin && enterLogin.innerText == yandexLogin) {
                let passwField = document.getElementById("passp-field-passwd");
                nativeInputValueSetter.call(passwField, yandexPass);
                passwField.dispatchEvent(new Event('change', {bubbles: true}));
                document.querySelector(".button2_type_submit.passp-form-button").click();
                return;
            } else return setTimeout(repeat, 100);
        } else return setTimeout(repeat, 200);
    }
})();
 
  • Like
Реакции: gremlin151 и Razor112
Скрипт авторизации на bonus.webmoney.ru через Яндекс
Код:
// ==UserScript==
// @name         Bonus WM login Yandex
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       Andronio
// @match        https://bonus.webmoney.ru/
// @match        https://login.wmtransfer.com/GateKeeper/*
// @match        https://bonus.webmoney.ru/shop/aliexpress-com/*
// @match        https://passport.yandex.ru/auth*
// @grant        none
// ==/UserScript==

let yandexLogin = "login";
let yandexPass  = "pass";

// далее не трогать
let onGoing = false;

(function repeat() {
    'use strict';
    if (location.href.startsWith("https://bonus.webmoney.ru/shop/aliexpress-com/")) {
        let gotoBtn = document.querySelector('.goToShopLink');
        if (!gotoBtn) return setTimeout(repeat, 200);
        location.href = gotoBtn.href;
    }

    if (location.href == "https://bonus.webmoney.ru/") {
        let loginBnt = document.querySelector('.login');
        let avatarBnt = document.getElementById("avatar");
        if (!loginBnt && !avatarBnt) return setTimeout(repeat, 200);
        if (loginBnt) loginBnt.click();
        if (avatarBnt) {
            let shops = document.querySelectorAll('.shopItem');
            if (shops.length == 0) return setTimeout(repeat, 200);
            shops.forEach(elem => {
                if (elem.getAttribute("title").includes("AliExpress")) {
                    elem.querySelector(".shopMoreInfoBtn").click();
                }
            });
            return setTimeout(repeat, 200);
        }
    }

    if (location.href.startsWith("https://login.wmtransfer.com/GateKeeper/Password/")) {
        if (!onGoing) {
            onGoing = true;
            setTimeout(SocialAuthWith('Yandex'), 300);
        }
        return setTimeout(repeat, 200);
    }

    if (location.href.startsWith("https://login.wmtransfer.com/GateKeeper/Factor2/")) {
        document.querySelectorAll('.auth-option input[type="submit"]')[0].click();

    }

    if (location.href.startsWith("https://passport.yandex.ru/auth")) {
        let nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set;
        if (document.getElementById("passp-field-login")) {
            let loginField = document.getElementById("passp-field-login");
            nativeInputValueSetter.call(loginField, yandexLogin);
            loginField.dispatchEvent(new Event('change', {bubbles: true}));
            document.querySelector(".button2_type_submit.passp-form-button").click();
            return setTimeout(repeat, 200);
        } else if (document.getElementById("passp-field-passwd")) {
            let enterLogin = document.querySelector(".passp-current-account__display-name");
            if (enterLogin && enterLogin.innerText == yandexLogin) {
                let passwField = document.getElementById("passp-field-passwd");
                nativeInputValueSetter.call(passwField, yandexPass);
                passwField.dispatchEvent(new Event('change', {bubbles: true}));
                document.querySelector(".button2_type_submit.passp-form-button").click();
                return;
            } else return setTimeout(repeat, 100);
        } else return setTimeout(repeat, 200);
    }
})();
Спасибо огромное, не хватало очень такого скрипта
 
Посидел-посмотрел, что же есть на каждой странице, куда можно воткнуть кнопочки? Оказывается везде есть логитип AliExpress. Долой его!

Код:
// ==UserScript==
// @name         Aliexpress All Currency Changer
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Изменяет валюту на Алиэкспресс
// @author       Andronio
// @include      https://*aliexpress.ru/*
// @include      https://*aliexpress.com/*
// @grant        none
// @run-at       document-end
// ==/UserScript==

let myCountry = "KZ";

(function repeat() {
    'use strict';
    let logoPic = document.querySelector(".hm-left");
    if (!logoPic) return setTimeout(repeat, 200);
    logoPic.innerHTML = `<div class="currency-button" data-curr="USD"><span class="css_flag css_us" style="display:inline"><span class="shipping-text" style="display:inline">USD</span></span></div>
                        <div class="currency-button" data-curr="RUB"><span class="css_flag css_ru" style="display:inline"><span class="shipping-text" style="display:inline">RUB</span></span></div>`;
    let style = document.createElement("style");
    style.innerHTML = `.currency-button {
                            display: inline-block;
                            padding: 5px 10px;
                            margin: 20px 0 0 20px;
                            border: 2px solid black;
                            border-radius: 0.5em;
                            cursor:pointer;
                        }

                        .no-modify-btn {background-color: OrangeRed;}

                        .yes-modify-btn {background-color: Lime;}
                            `;
    document.head.append(style);
    logoPic.addEventListener("click", btnClickHandler);
})();



function btnClickHandler(event) {
    'use strict';

    let btn = event.target.closest(".currency-button");
    if (!btn) return;
    let currency = btn.dataset.curr;
    let cookies = document.cookie.split('; ');
    let isNeedModif = false;
    let str;
    for (let i = 0; i < cookies.length; i++) {
        if (cookies[i].startsWith("aep_usuc_f=")) { // Если нашел нужную куку
            let cookie = cookies[i].slice(11).split('&'); // Убираем aep_usuc_f= и разделяем
            cookie = cookie.map(elem => { // Смотрим, что в куке
                if (elem.startsWith("c_tp=")) {
                    if (elem.slice(5) == currency)
                        return elem;
                    else {
                    isNeedModif = true;
                    return "c_tp=" + currency;
                    }
                } else if (elem.startsWith("region=")) {
                    let currCountry = elem.slice(7);
                    if (myCountry == "")
                        return elem;
                    else if (currCountry == myCountry)
                        return elem
                    else {
                        isNeedModif = true;
                        return "region=" + myCountry;
                    }

                } else return elem;
            });
            str = cookie.join("&");
            break;
        }
    }
    if (isNeedModif) {
        if (window.location.hostname.includes("aliexpress.ru")) {
            document.cookie = `aep_usuc_f=${str}; path=/; expires=Tue, 19 Jan 2088 03:14:07 GMT; domain=.aliexpress.ru`;
            window.location.reload();
        } else if (window.location.hostname.includes("aliexpress.com")) {
            document.cookie = `aep_usuc_f=${str}; path=/; expires=Tue, 19 Jan 2088 03:14:07 GMT; domain=.aliexpress.com`;
            window.location.reload();
        } else {alert("Ошибка в скрипте")};
        btn.classList.add("yes-modify-btn");
        setTimeout(() => {btn.classList.remove("yes-modify-btn");}, 300);
        window.location.reload();
    } else {
        btn.classList.add("no-modify-btn");
        setTimeout(() => {btn.classList.remove("no-modify-btn");}, 300);
    }
}