var timeout = null; var closetimer = null; var refreshPg = null; var noreload = null; function isNewUI(){ console.log('useNewUI::',parent.document.location.href); if ( parent.document.location.href.includes('com/gcdvMJ') || parent.document.location.href.includes('com/newui')){ return true; } return false; } function useNewUI(){ console.log('useNewUI::',parent.document.location.href); if ( parent.document.location.href.includes('com/gcdvMJ') || parent.document.location.href.includes('com/newui')){ return '&UI=new'; } return ''; } function wzStartApp(){ timeout = 500; closetimer = 0; refreshPg = 0; noreload = 0; } function adImgFail(id){ var img = document.getElementById(id); if (img){ img.style.display = 'none'; } } function getUrl(url) { var synchCon = getHttpConnection(); synchCon.open("GET", url, false); synchCon.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); synchCon.send(null); var result=synchCon.responseText; synchCon=null return result; } function wzLink(url){ console.log('wzLink::',url); parent.hideTop(); parent.window.scrollTo(0,0); window.scrollTo(0,0); parent.wzLinkChangedTo(url); document.location.href = url+useNewUI(); } function doFollowMbrACT(id,mbrID){ var el = document.getElementById(id); var xOff=wzAPI_getOffset(el).left; var yOff=wzAPI_getOffset(el).top; var ofrName = window.frameElement.id; popsCont = null; wzAPI_showFrame('/whzon/mbr/fanRequestFrm.php?wzID=' + parent.sID + '&fanID=' + mbrID + '&ofrname=' + ofrName ,340,240,xOff,yOff,popsCont); } function getHttpConnection() { var xmlhttp=null; /*@cc_on @*/ /*@if (@_jscript_version >= 5) // JScript gives us Conditional compilation, we can cope with old IE versions. // and security blocked creation of the objects. try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @end @*/ if (!xmlhttp && typeof XMLHttpRequest!='undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp=false; } } if (!xmlhttp && window.createRequest) { try { xmlhttp = window.createRequest(); } catch (e) { xmlhttp=false; } } return xmlhttp; } // utility functions function parsmsg(term) { var sword = ''; var endw = cptr.indexOf(term); if (endw > 0) sword = Left(cptr, endw); cptr = Right(cptr, cptr.length - endw - 1); return sword; } function Left(str, n) { if (n <= 0) return ""; else if (n > String(str).length) return str; else return String(str).substring(0, n); } function Right(str, n) { if (n <= 0) return ""; else if (n > String(str).length) return str; else { var iLen = String(str).length; return String(str).substring(iLen, iLen - n); } } function mkyTrim(stringToTrim) { return stringToTrim.replace(/^\s+|\s+$/g, ""); } function stripToAlpha(txt) { return txt.replace(/\W/g, ''); } // wzAPI functions function wzAPI_setRefreshPg(inV){ refreshPg=inV; } function wzAPI_loadElement(URL,w,h,xoff,yoff,id){ wzAPI_getHTML(URL,id); var wzoutput = document.getElementById(id); wzoutput.style.width = w+'px'; wzoutput.style.height = h+'px'; wzoutput.style.left = xoff+'px'; wzoutput.style.top = yoff+'px'; wzoutput.style.display="inline-block"; } function wzAPI_showFrameInfoP(URL,w,h,xoff,yoff,id){ URL = URL+useNewUI(); noreload=1; mcancelclosetime(); var fh=h-33; var wzoutput = document.getElementById(id); wzoutput.innerHTML = "
close[x]
"; wzoutput.style.position='fixed'; wzoutput.style.width = w+'px'; wzoutput.style.height = h+'px'; wzoutput.style.left = xoff+'px'; wzoutput.style.top = yoff+'px'; wzoutput.style.display="inline-block"; } function wzAPI_showFrameR(URL,w,h,xoff,yoff,id){ URL = URL+useNewUI(); var fh=h-33; var wzoutput = document.getElementById(id); wzoutput.innerHTML = "
close[x]
"; wzoutput.style.width = w+'px'; wzoutput.style.height = h+'px'; wzoutput.style.left = xoff+'px'; wzoutput.style.top = yoff+'px'; wzoutput.style.position='fixed'; wzoutput.style.display="inline-block"; } function wzAPI_showFrame(URL, w, h, xoff, yoff, id,fixed=false) { URL = URL+useNewUI(); parent.wzAPI_showFrame(URL,w,h,xoff,yoff,this); console.log('showThis', fixed); return; var fh=h-33; var wzoutput = document.getElementById('wzPopContainer'); wzoutput.innerHTML = "
close[x]
"; wzoutput.style.width = w+'px'; wzoutput.style.height = h+'px'; alert('fixed'+fixed); if (fixed){ wzoutput.style.position = 'fixed'; } wzoutput.style.left = xoff+'px'; wzoutput.style.top = yoff+'px'; wzoutput.style.display = "inline-block"; wzoutput.style.visibility = "visible"; } function wzAPI_showMenu(URL,w,h,xoff,yoff,id){ mcancelclosetime(); var fh=h; popViewer = document.getElementById(id); popViewer.innerHTML = ""; popViewer.style.width = w+'px'; popViewer.style.height = h+'px'; popViewer.style.left = xoff+'px'; popViewer.style.top = yoff+'px'; popViewer.style.display = "inline-block"; popViewer.style.visibility = "visible"; popViewer.style.zIndex = popzLayer; } function mcloseInfoPtime(id) { closetimer = window.setTimeout(function(){wzAPI_closeWin(id);id=null}, timeout); } function mclosetime(id) { closetimer = window.setTimeout(function(){wzAPI_closeMenu(id);id=null}, timeout); } function mcancelclosetime() { if(closetimer) { window.clearTimeout(closetimer); closetimer = null; } } function wzAPI_closeMenu(id){ var wzoutput = document.getElementById(id); wzoutput.style.display="none"; wzoutput.innerHTML=""; } function wzAPI_closeWin(id){ var wzoutput = document.getElementById(id); wzoutput.style.display = "none"; wzoutput.innerHTML=""; if (refreshPg==1&&noreload==0){ noreload=0; window.location.reload(); } noreload=0; } function wzAPI_prepUrl(url,inxml){ var xm = new Date(); if (url.indexOf("?")!=-1) url=url+ "&xv=" + xm.getMilliseconds(); else url=url+ "?xv=" + xm.getMilliseconds(); inxml.open("GET", url,true); } function reloadElement(xmlhttp,url,id,timer,doFunc){ xmlhttp=getHttpConnection(); xmlhttp.onreadystatechange= function() { if (xmlhttp.readyState==4) if (xmlhttp.status==200) if (typeof parent.doEmotes != 'undefined') doFunc(xmlhttp,url,id,parent.doEmotes(xmlhttp.responseText),timer); } xmlhttp.open("GET",url,true); xmlhttp.send(null); } function wzAPI_getHTML(url,id){ xmlhttp=getHttpConnection(); if (!xmlhttp){ alert('no xml'); return; } xmlhttp.onreadystatechange= function() { if (xmlhttp.readyState==4) if (xmlhttp.status==200) document.getElementById(id).innerHTML = xmlhttp.responseText; } xmlhttp.open("GET",url,true); xmlhttp.send(null); xmlhttp=null; } function wzAPI_sendHTML(url){ xmlhttp=getHttpConnection(); xmlhttp.onreadystatechange= function() { if (xmlhttp.readyState==4) if (xmlhttp.status==200) wzAPI_DoNothing(); } xmlhttp.open("GET",url,true); xmlhttp.send(null); xmlhttp=null; } function wzAPI_DoNothing(){ } var wzAPI_phxml; var wzAPI_vdxml; function wzAPI_photoMgrBar(albumID,wzUserID,nPics,pg){ wzAPI_phxml=getHttpConnection(); var xm = new Date(); var url='/whzon/mbr/xmlPhotoBar.php?wzID=' + parent.sID + '&fpg=' + pg + '&fn=' + nPics + '&falbumID=' + albumID + '&fwzUserID=' + wzUserID + '&xm=' + xm.getMilliseconds(); wzAPI_phxml.open("GET", url,true); wzAPI_phxml.onreadystatechange = wzAPI_photoBarWrite; wzAPI_phxml.send(null); } function wzAPI_photoBar(albumID,wzUserID,nPics,pg){ wzAPI_phxml=getHttpConnection(); var xm = new Date(); var url = '/whzon/mbr/xmlPhotoBar.php?wzID=' + parent.sID + '&fpg=' + pg + '&fn=' + nPics + '&falbumID=' + albumID + '&fwzUserID=' + wzUserID + '&xm=' + xm.getMilliseconds(); wzAPI_phxml.open("GET", url,true); wzAPI_phxml.onreadystatechange = wzAPI_photoBarWrite; wzAPI_phxml.send(null); } function wzAPI_photoBarWrite(){ if (wzAPI_phxml.readyState == 4){ if(wzAPI_phxml.status == 200){ var rHTML=wzAPI_phxml.responseText; var gdiv = document.getElementById("wzPhotoBar"); if (gdiv!=null ) { if (rHTML!="") gdiv.innerHTML=rHTML; else gdiv.innerHTML=""; } } } } function wzAPI_videoViewBar(albumID, wzUserID, nPics, pg) { wzAPI_vdxml = getHttpConnection(); var xm = new Date(); var url = '/whzon/mbr/vidView/xmlVideoBar.php?wzID=' + parent.sID + '&fpg=' + pg + '&fn=' + nPics + '&falbumID=' + albumID + '&fwzUserID=' + wzUserID + '&xm=' + xm.getMilliseconds(); wzAPI_vdxml.open("GET", url, true); wzAPI_vdxml.onreadystatechange = wzAPI_videoViewBarWrite; wzAPI_vdxml.send(null); } function wzAPI_videoViewBarWrite() { if (wzAPI_vdxml.readyState == 4) { if (wzAPI_vdxml.status == 200) { var rHTML = wzAPI_vdxml.responseText; var gdiv = document.getElementById("wzVideoBar"); if (gdiv != null) { if (rHTML != "") gdiv.innerHTML = rHTML; else gdiv.innerHTML = ""; } } } } function wzAPI_videoMgrBar(albumID,wzUserID,nPics,pg){ wzAPI_phxml=getHttpConnection(); var xm = new Date(); var url='/whzon/mbr/vidView/xmlVideoSBar.php?wzID=' + parent.sID + '&fpg=' + pg + '&fn=' + nPics + '&falbumID=' + albumID + '&fwzUserID=' + wzUserID + '&xm=' + xm.getMilliseconds(); wzAPI_phxml.open("GET", url,true); wzAPI_phxml.onreadystatechange = wzAPI_videoBarWrite; wzAPI_phxml.send(null); } function wzAPI_videoBarWrite(){ if (wzAPI_phxml.readyState == 4){ if(wzAPI_phxml.status == 200){ var rHTML=wzAPI_phxml.responseText; var gdiv = document.getElementById("wzVideoBar"); if (gdiv!=null ) { if (rHTML!="") gdiv.innerHTML=rHTML; else gdiv.innerHTML=""; } } } } function getYOffset(id){ var el = document.getElementById(id); return getOffset(el).top; } function wzAPI_getOffset( el ) { var _x = 0; var _y = 0; while( el && !isNaN( el.offsetLeft ) && !isNaN( el.offsetTop ) ) { _x += el.offsetLeft - el.scrollLeft; _y += el.offsetTop; el = el.offsetParent; } return { top: _y, left: _x }; } function getOffset( el ) { var _x = 0; var _y = 0; while( el && !isNaN( el.offsetLeft ) && !isNaN( el.offsetTop ) ) { _x += el.offsetLeft - el.scrollLeft; _y += el.offsetTop; el = el.offsetParent; } return { top: _y, left: _x }; } openTipSpot = null; function hideActivityTip(ID){ openTipSpot = null; var spot = document.getElementById('likeTipSpot'+ID); if (spot){ spot.innerHTML = ''; spot.style.display = 'none'; } } function sendLikeTip(ID){ var conf = confirm('Send Tip To The Owner Of This Post?'); if (!conf){ return; } var xml = parent.getHttpConnection(); var currentTime = new Date(); var ranTime = currentTime.getMilliseconds(); var spot = document.getElementById('likeTipSpot'+ID); var amt = document.getElementById('tipAmt').value; var com = document.getElementById('tipComment').value; var url = '/whzon/mbr/sendLikeTip.php?wzID=' + parent.sID + '&tipAmt='+amt+'&tipComment='+encodeURIComponent(com)+'&acID=' + ID + '&xr=' + ranTime; xml.timeout = 20*1000; xml.open("GET", url, true); xml.onreadystatechange = function(){ if (xml.readyState == 4){ if(xml.status == 200){ var j = null; j = xml.responseText; try {j = JSON.parse(xml.responseText); } catch(err) { alert('pars json failed'+xml.responseText,err); hideActivityTip(ID); return; } if (j.message){ spot.innerHTML = j.message; if (j.result){ parent.doRefreshLikes(ID); } var timeo = setTimeout( ()=>{ hideActivityTip(ID); },2*1000); } return; } } }; xml.send(null); } function activityTip(ID){ if(openTipSpot){ hideActivityTip(openTipSpot); } openTipSpot = ID; var xml = parent.getHttpConnection(); var currentTime = new Date(); var ranTime = currentTime.getMilliseconds(); var spot = document.getElementById('likeTipSpot'+ID); var url = '/whzon/mbr/popLikeTip.php?wzID=' + parent.sID + '&acID=' + ID + '&xr=' + ranTime; xml.timeout = 20*1000; xml.open("GET", url, true); xml.onreadystatechange = function(){ if (xml.readyState == 4){ if(xml.status == 200){ var j = null; j = xml.responseText; spot.style.display = 'block'; spot.innerHTML = j; } } }; xml.send(null); } function activityBoost(ID){ var elID = 'Boost' + ID; yoff = getYOffset(elID) - 200; parent.wzAPI_showFrame('/whzon/mbr/popBoostLike.php?wzID=' + parent.sID + '&acID=' + ID,350,350,500,yoff); }