Last active
January 11, 2024 11:14
-
-
Save koreapyj/d1bb06642e79163f7833e05193df4605 to your computer and use it in GitHub Desktop.
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 Yahoo Transit | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://transit.yahoo.co.jp/timetable/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=yahoo.co.jp | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
Array.from(document.querySelectorAll('a[href^="/station/"]')).forEach(x=>{ | |
const li = document.createElement('li') | |
const a = document.createElement('a') | |
const url = new URL(x.href) | |
const {1:station} = url.pathname.match(/^\/station\/(\d+)/) | |
a.href = `/timetable/${station}` | |
a.textContent = '時刻表' | |
li.appendChild(a) | |
x.parentNode.parentNode.insertBefore(li, x.parentNode) | |
}) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment