45 lines
1.7 KiB
JavaScript
45 lines
1.7 KiB
JavaScript
// ==UserScript==
|
||
// @name Вывод в дооларах к Тенге
|
||
// @namespace http://tampermonkey.net/
|
||
// @version 0.3
|
||
// @description try to take over the world!
|
||
// @author You
|
||
// @match https://aliexpress.ru/item/*
|
||
// @icon https://www.google.com/s2/favicons?sz=64&domain=aliexpress.ru
|
||
// @downloadURL https://gitlabappserver.lkaz.ru/lukas91/js-tampermonkey-public-scripts/raw/branch/main/Withdrawal%20in%20dollars%20to%20tenge.js
|
||
// @updateURL https://gitlabappserver.lkaz.ru/lukas91/js-tampermonkey-public-scripts/raw/branch/main/Withdrawal%20in%20dollars%20to%20tenge.js
|
||
// @grant none
|
||
// ==/UserScript==
|
||
|
||
// Функция для ожидания загрузки страницы
|
||
console.log('start');
|
||
|
||
function waitForPageLoad(callback) {
|
||
if (document.readyState === "complete") {
|
||
callback();
|
||
console.log('complete');
|
||
|
||
} else {
|
||
window.addEventListener("load", callback);
|
||
console.log('load');
|
||
}
|
||
}
|
||
|
||
// Функция для выполнения вычислений и обновления страницы
|
||
function performCalculations() {
|
||
const priceElement = document.querySelector('[class^="snow-price_SnowPrice__mainS__"]');
|
||
if (priceElement) {
|
||
const priceText = priceElement.innerText;
|
||
const priceInKZT = parseFloat(priceText.replace(/\s/g, '').replace('₸', '').replace(',', '.'));
|
||
const priceInUSD = (priceInKZT / 462.105).toFixed(2);
|
||
|
||
// Обновление страницы с новыми данными
|
||
priceElement.innerHTML = `${priceText} / (${priceInUSD}$)`;
|
||
}
|
||
}
|
||
|
||
|
||
|
||
// Ожидание загрузки страницы и выполнение вычислений
|
||
waitForPageLoad(performCalculations);
|