viewing source for "fancy-archives.js"

last commit

commit 7780b7260c3088044dd3a52b28f15424a4e9f7e2 Author: root <root@a04a6e75-5819-0410-a511-8dafea38c924> Date: Thu Feb 8 00:05:13 2007 +0000
Added option to display pages with posts Modified everything to newest version number

source code

01: /*
02: Fancy Archives ver 0.5
03: Copyright 2006 Andrew Rader
04: 
05: This file is part of Fancy Archives
06: 
07:     Fancy Archives is free software; you can redistribute it and/or modify
08:     it under the terms of the GNU General Public License as published by
09:     the Free Software Foundation; either version 2 of the License, or
10:     (at your option) any later version.
11: 
12:     Fancy Archives is distributed in the hope that it will be useful,
13:     but WITHOUT ANY WARRANTY; without even the implied warranty of
14:     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15:     GNU General Public License for more details.
16: 
17:     You should have received a copy of the GNU General Public License
18:     along with Fancy Archives; if not, write to the Free Software
19:     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20: */
21: 
22: if( window.addEventListener ) {
23: 	window.addEventListener( 'load', hideAll, false );
24: } else {
25: 	window.attachEvent('onload',hideAll);
26: }
27: 
28: function hideAll() {
29: 	items = document.getElementsByTagName("ul");
30: 	for( i = 0; i < items.length; i++ ) {
31: 		if( items[i].id.indexOf( "fancyArchivesList-" ) == 0 ) {
32: 			year = (new Date()).getYear();
33: 			month = (new Date()).getMonth() + 1;
34: 			if( year < 2000 ) {
35: 				year += 1900;
36: 			}
37: 
38: 			items[i].style.display = "none";
39: 
40: 			if( fancyarch_exp_curr_year && items[i].id == "fancyArchivesList-" + year ) {
41: 				items[i].style.display = "";
42: 			}
43: 
44: 			if( fancyarch_exp_curr_month && items[i].id == "fancyArchivesList-" + year + "-" + month ) {
45: 				items[i].style.display = "";
46: 			}
47: 		}
48: 	}
49: }
50: 
51: function hideNestedList( e ) {
52: 	if( e.target ) {
53: 		src = e.target;
54: 	}
55: 	else {
56: 		src = window.event.srcElement;
57: 	}
58: 
59: 	srcList = src.parentNode;
60: 	childList = null;
61: 
62: 	for( i = 0; i < srcList.childNodes.length; i++ ) {
63: 		if( srcList.childNodes[i].nodeName.toLowerCase() == 'ul' ) {
64: 			childList = srcList.childNodes[i];
65: 		}
66: 	}
67: 
68: 	if( src.getAttribute( "rel" ) == "hide" ) {
69: 		childList.style.display = "none";
70: 		src.setAttribute("rel","show");
71: 	}
72: 	else {
73: 		childList.style.display = "";
74: 		src.setAttribute("rel","hide");
75: 	}
76: 
77: 	if( e.preventDefault ) {
78: 		e.preventDefault();
79: 	}
80: 
81: 	return false;
82: }