Created
March 13, 2014 22:06
-
-
Save yajd/9538024 to your computer and use it in GitHub Desktop.
_ff-addon-snippet-SSS - using style sheet service
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
| var sss = Components.classes['@mozilla.org/content/style-sheet-service;1'].getService(Components.interfaces.nsIStyleSheetService); | |
| var ios = Components.classes['@mozilla.org/network/io-service;1'].getService(Components.interfaces.nsIIOService); | |
| try { | |
| sss.unregisterSheet(cssUri, sss.USER_SHEET); | |
| } catch (ex) {} | |
| var css = 'setting .preferences-alignment{ display:flex; flex-direction:row-reverse; align-items:center; }'; | |
| //var cssEnc = 'data:text/css;base64,' + window.btoa(css); | |
| var cssEnc = encodeURIComponent(css); | |
| var cssUri = makeURI('data:text/css,' + cssEnc); | |
| sss.loadAndRegisterSheet(cssUri, sss.USER_SHEET); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
replace makeURI with this:
function makeURI(aURL, aOriginCharset, aBaseURI)
{
return Services.io.newURI(aURL, aOriginCharset, aBaseURI);
}