From 988e88268ea1218e0841414b3f70055bb5655110 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 26 Nov 2008 05:47:02 +0000 Subject: [PATCH] Cleanup. --- content/style.js | 4 ++-- content/template.js | 4 ++++ content/ui.js | 31 ++++++++++--------------------- 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/content/style.js b/content/style.js index de853d6c..9996eaa0 100644 --- a/content/style.js +++ b/content/style.js @@ -38,9 +38,9 @@ function Highlights(name, store, serial) CompResult width: 45%; overflow: hidden; CompDesc color: gray; width: 50%; CompLess text-align: center; height: .5ex; line-height: .5ex; - CompLess:after content: "\2303" + CompLess:after content: "\2303" /* Unicode up arrowhead */ CompMore text-align: center; height: .5ex; line-height: .5ex; padding-bottom: 1ex; - CompMore:after content: "\2304" + CompMore:after content: "\2304" /* Unicode down arrowhead */ Indicator color: blue; Filter font-weight: bold; diff --git a/content/template.js b/content/template.js index 3bea3801..f69d8375 100644 --- a/content/template.js +++ b/content/template.js @@ -49,6 +49,10 @@ const template = { } return
+
  • {text} 
  • {desc} 
  • ; diff --git a/content/ui.js b/content/ui.js index 44baae88..024d1e06 100644 --- a/content/ui.js +++ b/content/ui.js @@ -1324,16 +1324,13 @@ function ItemList(id) //{{{ } , divNodes); - - // 1: doc.body.replaceChild(div, doc.body.firstChild); - // 2: items.contextList.forEach(function init_eachContext(context) { if (!context.items.length) return; context.cache.nodes = {}; - context.cache.dom = dom(
    + dom(
    {context.createRow(context.title || [], "hl-CompTitle")}
    @@ -1341,7 +1338,7 @@ function ItemList(id) //{{{
    , context.cache.nodes); - divNodes.completions.appendChild(context.cache.dom); + divNodes.completions.appendChild(context.cache.nodes.root); }); } @@ -1374,32 +1371,24 @@ function ItemList(id) //{{{ } items.contextList.forEach(function fill_eachContext(context) { - let cache = context.cache; - let dom = cache.dom; - if (!dom) + let nodes = context.cache.nodes; + if (!nodes) return; + let dom = nodes.root let [start, end] = getRows(context); let d = stuff.cloneNode(true); for (let [,row] in Iterator(context.getRows(start, end, doc))) d.appendChild(row); - dom.replaceChild(d, cache.nodes.items); - cache.nodes.items = d; - cache.nodes.up.style.display = (start == 0) ? "none" : "block"; - cache.nodes.down.style.display = (end == context.items.length) ? "none" : "block"; + dom.replaceChild(d, nodes.items); + nodes.items = d; + nodes.up.style.display = (start == 0) ? "none" : "block"; + nodes.down.style.display = (end == context.items.length) ? "none" : "block"; }); - divNodes.noCompletions.style.display = off > 0 ? "none" : "block"; + divNodes.noCompletions.style.display = (off > 0) ? "none" : "block"; - // 1: completionElements = div.getElementsByClassName("hl-CompItem"); - // 2: - //let node = div.cloneNode(true); - //completionElements = node.getElementsByClassName("hl-CompItem"); - //completionBody = node.getElementsByTagName("div")[1]; - //doc.body.replaceChild(node, doc.body.firstChild); - //completionElements = node.getElementsByClassName("hl-CompItem"); - autoSize(); return true; }