Skip to content

Instantly share code, notes, and snippets.

@ArcCosine
Created February 7, 2018 14:00
Show Gist options
  • Save ArcCosine/641322128fa6a2440fc108237b3a765a to your computer and use it in GitHub Desktop.
Save ArcCosine/641322128fa6a2440fc108237b3a765a to your computer and use it in GitHub Desktop.
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