From 8f3595d68b112cc18763f88f2e2ff9f996c84e63 Mon Sep 17 00:00:00 2001 From: John Foerch Date: Sun, 23 Mar 2008 12:36:50 -0400 Subject: [PATCH] move general stylesheet utilities from hints.js to utils.js hints_register_stylesheet renamed to register_user_stylesheet. hints_unregister_stylesheet renamed to unregister_user_stylesheet. hints-specific code removed. --- modules/hints.js | 20 +------------------- modules/utils.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/modules/hints.js b/modules/hints.js index 4333a30..22856f3 100644 --- a/modules/hints.js +++ b/modules/hints.js @@ -13,25 +13,7 @@ define_variable("hint_background_color", "yellow", "Color for the inactive hint. * Register hints style sheet */ const hints_stylesheet = "chrome://conkeror/content/hints.css"; -function hints_register_stylesheet(url) -{ - if (url) { - var uri = makeURL(url); - } else { - var uri = makeURL(hints_stylesheet); - } - var sss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService); - sss.loadAndRegisterSheet(uri, sss.USER_SHEET); -} - -function hints_unregister_stylesheet() -{ - var uri = makeURL(hints_stylesheet); - var sss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService); - if (sss.sheetRegistered(uri, sss.USER_SHEET)) - ss.unregisterSheet(uri, sss.USER_SHEET); -} -hints_register_stylesheet(); +register_user_stylesheet(hints_stylesheet); /** * buffer is a content_buffer diff --git a/modules/utils.js b/modules/utils.js index 2df9771..c855960 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -861,3 +861,19 @@ function define_variable(name, default_value, doc) { shortdoc: get_shortdoc_string(doc), source_code_reference: get_caller_source_code_reference() }); } + + +function register_user_stylesheet(url) +{ + var uri = makeURL(url); + var sss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService); + sss.loadAndRegisterSheet(uri, sss.USER_SHEET); +} + +function unregister_user_stylesheet(url) +{ + var uri = makeURL(url); + var sss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService); + if (sss.sheetRegistered(uri, sss.USER_SHEET)) + ss.unregisterSheet(uri, sss.USER_SHEET); +} -- 2.11.4.GIT