Last active
February 6, 2016 10:49
-
-
Save ShingoFukuyama/c33a79eb98d0891f0bca to your computer and use it in GitHub Desktop.
injectStyleSheet
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
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