/* // +----------------------------------------------------------------------+ // | Orginial Code Care Of: | // +----------------------------------------------------------------------+ // | Copyright (c) 2004 Bitflux GmbH | // +----------------------------------------------------------------------+ // | Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 | // | Unless required by applicable law or agreed to in writing, software | // | distributed under the License is distributed on an "AS IS" BASIS, | // | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | // | implied. See the License for the specific language governing | // | permissions and limitations under the License. | // +----------------------------------------------------------------------+ // | Author: Bitflux GmbH | // | http://blog.bitflux.ch/p1735.html | // +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+ // | Heavily Modified by Jeff Minard (07/09/04) | // +----------------------------------------------------------------------+ // | Author: Jeff Minard | // | http://www.creatimation.net | // +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+ // | Heavily Modified by Jonas Rabbe (2005-05-08) | // +----------------------------------------------------------------------+ // | Author: Jonas Rabbe | // | http://www.jonas.rabbe.com | // +----------------------------------------------------------------------+ // +----------------------------------------------------------------------+ // | Heavily Modified Again by Rob Sable (05/10/05) | // +----------------------------------------------------------------------+ // | Author: Rob Sable | // | http://www.wilshireone.com | // +----------------------------------------------------------------------+ */ var rssLiveReq = false; var rssLiveReqLast = "-"; var rssYear = 0; var rssMonth = 0; var rssIsIE = false; var rssIsIE7 = false; var rssLoadingMsg = "Loading Article Archives..."; // on !IE we only have to initialize it once if (window.XMLHttpRequest) { rssLiveReq = new XMLHttpRequest(); } function rssLiveReqDoReq(query) { if (rssLiveReqLast != query) { if (rssLiveReq && rssLiveReq.readyState < 4) { rssLiveReq.abort(); } if (window.XMLHttpRequest) { // branch for IE/Windows ActiveX version } else if (window.ActiveXObject) { rssLiveReq = new ActiveXObject("Microsoft.XMLHTTP"); } rssLiveReq.open("GET", "?larch=1&" + query); rssLiveReqLast = query; rssLiveReq.onreadystatechange = rssLiveReqProcessReqChange; rssLiveReq.send(null); } } function rssLiveReqProcessReqChange() { if (rssLiveReq.readyState == 4) { try { var loadingDiv = document.getElementById('rssLiveArchiveLoading'); loadingDiv.style.display = 'none'; var rssText = rssLiveReq.responseText; var resultID = rssText.substring(0, rssText.indexOf('|')); rssText = rssText.substring(rssText.indexOf('|') + 1, rssText.length); document.getElementById(resultID).innerHTML = rssText; var year_list = document.getElementById(resultID+'-year').childNodes; for( var i = 0; i < year_list.length; i++ ) { if( year_list[i].nodeName == 'LI' ) { year_list[i].style.cursor = 'pointer'; var tf = function(e) { var rssID = rssEventElement(e).id; rssYear = rssID.substring(rssID.lastIndexOf('-') + 1, rssID.length); rssSelectYear(); } rssAttachClickEvent(year_list[i], tf); } } var month_list = document.getElementById(resultID+'-month').childNodes; for( var i = 0; i < month_list.length; i++ ) { if( month_list[i].nodeName == 'LI' ) { month_list[i].style.cursor = 'pointer'; var tf = function(e) { var rssID = rssEventElement(e).id; rssMonth = rssID.substring(rssID.lastIndexOf('-') + 1, rssID.length); rssSelectMonth(); } rssAttachClickEvent(month_list[i], tf); } } } catch (exception) { } } } function rssAttachClickEvent(element, tf) { if (!element) { alert("No object given"); } if (element.addEventListener) { element.addEventListener('click', tf, false); } else { element.attachEvent('onclick',tf); } /* if( rssIsIE) { alert("Calling attachEvent"); element.attachEvent('onclick',tf); } else { alert("Calling addEventListener"); element.addEventListener('click', tf, false); } */ } function rssGetInternetExplorerVersion() // Returns the version of Internet Explorer or a -1 // (indicating the use of another browser). { var rv = -1; // Return value assumes failure if (navigator.appName == 'Microsoft Internet Explorer') { var ua = navigator.userAgent; var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); if (re.exec(ua) != null) rv = parseFloat( RegExp.$1 ); } return rv; } function rssCheckIEVersion() { var ver = rssGetInternetExplorerVersion(); if ( ver > -1 ) { rssIsIE = true; if ( ver >= 7.0 ) { rssIsIE7 = true; } } } function rssLiveReqInit() { if (navigator.userAgent.indexOf("Safari") > 0) { // branch to get to internet explorer } else if (navigator.product == "Gecko") { // branch to get to internet explorer } else { // rssIsIE = true; rssCheckIEVersion(); } var notlive = document.getElementById('notlive'); var newDiv = document.createElement('div'); newDiv.id = 'rssLiveArchiveLoading'; newDiv.style.display = 'none'; newDiv.innerHTML = rssLoadingMsg; newDiv.style.display = 'block'; try { document.getElementById('livearchives').appendChild(newDiv); document.getElementById('livearchives').removeChild(notlive); } catch (exception) { } rssLiveReqDoReq(''); } function rssSelectYear() { rssLiveReqDoReq('year=' + rssYear); } function rssSelectMonth() { rssLiveReqDoReq('year=' + rssYear + '&month=' + rssMonth); } function rssEventElement(e) { if( rssIsIE ) { return e.srcElement; } else { return e.currentTarget; } } function addrssLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } addrssLoadEvent(function() { rssLiveReqInit(); });