Skip to content

Instantly share code, notes, and snippets.

@td2sk
Last active January 27, 2024 10:52
Show Gist options
  • Save td2sk/4a7ed5f022949248dbd0ea076fd66fcf to your computer and use it in GitHub Desktop.
Save td2sk/4a7ed5f022949248dbd0ea076fd66fcf to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Redirect for akizuki catalog
// @namespace http://tampermonkey.net/
// @version 2024-01-26
// @description Redirects from the old akizuki product page to the new one.
// @author td2sk
// @match https://akizukidenshi.com/catalog/g/*/
// @icon https://www.google.com/s2/favicons?sz=64&domain=akizukidenshi.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
const pattern = /^https:\/\/akizukidenshi\.com\/catalog\/g\/g[a-zA-Z]-([0-9]+)\/$/;
const url = document.URL;
const m = url.match(pattern);
if (!m) { return; }
const newUrl = `https://akizukidenshi.com/catalog/g/g1${m[1]}`;
window.location.href = newUrl;
})();
@td2sk
Copy link
Author

td2sk commented Jan 26, 2024

This code is licensed under CC0.

@td2sk
Copy link
Author

td2sk commented Jan 27, 2024

This script is no longer needed because the redirect setting has been added to the website itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment