diff --git a/content/bookmarks.js b/content/bookmarks.js index b4bf48a4..ebb56345 100644 --- a/content/bookmarks.js +++ b/content/bookmarks.js @@ -184,6 +184,9 @@ liberator.Bookmarks = function () //{{{ } var cache = liberator.storage.newObject("bookmark-cache", Cache, false); liberator.storage.addObserver("bookmark-cache", bookmarkObserver); + liberator.registerCallback("shutdown", 0, function () { + liberator.storage.removeObserver("bookmark-cache", bookmarkObserver) + }); /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// OPTIONS ///////////////////////////////////////////////// @@ -416,11 +419,11 @@ liberator.Bookmarks = function () //{{{ { var searchEngines = []; var firefoxEngines = searchService.getVisibleEngines({}); - for (let i in firefoxEngines) + for (let [,engine] in Iterator(firefoxEngines)) { - var alias = firefoxEngines[i].alias; + var alias = engine.alias; if (!alias || !/^[a-z0-9_-]+$/.test(alias)) - alias = firefoxEngines[i].name.replace(/^\W*([a-zA-Z_-]+).*/, "$1").toLowerCase(); + alias = engine.name.replace(/^\W*([a-zA-Z_-]+).*/, "$1").toLowerCase(); if (!alias) alias = "search"; // for search engines which we can't find a suitable alias @@ -434,10 +437,10 @@ liberator.Bookmarks = function () //{{{ newAlias = alias + j; } // only write when it changed, writes are really slow - if (firefoxEngines[i].alias != newAlias) - firefoxEngines[i].alias = newAlias; + if (engine.alias != newAlias) + engine.alias = newAlias; - searchEngines.push([firefoxEngines[i].alias, firefoxEngines[i].description]); + searchEngines.push([engine.alias, engine.description, engine.iconURI.spec]); } return searchEngines; @@ -500,16 +503,11 @@ liberator.Bookmarks = function () //{{{ { url: item[0], title: item[1], - extra: [['keyword', item[2], 'red'], - ['tags', item[3].join(', '), 'blue']].filter(function (i) i[1]) + extra: [['keyword', item[2], 'red'], + ['tags', (item[3]||[]).join(', '), 'blue']].filter(function (i) i[1]) } for each (item in items))); liberator.commandline.echo(list, liberator.commandline.HL_NORMAL, liberator.commandline.FORCE_MULTILINE); }, - - destroy: function () - { - liberator.storage.removeObserver("bookmark-cache", bookmarkObserver); - } }; //}}} }; //}}} diff --git a/content/buffer.js b/content/buffer.js index 25c5d199..a17ed100 100644 --- a/content/buffer.js +++ b/content/buffer.js @@ -38,11 +38,13 @@ liberator.Buffer = function () //{{{ 120, 150, 200, 300, 500, 1000, 2000 ]; const arrayIter = liberator.util.arrayIter; - /* Can't reference liberator inside Styles -- - * it's a global object, and liberator disappears + /* Can't reference liberator or Components inside Styles -- + * they're members of the window object, which disappear * with this window. */ const util = liberator.util; + const consoleService = Components.classes["@mozilla.org/consoleservice;1"] + .getService(Components.interfaces.nsIConsoleService); function Styles(name, store, serial) { @@ -143,13 +145,10 @@ liberator.Buffer = function () //{{{ } }; - var consoleService = Components.classes["@mozilla.org/consoleservice;1"] - .getService(Components.interfaces.nsIConsoleService); - consoleService.registerListener(listener); - try { - var doc = document.implementation.createDocument(XHTML, "doc", null); + consoleService.registerListener(listener); + let doc = document.implementation.createDocument(XHTML, "doc", null); doc.documentElement.appendChild(util.xmlToDom(
, doc)); @@ -182,6 +181,16 @@ liberator.Buffer = function () //{{{ let styles = liberator.storage.newObject("styles", Styles, false); + /* FIXME: This doesn't belong here. */ + let mainWindowID = liberator.config.mainWindowID || "main-window"; + let fontSize = document.defaultView.getComputedStyle(document.getElementById(mainWindowID), null) + .getPropertyValue("font-size"); + + let name = liberator.config.name.toLowerCase(); + styles.registerSheet("chrome://" + name + "/skin/vimperator.css"); + let error = styles.addSheet("chrome://" + name + "/content/buffer.xhtml", + "body { font-size: " + fontSize + "}"); + function setZoom(value, fullZoom) { if (value < 1 || value > 2000) diff --git a/skin/blank-muttator.xhtml b/content/buffer.xhtml similarity index 70% rename from skin/blank-muttator.xhtml rename to content/buffer.xhtml index 9fe8e380..089b1563 100644 --- a/skin/blank-muttator.xhtml +++ b/content/buffer.xhtml @@ -4,8 +4,6 @@