Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harai/6621393 to your computer and use it in GitHub Desktop.
Save harai/6621393 to your computer and use it in GitHub Desktop.
Mapsだけは日本語で! for Google Maps™ Greasemonkey Script
// ==UserScript==
// @name Mapsだけは日本語で! for Google Maps™
// @namespace https://github.com/harai/
// @include https://www.google.co.jp/maps*
// @include http://www.google.co.jp/maps*
// @include https://www.google.com/maps*
// @include http://www.google.com/maps*
// @include https://maps.google.co.jp/*
// @include http://maps.google.co.jp/*
// @include https://maps.google.com/*
// @include http://maps.google.com/*
// @version 1
// @run-at document-end
// ==/UserScript==
if (window.top != window.self)
return;
var q = location.search;
if (q.indexOf("?hl=") != -1 || q.indexOf("&hl=") != -1) {
return;
}
var search = (q.length == 0) ? "?hl=ja" : (q + "&hl=ja");
var href = "https://" + location.host + location.pathname + search + location.hash;
var s = document.createElement("script");
s.type = "text/javascript";
// no need to escape href to avoid XSS
s.textContent = 'window.location = "' + href + '";';
document.body.appendChild(s);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment