mirror of
				https://github.com/Maks1mS/userscripts.git
				synced 2025-11-04 07:01:24 +03:00 
			
		
		
		
	Compare commits
	
		
			14 Commits
		
	
	
		
			b6ff558469
			...
			main
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| becff1ef68 | |||
| 5f002ba7f7 | |||
| 
						 | 
					9cad4d315b | ||
| 
						 | 
					cf8ed72d1a | ||
| 38b3fe10be | |||
| 91e5166b44 | |||
| 82ea415171 | |||
| fbe2e6e830 | |||
| 5de1a557f1 | |||
| 
						 | 
					db9d93407d | ||
| 32a4239fe4 | |||
| 6e2eb40def | |||
| 1e5f939be0 | |||
| 5326567242 | 
							
								
								
									
										171
									
								
								FreeOzonDPR/FreeOzonDPR.user.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										171
									
								
								FreeOzonDPR/FreeOzonDPR.user.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,171 @@
 | 
				
			|||||||
 | 
					// ==UserScript==
 | 
				
			||||||
 | 
					// @name         БЕСПЛАТНЫЕ ПВЗ ОЗОН
 | 
				
			||||||
 | 
					// @namespace    https://github.com/Maks1mS/userscripts
 | 
				
			||||||
 | 
					// @version      0.2.1
 | 
				
			||||||
 | 
					// @description  Заменяет партнерские ПВЗ на понятные адреса
 | 
				
			||||||
 | 
					// @author       Maxim Slipenko
 | 
				
			||||||
 | 
					// @match        https://www.ozon.ru/*
 | 
				
			||||||
 | 
					// @icon         https://www.google.com/s2/favicons?sz=64&domain=ozon.ru
 | 
				
			||||||
 | 
					// @grant        GM_xmlhttpRequest
 | 
				
			||||||
 | 
					// ==/UserScript==
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(function () {
 | 
				
			||||||
 | 
					    'use strict';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function qs(...args) {
 | 
				
			||||||
 | 
					        return document.querySelector(...args);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function qsa(...args) {
 | 
				
			||||||
 | 
					        return Array.from(document.querySelectorAll(...args));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    async function GM_fetch(url, { method = "get", headers } = {}) {
 | 
				
			||||||
 | 
					        return new Promise((resolve, _reject) => {
 | 
				
			||||||
 | 
					            const blobPromise = new Promise((resolve, reject) => {
 | 
				
			||||||
 | 
					                GM_xmlhttpRequest({
 | 
				
			||||||
 | 
					                    url,
 | 
				
			||||||
 | 
					                    method,
 | 
				
			||||||
 | 
					                    headers,
 | 
				
			||||||
 | 
					                    responseType: "blob",
 | 
				
			||||||
 | 
					                    onload: response => resolve(response.response),
 | 
				
			||||||
 | 
					                    onerror: reject,
 | 
				
			||||||
 | 
					                    ontimeout: reject,
 | 
				
			||||||
 | 
					                    onreadystatechange: onHeadersReceived
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					            blobPromise.catch(_reject);
 | 
				
			||||||
 | 
					            function onHeadersReceived(response) {
 | 
				
			||||||
 | 
					                const {
 | 
				
			||||||
 | 
					                    readyState, responseHeaders, status, statusText
 | 
				
			||||||
 | 
					                } = response;
 | 
				
			||||||
 | 
					                if (readyState === 2) { // HEADERS_RECEIVED
 | 
				
			||||||
 | 
					                    const headers = parseHeaders(responseHeaders);
 | 
				
			||||||
 | 
					                    resolve({
 | 
				
			||||||
 | 
					                        headers,
 | 
				
			||||||
 | 
					                        status,
 | 
				
			||||||
 | 
					                        statusText,
 | 
				
			||||||
 | 
					                        ok: status.toString().startsWith("2"),
 | 
				
			||||||
 | 
					                        arrayBuffer: () => blobPromise.then(blob => blob.arrayBuffer()),
 | 
				
			||||||
 | 
					                        blob: () => blobPromise,
 | 
				
			||||||
 | 
					                        json: () => blobPromise.then(blob => blob.text()).then(text => JSON.parse(text)),
 | 
				
			||||||
 | 
					                        text: () => blobPromise.then(blob => blob.text()),
 | 
				
			||||||
 | 
					                    });
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function parseHeaders(headersString) {
 | 
				
			||||||
 | 
					        class Headers {
 | 
				
			||||||
 | 
					            get(key) {
 | 
				
			||||||
 | 
					                return this[key.toLowerCase()];
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const headers = new Headers();
 | 
				
			||||||
 | 
					        for (const line of headersString.trim().split("\n")) {
 | 
				
			||||||
 | 
					            const [key, ...valueParts] = line.split(":"); // last-modified: Fri, 21 May 2021 14:46:56 GMT
 | 
				
			||||||
 | 
					            headers[key.trim().toLowerCase()] = valueParts.join(":").trim();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return headers;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const observers = new WeakMap();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function addObserver(element, callback, config = { childList: true }) {
 | 
				
			||||||
 | 
					        if (element && !observers.has(element)) {
 | 
				
			||||||
 | 
					            const observer = new MutationObserver(callback);
 | 
				
			||||||
 | 
					            observer.observe(element, config);
 | 
				
			||||||
 | 
					            observers.set(element, observer);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    async function main() {
 | 
				
			||||||
 | 
					        const result = await GM_fetch('https://free-ozon-dpr.vercel.app/merged-data.json');
 | 
				
			||||||
 | 
					        const json = await result.json()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        function updateInfo(node) {
 | 
				
			||||||
 | 
					            const text = node.textContent;
 | 
				
			||||||
 | 
					            const id = text.split(' ').at(-1);
 | 
				
			||||||
 | 
					            const pvz = json.find(obj => obj.id === id);
 | 
				
			||||||
 | 
					            if (pvz) {
 | 
				
			||||||
 | 
					                node.title = node.textContent;
 | 
				
			||||||
 | 
					                node.textContent = pvz.address;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        function handleElement(element) {
 | 
				
			||||||
 | 
					            if (element) {
 | 
				
			||||||
 | 
					                updateInfo(element);
 | 
				
			||||||
 | 
					                addObserver(element, () => {
 | 
				
			||||||
 | 
					                    updateInfo(element);
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        function updateInfoALL() {
 | 
				
			||||||
 | 
					            const headerAddress = qs('[data-widget="addressBookBarWeb"] .tsBody400Small');
 | 
				
			||||||
 | 
					            const commonAddressBook = qsa('[data-widget="commonAddressBook"] .tsBody500Medium');
 | 
				
			||||||
 | 
					            const delivery = qsa('[data-widget="orderDeliveryDetails"] .tsBody500Medium');
 | 
				
			||||||
 | 
					            const delivery2 = qsa('[data-widget="rfbsAddressInfo"] .tsBody500Medium');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            const elements = [headerAddress, ...commonAddressBook, ...delivery, ...delivery2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            elements.forEach(handleElement);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        function updateInfoPeriodically(interval) {
 | 
				
			||||||
 | 
					            setInterval(updateInfoALL, interval);
 | 
				
			||||||
 | 
					            updateInfoALL();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        async function onSelectorAdd(targetNode, selector, callback) {
 | 
				
			||||||
 | 
					            function check(s) {
 | 
				
			||||||
 | 
					                const r = qs(s);
 | 
				
			||||||
 | 
					                if (r) {
 | 
				
			||||||
 | 
					                    callback(r);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            function checkSelector() {
 | 
				
			||||||
 | 
					                if (Array.isArray(selector)) {
 | 
				
			||||||
 | 
					                    selector.forEach(check);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                check(selector);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            checkSelector();
 | 
				
			||||||
 | 
					            function handle(mutationsList) {
 | 
				
			||||||
 | 
					                for (let mutation of mutationsList) {
 | 
				
			||||||
 | 
					                    if (mutation.type === 'childList') {
 | 
				
			||||||
 | 
					                        checkSelector();
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            addObserver(targetNode, handle, { childList: true, subtree: true });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let called = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        function fullExecute() {
 | 
				
			||||||
 | 
					            if (called) return;
 | 
				
			||||||
 | 
					            called = true;
 | 
				
			||||||
 | 
					            updateInfoALL();
 | 
				
			||||||
 | 
					            onSelectorAdd(document.body, [
 | 
				
			||||||
 | 
					                '[data-widget="commonAddressBook"]',
 | 
				
			||||||
 | 
					            ], updateInfoALL);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        window.addEventListener('popstate', fullExecute);
 | 
				
			||||||
 | 
					        window.addEventListener('load', fullExecute);
 | 
				
			||||||
 | 
					        document.addEventListener('DOMContentLoaded', fullExecute);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (document.readyState == "complete" ||
 | 
				
			||||||
 | 
					            document.readyState == "loaded" ||
 | 
				
			||||||
 | 
					            document.readyState == "interactive"
 | 
				
			||||||
 | 
					        ) {
 | 
				
			||||||
 | 
					            fullExecute();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    main();
 | 
				
			||||||
 | 
					})();
 | 
				
			||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
// ==UserScript==
 | 
					// ==UserScript==
 | 
				
			||||||
// @name         Github Link External Resources
 | 
					// @name         Github Link External Resources
 | 
				
			||||||
// @namespace    https://github.com/Maks1mS/userscripts
 | 
					// @namespace    https://github.com/Maks1mS/userscripts
 | 
				
			||||||
// @version      0.1
 | 
					// @version      0.2
 | 
				
			||||||
// @description  Github Link External Resources
 | 
					// @description  Github Link External Resources
 | 
				
			||||||
// @author       Maxim Slipenko
 | 
					// @author       Maxim Slipenko
 | 
				
			||||||
// @match        https://github.com/*
 | 
					// @match        https://github.com/*
 | 
				
			||||||
@@ -30,8 +30,9 @@
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function t(key) {
 | 
					    function t(key) {
 | 
				
			||||||
        const currentLang = navigator.language;
 | 
					        const currentLang = navigator.language || 'en-US';
 | 
				
			||||||
        return translations?.[currentLang]?.[key] ?? translations?.['en-US'] ?? key;
 | 
					        const shortLang = currentLang.split('-')[0];
 | 
				
			||||||
 | 
					        return translations?.[currentLang]?.[key] ?? translations?.[shortLang]?.[key] ?? translations?.['en-US']?.[key] ?? key;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const settingsId = 'GithubLinkExternalResources';
 | 
					    const settingsId = 'GithubLinkExternalResources';
 | 
				
			||||||
@@ -46,7 +47,7 @@
 | 
				
			|||||||
            data: {
 | 
					            data: {
 | 
				
			||||||
                label: t('config'),
 | 
					                label: t('config'),
 | 
				
			||||||
                type: 'textarea',
 | 
					                type: 'textarea',
 | 
				
			||||||
                // github prefix org or org/repo | prefix | url ($1 - numeric identifier)
 | 
					                // github prefix org or org/repo | prefix | url ($2 - numeric identifier)
 | 
				
			||||||
                default: 'pyside | PYSIDE- | https://bugreports.qt.io/browse/$1'
 | 
					                default: 'pyside | PYSIDE- | https://bugreports.qt.io/browse/$1'
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
@@ -66,6 +67,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    const selector = '.js-issue-title.markdown-title,' +
 | 
					    const selector = '.js-issue-title.markdown-title,' +
 | 
				
			||||||
          '.js-navigation-open.markdown-title,' +
 | 
					          '.js-navigation-open.markdown-title,' +
 | 
				
			||||||
 | 
					          '.commit-title.markdown-title,' +
 | 
				
			||||||
          '#partial-actions-workflow-runs .Link--primary,' + // actions
 | 
					          '#partial-actions-workflow-runs .Link--primary,' + // actions
 | 
				
			||||||
          '.repository-content h3.PageHeader-title > span > span,' + // actions
 | 
					          '.repository-content h3.PageHeader-title > span > span,' + // actions
 | 
				
			||||||
          'div.my-2.Details-content--hidden,' + // commit message
 | 
					          'div.my-2.Details-content--hidden,' + // commit message
 | 
				
			||||||
@@ -73,7 +75,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    const replace = (node, row) => {
 | 
					    const replace = (node, row) => {
 | 
				
			||||||
        if (!node) return;
 | 
					        if (!node) return;
 | 
				
			||||||
         const re = new RegExp(`\\b(${row[1]}\\d+)\\b(?!<\\/a>|")`, 'g');
 | 
					        const re = new RegExp(`\\b(${row[1]}(\\d+))\\b(?!<\\/a>|")`, 'g');
 | 
				
			||||||
 | 
					        console.log(re);
 | 
				
			||||||
        node.innerHTML = node.innerHTML.replace(re, `<a href="${row[2]}">$1</a>`);
 | 
					        node.innerHTML = node.innerHTML.replace(re, `<a href="${row[2]}">$1</a>`);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -81,16 +84,15 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    const run = (url) => {
 | 
					    const run = (url) => {
 | 
				
			||||||
        const row = data.find(row => url.startsWith(`https://github.com/${row[0]}`));
 | 
					        const row = data.find(row => url.startsWith(`https://github.com/${row[0]}`));
 | 
				
			||||||
 | 
					        console.log(data);
 | 
				
			||||||
        console.log(row)
 | 
					        if (!row) return;
 | 
				
			||||||
 | 
					        console.log(row);
 | 
				
			||||||
        const matches = document.querySelectorAll(selector)
 | 
					        const matches = document.querySelectorAll(selector)
 | 
				
			||||||
        matches.forEach(n => replace(n, row));
 | 
					        matches.forEach(n => replace(n, row));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const onInit = gmc => new Promise(resolve => {
 | 
					    const onInit = gmc => new Promise(resolve => {
 | 
				
			||||||
       let isInit = () => setTimeout(() =>
 | 
					        let isInit = () => setTimeout(() => gmc.isInit ? resolve() : isInit(), 0);
 | 
				
			||||||
       gmc.isInit ? resolve() : isInit(), 0);
 | 
					 | 
				
			||||||
        isInit();
 | 
					        isInit();
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -102,4 +104,5 @@
 | 
				
			|||||||
            });
 | 
					            });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
})();
 | 
					})();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,10 +1,11 @@
 | 
				
			|||||||
// ==UserScript==
 | 
					// ==UserScript==
 | 
				
			||||||
// @name         Steam Price Converter
 | 
					// @name         Steam Price Converter
 | 
				
			||||||
// @namespace    https://github.com/Maks1mS/userscripts
 | 
					// @namespace    https://github.com/Maks1mS/userscripts
 | 
				
			||||||
// @version      0.1
 | 
					// @version      0.7.1
 | 
				
			||||||
// @description  Converts prices to rubles
 | 
					// @description  Converts prices to rubles
 | 
				
			||||||
// @author       Maxim Slipenko
 | 
					// @author       Maxim Slipenko
 | 
				
			||||||
// @match        https://store.steampowered.com/*
 | 
					// @match        https://store.steampowered.com/*
 | 
				
			||||||
 | 
					// @match        https://steamcommunity.com/*
 | 
				
			||||||
// @icon         https://www.google.com/s2/favicons?sz=64&domain=steampowered.com
 | 
					// @icon         https://www.google.com/s2/favicons?sz=64&domain=steampowered.com
 | 
				
			||||||
// @grant        GM_xmlhttpRequest
 | 
					// @grant        GM_xmlhttpRequest
 | 
				
			||||||
// @grant        GM_registerMenuCommand
 | 
					// @grant        GM_registerMenuCommand
 | 
				
			||||||
@@ -23,6 +24,9 @@
 | 
				
			|||||||
        source_symbol: undefined
 | 
					        source_symbol: undefined
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const delay = (ms) =>
 | 
				
			||||||
 | 
					        new Promise(resolve => setTimeout(resolve, ms));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async function getRates() {
 | 
					    async function getRates() {
 | 
				
			||||||
        const arr = await new Promise((resolve, reject) => {
 | 
					        const arr = await new Promise((resolve, reject) => {
 | 
				
			||||||
            GM_xmlhttpRequest({
 | 
					            GM_xmlhttpRequest({
 | 
				
			||||||
@@ -50,8 +54,31 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    function getCurrentValute() {
 | 
					    function getCurrentValute() {
 | 
				
			||||||
        const walletText = document.getElementById('header_wallet_balance').innerText;
 | 
					        const walletText = document.getElementById('header_wallet_balance').innerText;
 | 
				
			||||||
        const symbol = Object.keys(SYMBOL_TO_CODE_MAPPING).find(symbol => walletText.includes(symbol))
 | 
					        state.source_symbol = Object.keys(SYMBOL_TO_CODE_MAPPING).find(symbol => walletText.includes(symbol))
 | 
				
			||||||
        return SYMBOL_TO_CODE_MAPPING[symbol];
 | 
					        return SYMBOL_TO_CODE_MAPPING[state.source_symbol];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const observers = new WeakMap();
 | 
				
			||||||
 | 
					    function addObserver(element, callback, config = { childList: true }) {
 | 
				
			||||||
 | 
					        if (element && !observers.has(element)) {
 | 
				
			||||||
 | 
					            const observer = new MutationObserver(callback);
 | 
				
			||||||
 | 
					            observer.observe(element, config);
 | 
				
			||||||
 | 
					            observers.set(element, observer);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function qs(...args) {
 | 
				
			||||||
 | 
					        return document.querySelector(...args);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function debounce(callback, delay) {
 | 
				
			||||||
 | 
					        let timeout;
 | 
				
			||||||
 | 
					        return function (...args) {
 | 
				
			||||||
 | 
					            clearTimeout(timeout);
 | 
				
			||||||
 | 
					            timeout = setTimeout(() => {
 | 
				
			||||||
 | 
					                callback(...args);
 | 
				
			||||||
 | 
					            }, delay);
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async function main() {
 | 
					    async function main() {
 | 
				
			||||||
@@ -62,22 +89,76 @@
 | 
				
			|||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const convert = (n) => +(n * rates[source_valute].value).toFixed(2);
 | 
					        // await delay(75);
 | 
				
			||||||
        replace(convert);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        GM_registerMenuCommand("update", () => replace(convert), "u");
 | 
					        const convert = (n) => +(n * rates[source_valute].value).toFixed(2);
 | 
				
			||||||
 | 
					        const execute = () => {
 | 
				
			||||||
 | 
					            replace(convert);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        const config = { childList: true, subtree: true };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        function handle(mutationsList, observer) {
 | 
				
			||||||
 | 
					            observer.disconnect();
 | 
				
			||||||
 | 
					            execute();
 | 
				
			||||||
 | 
					            observer.observe(document.body, config);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        const debouncedCallback = debounce(handle, 300);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        addObserver(document.body, debouncedCallback, config);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        window.addEventListener('popstate', execute);
 | 
				
			||||||
 | 
					        window.addEventListener('load', execute);
 | 
				
			||||||
 | 
					        document.addEventListener('DOMContentLoaded', execute);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (document.readyState == "complete" ||
 | 
				
			||||||
 | 
					            document.readyState == "loaded" ||
 | 
				
			||||||
 | 
					            document.readyState == "interactive"
 | 
				
			||||||
 | 
					        ) {
 | 
				
			||||||
 | 
					            execute();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // GM_registerMenuCommand("update", () => replace(convert), "u");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function replace(convert) {
 | 
					    function replace(convert) {
 | 
				
			||||||
        let r = document.evaluate('//text()[contains(., \"₸\")]',document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
 | 
					        let xpath = `//text()[contains(., \"${state.source_symbol}\") and not(ancestor::*[@data-converted]) and not(ancestor::script)]`;
 | 
				
			||||||
 | 
					        let r = document.evaluate(xpath, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (let i = 0; i < r.snapshotLength; i++) {
 | 
					        for (let i = 0; i < r.snapshotLength; i++) {
 | 
				
			||||||
            let n = r.snapshotItem(i);
 | 
					            let n = r.snapshotItem(i);
 | 
				
			||||||
            const value = parseFloat(n.textContent.replace(" ", "").replace(',', '.'))
 | 
					            let textContent = n.textContent;
 | 
				
			||||||
            n.replaceWith(`${convert(value)} ₽`);
 | 
					            let regex = new RegExp(`(\\${state.source_symbol}\\s*[0-9\\s]+[.,]?[0-9]*(?:USD)?|[0-9\\s]*[.,]?[0-9]+\\s*\\${state.source_symbol})`, 'g');
 | 
				
			||||||
            console.log(n)
 | 
					
 | 
				
			||||||
 | 
					            let newContent = textContent.replace(regex, (match) => {
 | 
				
			||||||
 | 
					                let value;
 | 
				
			||||||
 | 
					                let originalValue;
 | 
				
			||||||
 | 
					                originalValue = match.replace(state.source_symbol, '').replace(' ', '').replace(',', '.').trim();
 | 
				
			||||||
 | 
					                value = parseFloat(originalValue);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                let convertedValue = convert(value);
 | 
				
			||||||
 | 
					                let formattedConvertedValue;
 | 
				
			||||||
 | 
					                let formattedOriginalValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (match.trim().startsWith(state.source_symbol)) {
 | 
				
			||||||
 | 
					                    formattedOriginalValue = `${state.source_symbol}${originalValue}`;
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    formattedOriginalValue = `${originalValue}${state.source_symbol}`;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                formattedConvertedValue = `${convertedValue}₽`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                return `${formattedConvertedValue} / ${formattedOriginalValue}`;
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            let newNode = document.createTextNode(newContent);
 | 
				
			||||||
 | 
					            n.parentNode.setAttribute('data-converted', 'true');
 | 
				
			||||||
 | 
					            n.parentNode.replaceChild(newNode, n);
 | 
				
			||||||
 | 
					            // console.log(newNode);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    main();
 | 
					    main();
 | 
				
			||||||
})();
 | 
					})();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
// ==UserScript==
 | 
					// ==UserScript==
 | 
				
			||||||
// @name         VK Big Chat Stickers
 | 
					// @name         VK Big Chat Stickers
 | 
				
			||||||
// @namespace    https://github.com/Maks1mS/userscripts
 | 
					// @namespace    https://github.com/Maks1mS/userscripts
 | 
				
			||||||
// @version      0.2
 | 
					// @version      0.3
 | 
				
			||||||
// @description  Increases size of chat stickers
 | 
					// @description  Increases size of chat stickers
 | 
				
			||||||
// @author       Maxim Slipenko
 | 
					// @author       Maxim Slipenko
 | 
				
			||||||
// @match        https://vk.com/*
 | 
					// @match        https://vk.com/*
 | 
				
			||||||
@@ -13,10 +13,14 @@
 | 
				
			|||||||
    'use strict';
 | 
					    'use strict';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const style = `
 | 
					    const style = `
 | 
				
			||||||
    img.StickerUGC {
 | 
					    .sticker_img_wrapper:has(.StickerUGC) {
 | 
				
			||||||
        width: 256px;
 | 
					        width: 256px;
 | 
				
			||||||
        height: 256px;
 | 
					        height: 256px;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    img.StickerUGC {
 | 
				
			||||||
 | 
					        height: 100%;
 | 
				
			||||||
 | 
					        width: 100%;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    .StickersEmojiKeyboard-module__in--GCR5_:has(.StickersKeyboardGroupItem-module__in--CKjkC.StickersKeyboardGroupItem-module__inActive--iqstp > div[aria-label="Стикеры чата"]) .StickersKeyboard-module__keyboard--HhSGu.View-module__panel--WNKKi.View-module__panelSwitched--hg3jP {
 | 
					    .StickersEmojiKeyboard-module__in--GCR5_:has(.StickersKeyboardGroupItem-module__in--CKjkC.StickersKeyboardGroupItem-module__inActive--iqstp > div[aria-label="Стикеры чата"]) .StickersKeyboard-module__keyboard--HhSGu.View-module__panel--WNKKi.View-module__panelSwitched--hg3jP {
 | 
				
			||||||
        --stickers-columns: 2 !important;
 | 
					        --stickers-columns: 2 !important;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user