Skip to content

Instantly share code, notes, and snippets.

@ShingoFukuyama
Last active February 6, 2016 10:49
Show Gist options
  • Save ShingoFukuyama/c33a79eb98d0891f0bca to your computer and use it in GitHub Desktop.
Save ShingoFukuyama/c33a79eb98d0891f0bca to your computer and use it in GitHub Desktop.
injectStyleSheet
function injectStyleSheet(cssText) {
var $style = document.createElement('style');
var css = document.createTextNode(cssText);
var container = document.getElementsByTagName('head')[0];
$style.type = 'text/css';
if ($style.styleSheet) {
$style.styleSheet.cssText = css.nodeValue;
}
else {
$style.appendChild(css);
}
if (!container) {
container = document.getElementsByTagName('html')[0];
}
container.appendChild($style);
}
// workflowyを開いたときだけ
if (/workflowy\.com/.test(location.host)) {
// injectStyleSheet("ここにCSSを書き込む");
injectStyleSheet(".contentUnderline{border-bottom: 2px #0000FF solid;text-decoration:none;}.contentBold{border-bottom:2px #f00 solid;}.contentItalic{background-color:#bf9;text-style:normal;}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment