viewing source for "fancy-categories.js"

last commit

commit 2023770d4aea75baa7dd033df9b6402e134da37b Author: andy <andy@a04a6e75-5819-0410-a511-8dafea38c924> Date: Wed Dec 12 18:28:18 2007 +0000
code cleanup and changelog / readme update

source code

01: /*
02: Copyright 2007 Andrew Rader
03: 
04: This file is part of Fancy Categories
05: 
06: Fancy Categories is free software; you can redistribute it and/or modify
07: it under the terms of the GNU General Public License as published by
08: the Free Software Foundation; either version 2 of the License, or
09: (at your option) any later version.
10: 
11: Fancy Categories is distributed in the hope that it will be useful,
12: but WITHOUT ANY WARRANTY; without even the implied warranty of
13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14: GNU General Public License for more details.
15: 
16: You should have received a copy of the GNU General Public License
17: along with Fancy Categories; if not, write to the Free Software
18: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19: */
20: 
21: function fancat_click( e ) {
22:     if( e.target ) {
23:         src = e.target;
24:     }
25:     else {
26:         src = window.event.srcElement;
27:     }
28: 
29:     id = src.id.replace( 'fancycat_link_', '' );
30:     subcats = document.getElementById( 'fancycat_sub_' + id );
31:     posts = document.getElementById( 'fancycat_posts_' + id );
32: 
33:     if( src.getAttribute( "rel" ) == "hide" ) {
34:         if( subcats != null ) {
35:             subcats.style.display = "none";
36:         }
37:         if( posts != null ) {
38:             posts.style.display = "none";
39:         }
40:         src.setAttribute("rel","show");
41:     }
42:     else {
43:         if( subcats != null ) {
44:             subcats.style.display = "";
45:         }
46:         if( posts != null ) {
47:             posts.style.display = "";
48:         }
49:         src.setAttribute("rel","hide");
50:     }
51: 
52:     if( e.preventDefault ) {
53:         e.preventDefault();
54:     }
55: 
56:     e.returnValue = false;
57: 
58:     return false;
59: }