Widget:GetAgencyInfo

 Loading agency information ... load_agency_info; function load_agency_info { var aID = ""; var dNow = new Date; nCache = localStorage.getItem("exp-"+aID); console.log('cache time: ' + nCache); if (nCache > 10000) { var dCacheExp = new Date(parseInt(nCache)); console.log(dCacheExp); }	if (nCache == null || nCache < 10000 || dCacheExp < dNow) { console.log("Cache expired or not found for Agency "+aID+ " (" + localStorage.getItem("exp-"+aID) + ")"); var xhttp = new XMLHttpRequest; xhttp.addEventListener("error", transferFailed); xhttp.onreadystatechange = function { if (xhttp.readyState == 4 && xhttp.status == 200) { document.getElementById("agency_info").innerHTML = xhttp.responseText; var nUpdCache = dNow.getTime + (1000 * 60 * 60 * 24); // 24 hr cache cleanup_cache; localStorage.setItem("exp-"+aID, nUpdCache); localStorage.setItem("ag-"+aID, xhttp.responseText); console.log("Saved cache for Agency "+aID + " as " + nUpdCache); }		};		xhttp.open("POST", "https://foia.wiki/ext_data/agency_info.php", true); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.send("qq=7&id="+aID); function transferFailed(evt) { document.getElementById("agency_info").innerHTML = "Not available." + JSON.stringify(evt); }	} else { //cache hasn't expired document.getElementById("agency_info").innerHTML = localStorage.getItem("ag-"+aID); console.log("Used cache for Agency "+aID); } }

function cleanup_cache { var tKey = 0; var sTempID = ''; var dN = new Date; for (var i = 0; i < localStorage.length; i++) { tKey = localStorage.key(i); if (tKey.substr(0,3) == 'exp') { var dv = new Date(parseInt(localStorage.getItem(tKey))); if (dv < dN) { //old var sTempID = tKey.substr(4); localStorage.removeItem(tKey); localStorage.removeItem('ag-'+sTempID); }		}	} } function clear_cache { var tKey = 0; var sTempID = ''; var dN = new Date; var log = ''; for (var i = 0; i < localStorage.length; i++) { tKey = localStorage.key(i); if (tKey.substr(0,3) == 'exp') { var sTempID = tKey.substr(4); localStorage.removeItem(tKey); localStorage.removeItem('ag-'+sTempID); log += "Deleted " + tKey + "\n"; }	}	if (log.length > 0) { alert(log); } else { alert("Nothing to delete"); } }

function fp_view_case(cid) { $("#hiddencase").html("close \n"); $("#hiddencase").load("https://foia.wiki/ext_data/fp_view_case.php", { id: cid }); $("#hiddencase").css({ display: "block", left: "15%", top:"20%", width:"70%", maxHeight:"60%" }); } function fp_close_preview { $("#hiddencase").css({ display: "none" }); $("#hiddencase").html("close "); } function storageAvailable { try { var storage = window[localStorage], x = '__storage_test__'; storage.setItem(x, x); storage.removeItem(x); return true; }	catch(e) { return false; } }  close