c7aadaa4596390e82cd452247d9cc9d8603d1fc9
[Packages/TYPO3.CMS.git] / typo3 / js / pagetreefiltermenu.js
1 /***************************************************************
2 * Copyright notice
3 *
4 * (c) 2010-2011 Jigal van Hemert <jigal@xs4all.nl>
5 * All rights reserved
6 *
7 * This script is part of the TYPO3 project. The TYPO3 project is
8 * free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * The GNU General Public License can be found at
14 * http://www.gnu.org/copyleft/gpl.html.
15 * A copy is found in the textfile GPL.txt and important notices to the license
16 * from the author is found in LICENSE.txt distributed with these scripts.
17 *
18 *
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
26
27 /**
28 * class to handle the pagetree filter menu
29 */
30 var PagetreeFilterMenu = Class.create({
31
32 /**
33 * registers for resize event listener and executes on DOM ready
34 */
35 initialize: function() {
36 Ext.onReady(function() {
37 Ext.get('tree-toolbar-filter-item').on('click', this.toggleMenu);
38 }, this);
39 },
40
41 /**
42 * toggles the visibility of the filter
43 */
44 toggleMenu: function(event) {
45 var toolbarItem = Ext.get('tree-toolbar-filter-item');
46 var treeFilterBox = Ext.get('treeFilterBox');
47 var treeFilterItem = Ext.get('treeFilter');
48 var treeFilterReset = Ext.get('treeFilterReset');
49
50 toolbarItem.blur();
51
52 if (toolbarItem.hasClass('active')) {
53 treeFilterBox.fadeOut();
54 TYPO3PageTreeFilter.resetSearchField();
55 } else {
56 treeFilterBox.fadeIn();
57 treeFilterItem.focus();
58 }
59
60 toolbarItem.toggleClass('active');
61
62 }
63 });
64
65 var TYPO3BackendFilterMenu = new PagetreeFilterMenu();