Last active
August 29, 2015 14:06
-
-
Save nanonanomachine/b2d8b8adfec5d238afa6 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
(function() { | |
function seirekiReplacer(str, p) { | |
if (p == '1' || p == '1' || p == '元') { | |
return str + '(西暦1988年)'; | |
} else { | |
var seireki = Number(p) + 1988; | |
return str + '(西暦' + seireki + '年)'; | |
} | |
} | |
document.body.innerHTML = document.body.innerHTML.replace(/平成\s*(\d{1,2}|元)\s*年/g, seirekiReplacer); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment