Last active
February 8, 2018 06:49
-
-
Save ArcCosine/a10fe5b460dd068a2a13beef1ba8426b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
javascript:( | |
() => { | |
'use strict'; | |
const getLastUpdate = domObj => { | |
return domObj.querySelector(".contributors-sub time").dateTime; | |
}; | |
//XMLHttpRequestで英語版MDNを取得 | |
fetch("https://developer.mozilla.org" + location.pathname.replace(/\/ja\//, "/en-US/")) | |
.then( response => { | |
return response.text(); | |
}) | |
.then( resText => { | |
const parser = new DOMParser(); | |
//英語版MDNページの最終更新日を取得 | |
const enlastmod = getLastUpdate(parser.parseFromString(resText, "text/html")); | |
//現在の日本語版MDNページの最終更新日を取得 | |
const jalastmod = getLastUpdate(document); | |
const message = (Date.parse(jalastmod) - Date.parse(enlastmod) < 0 ) ? `${jalastmod} :ja\n${enlastmod} :en\n日本語の情報が古いです。` : "☺"; | |
window.alert(message); | |
}); | |
} | |
)(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ref:http://momdo.hatenablog.jp/entry/20180207/1518006798