forked from alice0775/userChrome.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclearSidebarSearchBox.uc.js
More file actions
66 lines (66 loc) · 2.45 KB
/
clearSidebarSearchBox.uc.js
File metadata and controls
66 lines (66 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// ==UserScript==
// @name clearSidebarSearchBox.uc.js
// @namespace http://space.geocities.yahoo.co.jp/gl/alice0775
// @description Right click to Clear Search Box on Bookmark and History Sidebar Pannel
// @include chrome://browser/content/bookmarks/bookmarksPanel.xul
// @include chrome://browser/content/history/history-panel.xul
// @compatibility Firefox 2.0 3.0a8pre
// @author Alice0775
// @version 2007/08/31 20:00
// @Note
// ==/UserScript==
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License Version 2 or later (the
* "GPL"), in which case the provisions of the GPL are applicable
* instead of those above.
*
* The Original Code is Alice0775
* http://space.geocities.yahoo.co.jp/gl/alice0775
* (2007/04/28)
*
* Contributor(s):
* ()
*
* ***** END LICENSE BLOCK ***** */
(function() {
if (location.href == 'chrome://browser/content/bookmarks/bookmarksPanel.xul') {
var bookmarksview = document.getElementById('bookmarks-view');
var label = bookmarksview.previousSibling.firstChild;
label.addEventListener('click',function(event) {
var doc = event.target.ownerDocument;
var searchbox = document.getElementById('search-box');
if (event.button == 2) {
event.preventDefault();
searchbox.value = '';
searchbox.doCommand();
} else if (event.button == 0) {
if (searchbox.value != '' )
searchbox.doCommand();
}
},true);
} else if (location.href == 'chrome://browser/content/history/history-panel.xul') {
var viewButton = document.getElementById('viewButton');
viewButton.addEventListener('click',function(event) {
var doc = event.target.ownerDocument;
var searchbox = document.getElementById('search-box');
if (event.button == 2) {
event.preventDefault();
searchbox.value = '';
searchbox.doCommand();
}
},true);
}
})();