diff options
author | Matěj Cepl <mcepl@redhat.com> | 2011-02-24 23:49:39 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2011-02-24 23:49:39 +0100 |
commit | c336792e45b8567746cbb5aa7cf07543aebcd4f7 (patch) | |
tree | c0d8907c36302c9fe02e95919c3bc013f645f700 /data/lib/cssUtils.js | |
parent | 5b9f263ac1485c0ab18c2d42c5cd18746208bad4 (diff) | |
download | bugzilla-triage-c336792e45b8567746cbb5aa7cf07543aebcd4f7.tar.gz |
Nouveau doesn't dedicated data, so just the Chipset line is parsed.
Diffstat (limited to 'data/lib/cssUtils.js')
-rw-r--r-- | data/lib/cssUtils.js | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/data/lib/cssUtils.js b/data/lib/cssUtils.js deleted file mode 100644 index da24aa2..0000000 --- a/data/lib/cssUtils.js +++ /dev/null @@ -1,77 +0,0 @@ -/*global console: false */ -/*jslint onevar: false */ -// Released under the MIT/X11 license -// http://www.opensource.org/licenses/mit-license.php -"use strict"; - -/** - * get CSS style from all styles in the document with given name - * - * @param ruleName String with the identificator of the rule (the same - * used on the page itself) - * @param deleteFlag ??? - * @return ??? (exact type of the object returned FIXME) - * - * e.g., getCSSRule(".tramp") gives particular style - * from http://www.hunlock.com/blogs/Totally_Pwn_CSS_with_Javascript - */ -var getCSSRule = exports.getCSSRule = function getCSSRule(ruleName, deleteFlag) { - ruleName=ruleName.toLowerCase(); // style rules are case insensitive - var foundRuleIdx = 0; - - Array.forEach(document.styleSheets, function (sheet) { - var ruleIdx = 0; - foundRule = Array.reduce(sheet.cssRules, function (ruleIdx, curRule, idx) { - if ((foundRuleIdx === 0) && (curRule. - selectorText.toLowerCase() == ruleName)) { - return idx; - } - return foundRuleIdx; - }); - if (foundRules > 0) { - if (deleteFlag === "delete") { - sheet.deleteRule(foundRuleIdx); - return true; - } - return sheet.cssRules[foundRuleIdx]; - } - }); - return false; // we found NOTHING! -}; - -/** - * - */ -exports.killCSSRule = function killCSSRule (ruleName) { - return getCSSRule(ruleName, "delete"); -}; - -/** - * - */ -exports.addCSSRule = function addCSSRule(ruleName, stylesheetTitle) { - var sheets = {}; - if (!getCSSRule(ruleName)) { - if (stylesheetTitle) { - sheets = Array.filter(document.styleSheets,function (sheet) { - return (sheet.title === stylesheetTitle); - }); - } else { - sheets = document.styleSheets; - } - sheets[0].insertRule(ruleName+' { }', 0); - } - return getCSSRule(ruleName); -}; - -/** - * - */ -exports.addCSSStylesheet = function addCSSStylesheet (StylesheetName) { - var cssNode = document.createElement("style"); - cssNode.type = 'text/css'; - cssNode.rel = 'stylesheet'; - cssNode.media = 'screen'; - cssNode.title = StylesheetName; - document.getElementsByTagName("head")[0].appendChild(cssNode); -}; |