Last active
November 16, 2023 12:22
-
-
Save Vanawy/cdf5edcdd574b3ed59206b4bc1c3e31c to your computer and use it in GitHub Desktop.
Wildberries.by 404 fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Wildberries 404 Fix | |
// @namespace http://tampermonkey.net/ | |
// @version 0.2.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://www.wildberries.by/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=wildberries.by | |
// @grant none | |
// @homepage https://gist.github.com/Vanawy/ | |
// @updateURL https://gist.githubusercontent.com/Vanawy/cdf5edcdd574b3ed59206b4bc1c3e31c/raw/wb.js | |
// @downloadURL https://gist.githubusercontent.com/Vanawy/cdf5edcdd574b3ed59206b4bc1c3e31c/raw/wb.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
let location = new URL(window.location.href); | |
let m = location.pathname.match(/\/catalog\/(\d+)\/detail.aspx/i) | |
if (m) { | |
let url = new URL('/product', location); | |
url.searchParams.append('card', m[1]); | |
let option = location.searchParams.get('size'); | |
if (option) { | |
url.searchParams.append('option', option); | |
} | |
window.location = url.href; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment