Last active
August 29, 2015 14:07
-
-
Save sheodox/0458bfb313978a7bdb18 to your computer and use it in GitHub Desktop.
Automatically changes the font to Meiryo for the chosen domains.
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
// ==UserScript== | |
// @name Auto-Meiryo | |
// @namespace http://use.i.E.your.homepage/ | |
// @version 0.1 | |
// @description enter something useful | |
// @copyright 2012+, You | |
// ==/UserScript== | |
(function() { | |
var always = 'alwaysHost'; | |
function styleMeiryo() { | |
var style = document.createElement('style'); | |
style.textContent = '*{font-family:Meiryo !important;}'; | |
document.body.appendChild(style); | |
} | |
function hasHost() { | |
return GM_getValue(always, []).indexOf(location.host) !== -1; | |
} | |
function addHost() { | |
var hosts = GM_getValue(always, []); | |
hosts.push(location.host); | |
GM_setValue(always, hosts); | |
} | |
function removeHost() { | |
var hosts = GM_getValue(always, []); | |
hosts.splice(hosts.indexOf(location.host), 1); | |
GM_setValue(always, hosts); | |
} | |
if (hasHost()) { | |
styleMeiryo(); | |
GM_registerMenuCommand('Meiryo auto-styler: remove ' + location.host, function() { | |
removeHost(); | |
}); | |
} | |
else { | |
GM_registerMenuCommand('Meiryo auto-styler: add ' + location.host, function() { | |
addHost(); | |
styleMeiryo(); | |
}); | |
} | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment