function CheckForHash(){ if(document.location.hash){ var HashLocationName = document.location.hash; HashLocationName = HashLocationName.replace("#",""); if (window.ajaxLocation == HashLocationName) { document.getElementById('hashinfo').innerHTML = window.ajaxLocation; }else{ window.ajaxLocation = HashLocationName; document.getElementById('hashinfo').innerHTML = 'loading page: '+ HashLocationName +'?t='+ fetch_unix_timestamp(); AjaxFetch(HashLocationName); } //alert(hashinfo); //document.getElementById('hashinfo').innerHTML = HashLocationName; //document.getElementById('Intructions').style.display='none'; //for(var a=0; a<5; a++){ // if(HashLocationName != ('Show' +(a+1))){ // document.getElementById('Show'+(a+1)).style.display='none'; // } //} }else{ if (location.search) { if (window.ajaxLocation == location.pathname+''+location.search) { document.getElementById('hashinfo').innerHTML = location.pathname+''+location.search; }else{ window.ajaxLocation = location.pathname+''+location.search; document.getElementById('hashinfo').innerHTML = 'loading page: '+ location.pathname+''+location.search +'&t='+ fetch_unix_timestamp(); AjaxFetch(location.pathname+''+location.search+'&'); } }else{ if (window.ajaxLocation == location.pathname) { document.getElementById('hashinfo').innerHTML = location.pathname; }else{ window.ajaxLocation = location.pathname; document.getElementById('hashinfo').innerHTML = 'loading page: '+ location.pathname +'?t='+ fetch_unix_timestamp(); AjaxFetch(location.pathname); } } //alert(location.pathname); //document.getElementById('hashinfo').innerHTML = HashLocationName; } } function Go(alink) { window.ajaxLocation = ""; document.location.hash = alink; } function AjaxFetch(url) { document.getElementById('tloader').style.display='block'; var timestamp = fetch_unix_timestamp(); myRequest = new ajaxObject('/ajax'+ url); myRequest.callback = function(responseText) { var trimmed = responseText.replace(/^\s+|\s+$/g, '') ; responseText = trimmed; //alert(responseText); //eval(responseText); AjaxRender(responseText); //document.getElementById('contentLoader').innerHTML = responseText; } myRequest.update('','POST'); } function AjaxRepeat() { if (window.ajaxRepeat) { var timestamp = fetch_unix_timestamp(); myRequest = new ajaxObject(window.ajaxRepeat); myRequest.callback = function(responseText) { var trimmed = responseText.replace(/^\s+|\s+$/g, '') ; responseText = trimmed; //alert(responseText); //eval(responseText); //AjaxRender(responseText); //document.getElementById('contentLoader').innerHTML = responseText; } myRequest.update('','POST'); } } function AjaxRender(data) { var r = eval("(" + data + ")"); if (r.ok == false) { window.location = "/user.login/"; return; } if (r.updater) { window.ajaxRepeat = r.updater; }else{ window.ajaxRepeat = ""; } document.getElementById('contentLoader').innerHTML = r.page; resizecontent(); document.getElementById('tloader').style.display='none'; if (r.js) { if (document.getElementById(r.js.id)) { }else{ var head= document.getElementsByTagName('head')[0]; var script= document.createElement('script'); script.type= 'text/javascript'; script.src= r.js.src; script.id = r.js.id; head.appendChild(script); } } } fetch_unix_timestamp = function() { return parseInt(new Date().getTime().toString().substring(0, 10)); } function NewWindow(mypage, myname, w, h, scroll) { //var myname=Math.floor(Math.random()*900) var winl = (screen.width - w) / 2; var wint = (screen.height - h) / 2; winprops = 'toolbar=no,location=no,scrollbars=no,resizable=no, height='+h+',width='+w; win = window.open(mypage, myname, winprops) if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); } } // setInterval('self.location.reload()',20000); /* name - name of the cookie value - value of the cookie [expires] - expiration date of the cookie (defaults to end of current session) [path] - path for which the cookie is valid (defaults to path of calling document) [domain] - domain for which the cookie is valid (defaults to domain of calling document) [secure] - Boolean value indicating if the cookie transmission requires a secure transmission * an argument defaults when it is assigned null as a placeholder * a null placeholder is not required for trailing omitted arguments */ function setCookie(name, value, expires, path, domain, secure) { //alert(document.domain); var mydomain = document.domain domain_cookie = mydomain.replace("www.", ""); domain = domain_cookie; //alert(domain_cookie); var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); document.cookie = curCookie; } /* name - name of the desired cookie return string containing value of specified cookie or null if cookie does not exist */ function getCookie(name) { var dc = document.cookie; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; } else begin += 2; var end = document.cookie.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin + prefix.length, end)); } /* name - name of the cookie [path] - path of the cookie (must be same as path used to create cookie) [domain] - domain of the cookie (must be same as domain used to create cookie) path and domain default if assigned null or omitted if no explicit argument proceeds */ function deleteCookie(name, path, domain) { if (getCookie(name)) { document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; } } // date - any instance of the Date object // * hand all instances of the Date object to this function for "repairs" function fixDate(date) { var base = new Date(0); var skew = base.getTime(); if (skew > 0) date.setTime(date.getTime() - skew); } // *********************************************************************** // *********************************************************************** // The Ultimate Ajax Object // http://www.hunlock.com/blogs/The_Ultimate_Ajax_Object // *********************************************************************** // *********************************************************************** function ajaxObject(url, callbackFunction) { var that=this; this.updating = false; this.abort = function() { if (that.updating) { that.updating=false; that.AJAX.abort(); that.AJAX=null; } } this.update = function(passData,postMethod) { if (that.updating) { return false; } that.AJAX = null; if (window.XMLHttpRequest) { that.AJAX=new XMLHttpRequest(); } else { that.AJAX=new ActiveXObject("Microsoft.XMLHTTP"); } if (that.AJAX==null) { return false; } else { that.AJAX.onreadystatechange = function() { if (that.AJAX.readyState==4) { that.updating=false; that.callback(that.AJAX.responseText,that.AJAX.status,that.AJAX.responseXML); that.AJAX=null; } } that.updating = new Date(); if (/post/i.test(postMethod)) { var uri=urlCall+'?'+that.updating.getTime(); that.AJAX.open("POST", uri, true); that.AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); that.AJAX.setRequestHeader("Content-Length", passData.length); that.AJAX.send(passData); } else { var uri=urlCall+'?'+passData+'×tamp='+(that.updating.getTime()); that.AJAX.open("GET", uri, true); that.AJAX.send(null); } return true; } } var urlCall = url; this.callback = callbackFunction || function () { }; } function cleardiv(div) { document.getElementById(div).innerHTML = ""; } function showPopUp(el) { // document.getElementById("dialog").innerHTML = '
| Loading... | [ cancel ] |
loading...
'+ msg;
document.getElementById('error_'+div).style.display = "block";
}
function reseterror(div)
{
document.getElementById('error_'+div).innerHTML = '';
document.getElementById('error_'+div).style.display = "none";
}
function loadingdiv(div)
{
document.getElementById('loading_'+div).innerHTML = '
';
}
function resetdiv(div)
{
document.getElementById(div).innerHTML = '';
}
function ReTweetPost(id)
{
var str = "";
str += 'retweet_id='+ id +'&';
var timestamp = fetch_unix_timestamp();
myRequest = new ajaxObject('/?/rt/retweet-this/&');
myRequest.callback = function(responseText)
{
var trimmed = responseText.replace(/^\s+|\s+$/g, '') ;
responseText = trimmed;
document.getElementById('retweet'+ id).style.display = "block";
//alert(responseText);
//eval(responseText);
document.getElementById('retweet'+ id).innerHTML = responseText;
}
myRequest.update(str,'POST');
}
function UserRegister(url)
{
var str = "";
var merror = "";
if (document.getElementById('register_email').value == ""){ loaderror('register_email','please enter an email address'); merror='1';}else{ reseterror('register_email'); }
if (document.getElementById('register_password').value == ""){ loaderror('register_password','please enter a password'); merror='1';}else{ reseterror('register_password'); }
if (document.getElementById('register_lname').value == ""){ loaderror('register_lname','please enter your last name'); merror='1'; }else{ reseterror('register_lname'); }
if (document.getElementById('register_fname').value == ""){ loaderror('register_fname','please enter your first name'); merror='1'; }else{ reseterror('register_fname'); }
if (document.getElementById('register_username').value == ""){ loaderror('register_username','please enter a username'); merror='1'; }else{ reseterror('register_username'); }
if (merror=='1'){ return; }
str += 'register_fname='+ escape(document.getElementById('register_fname').value) +'&';
str += 'register_lname='+ escape(document.getElementById('register_lname').value) +'&';
str += 'register_email='+ escape(document.getElementById('register_email').value) +'&';
str += 'register_password='+ escape(document.getElementById('register_password').value) +'&';
str += 'register_username='+ escape(document.getElementById('register_username').value) +'&';
str += 'url='+ escape(url) +'&';
loadingdiv('register');
var timestamp = fetch_unix_timestamp();
myRequest = new ajaxObject('/index.php?plugin=login-register&');
myRequest.callback = function(responseText)
{
var trimmed = responseText.replace(/^\s+|\s+$/g, '') ;
responseText = trimmed;
//alert(responseText);
eval(responseText);
//document.getElementById('states').innerHTML = responseText;
}
myRequest.update(str,'POST');
}
function UserLogin(url)
{
var str = ""; var merror = "";
if (document.getElementById('login_email').value == ""){ loaderror('login_email','please enter your email address'); merror='1'; }else{ reseterror('login_email'); }
if (document.getElementById('login_password').value == ""){ loaderror('login_password','please enter your password'); merror='1'; }else{ reseterror('login_password'); }
if (merror=='1'){ return; }
loadingdiv('login');
str += 'login_email='+ escape(document.getElementById('login_email').value) +'&';
str += 'login_password='+ escape(document.getElementById('login_password').value) +'&';
str += 'url='+ escape(url) +'&';
var timestamp = fetch_unix_timestamp();
myRequest = new ajaxObject('/index.php?plugin=login-user&');
myRequest.callback = function(responseText)
{
var trimmed = responseText.replace(/^\s+|\s+$/g, '') ;
responseText = trimmed;
//alert(responseText);
eval(responseText);
//document.getElementById('states').innerHTML = responseText;
}
myRequest.update(str,'POST');
}