Named things for the about page consistently.
[taboo.git] / chrome / content / start.js
blob31dfc2368885ca092e748e4f4663a4fc8796eebf
1 /*
2 * Copyright 2007 Jesse Andrews, Manish Singh, Ian Fischer
4 * This file may be used under the terms of of the
5 * GNU General Public License Version 2 or later (the "GPL"),
6 * http://www.gnu.org/licenses/gpl.html
8 * Software distributed under the License is distributed on an "AS IS" basis,
9 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
10 * for the specific language governing rights and limitations under the
11 * License.
14 function Controller() {
15 var content = $('content');
16 var view = null;
18 this.load = function(ViewClass) {
19 content.innerHTML = '';
21 view = new ViewClass(content);
22 tboPrefs.setCharPref("extensions.taboo.view", ViewClass + '');
23 this.display();
26 this.filter = function(str) {
27 if (this._filterStr == str) {
28 return;
31 this.display(str);
32 this._filterStr = str;
35 this.tabDelete = function(tab, el) {
36 el.style.display = "none";
37 this.displayUndelete(tab, el);
38 SVC.delete(tab.url);
41 this.tabFinalDelete = function(tab, el) {
42 el.style.display = "none";
43 SVC.reallyDelete(tab.url);
46 this.tabUndelete = function(tab) {
47 SVC.undelete(tab.url);
50 this.displayUndelete = function(tab, el) {
51 var a = document.getElementById('undeleteLink');
52 var div = document.getElementById('undelete');
53 a.onclick = function() {
54 el.style.display = '';
55 div.style.visibility = 'hidden';
56 SVC.undelete(tab.url);
58 div.url = tab.url;
59 div.style.visibility = 'visible';
60 setTimeout(function() {
61 if (div.url == tab.url) {
62 div.style.visibility = 'hidden';
64 }, 30000);
67 this.display = function(searchTxt) {
68 view.start();
70 var taboos = SVC.get(searchTxt, view.trash);
72 if (!searchTxt && !view.trash && !view.info && !taboos.hasMoreElements()) {
73 controller.load(DisplayInfo);
74 return;
77 while (taboos.hasMoreElements()) {
78 var tab = taboos.getNext();
79 tab.QueryInterface(Components.interfaces.oyITabooInfo);
80 view.add(tab);
83 view.finish();
88 var controller = new Controller();
89 try {
90 var view = tboPrefs.getCharPref("extensions.taboo.view");
91 if (view.match(/Trash|About/)) throw 'We don\'t reload trash';
92 var ViewClass = eval('(' + view + ')');
93 controller.load(ViewClass);
95 catch (e) {
96 controller.load(Grid);