From 960fdc1bef0895c177230ae6edd07782b80bc4ac Mon Sep 17 00:00:00 2001 From: Masaki Kobayashi Date: Fri, 10 Jul 2026 06:23:14 +0900 Subject: [PATCH] Add `rakuten-humanized` --- README.md | 4 +++ dist/rakuten-humanized.user.js | 25 +++++++++++++++++++ .../rakuten-humanized/index.user.ts | 22 ++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 dist/rakuten-humanized.user.js create mode 100644 src/userscripts/rakuten-humanized/index.user.ts diff --git a/README.md b/README.md index ebe176b5..17c36ab5 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,10 @@ Redirect Japanese pages in MDN to corresponding English pages Ctrl+Enter in "Save from site" +### [Rakuten Humanized](https://github.com/mkobayashime/userscripts/raw/main/dist/rakuten-humanized.user.js) + +楽天の商品ページを人間にも使える程度にマシにします + ### [Scrapbox - Clear Watch List](https://github.com/mkobayashime/userscripts/raw/main/dist/scrapbox-clear-watch-list.user.js) Scrapbox の Watch List を自動的に全削除します diff --git a/dist/rakuten-humanized.user.js b/dist/rakuten-humanized.user.js new file mode 100644 index 00000000..75a6f4b9 --- /dev/null +++ b/dist/rakuten-humanized.user.js @@ -0,0 +1,25 @@ +// ==UserScript== +// @name Rakuten Humanized +// @namespace mkobayashime +// @version 1.0.0 +// @description 楽天の商品ページを人間にも使える程度にマシにします +// @icon https://www.google.com/s2/favicons?domain=rakuten.co.jp +// @author mkobayashime +// @homepage https://github.com/mkobayashime/userscripts +// @homepageURL https://github.com/mkobayashime/userscripts +// @match https://item.rakuten.co.jp/* +// @run-at document-end +// @updateURL https://github.com/mkobayashime/userscripts/raw/main/dist/rakuten-humanized.user.js +// @downloadURL https://github.com/mkobayashime/userscripts/raw/main/dist/rakuten-humanized.user.js +// ==/UserScript== + +// src/userscripts/rakuten-humanized/index.user.ts +void (() => { + const itemNameArea = document.querySelector("#item-name-area"); + if (!itemNameArea) return; + const table = itemNameArea.closest("table:has(#item-name-area)"); + if (!table) return; + const prevSibling = table.previousElementSibling; + if (!prevSibling) return; + prevSibling.before(table); +})(); diff --git a/src/userscripts/rakuten-humanized/index.user.ts b/src/userscripts/rakuten-humanized/index.user.ts new file mode 100644 index 00000000..2ed33410 --- /dev/null +++ b/src/userscripts/rakuten-humanized/index.user.ts @@ -0,0 +1,22 @@ +import { defineUserScript } from "bundlemonkey"; + +export default defineUserScript({ + name: "Rakuten Humanized", + version: "1.0.0", + description: "楽天の商品ページを人間にも使える程度にマシにします", + match: ["https://item.rakuten.co.jp/*"], + runAt: "document-end", + icon: "https://www.google.com/s2/favicons?domain=rakuten.co.jp", + main: () => { + const itemNameArea = document.querySelector("#item-name-area"); + if (!itemNameArea) return; + + const table = itemNameArea.closest("table:has(#item-name-area)"); + if (!table) return; + + const prevSibling = table.previousElementSibling; + if (!prevSibling) return; + + prevSibling.before(table); + }, +});