Created
February 7, 2018 14:00
-
-
Save ArcCosine/641322128fa6a2440fc108237b3a765a 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
javascript:( | |
function () { | |
'use strict'; | |
//現在の日本語版MDNページの最終更新日を取得 | |
//XMLHttpRequestで英語版MDNを取得 | |
fetch('https://developer.mozilla.org' + location.pathname.replace('\/ja\/', '\/en-US\/')) | |
.then(function(response){ | |
return response.text(); | |
}).then(function(resText){ | |
var parser = new DOMParser(); | |
var dom = parser.parseFromString(resText, "text/html"); | |
var jalastmod = document.querySelector('.contributors-sub time').dateTime; | |
var enlastmod = dom.querySelector('.contributors-sub time').dateTime; | |
if (Date.parse(jalastmod) - Date.parse(enlastmod) < 0 ) { | |
window.alert(jalastmod + " :ja\n" + enlastmod + " :en\n" +"日本語の情報が古いです。"); | |
} else { | |
window.alert("☺"); | |
} | |
}); | |
} | |
)(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment