1/** 2 * DOCman Categories Tree - Site 3 * 4 * Customized instance of jqTree to render a list of categories in a tree structure. 5 * It deals with turning a flat list into a hierarchy structure that jqTree understands. 6 * And it changes the default styling and behavior to match the general DOCman GUI. 7 * 8 * @copyright Copyright (C) 2007 Johan Janssens and Timble CVBA. (http://www.timble.net) 9 * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> 10 * @requires Koowa.Class, jqTree plugin 11 */ 12 13var Docman = Docman || {}; 14if(!Docman.hasOwnProperty('Tree')) Docman.Tree = {}; 15 16(function($){ 17 18 Docman.Tree.CategoriesSite = Koowa.Tree.extend({ 19 getDefaults: function() { 20 var defaults = this.supr(); 21 22 defaults.autoOpen = false; 23 24 return defaults; 25 }, 26 attachHandlers: function(){ 27 28 this._attachHandlers(); // Attach needed events from DOCman.Tree.Categories._attachHandlers 29 30 var self = this; 31 32 this.element.bind({ 33 'tree.init': 34 function() { 35 /** 36 * Select the root node, if no other node is selected 37 */ 38 if(!$(this).tree('getSelectedNode')) $(this).tree('selectNode', $(this).tree('getNodeById', -1)); 39 40 /** 41 * Attach select event, after a potential select event fired to hilite the root node 42 */ 43 self.element.bind('tree.select', function(event){ 44 if(event.node) { // When event.node is null, it's actually a deselect event 45 var node = event.node; 46 47 if (node.id != -1 && node.route) { 48 window.location = node.route; 49 } 50 } 51 }); 52 53 /** 54 * Sidebar.js will fire a resize event when it sets the height on load, we want our animated scroll 55 * to happen after that, but not on future resize events as it would confuse the user experience 56 */ 57 self.element.one('resize', function(){ 58 if(self.tree('getSelectedNode')) { 59 self.scrollIntoView(self.tree('getSelectedNode'), self.element, 900); 60 } 61 }); 62 } 63 }); 64 65 } 66 }); 67}(window.kQuery));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.