mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-13 05:05:45 +01:00
Move bookmark info before title in completions, and show for "Smart" completions.
This commit is contained in:
@@ -251,6 +251,7 @@ const ConfigBase = Class(ModuleBase, {
|
|||||||
Title color: magenta; background: white; font-weight: bold;
|
Title color: magenta; background: white; font-weight: bold;
|
||||||
URL text-decoration: none; color: green; background: inherit;
|
URL text-decoration: none; color: green; background: inherit;
|
||||||
URL:hover text-decoration: underline; cursor: pointer;
|
URL:hover text-decoration: underline; cursor: pointer;
|
||||||
|
URLExtra color: gray;
|
||||||
|
|
||||||
FrameIndicator;;* {
|
FrameIndicator;;* {
|
||||||
/* This gets released into the wild, so everything is important */
|
/* This gets released into the wild, so everything is important */
|
||||||
|
|||||||
@@ -56,6 +56,14 @@ const BookmarkCache = Module("BookmarkCache", XPCOM(Ci.nsINavBookmarkObserver),
|
|||||||
return Bookmark(node.uri, node.title, node.icon && node.icon.spec, post, keyword, tags, node.itemId);
|
return Bookmark(node.uri, node.title, node.icon && node.icon.spec, post, keyword, tags, node.itemId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get: function (url) {
|
||||||
|
let ids = bookmarks.getBookmarkIdsForURI(util.newURI(url));
|
||||||
|
for (let id in values(ids))
|
||||||
|
if (id in this.bookmarks)
|
||||||
|
return this.bookmarks[id];
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
readBookmark: function readBookmark(id) {
|
readBookmark: function readBookmark(id) {
|
||||||
return {
|
return {
|
||||||
itemId: id,
|
itemId: id,
|
||||||
|
|||||||
@@ -50,18 +50,17 @@ const Template = Module("Template", {
|
|||||||
|
|
||||||
bookmarkDescription: function (item, text)
|
bookmarkDescription: function (item, text)
|
||||||
<>
|
<>
|
||||||
<a xmlns:dactyl={NS} identifier={item.id} dactyl:command={item.command}
|
|
||||||
href={item.item.url} highlight="URL">{text || ""}</a> 
|
|
||||||
{
|
{
|
||||||
!(item.extra && item.extra.length) ? "" :
|
!(item.extra && item.extra.length) ? "" :
|
||||||
<span class="extra-info">
|
<span highlight="URLExtra">
|
||||||
({
|
({
|
||||||
template.map(item.extra, function (e)
|
template.map(item.extra, function (e)
|
||||||
<>{e[0]}: <span highlight={e[2]}>{e[1]}</span></>,
|
<>{e[0]}: <span highlight={e[2]}>{e[1]}</span></>,
|
||||||
<> </>/* Non-breaking space */)
|
<> </>)
|
||||||
})
|
}) </span>
|
||||||
</span>
|
|
||||||
}
|
}
|
||||||
|
<a xmlns:dactyl={NS} identifier={item.id} dactyl:command={item.command}
|
||||||
|
href={item.item.url} highlight="URL">{text || ""}</a>
|
||||||
</>,
|
</>,
|
||||||
|
|
||||||
filter: function (str) <span highlight="Filter">{str}</span>,
|
filter: function (str) <span highlight="Filter">{str}</span>,
|
||||||
|
|||||||
@@ -58,8 +58,6 @@
|
|||||||
width: 0px;
|
width: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.extra-info { color: gray; }
|
|
||||||
|
|
||||||
.times-executed, .time-average { color: green; }
|
.times-executed, .time-average { color: green; }
|
||||||
.time-total { color: red; }
|
.time-total { color: red; }
|
||||||
|
|
||||||
|
|||||||
@@ -254,8 +254,11 @@ const Config = Module("config", ConfigBase, {
|
|||||||
context.filterFunc = null;
|
context.filterFunc = null;
|
||||||
context.hasItems = context.completions.length > 0; // XXX
|
context.hasItems = context.completions.length > 0; // XXX
|
||||||
context.incomplete = true;
|
context.incomplete = true;
|
||||||
context.keys.icon = 2;
|
|
||||||
|
context.format = bookmarks.format;
|
||||||
|
context.keys.extra = function (item) (bookmarkcache.get(item.url) || {}).extra;
|
||||||
context.title = ["Smart Completions"];
|
context.title = ["Smart Completions"];
|
||||||
|
|
||||||
context.cancel = function () {
|
context.cancel = function () {
|
||||||
if (searchRunning) {
|
if (searchRunning) {
|
||||||
services.get("autoCompleteSearch").stopSearch();
|
services.get("autoCompleteSearch").stopSearch();
|
||||||
@@ -267,8 +270,8 @@ const Config = Module("config", ConfigBase, {
|
|||||||
let timer = new Timer(50, 100, function (result) {
|
let timer = new Timer(50, 100, function (result) {
|
||||||
context.incomplete = result.searchResult >= result.RESULT_NOMATCH_ONGOING;
|
context.incomplete = result.searchResult >= result.RESULT_NOMATCH_ONGOING;
|
||||||
context.completions = [
|
context.completions = [
|
||||||
[result.getValueAt(i), result.getCommentAt(i), result.getImageAt(i)]
|
{ url: result.getValueAt(i), title: result.getCommentAt(i), icon: result.getImageAt(i) }
|
||||||
for (i in util.range(0, result.matchCount))
|
for (i in util.range(0, result.matchCount))
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
services.get("autoCompleteSearch").startSearch(context.filter, "", context.result, {
|
services.get("autoCompleteSearch").startSearch(context.filter, "", context.result, {
|
||||||
|
|||||||
Reference in New Issue
Block a user