]> Tony Duckles's Git Repositories (git.nynim.org) - userscripts.git/blob - rtm_a_bit_better.js
Initial commit
[userscripts.git] / rtm_a_bit_better.js
1 // ==UserScript==
2 // @name A Bit Better RTM
3 // @namespace http://www.rememberthemilk.com
4 // @description Small improvements for Remember The Milk: display list tabs to the left; display tasks count; GoTo & MoveTo list quickly;
5 // @include http://www.rememberthemilk.com/*
6 // @include https://www.rememberthemilk.com/*
7 // ==/UserScript==
8 //
9
10 function Autocomplete(inputField, box, autocompleteStore, callback)
11 {
12 this.inputField = inputField;
13 this.box = box;
14 this.autocompleteList = new AutocompleteList(inputField, autocompleteStore, this);
15 this.callback = callback;
16 this.hide();
17 this.bind();
18 }
19
20 Autocomplete.prototype.show = function()
21 {
22 this.box.wrappedJSObject.style.display = "block";
23 this.inputField && this.inputField.focus();
24 }
25
26 Autocomplete.prototype.hide = function()
27 {
28 this.box.wrappedJSObject.style.display = "none";
29 this.inputField && (this.inputField.value = "");
30 this.autocompleteList.clearOutput();
31 }
32
33 Autocomplete.prototype.doCallback = function()
34 {
35 var completion = this.autocompleteList.getCurrentCompletion();
36 this.hide();
37 this.callback(completion);
38 }
39
40 Autocomplete.prototype.bind = function()
41 {
42 var autocompleteList = this.autocompleteList;
43 var inputField = this.inputField;
44 var currentText = "";
45
46 var handleKeyPressEvent = function(event)
47 {
48 currentText = inputField.value;
49 if (event.keyCode == 9) // Tab
50 {
51 if (window.wrappedJSObject.utility)
52 window.wrappedJSObject.utility.stopEvent(event);
53 return false
54 }
55 else if (autocompleteList.isVisible)
56 {
57 if (event.keyCode == 13)// Enter
58 autocompleteList.parent.doCallback();
59 if (event.keyCode == 40)// Key down
60 autocompleteList.highlightNextCompletion();
61 else if (event.keyCode == 38) // Key up
62 autocompleteList.highlightPreviousCompletion();
63 else if (event.keyCode == 27) // Esc
64 autocompleteList.clearOutput();
65 }
66 else if (event.keyCode == 27)
67 autocompleteList.parent.hide();
68
69 return true;
70 };
71 var handleKeyUpEvent = function(event)
72 {
73 if (currentText === null || currentText != inputField.value)
74 autocompleteList.update();
75 };
76 var handleClickEvent = function(event)
77 {
78 if (autocompleteList.isVisible)
79 autocompleteList.hideOutput();
80
81 if (window.wrappedJSObject.utility)
82 window.wrappedJSObject.utility.stopEvent(event);
83 }
84
85 this.inputField.setAttribute("autocomplete", "off");
86 this.inputField.addEventListener("keypress", handleKeyPressEvent, false);
87 this.inputField.addEventListener("keyup", handleKeyUpEvent, false);
88 this.box.addEventListener("click", handleClickEvent, false);
89 this.autocompleteList.createOutput();
90 }
91
92 function AutocompleteList(inputField, autocompleteStore, parent)
93 {
94 this.inputField = inputField;
95 this.autocompleteStore = autocompleteStore;
96 this.parent = parent;
97 this.output = null;
98 this.completions = null;
99 this.position = -1;
100 this.isVisible = false;
101 }
102
103 AutocompleteList.prototype.createOutput = function()
104 {
105 if (!this.inputField) return;
106
107 this.output = document.createElement('div');
108 this.output.setAttribute('id','autoCompleteList_' + this.inputField.id);
109 this.output.style.border = "solid 1px black";
110 this.output.style.background = "white";
111 this.output.style.position = "absolute";
112 this.output.style.width = "150px";
113 this.output.style.visibility = "hidden";
114
115 this.inputField.parentNode.insertBefore(this.output, this.inputField.nextSibling);
116 }
117
118 AutocompleteList.prototype.showOutput = function()
119 {
120 this.output && (this.output.style.visibility = "visible");
121 this.isVisible = true;
122 }
123
124 AutocompleteList.prototype.hideOutput = function()
125 {
126 this.output && (this.output.style.visibility = "hidden");
127 this.isVisible = false;
128 }
129
130 AutocompleteList.prototype.clearOutput = function()
131 {
132 while(this.output && this.output.childNodes.length)
133 this.output.removeChild(this.output.firstChild);
134
135 this.position = -1;
136 this.hideOutput();
137 }
138
139 AutocompleteList.prototype.addCompletion = function(completion)
140 {
141 var autocompleteList = this;
142
143 var mouseOverHandler = function(event)
144 {
145 autocompleteList.position = this.position;
146 autocompleteList.highlightCompletion();
147 }
148
149 var mouseClickHandler = function(event)
150 {
151 autocompleteList.parent.doCallback();
152 }
153
154 var completionBox = document.createElement("div");
155 completionBox.style.textAlign = "left";
156 completionBox.style.paddingLeft = "2px";
157 completionBox.appendChild(document.createTextNode(completion));
158 completionBox.wrappedJSObject.position = this.output.childNodes.length;
159 completionBox.addEventListener("mouseover", mouseOverHandler, false);
160 completionBox.addEventListener("click", mouseClickHandler, false);
161 this.output.appendChild(completionBox);
162 }
163
164 AutocompleteList.prototype.highlightCompletion = function()
165 {
166 if (this.output && this.output.childNodes)
167 {
168 for (var i = 0; i < this.output.childNodes.length; ++i)
169 {
170 if (i == this.position)
171 {
172 this.output.childNodes[i].style.color = "white";
173 this.output.childNodes[i].style.background = "#316ac5";
174 }
175 else
176 {
177 this.output.childNodes[i].style.color = "black";
178 this.output.childNodes[i].style.background = "white";
179 }
180 }
181 }
182 }
183
184 AutocompleteList.prototype.highlightNextCompletion = function()
185 {
186 if (this.completions && this.completions.length > 0 && this.position < this.completions.length - 1)
187 {
188 ++this.position;
189 this.highlightCompletion();
190 }
191 }
192
193 AutocompleteList.prototype.highlightPreviousCompletion = function()
194 {
195 if (this.completions && this.completions.length > 1 && this.position > 0)
196 {
197 --this.position;
198 this.highlightCompletion();
199 }
200 }
201
202 AutocompleteList.prototype.getCurrentCompletion = function()
203 {
204 if (this.completions && this.completions.length > 0)
205 return this.completions[this.position];
206
207 return null;
208 }
209
210 AutocompleteList.prototype.update = function()
211 {
212 if (this.inputField.value.length > 0)
213 {
214 this.completions = this.autocompleteStore.getCompletions(this.inputField.value);
215 if (this.completions && this.completions.length > 0)
216 {
217 this.clearOutput();
218 for (var i = 0; i < this.completions.length; ++i)
219 this.addCompletion(this.completions[i]);
220
221 this.showOutput();
222 this.highlightNextCompletion();
223 }
224 else
225 {
226 this.hideOutput();
227 this.position = -1;
228 }
229 }
230 else
231 {
232 this.hideOutput();
233 this.position = -1;
234 }
235 }
236
237 function ListAutocompleteStore()
238 {
239
240 }
241
242 ListAutocompleteStore.prototype.getCompletions = function(text)
243 {
244 if (window.wrappedJSObject.listTabs && window.wrappedJSObject.listTabs.entries && window.wrappedJSObject.listTabs.entries.length > 0)
245 {
246 var completions = new Array();
247
248 for (var i = 0; i < window.wrappedJSObject.listTabs.entries.length; ++i)
249 {
250 if (window.wrappedJSObject.listTabs.entries[i].toLowerCase().indexOf(text.toLowerCase()) == 0)
251 completions.push(window.wrappedJSObject.listTabs.entries[i]);
252 }
253
254 return completions;
255 }
256
257 return null;
258 }
259
260 window.wrappedJSObject.autocompletes = {};
261
262 var createAutoComplete = function(name, callback)
263 {
264 var autocompleteBox = document.createElement('div');
265
266 autocompleteBox.setAttribute("id", "autocompleteBox_" + name);
267 autocompleteBox.style.width = "240px";
268 autocompleteBox.style.position = "absolute";
269
270 autocompleteBox.innerHTML = '<div class="white_rbroundbox"> <div class="white_rbtop"> <div> <div></div> </div> </div> <div class="white_rbcontentwrap"> <div class="white_rbcontent"> <div class="taskcloudcontent" style="padding: 0px 5px 0px 5px; height: 17px;" id="listtabscontainer"><div style="width: 70px; font-weight: bold; float: left; height: 17px; padding-top: 1px;">' + name + '</div><div style="text-align: right; float: right; width: 155px; padding-right: 2px;"><input type="text" id="autocompleteInputField_' + name + '" name="text" style="width: 151px; ";/></div> </div> </div> </div> <div class="white_rbbot"> <div><div></div> </div> </div> </div> ';
271
272 document.body.appendChild(autocompleteBox);
273 var autocomplete = new Autocomplete(document.getElementById("autocompleteInputField_" + name),
274 document.getElementById("autocompleteBox_" + name),
275 new ListAutocompleteStore(),
276 callback);
277
278 function centerAutoCompleteBox()
279 {
280 var left = window.wrappedJSObject.innerWidth / 2 - 120 + window.wrappedJSObject.scrollX;
281 var top = window.wrappedJSObject.innerHeight / 2 - 10 + window.wrappedJSObject.scrollY;
282
283 autocompleteBox.style.left = left + "px";
284 autocompleteBox.style.top = top + "px";
285 }
286
287 centerAutoCompleteBox();
288 window.addEventListener("scroll", centerAutoCompleteBox, false);
289 window.addEventListener("resize", centerAutoCompleteBox, false);
290
291 return autocomplete;
292 }
293
294 var createAutoCompletes = function()
295 {
296 window.wrappedJSObject.autocompletes["goTo"] = createAutoComplete("GO TO: ", selectListByName);
297 window.wrappedJSObject.autocompletes["moveTo"] = createAutoComplete("MOVE TO: ", moveToListByName);
298 }
299
300 var moveToListByName = function(text)
301 {
302 if (!window.wrappedJSObject.listTabs || !window.wrappedJSObject.listTabs.entries)
303 return;
304
305 for (var i = 0; i < window.wrappedJSObject.listTabs.entries.length; ++i)
306 {
307 if (window.wrappedJSObject.listTabs.entries[i].toLowerCase() == text.toLowerCase())
308 window.wrappedJSObject.control.tasksSelectionChanged("", ["", "tasks.moveTo." + window.wrappedJSObject.listTabs.data[i][1]]);
309 }
310 }
311
312 var selectListByName = function(text)
313 {
314 if (!window.wrappedJSObject.listTabs || !window.wrappedJSObject.listTabs.entries)
315 return;
316
317 for (var i = 0; i < window.wrappedJSObject.listTabs.entries.length; ++i)
318 {
319 if (window.wrappedJSObject.listTabs.entries[i].toLowerCase() == text.toLowerCase())
320 window.wrappedJSObject.listTabs.selectTabByPosition(i);
321 }
322 }
323
324 var hideAutocompletes = function()
325 {
326 if (window.wrappedJSObject.autocompletes)
327 for (var name in window.wrappedJSObject.autocompletes)
328 window.wrappedJSObject.autocompletes[name].hide();
329 }
330
331 // end Autocomplete
332
333 var createLeftColumn = function()
334 {
335 var leftColumn = document.createElement('div');
336 var appView = document.getElementById("appview");
337 var listBox = document.getElementById("listbox");
338
339 leftColumn.setAttribute('id','leftColumn');
340 leftColumn.style.cssFloat = "left";
341 leftColumn.style.paddingLeft = "5px";
342 leftColumn.style.paddingRight = "8px";
343 leftColumn.style.display = "none";
344
345 if (appView && listBox)
346 appView.insertBefore(leftColumn, listBox);
347 }
348
349 var createListTabsContainer = function()
350 {
351 var listTabsBox = document.createElement('div');
352 var leftColumn = document.getElementById("leftColumn");
353
354 if (leftColumn)
355 {
356 listTabsBox.innerHTML = '<div class="white_rbroundbox"> <div class="white_rbtop"> <div> <div></div> </div> </div> <div class="white_rbcontentwrap"> <div class="white_rbcontent"> <table><tr><td><div class="taskcloudcontent" style="padding: 0px 5px 0px 5px;" id="listtabscontainer"> </div></td></tr></table> </div> </div> <div class="white_rbbot"> <div><div></div> </div> </div> </div> ';
357
358 leftColumn.appendChild(listTabsBox);
359 }
360 }
361
362 var moveListTabs = function()
363 {
364 var listTabs = document.getElementById("listtabs");
365 if (listTabs)
366 {
367 listTabs.className = "";
368 listTabs.style.width = "100%";
369
370 var listTabsContainer = document.getElementById("listtabscontainer");
371
372 if (listTabsContainer)
373 listTabsContainer.appendChild(listTabs);
374 }
375 }
376
377 var hideLeftColumn = function()
378 {
379 var content = document.getElementById("content");
380 var leftColumn = document.getElementById("leftColumn");
381
382 if (leftColumn)
383 {
384 leftColumn.style.display = "none";
385 content.style.width = "870px";
386 }
387 }
388
389 var showLeftColumn = function()
390 {
391 var content = document.getElementById("content");
392 var leftColumn = document.getElementById("leftColumn");
393 var listTabsContainer = document.getElementById("listtabscontainer");
394
395 if (leftColumn)
396 {
397 leftColumn.style.display = "block";
398 leftColumn.style.width = Math.round(listTabsContainer.clientWidth * 1.14) + "px";
399 content.style.width = (863 + leftColumn.clientWidth) + "px";
400 }
401 }
402
403 var moveTabsToTheLeft = function()
404 {
405 var content = document.getElementById("content");
406 var listBox = document.getElementById("listbox");
407 var tools_spacer = document.getElementById("tools_spacer");
408 var sorting = document.getElementById("sorting");
409 var tools = document.getElementById("tools");
410
411 createLeftColumn();
412 createListTabsContainer();
413 moveListTabs();
414
415 var leftColumn = document.getElementById("leftColumn");
416
417 var handleViewChanged = function(d, e)
418 {
419 if (e[0][1] == "Tasks")
420 hideLeftColumn();
421 else if (e[1][1] == "Tasks")
422 showLeftColumn();
423 }
424
425 if (window.wrappedJSObject.messageBus)
426 window.wrappedJSObject.messageBus.subscribe(handleViewChanged, window.wrappedJSObject.view.getUniqueMessageBusName() + "viewChanged");
427
428 if (tools_spacer)
429 {
430 tools_spacer.style.paddingTop = "1px";
431 tools_spacer.style.borderTop = "1px solid #CACACA";
432 }
433
434 if (sorting)
435 sorting.style.marginTop = "0px";
436
437 if (tools)
438 tools.style.paddingTop = "5px";
439
440 if (content && window.wrappedJSObject.view)
441 {
442 if (window.wrappedJSObject.view.getSelected() == "Tasks")
443 showLeftColumn();
444 else
445 hideLeftColumn();
446 }
447 }
448
449 var handleKeyPressEvent = function(ev, ignoreCombo)
450 {
451 ev || (ev = window.event);
452
453 if (ev == null)
454 return;
455
456 var target = null;
457
458 if (window.wrappedJSObject.utility)
459 target = window.wrappedJSObject.utility.getEventTarget(ev);
460
461 if (target == null)
462 return true
463
464 var pressed = (ev.charCode) ? ev.charCode: ((ev.which) ? ev.which: ev.keyCode);
465
466 if (target != null && target.type != null && (target.type == "textarea" || target.type == "input" || target.type.indexOf("select") == 0 || target.type == "button" || target.type === "submit" || target.type == "text" || target.type == "password" || (target.id != null && target.id == "map")))
467 return true
468
469 var tabs = null;
470
471 if (window.wrappedJSObject.view)
472 tabs = window.wrappedJSObject.view.getViewTabs();
473
474 if (tabs)
475 {
476 switch (pressed)
477 {
478 case 74:
479 if (ev.shiftKey)
480 {
481 tabs.selectRight();
482 if (window.wrappedJSObject.utility)
483 window.wrappedJSObject.utility.stopEvent(ev);
484
485 return false
486 }
487 break;
488 case 75:
489 if (ev.shiftKey)
490 {
491 tabs.selectLeft();
492 if (window.wrappedJSObject.utility)
493 window.wrappedJSObject.utility.stopEvent(ev);
494
495 return false
496 }
497 break;
498 case 103:
499 if (ev.ctrlKey)
500 {
501 hideAutocompletes();
502 window.wrappedJSObject.autocompletes["goTo"] && window.wrappedJSObject.autocompletes["goTo"].show();
503 if (window.wrappedJSObject.utility)
504 window.wrappedJSObject.utility.stopEvent(ev);
505
506 return false;
507 }
508 break;
509 case 109:
510 if (ev.ctrlKey)
511 {
512 hideAutocompletes();
513 window.wrappedJSObject.autocompletes["moveTo"] && window.wrappedJSObject.autocompletes["moveTo"].show();
514 if (window.wrappedJSObject.utility)
515 window.wrappedJSObject.utility.stopEvent(ev);
516
517 return false;
518 }
519 break
520 }
521 }
522
523 return true;
524 }
525
526 var overrideBodyKeyPressHandler = function()
527 {
528 if (window.wrappedJSObject.eventMgr)
529 {
530 var oldBodyKeyPressHandler = window.wrappedJSObject.eventMgr.bodyKeyPressHandler;
531
532 window.wrappedJSObject.eventMgr.bodyKeyPressHandler = function(ev, ignoreCombo)
533 {
534 if (handleKeyPressEvent(ev, ignoreCombo))
535 return oldBodyKeyPressHandler.call(window.wrappedJSObject.eventMgr, ev, ignoreCombo);
536
537 return true;
538 }
539 }
540 }
541
542 var overrideListTabsBlitDiv = function()
543 {
544 if (window.wrappedJSObject.listTabs)
545 {
546 var oldBlitDiv = window.wrappedJSObject.listTabs.blitDiv;
547
548 window.wrappedJSObject.listTabs.blitDiv = function()
549 {
550 oldBlitDiv.call(window.wrappedJSObject.listTabs);
551 refreshListTabsStyles();
552 showTasksCount();
553 hideLists();
554 }
555
556 window.wrappedJSObject.listTabs.blitDiv();
557 }
558 }
559
560 var refreshListTabsStyles = function()
561 {
562 var divListTabs = document.getElementById("listtabs");
563
564 if (divListTabs)
565 {
566 divListTabs.firstChild.style.listStyle = "none";
567 divListTabs.firstChild.style.padding = "0px 5px 0px 5px";
568 divListTabs.firstChild.style.whiteSpace = "nowrap";
569 }
570 }
571
572 var hideLists = function()
573 {
574 if (window.wrappedJSObject.listTabs)
575 {
576 var listItems = window.wrappedJSObject.listTabs.div.getElementsByTagName("li");
577
578 for (var i = 0; i < window.wrappedJSObject.listTabs.data.length; ++i)
579 {
580 if (window.wrappedJSObject.listTabs.data[i] && isListHidden(window.wrappedJSObject.listTabs.data[i][1]))
581 listItems[i].style.display = "none";
582 }
583
584 /*if (window.wrappedJSObject.view.getSelected() == "Tasks")
585 showLeftColumn();*/
586 }
587 }
588
589 var overrideListTabsSelectLeft = function()
590 {
591 if (window.wrappedJSObject.listTabs)
592 {
593 var oldListTabsSelectLeft = window.wrappedJSObject.listTabs.selectLeft;
594
595 window.wrappedJSObject.listTabs.selectLeft = function()
596 {
597 var position = this.selected - 1;
598
599 while (true)
600 {
601 if (position >= 0)
602 {
603 if (!isListHidden(this.data[position][1]))
604 break;
605
606 --position;
607 }
608 else
609 position = this.entries.length - 1;
610 }
611
612 this.selectTabByPosition(position);
613 }
614 }
615 }
616
617 var overrideListTabsSelectRight = function()
618 {
619 if (window.wrappedJSObject.listTabs)
620 {
621 var oldListTabsSelectRight = window.wrappedJSObject.listTabs.selectRight;
622
623 window.wrappedJSObject.listTabs.selectRight = function()
624 {
625 var position = this.selected + 1;
626
627 while (true)
628 {
629 if (position < this.entries.length)
630 {
631 if (!isListHidden(this.data[position][1]))
632 break;
633
634 ++position;
635 }
636 else
637 position = 0;
638 }
639
640 this.selectTabByPosition(position);
641 }
642 }
643 }
644
645 var showTasksCount = function()
646 {
647 if (window.wrappedJSObject.listTabs)
648 {
649 var listItems = window.wrappedJSObject.listTabs.div.getElementsByTagName("li");
650
651 for (var i = 0; window.wrappedJSObject.listTabs.data && window.wrappedJSObject.listTabs.data[i]; ++i)
652 {
653 var tasksCount = 0;
654
655 if (window.wrappedJSObject.listTabs.data[i][2])
656 {
657 var filter = window.wrappedJSObject.listTabs.data[i][2];
658
659 if (filter && filter.indexOf("status:") < 0)
660 filter = "(" + filter + ") and (status:incomplete)";
661
662 if (window.wrappedJSObject.overviewList && filter)
663 tasksCount = window.wrappedJSObject.overviewList.getFilteredList(filter).length
664 }
665 else
666 {
667 if (window.wrappedJSObject.format)
668 tasksCount = window.wrappedJSObject.format.getListStatistics(window.wrappedJSObject.listTabs.data[i][1])[5];
669
670 listItems[i].firstChild.style.color = "black";
671 }
672
673 if (tasksCount > 0)
674 listItems[i].firstChild.innerHTML = listItems[i].firstChild.innerHTML + " (" + tasksCount + ")";
675 }
676 }
677 }
678
679 var subscribeToFilterEditFinished = function()
680 {
681 if (window.wrappedJSObject.messageBus)
682 window.wrappedJSObject.messageBus.subscribe(window.wrappedJSObject.listTabs.blitDiv, window.wrappedJSObject.listList.mbn + "setFilterSuccess");
683 }
684
685 var overrideTaskCloudUpdate = function()
686 {
687 if (window.wrappedJSObject.taskCloud)
688 {
689 var oldTaskCloudUpdate = window.wrappedJSObject.taskCloud.update;
690
691 window.wrappedJSObject.taskCloud.update = function()
692 {
693 oldTaskCloudUpdate.call(window.wrappedJSObject.taskCloud);
694
695 if (window.wrappedJSObject.listTabs)
696 window.wrappedJSObject.listTabs.blitDiv();
697 }
698 }
699 }
700
701 var hiddenLists = GM_getValue("hiddenLists", "");
702
703 var isListHidden = function(listID)
704 {
705 if (hiddenLists)
706 return hiddenLists.indexOf(listID) >= 0;
707
708 return false;
709 }
710
711 var isListArchived = function(listID)
712 {
713 if (window.wrappedJSObject.stateMgr.lists[listID] && window.wrappedJSObject.stateMgr.lists[listID].archived)
714 return true;
715
716 return false;
717 }
718
719 var hideList = function(entry)
720 {
721 hiddenLists = (hiddenLists || "") + entry[0] + ",";
722
723 GM_setValue("hiddenLists", hiddenLists);
724
725 window.wrappedJSObject.listList.list.updateEntry(entry);
726 window.wrappedJSObject.listTabs.blitDiv();
727 }
728
729 var showList = function(entry)
730 {
731 hiddenLists = hiddenLists.replace(entry[0], "");
732 hiddenLists = hiddenLists.replace(",,", ",");
733
734 GM_setValue("hiddenLists", hiddenLists);
735
736 window.wrappedJSObject.listList.list.updateEntry(entry);
737 window.wrappedJSObject.listTabs.blitDiv();
738 }
739
740
741 var overrideListListUpdateEntry = function()
742 {
743 if (window.wrappedJSObject.listList)
744 {
745 var oldListListUpdateEntry = window.wrappedJSObject.listList.list.updateEntry;
746
747 window.wrappedJSObject.listList.list.updateEntry = function(entry, D)
748 {
749 oldListListUpdateEntry.call(window.wrappedJSObject.listList.list, entry, D);
750
751 var index = window.wrappedJSObject.listList.list.map[entry[0]];
752 var row = window.wrappedJSObject.listList.list.table.rows[index];
753
754 row.entry = entry;
755 row.rowText.innerHTML = "<div id='listName_" + entry[0] + "' style='float: left;'>" + entry[1] + "</div><div style='align: right; float: right;'><a href=\"# \" id='displayListLink_" + entry[0] + "'></a></div>";
756
757 var displayListLink = document.getElementById('displayListLink_' + entry[0]);
758 var listName = document.getElementById('listName_' + entry[0]);
759
760 var listClickHandler = function(event)
761 {
762 if (isListHidden(entry[0]))
763 showList(entry);
764 else
765 hideList(entry);
766
767
768 if (window.wrappedJSObject.utility)
769 window.wrappedJSObject.utility.stopEvent(event);
770 }
771
772 displayListLink.addEventListener('click', listClickHandler, false);
773
774 if (!isListArchived(entry[0]))
775 {
776 if (isListHidden(entry[0]))
777 {
778 displayListLink.innerHTML = "show";
779 listName.style.color = "#cacaca";
780 }
781 else
782 {
783 displayListLink.innerHTML = "hide";
784 listName.style.color = "";
785 }
786 }
787 }
788
789 window.wrappedJSObject.listList.doStyles();
790 }
791 }
792
793 window.addEventListener('load', overrideListTabsBlitDiv, false);
794 window.addEventListener('load', moveTabsToTheLeft, false);
795 window.addEventListener('load', overrideBodyKeyPressHandler, false);
796 window.addEventListener('load', overrideTaskCloudUpdate, false);
797 window.addEventListener('load', overrideListTabsSelectLeft, false);
798 window.addEventListener('load', overrideListTabsSelectRight, false);
799 window.addEventListener('load', subscribeToFilterEditFinished, false);
800 window.addEventListener('load', createAutoCompletes, false);
801 window.addEventListener('click', hideAutocompletes, false);
802
803 window.addEventListener('load', overrideListListUpdateEntry, false);