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
14 function Controller() {
15 var content
= $('content');
18 this.load = function(ViewClass
) {
19 content
.innerHTML
= '';
21 view
= new ViewClass(content
);
22 tboPrefs
.setCharPref("extensions.taboo.view", ViewClass
+ '');
26 this.filter = function(str
) {
27 if (this._filterStr
== str
) {
32 this._filterStr
= str
;
35 this.tabDelete = function(tab
, el
) {
36 el
.style
.display
= "none";
37 this.displayUndelete(tab
, el
);
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
);
59 div
.style
.visibility
= 'visible';
60 setTimeout(function() {
61 if (div
.url
== tab
.url
) {
62 div
.style
.visibility
= 'hidden';
67 this.display = function(searchTxt
) {
70 var taboos
= SVC
.get(searchTxt
, view
.trash
);
72 if (!searchTxt
&& !view
.trash
&& !view
.info
&& !taboos
.hasMoreElements()) {
73 controller
.load(DisplayInfo
);
77 while (taboos
.hasMoreElements()) {
78 var tab
= taboos
.getNext();
79 tab
.QueryInterface(Components
.interfaces
.oyITabooInfo
);
88 var controller
= new Controller();
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
);
96 controller
.load(Grid
);