Permalink
Browse files

Firefox 4 fixes: append toolbar button for the first time.

  • Loading branch information...
1 parent d385661 commit 4c166840fe947b6f7209c41506c7ae4418683571 @littlebtc committed May 5, 2011
Showing with 22 additions and 1 deletion.
  1. +19 −1 content/overlay.js
  2. +3 −0 defaults/preferences/nicofox.js
View
@@ -17,7 +17,25 @@ nicofox.overlay = {
if (XULBrowserWindow.inContentWhitelist) {
XULBrowserWindow.inContentWhitelist.push("about:nicofox");
}
-
+ /* For Firefox 4, append the toolbar button for the first time.
+ * Modified from https://developer.mozilla.org/en/Code_snippets/Toolbar
+ */
+ if (!nicofox.Core.prefs.getBoolPref("toolbar_check") && !document.getElementById("nicofox-panel-container")) {
+ var toolbarId = "nicofox-toolbar-button";
+ var navBar = document.getElementById("nav-bar");
+ var curSet = navBar.currentSet.split(",");
+ if (curSet.indexOf(toolbarId) == -1) {
+ /* Just append to the end. */
+ curSet.push(toolbarId);
+ navBar.setAttribute("currentset", curSet.join(","));
+ navBar.currentSet = curSet.join(",");
+ document.persist(navBar.id, "currentset");
+ try {
+ BrowserToolboxCustomizeDone(true);
+ } catch (e) {}
+ }
+ nicofox.Core.prefs.setBoolPref("toolbar_check", true);
+ }
/* Register panel initializer */
document.getElementById("nicofox-library").addEventListener("popupshowing", nicofox.panel.onPopupShowing, false);
document.getElementById("nicofox-library").addEventListener("popupshown", nicofox.panel.onPopupShown, false);
@@ -29,6 +29,9 @@ pref("extensions.nicofox.economy_notice", true);
// New in 0.6
pref("extensions.nicofox.thumbnail_check", false);
+// New in 0.7a
+pref("extensions.nicofox.toolbar_check", false);
+
/////////////////////////////////////////// NicoMonkey
// pref("extensions.nicofox.nicomonkey.enable", true); // Removed in 0.7a
// pref("extensions.nicofox.nicomonkey.toolbar", true); // Removed in 0.7a

0 comments on commit 4c16684

Please sign in to comment.