Last active
July 24, 2018 15:19
-
-
Save abcang/d2cc84dd260cf7d6c7fbdfaf4385353e to your computer and use it in GitHub Desktop.
wikiwiki external link
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 wikiwiki external link | |
// @namespace https://gist.github.com/abcang/d2cc84dd260cf7d6c7fbdfaf4385353e | |
// @version 0.2 | |
// @description wikiwikiの外部リンクを使いやすくする | |
// @author abcang | |
// @match https://wikiwiki.jp/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
replace(); | |
document.addEventListener('DOMContentLoaded', replace, false); | |
function replace() { | |
for (const a of document.querySelectorAll('a[href^="https://re.wikiwiki.jp/"]')) { | |
const link = a.getAttribute('href'); | |
a.setAttribute('href', link.replace('https://re.wikiwiki.jp/?', '')); | |
a.setAttribute('target', '_blank'); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment