Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow hiding the search bar from a pref and the option screen.

  • Loading branch information...
commit 2861bb5cfe97b20ca7a77a8ddfe561115d9ba9f7 1 parent 391bf13
Ed Lee authored
Showing with 23 additions and 5 deletions.
  1. +18 −5 bootstrap.js
  2. +4 −0 options.xul
  3. +1 −0  scripts/prefs.js
23 bootstrap.js
View
@@ -51,9 +51,13 @@ const OFFSETS = {
// Add search tabs that allow searching with installed search engines
function addSearchTabs(window) {
- let {async, createNode, getDominantColor, listen, unload} = makeWindowHelpers(window);
+ let {async, change, createNode, getDominantColor, listen, unload} = makeWindowHelpers(window);
let {document, gBrowser} = window;
+ // Make sure the search bar is hidden as desired
+ let hideSearch = pref("hideSearchbar");
+ change(document.getElementById("search-container"), "hidden", hideSearch);
+
// Create a box for tabs that sit near the bottom of the screen
let tabs = createNode("hbox");
tabs.setAttribute("bottom", 0);
@@ -300,11 +304,20 @@ function startup({id}) AddonManager.getAddonByID(id, function(addon) {
Services.scriptloader.loadSubScript(fileURI.spec, global);
});
- // Load style files that get automatically unloaded
- loadStyles(addon, ["browser"]);
+ // Initialize the add-on UI
+ (function init() {
+ // Reload the interface when certain prefs change
+ pref.observe(["hideSearchbar"], function() {
+ unload();
+ init();
+ });
+
+ // Load style files that get automatically unloaded
+ loadStyles(addon, ["browser"]);
- // Add search tabs with colors
- watchWindows(addSearchTabs);
+ // Add search tabs with colors
+ watchWindows(addSearchTabs);
+ })();
})
4 options.xul
View
@@ -49,4 +49,8 @@
title="Show tabs when typing"
type="bool"/>
+ <setting pref="extensions.searchTabs.hideSearchbar"
+ title="Hide the search bar"
+ type="bool"/>
+
</box>
1  scripts/prefs.js
View
@@ -63,6 +63,7 @@ pref.defaults = {
checkInput: false,
checkLocation: true,
checkSelection: false,
+ hideSearchbar: false,
};
/**
Please sign in to comment.
Something went wrong with that request. Please try again.