Greasy Fork is available in English.

Discussions » Creation Requests

Скрипт, отображающий цифровой ID во ВКонтакте

§
Posted: 23.11.2022

Нужен скрипт, который, при заходе на чью либо страницу во ВКонтакте, отображал бы в адресной строке ссылку на страницу в цифровом виде, то есть не "https://vk.com/durov", а "https://vk.com/id1".

§
Posted: 30.11.2022
Edited: 30.11.2022
// ==UserScript==
// @name         change id
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       DoctorDeathDDracula
// @match        https://vk.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=vk.com
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    window.fetch = new Proxy(window.fetch, {
        async apply(target, thisArg, args) {

            const data = await Reflect.apply(...arguments);
            if (args[0] == "https://login.vk.com/?act=web_token") {
                const json = await data.json();
                window.history.pushState({}, 'id' + json.data.user_id, '/id' + json.data.user_id)
                data.json = async () => json;
            }
            return data;
        }
    });

})();

Post reply

Sign in to post a reply.