javascript works with mozilla but not with webkit based browsers

Posted by GlassGhost on Stack Overflow See other posts from Stack Overflow or by GlassGhost
Published on 2010-04-25T22:50:28Z Indexed on 2010/04/26 2:03 UTC
Read the original article Hit count: 269

Filed under:
|
|
|
|

Im having problems with a css text variable in this javascript with webkit based browsers(Chrome & Safari) but it works in firefox 3.6

importScript('User:Gerbrant/hidePane.js');//Special thanks to Gerbrant for this wonderful script
function addGlobalStyle(css) {
    var head = document.getElementsByTagName('head')[0];
    if (!head) { return; }
    var style = document.createElement('style');
    style.type = 'text/css';
    style.rel = 'stylesheet';
    style.media = 'screen';
    style.href = 'FireFox.css';
    style.innerHTML = css;
    head.appendChild(style);
}

//The page styling
var NewSyleText = 
"h1, h2, h3, h4, h5 {font-family: 'Verdana','Helvetica',sans-serif; font-style: normal; font-weight:normal;}" + 
"body, b {background: #fbfbfb; font-style: normal; font-family: 'Cochin','GaramondNo8','Garamond','Big Caslon','Georgia','Times',serif;font-size: 11pt;}" +
"p { margin: 0pt; text-indent:1.25em;  margin-top: 0.3em; }" +
"a {    text-decoration: none; color: Navy; background: none;}" +
"a:visited {    color: #500050;}" +
"a:active { color: #faa700;}" +
"a:hover {  text-decoration: underline;}" +
"a.stub {   color: #772233;}" +
"a.new, #p-personal a.new { color: #ba0000;}" +
"a.new:visited, #p-personal a.new:visited { color: #a55858;}" +
"a.new, #quickbar a.new { color: #CC2200; }" +
/* removes "From Wikipedia, the free encyclopedia" for those of you who actually know what site you are on */
"#siteSub { display: none; }" +
/* hides the speaker icon in some articles */
"#spoken-icon .image {  display:none;}" +
/* KHTMLFix.css */
"#column-content { margin-left: 0; }" +
/* Remove contents of the footer, but not the footer itself */
"#f-poweredbyico, #f-copyrightico { display:none;}" +
/* Needed to show the star icon in a featured article correctly */
"#featured-star div div {   line-height: 10px;}" +
/* And the content expands to top and left */
"#content {margin: 0; padding: 0; background:none;}" +
"#content div.thumb {border-color:white;}" +
/* Hiding the bar under the entry header */
"h1.firstHeading {  border-bottom: none;}" +
/* Used for US city entries */
"#coordinates {  top:1.2em;}";

addGlobalStyle(NewSyleText);//inserts the page styling

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html