mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-04 02:04:14 +01:00
fixed :qmarks/:hs/:bmarks display, add a new template.genericTable() method
This commit is contained in:
@@ -138,20 +138,51 @@ const template = {
|
||||
return <>:{commandline.getCommand()}<br/></> + xml;
|
||||
},
|
||||
|
||||
bookmarks: function (header, items)
|
||||
// every item must have a .xml property which defines how to draw itself
|
||||
// @param headers is an array of strings, the text for the header columns
|
||||
genericTable: function (headers, items)
|
||||
{
|
||||
let createRow = completion.bookmark("").createRow;
|
||||
return this.generic(
|
||||
<table>
|
||||
<tr align="left" class="hl-Title">
|
||||
<th/><th>{header}</th><th>URL</th>
|
||||
{
|
||||
headers.reduce(function (prev, cur) prev + <th>{cur}</th>, <></>)
|
||||
}
|
||||
</tr>
|
||||
{
|
||||
this.map(items, function (item) createRow(item))
|
||||
this.map(items, function (item) item.xml)
|
||||
}
|
||||
</table>);
|
||||
},
|
||||
|
||||
// returns a single row for a bookmark or history item
|
||||
bookmarkItem: function (item)
|
||||
{
|
||||
var extra = [];
|
||||
if (item.keyword)
|
||||
extra.push(['keyword', item.keyword, "hl-Keyword"]);
|
||||
if (item.tags && item.tags.length > 0)
|
||||
extra.push(["tags", item.tags.join(","), "hl-Tag"]); // no space, otherwise it looks strange, since we just have spaces to seperate tags from keywords
|
||||
|
||||
return <ul class="hl-CompItem">
|
||||
<li class="hl-CompIcon"><img src={item.icon || ""}/></li>
|
||||
<li class="hl-CompResult">{util.clip(item.title || "", 50)}</li>
|
||||
<li style="width: 100%">
|
||||
<a href="#" class="hl-URL">{item.url}</a> 
|
||||
{
|
||||
!(extra.length) ? "" :
|
||||
<span class="extra-info">
|
||||
({
|
||||
template.map(extra, function (e)
|
||||
<>{e[0]}: <span class={e[2]}>{e[1]}</span></>,
|
||||
<> </>/* Non-breaking space */)
|
||||
})
|
||||
</span>
|
||||
}
|
||||
</li>
|
||||
</ul>
|
||||
},
|
||||
|
||||
jumps: function (index, elems)
|
||||
{
|
||||
return this.generic(
|
||||
|
||||
Reference in New Issue
Block a user