1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-08 11:24:11 +01:00

fixed favicons in :hs and :bmarks output (:bmarks filter still broken)

This commit is contained in:
Martin Stubenschrott
2008-11-20 21:55:41 +00:00
parent 7032d4ec38
commit aa13986142
2 changed files with 19 additions and 12 deletions

View File

@@ -26,6 +26,9 @@ the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
}}} ***** END LICENSE BLOCK *****/
// TODO: with the new subscript loader, is there really no way to keep variable in per-file scope?
const DEFAULT_FAVICON = "chrome://mozapps/skin/places/defaultFavicon.png";
// also includes methods for dealing with keywords and search engines
function Bookmarks() //{{{
{
@@ -74,7 +77,7 @@ function Bookmarks() //{{{
let keyword = bookmarksService.getKeywordForBookmark(node.itemId);
let tags = taggingService.getTagsForURI(uri, {}) || [];
//return bookmarks.push(new Bookmark(node.uri, node.title, null, keyword, tags, node.itemId));
return bookmarks.push({url: node.uri, title: node.title, icon: null, keyword: keyword, tags: tags, id: node.itemId});
return bookmarks.push({ url: node.uri, title: node.title, get icon() getFavicon(node.uri), keyword: keyword, tags: tags, id: node.itemId});
}
function readBookmark(id)
@@ -715,7 +718,7 @@ function History() //{{{
{
let node = root.getChild(i);
if (node.type == node.RESULT_TYPE_URI) // just make sure it's a bookmark
items.push({ url: node.uri, title: node.title, get icon() function() bookmarks.getFavicon(node.uri) });
items.push({ url: node.uri, title: node.title, icon: node.icon ? node.icon.spec : DEFAULT_FAVICON });
}
root.containerOpen = false; // close a container after using it!
@@ -942,6 +945,7 @@ function QuickMarks() //{{{
}
let items = ({ title: String(mark), url: qmarks.get(mark) } for each (mark in marks));
// TODO: template.bookmarks is not the best for quickmarks
let list = template.bookmarks("QuickMark", items);
commandline.echo(list, commandline.HL_NORMAL, commandline.FORCE_MULTILINE);
}

View File

@@ -1324,31 +1324,34 @@ function ItemList(id) //{{{
}
// TODO: move to completions?
function createDefaultRow([b, c, a], dom)
function createDefaultRow(item, dom)
{
if (item instanceof Array)
item = { text: item[0], description: item[1], icon: item[2] };
/* Kludge until we have completion contexts. */
let map = completion.filterMap;
if (map)
{
b = map[0] ? map[0](b) : b;
c = map[1] ? map[1](c) : c;
item.text = map[0] ? map[0](item.text) : item.text;
item.description = map[1] ? map[1](item.description) : item.description;
}
/* Obviously, ItemList shouldn't know or care about this. */
let filter = completion.filterString;
if (filter)
{
b = template.highlightFilter(b, filter);
c = template.highlightFilter(c, filter);
item.text = template.highlightFilter(item.text, filter);
item.description = template.highlightFilter(item.description, filter);
}
if (typeof a == "function")
a = a();
if (typeof item.icon == "function")
item.icon = item.icon();
let row =
<ul class="hl-CompItem">
<li class="hl-CompIcon">{a ? <img src={a}/> : <></>}</li>
<li class="hl-CompResult">{b}</li>
<li class="hl-CompDesc">{c}</li>
<li class="hl-CompIcon">{item.icon ? <img src={item.icon}/> : <></>}</li>
<li class="hl-CompResult">{item.text}</li>
<li class="hl-CompDesc">{item.description}</li>
</ul>;
if (dom)