From b19227654cfa081db7868a681239bb9a31c6f7b6 Mon Sep 17 00:00:00 2001 From: Ian Fischer Date: Fri, 20 Jul 2007 02:13:39 -0700 Subject: [PATCH] Added basic code to allow search on typing, and made the creation of the taboos a function. --- chrome/taboo/content/start.css | 8 +++++ chrome/taboo/content/start.html | 20 +++++++++-- chrome/taboo/content/start.js | 73 ++++++++++++++++++++++------------------- 3 files changed, 65 insertions(+), 36 deletions(-) rewrite chrome/taboo/content/start.js (87%) diff --git a/chrome/taboo/content/start.css b/chrome/taboo/content/start.css index 63d70e1..312d9e5 100644 --- a/chrome/taboo/content/start.css +++ b/chrome/taboo/content/start.css @@ -72,4 +72,12 @@ body { background: #eee; } +#search { + width: 100px; + height: 75px; + background: #fff; +} +.hidden { + display: none; +} diff --git a/chrome/taboo/content/start.html b/chrome/taboo/content/start.html index c64fae8..af733a1 100644 --- a/chrome/taboo/content/start.html +++ b/chrome/taboo/content/start.html @@ -18,7 +18,7 @@ - + diff --git a/chrome/taboo/content/start.js b/chrome/taboo/content/start.js dissimilarity index 87% index 925b98f..1985edd 100644 --- a/chrome/taboo/content/start.js +++ b/chrome/taboo/content/start.js @@ -1,34 +1,39 @@ -const CC = Components.classes; -const CI = Components.interfaces; -const SVC = CC['@oy/taboo;1'].getService(CI.oyITaboo); - -var ul = document.createElement('ul'); - -var enum = SVC.get(null); -while (enum.hasMoreElements()) { - var tab = enum.getNext(); - tab.QueryInterface(CI.oyITabooInfo); - - // this should be a custom xbl: - (function (tab){ - var box = document.createElement('li'); - box.setAttribute('title', tab.title); - box.innerHTML = '' + - tab.title + '' + - tab.url + ''; - - box.onclick = function(event) { - if (event.originalTarget.className == 'delete') { - SVC.delete(tab.url); - box.parentNode.removeChild(box); - } - else { - SVC.open(tab.url, whereToOpenLink(event)); - } - } - - ul.appendChild(box); - })(tab); -} - -document.body.appendChild(ul); +const CC = Components.classes; +const CI = Components.interfaces; +const SVC = CC['@oy/taboo;1'].getService(CI.oyITaboo); + +var searchText = null; +function loadTaboos() { + var ul = document.createElement('ul'); + ul.setAttribute('id', 'taboos'); + + var enum = SVC.get(searchText); + while (enum.hasMoreElements()) { + var tab = enum.getNext(); + tab.QueryInterface(CI.oyITabooInfo); + + // this should be a custom xbl: + (function (tab){ + var box = document.createElement('li'); + box.setAttribute('title', tab.title); + box.innerHTML = '' + + tab.title + '' + + tab.url + ''; + + box.onclick = function(event) { + if (event.originalTarget.className == 'delete') { + SVC.delete(tab.url); + box.parentNode.removeChild(box); + } + else { + SVC.open(tab.url, whereToOpenLink(event)); + } + } + + ul.appendChild(box); + })(tab); + } + + document.body.appendChild(ul); +} + -- 2.11.4.GIT