var mblAdsServed = null; var mblAdCnt = null; var mblAdDivID = null; var mblAdMax = null; var sendmgsxml = null; var cptr = null; var lastMsgID = null; var fwarnings = null; var mutexml = null; var readxml = null; var winxml = null; var synchCon = null; var refresh = null; var wzChanID = null; var wzChanName = null; var urlroot = null; var ifrm = null; var wzUserID = null; var talkTimer = null; var talkmode = null; var imgSize = null; var nDispRecs = null; var listLength = null; var chatMsgEL = null; var chatMsgELC = null; var chatELTimer = null; var zoomImgEL = null; var pvcInFocus = null; var showGoogleAd = null; var rollMsgs = null; var rollCnt = null; var rollRefresh = null; var rollnNew = null; var rollTimer = null; var isRolling = null; var chanHasChanged = null; // end chat engine core declarations.. var chanReload = 1; var mkyUState = { muid : '' } var actv_msgNum = 0; var actv_msgs = [ "
[|]
- Initializing Brain", "
[/]
- Scaning Neural Network", "
[-]
- Activating All Neurons ", "
[\\]
- Collecting Market Data", "
[|]
- Shaking The Tree Of Money", "
[/]
- Ready To Earn Some BMGP!" ]; function mkySanitize(input) { const map = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', "/": '/' }; const regex = /[&<>"'/]/g; return input.replace(regex, match => map[match]); } function saveUState(){ var divxml = getHttpConnection(); var currentTime = new Date(); var ranTime = currentTime.getMilliseconds(); inUrl = '/whzon/safeUState.php?wzID=0&state='+encodeURIComponent(JSON.stringify(mkyUState)) divxml.open("GET", inUrl,true); divxml.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { console.log('userStateSaved: '+JSON.stringigy(mkyUState)); } }; divxml.send(null); } function hutRefer(wsID,hutID){ var wzID = '0'; var url = 'https://www.bitmonky.com/whzon/adMgr/clickHutRefer.php?wzID='+wzID+'&wsID='+wsID+'&hutID='+hutID; window.open(url,'bitHutRef'); } function quickSellGold(){ hideDiv('spotBuyOrders'); var edUrl = '/whzon/gold/mbrPFrmSellOrder.php?wzID=0'; var edDiv = 'spotSellOrders'; var spot = document.getElementById('spotSellOrders'); if (spot){ spot.innerHTML = ""; } updateDivHTML(edUrl,edDiv); showDiv('spotSellOrders'); } var cpTextAlertSpot = null; var cpTextTextarea = null; function copyText(id,indoc) { var textarea = findDiv(id); var spot = findDiv('alertSpot_'+id); cpTextTextarea = textarea; cpTextAlertSpot = spot; textarea.disabled = false; textarea.focus(); textarea.select(); try { var successful = indoc.execCommand('copy'); var msg = successful ? 'successful' : 'unsuccessful'; console.log('Fallback: Copying text command was ' + msg); } catch (err) { console.error('Fallback: Oops, unable to copy', err); } spot.style.color = 'white'; spot.innerHTML = ' ... Copied!'; setTimeout('clearAlert()',1000); } function clearAlert(){ cpTextTextarea.disabled = true; var text = cpTextTextarea.innerHTML; cpTextTextarea.innerHTML = ''; cpTextTextarea.innerHTML = text; cpTextAlertSpot.innerHTML = ''; } function quickBuyGold(amt=null){ hideDiv('spotSellOrders'); if (amt){ amt = '&amt='+amt; } else{ amt = ''; } var edUrl = '/whzon/gold/mbrPFrmBuyOrder.php?wzID=0'+amt; var edDiv = 'spotBuyOrders'; var spot = document.getElementById(edDiv); if (spot){ spot.innerHTML = ""; } updateDivHTML(edUrl,edDiv); showDiv('spotBuyOrders'); } function hideMkyDisclaimer(){ var d = document.getElementById('siteMonkDisclaimer'); if (d){ d.style.display = 'none'; } } function showMkyDisclaimer(){ var d = document.getElementById('siteMonkDisclaimer'); if (d){ d.style.display = 'block'; } } function joinBusinessGroup(){ wzGetPage("/whzon/public/homepg.php?wzID=0&fhQry=BusinessNetworkingGroup"); } function showMainLoadProgress(){ //return; var spot = document.getElementById('wzMainLoader'); //console.log('showing progress',actv_msgs); if (spot){ spot.style.display = 'block'; spot.style.background = '#222222'; spot.style.color = 'darkKhaki'; spot.style.fontSize = '3vw'; spot.style.fontWeight = 'bold'; spot.style.padding = '1em'; spot.innerHTML = "
" + "

" + actv_msgs[actv_msgNum] + "...

"; actv_msgNum += 1; if (actv_msgNum <= actv_msgs.length){ setTimeout('showMainLoadProgress()',8*100); } else { spot.style.display = 'none'; } } } function getSpinner(msg){ return "
" + msg + "...
"; } function getInvitePg(group,muid){ var url = 'https://www.bitmonky.com/whzon/adMgr/joinMyChan.php?grp='+group+'&muid='+muid+'&rfm=webr'; window.open(url,'mkyGrpInvite'); } function testYouTubeIFail(vidId,img=null){ var divxml = getHttpConnection(); var currentTime = new Date(); var ranTime = currentTime.getMilliseconds(); inUrl = img.src; divxml.open("GET", inUrl,true); divxml.onreadystatechange = function() { if (this.readyState == 4 && this.status == 404) { console.log('YT Video: '+vidId+' Marked For Delete'); logYouTubeImgFail(vidId,img); } }; divxml.send(null); } function logYouTubeImgFail(vidId,img){ if (img){ img.style.display = 'none'; } var divxml = getHttpConnection(); var currentTime = new Date(); var ranTime = currentTime.getMilliseconds(); inUrl = '/whzon/mbr/vidView/logYouTubeImgFail.php?vidID=' + vidId + '&xm=' + ranTime ; divxml.open("GET", inUrl,true); divxml.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { console.log('YT Video: '+vidId+' Marked For Delete'); return; } }; divxml.send(null); } function checkUrlExists(url){ var http = new XMLHttpRequest(); http.open('HEAD', url, false); http.send(); return http.status!=404; } function checkImgURL(url,id){ if (checkUrlExists(url)){ return true; } adImgFail(id,1); } var emAlertTimer = null; var emAlertcon = null; var pvcDeclcon = null; emAlertcon = getHttpConnection(); pvcDeclcon = getHttpConnection(); setTimeout('roomEmPopAlert()',15*1000); /* window.addEventListener('load',function(){ var el = document.getElementById('pvChatAlertSpotCon'); if (el){ el.style.zIndex = 999999; dragDIVListen(el, function(distX,distY){ var ex = pxToInt(percentToPx(el.style.left,'left')); var ey = pxToInt(percentToPx(el.style.top,'top')); el.style.top = ey + distY + 'px'; el.style.left = ex + distX + 'px'; }); el.style.display = 'none'; } }, false); */ function dragDIVListen(el, callback){ console.log('drag pre listing'); var touchsurface = el, startX, startY, distX, distY, dragDiv = callback || function(distX,distY){} document.onmousedown = function(e){ e = e || window.event; startX = e.clientX; startY = e.clientY; } document.onmouseup = function(e){ startX = null; e.preventDefault(); } document.onmousemove = function(e){ e = e || window.event; if (startX){ distX = e.clientX - startX; // get horizontal dist traveled by finger while in contact with surface distY = e.clientY - startY; // get vertical dist traveled by finger while in contact with surface dragDiv(distX,distY); startX = e.clientX; startY = e.clientY; } } } function percentToPx(str,cord){ if (str.indexOf('%') < 0) {return str;} str = str.replace('%',''); var si = parseInt(str); var d = window.innerHeight; if (cord == 'left'){ d = window.innerWidth; } return (si/100.0) * d + 'px'; } function pxToInt(str){ str = str.replace('px',''); var si = parseInt(str); return si; } function swipedetect(el, callback){ var touchsurface = el, swipedir, startX, startY, distX, distY, threshold = 150, //required min distance traveled to be considered swipe restraint = 100, // maximum distance allowed at the same time in perpendicular direction allowedTime = 300, // maximum time allowed to travel that distance elapsedTime, startTime, handleswipe = callback || function(swipedir){} touchsurface.addEventListener('touchstart', function(e){ var touchobj = e.changedTouches[0] swipedir = 'none' dist = 0 startX = touchobj.pageX startY = touchobj.pageY startTime = new Date().getTime() // record time when finger first makes contact with surface //e.preventDefault() }, false) touchsurface.addEventListener('touchmove', function(e){ //e.preventDefault() // prevent scrolling when inside DIV }, false) touchsurface.addEventListener('touchend', function(e){ var touchobj = e.changedTouches[0] distX = touchobj.pageX - startX // get horizontal dist traveled by finger while in contact with surface distY = touchobj.pageY - startY // get vertical dist traveled by finger while in contact with surface elapsedTime = new Date().getTime() - startTime // get time elapsed if (elapsedTime <= allowedTime){ // first condition for awipe met if (Math.abs(distX) >= threshold && Math.abs(distY) <= restraint){ // 2nd condition for horizontal swipe met swipedir = (distX < 0)? 'left' : 'right' // if dist traveled is negative, it indicates left swipe } else if (Math.abs(distY) >= threshold && Math.abs(distX) <= restraint){ // 2nd condition for vertical swipe met swipedir = (distY < 0)? 'up' : 'down' // if dist traveled is negative, it indicates up swipe } } handleswipe(swipedir) //e.preventDefault() }, false) } function roomAcceptAtM(atm){ //hideTop(); showChatWidget(null,null,atm); roomDeclineAtM(atm.msgID,atm.mbrID); } function roomDeclineAtM(id,uid){ var xm = new Date(); var url = '/whzon/mblp/mail/atAlertDecline.php?wzID=' + sID + '&fmsgID=' + id + '&xm=' + xm.getTime(); pvcDeclcon.open("GET", url,true); pvcDeclcon.onreadystatechange = doRoomDeclineEM; pvcDeclcon.send(null); } function doRoomDeclinePVC(){ if (pvcDeclcon.readyState == 4){ if (pvcDeclcon.status == 200) { var cdiv = document.getElementById("pvChatAlertSpotCon"); if (cdiv) {cdiv.style.display = 'none';} var gdiv = document.getElementById("pvChatAlertSpot"); gdiv.innerHTML = ""; dbug('innerHTML set to By RoomDelcinePVC : ' + gdiv.innerHTML); } } } var lastAtmID = null; function showAtMemberNotice(atm){ var gdiv = document.getElementById("pvChatAlertSpot"); if (gdiv != null ) { if (atm.msgID != lastAtmID){ lastAtmID = atm.msgID; var snd = new Audio("/sounds/quiteTone.wav"); if (snd.currentTime == 0){ snd.play(); } } var mtype = 2; var pimg = 'getMbrImg.php'; var bgc = '#333333' var cdiv = document.getElementById("pvChatAlertSpotCon"); if (cdiv) {cdiv.style.display = 'inline-block';} gdiv.innerHTML = "
"+ ""+ " New Message "+ "
|
"; } } function roomEmPopAlert(){ return; if (sID == '0'){ dbug('cancel emAlert room'); return; } if (emAlertTimer) {clearTimeout(emAlertTimer)}; var xm = new Date(); var url = '/whzon/mblp/emAlertRoom.php?wzID=' + sID + '&xm=' + xm.getMilliseconds(); emAlertcon.timeout = 22*1000; emAlertcon.ontimeout = roomEmPopAlert; emAlertcon.onerror = function(){ emAlertTimer = setTimeout('roomEmPopAlert()',22*1000); }; emAlertcon.open("GET", url, true); emAlertcon.onreadystatechange = doRoomEmPopAlert; emAlertcon.send(null); } function excRoomEmPopAlert(j){ eAlert = j.emAlerts; console.log(eAlert); if(eAlert.msgID == 0){ return; } var gdiv = document.getElementById("pvChatAlertSpot"); if (gdiv != null ) { if (eAlert){ var mtype = eAlert.msgType; var pimg = 'getMbrImg.php'; var bgc = '#222222'; if (mtype == 2){ console.log(eAlert); showAtMemberNotice(eAlert); return; } if (mtype == 1){ pimg = 'getDProfThm.php'; bgc = 'fireBrick' } var cdiv = document.getElementById("pvChatAlertSpotCon"); if (cdiv) {cdiv.style.display = 'inline-block';} gdiv.innerHTML = "
New Email!
|
"; } else { /* var cdiv = document.getElementById("pvChatAlertSpotCon"); if (cdiv) {cdiv.style.display = 'none';} gdiv.innerHTML = ""; */ } } } function doRoomEmPopAlert(){ if (emAlertcon.readyState == 4){ emAlertTimer = setTimeout(roomEmPopAlert, 22*1000); if(emAlertcon.status == 200){ var jdata = emAlertcon.responseText; var eAlert = null; if (jdata == 'NF') { return; } try {eAlert = JSON.parse(jdata); } catch(err) { eAlert = null; } var gdiv = document.getElementById("pvChatAlertSpot"); if (gdiv != null ) { if (eAlert){ var mtype = eAlert.msgType; var pimg = 'getMbrImg.php'; var bgc = '#222222'; if (mtype == 2){ console.log(eAlert); showAtMemberNotice(eAlert); return; } if (mtype == 1){ pimg = 'getDProfThm.php'; bgc = 'fireBrick' } var cdiv = document.getElementById("pvChatAlertSpotCon"); if (cdiv) {cdiv.style.display = 'inline-block';} gdiv.innerHTML = "
New Email!
|
"; } else { /* var cdiv = document.getElementById("pvChatAlertSpotCon"); if (cdiv) {cdiv.style.display = 'none';} gdiv.innerHTML = ""; */ } } } } } // **************************************** // Public Chat Widget Controls // **************************************** function showChatWidgetSpace(){ //hideTop(); var space = document.getElementById('chatWidgetSpace'); if (space){ space.style.display = 'block'; } } function hideChatWidgetSpace(){ var space = document.getElementById('chatWidgetSpace'); if (space){ space.style.display = 'none'; } } function atMChangeChannel(atm){ atm = JSON.parse(decodeURIComponent(atm)); wzChangeChannel(atm.chanID); //doShowChatRoom(); showChatWidget(null,null,atm); } function hideChatWidget() { hideChatWidgetSpace(); var chatW = document.getElementById('chatWidget'); if (chatW) { chatW.style.display = "none"; } } function showChatWidget(name,id,atm=null) { console.log('showChatWidget'); if (atm){ name = atm.nic; id = atm.mbrID; var toChanID = document.getElementById('postToChan'); if (toChanID){ toChanID.value = atm.chanID; } } var gto = id; if (!gto){gto = 0;} //hidePVChatWidget(); //hidePVDChatWidget(); showChatWidgetSpace(); //hideMoreWidget(); var chatW = document.getElementById('chatWidget'); var chatT = document.getElementById('chatWidgetT'); if (chatW) { wzAPI_closeMenu(); //chatW.style.width = "98%"; if (chatT){ chatT.style.width = "98%"; } chatW.style.display = 'block'; chatW.style.zIndex = 20; var chatb = document.getElementById("chatWidgetBox"); var cimg = document.getElementById('chatWhoImg'); var cmsg = document.getElementById('chatWhoMsg'); if (cmsg){ if (atm){ var clink = "

" + atm.nic + "
"; cmsg.innerHTML = '
' + doEmotes(atm.msg) + clink + '

'; } else { cmsg.innerHTML = ''; } } if (cimg && gto){ if (wzChanID == 302057){ cimg.src = '//image.bitmonky.com/getDProfThm.php?id=' + gto; } else { cimg.src = '//image.bitmonky.com/getMbrImg.php?id=' + gto; } } if (chatb){ chatb.value = ''; if (name){ chatb.value = '@' + name + ' - '; } //chatb.focus(); } var goPV = document.getElementById("goPrivate"); dbug('div goPrivate found'); if (goPV){ goPV.onclick = function() { if (wzChanID == 302057){ wzPopDChat(gto); } else { wzPopChat(gto); } dbug('wzPop installed'); }; } var goMor = document.getElementById("goMoreWid"); dbug('div goMore found'); if (goMor){ goMor.value = ' More '; goMor.style.display = 'none'; goMor.onclick = function() { doWidgetShowMore(gto); dbug('wzMore installed'); }; } } return false; } function roomAcceptEM(id,uid,mtype){ var cdiv = document.getElementById("pvChatAlertSpotCon"); if (cdiv) {cdiv.style.display = 'none';} var gdiv = document.getElementById("pvChatAlertSpot"); gdiv.innerHTML = ""; if(mtype == 0){ wzGetPage('/whzon/mbr/mail/replyForm.php?wzID=' + sID + '&fmsgID=' + id + '&fwzUserID=' + uid); } else { wzGetPage('/whzon/apps/dating/mail/replyForm.php?wzID=' + sID + '&fmsgID=' + id + '&fwzUserID=' + uid); } } function roomDeclineEM(id,uid){ var xm = new Date(); var url = '/whzon/mblp/mail/emAlertDecline.php?wzID=' + sID + '&fmsgID=' + id + '&xm=' + xm.getTime(); pvcDeclcon.open("GET", url,true); pvcDeclcon.onreadystatechange = doRoomDeclineEM; pvcDeclcon.send(null); } function roomAcceptAtM(atm){ //hideTop(); showChatWidget(null,null,atm); roomDeclineAtM(atm.msgID,atm.mbrID); } function roomDeclineAtM(id,uid){ var xm = new Date(); var url = '/whzon/mblp/mail/atAlertDecline.php?wzID=' + sID + '&fmsgID=' + id + '&xm=' + xm.getTime(); pvcDeclcon.open("GET", url,true); pvcDeclcon.onreadystatechange = doRoomDeclineEM; pvcDeclcon.send(null); } function doRoomDeclineEM(){ if (pvcDeclcon.readyState == 4){ if (pvcDeclcon.status == 200) { var cdiv = document.getElementById("pvChatAlertSpotCon"); if (cdiv) {cdiv.style.display = 'none';} var gdiv = document.getElementById("pvChatAlertSpot"); gdiv.innerHTML = ""; } } } window.addEventListener('load',function(){ var el = document.getElementById('videoChatWindow'); if (el){ el.style.zIndex = 999999; dragDIVListen(el, function(distX,distY){ var ex = pxToInt(percentToPx(el.style.left,'left')); var ey = pxToInt(percentToPx(el.style.top,'top')); el.style.top = ey + distY + 'px'; el.style.left = ex + distX + 'px'; }); el.style.display = 'none'; } }, false); function openVideoChatFrame(url,width,height){ var gdiv = document.getElementById("videoChatFrame"); if (gdiv != null ) { var cdiv = document.getElementById("videoChatWindow"); if (cdiv) {cdiv.style.display = 'inline-block';} var htm = ''; htm += "

"; htm += " End Chat[x] "; htm += "
"; htm += ""; htm = htm + "
"; bmineDiv.innerHTML = htm; bmineDiv.style.borderRadius = '5px 5px 5px 5px'; //bmineDiv.style.height = h+'px'; bmineDiv.style.left = xoff+'px'; bmineDiv.style.top = yoff+'px'; bmineDiv.style.display = "inline-block"; bmineDiv.style.visibility = "visible"; bmineDiv.style.zIndex = wzFocuslayer(); bmineStarted = true; var chtm = ""; chtm = chtm + "Bit Miner [-][+]"; bmineControl.innerHTML = chtm; bmineInFocus = 1; console.log ('pvc infocus ',pvcInFocus); } function closeBitMiner() { pvcCurUID = null; bmineDiv.style.display = "none"; bmineDiv.innerHTML = ""; bmineDiv.style.zIndex = bmnzLayer; bmineStarted = false; bmineControl.innerHTML=""; bmineInFocus = null; console.log ('bitMine infocus ',bmineInFocus); } function hideBitMiner() { bmineDiv.style.display = "none"; bmineDiv.style.zIndex = bmnzLayer; bmineInFocus = null; console.log ('bitMine hiden ',bmineInFocus); } function showBitMiner() { bmineDiv.style.display = "inline-block"; bmineDiv.style.zIndex = wzFocuslayer(); bmineInFocus = 1; console.log ('bitMine hiden ',bmineInFocus); } function wzAPI_showPVC(URL, w, h, xoff, yoff) { var fh = h - 23; pvcDiv.innerHTML = "
close[x]
"; pvcDiv.style.borderRadius = '5px 5px 0px 0px'; pvcDiv.style.height = '80vh'; pvcDiv.style.left = 'calc(100vw - 800px)'; pvcDiv.style.top = '6.5em'; pvcDiv.style.display = "inline-block"; pvcDiv.style.visibility = "visible"; pvcDiv.style.zIndex = wzFocuslayer(); pvChatStarted = true; pvchatControl.innerHTML = "Private Chat [-][+]"; pvcInFocus = 1; console.log ('pvc infocus ',pvcInFocus); } function wzAPI_closePVC() { pvcCurUID = null; pvcDiv.style.display = "none"; pvcDiv.innerHTML = "" pvcDiv.style.zIndex = pvczLayer;; pvChatStarted = false; pvchatControl.innerHTML="" pvcInFocus = null; console.log ('pvc infocus ',pvcInFocus); } function wzAPI_hidePVC() { pvcDiv.style.visibility = "hidden"; pvcDiv.style.zIndex = pvczLayer; pvcInFocus = null; console.log ('pvc infocus ',pvcInFocus); } function wzAPI_focusPVC() { pvcDiv.style.visibility = "visible"; pvcDiv.style.zIndex = wzFocuslayer(); pvcInFocus = 1; console.log ('pvc infocus ',pvcInFocus); pvchatControl.innerHTML = "Private Chat [-][+]"; } // MoshBox Controls function wzOpenSong(url){ doUserActionLog(); wzGetPage(url); } function closeGigBox(){ moshOP.style.display = "none"; moshOP.style.zIndex = moszLayer; var moshEL = document.getElementById('moshBOX'); if (moshEL) moshEL.contentWindow.closeMosh(); moshStatus = 0; } function fetchGigBox(boxID){ moshOP.style.display = "inline-block"; moshOP.style.visibility = "visible"; moshOP.style.zIndex = wzFocuslayer(); var moshEL = document.getElementById('moshBOX'); if (moshEL) { var tries = 0; if (typeof(moshEL.contentWindow.startMosh) == 'function'){ moshEL.contentWindow.startMosh(boxID); } else { if (tries < 5){ setTimeout(()=>{ tries++; console.log('fetGigBox::retry',tries); fetchGigBox(boxID); },2000); } } } moshSelected = boxID; moshStatus = boxID; } function initGigBox(boxID) { gigBoxIntialized = true; if (boxID == 0) boxID = 1; var mosh = "/whzon/moshbox/moshBox2.php?wzID=" + sID + "&fboxID=" + boxID; dxOff = document.getElementById('wzBrowser').offsetLeft; dyOff = wzAPI_getOffset(browsDiv).top; createNewMosh(mosh, 615, 910, dxOff, layersViewTop, boxID); moshStatus = boxID; } function createNewMosh(URL, w, h, xoff, yoff,boxID) { if (moshStatus != boxID) { var fh = h - 23; moshOP.innerHTML = "
hide[-] | close[x]
"; moshOP.style.left = 'calc(100vw - '+(w+80)+'px)'; moshOP.style.top = '6.5em'; } moshOP.style.overflow = "hidden"; moshOP.style.borderRadius = '5px 5px 0px 0px'; moshOP.style.width = w+'px'; moshOP.style.background = 'none'; moshOP.style.height = '1005px'; moshOP.style.display = "none"; moshOP.style.zIndex = wzFocuslayer(); } function wzAPI_showMosh(URL, w, h, xoff, yoff,boxID) { if (moshStatus != boxID) { var fh = h - 23; moshOP.innerHTML = "
hide[-] | close[x]
"; moshOP.style.left = xoff+'px'; moshOP.style.top = yoff+'px'; } moshOP.style.overflow = "hidden"; moshOP.style.borderRadius = '5px 5px 0px 0px'; moshOP.style.width = w+'px'; moshOP.style.background = 'none'; moshOP.style.height = '1005px'; moshOP.style.display = "inline-block"; moshOP.style.visibility = "visible"; moshOP.style.zIndex = wzFocuslayer(); } function OpenGigBox(boxID) { if (!gigBoxIntialized){ initGigBox(1); } doUserActionLog(); wzAPI_closeVideoPage(); if (boxID != moshStatus) {sendMoshBoxNotification(boxID);} if (boxID == 0) boxID = moshStatus; if (boxID == 0) boxID = 1; window.scrollTo(0, 0); fetchGigBox(boxID); return; } function wzAPI_showMosh(URL, w, h, xoff, yoff,boxID) { if (moshStatus != boxID) { var fh = h - 23; moshOP.innerHTML = "
hide[-] | close[x]
"; moshOP.style.left = xoff+'px'; moshOP.style.top = yoff+'px'; } moshOP.style.overflow = "hidden"; moshOP.style.borderRadius = '5px 5px 0px 0px'; moshOP.style.width = w+'px'; moshOP.style.background = 'none'; moshOP.style.height = '1005px'; moshOP.style.display = "inline-block"; moshOP.style.visibility = "visible"; moshOP.style.zIndex = wzFocuslayer(); } function wzAPI_closeMosh() { moshOP.style.visibility = "hidden"; var moshEL = document.getElementById('moshBOX'); if (moshEL) moshEL.contentWindow.leaveShow(); closeGigBox();return; moshOP.innerHTML = ""; moshOP.style.zIndex = moszLayer; moshStatus = 0; } function wzAPI_hideMosh() { //moshOP.style.width = '1px'; //moshOP.style.height = '1px'; moshOP.style.visibility = "hidden"; moshOP.style.zIndex = moszLayer; moshOP.style.display = "inline-block"; } // PgViewr Controls function wzGetApp(dname,appkey,ukey,chanID){ wzGetPage('//' + dname + '.icdirect.com/whzon/mkyAPI/index.php?wzID=' + sID + '&mky=' + appkey + '&UKey=' + ukey); wzChangeChannel(chanID); } function wzGetNewChannel(id,tag){ wzGetPage('/whzon/public/homepg.php?wzID=' + sID + '&fhQry=' + tag); wzChangeChannel(id); } function wzLink(url){ wzGetPage(url); } function wzGetPage(url) { console.log('wzGetPage::OLD',url); moveDredge(); if (photoIDApp == 'Spam'){ // || photoIDApp == 'New'){ //url = '/whzon/gold/goldMgr.php?wzID=' + sID; } if (url.indexOf("viewVideoPg.php") > -1) { wzGetVideoPage(url); return; } if (vcontest){ vcontest = null; //wzGetPage('/'); wzGetVideoPage('/whzon/mbr/vidView/gotoContest.php?wzID=' + sID); return; } window.scrollTo(0, 0); wzAPI_closeWin(); dxOff = document.getElementById('wzBrowser').offsetLeft; dyOff = wzAPI_getOffset(browsDiv).top; wzAPI_showPage(url,pgViewXW , appPgHeight, dxOff, layersViewTop); pageStatus = url; historyNdx = historyNdx + 1; historyPtr = historyNdx; phistory[historyNdx] = url; setLoginPage(); } function wzGetPageOS(url) { url = url.replace('/whozon/mbrFanRoom.asp?','/whzon/mbr/mbrProfile.php?wzID=0&'); if (url.indexOf("viewVideoPg.php") > -1) { wzGetVideoPage(url); return; } if (url.indexOf("/") == 0){ if (url.indexOf("/whzon/mbr/") == 0){ url = '//bitmonky.com' + url; } else { url = '//bitmonky.com' + url; } } window.scrollTo(0, 0); dxOff = document.getElementById('wzBrowser').offsetLeft; dyOff = wzAPI_getOffset(browsDiv).top; wzAPI_forcePage(url,pgViewXW , appPgHeight, dxOff, layersViewTop); pageStatus = url; historyNdx = historyNdx + 1; historyPtr = historyNdx; phistory[historyNdx] = url; setLoginPage(); } function onPageFrameResize(inSize=null){ if (document.location.href.includes('com/gcdvMJ') || document.location.href.includes('com/newui')){ return; } const minh = 1800; fr = document.getElementById('pgViewerFrame'); if (fr){ fr.contentWindow.document.querySelector('body').style.color = 'white'; const divs = fr.contentWindow.document.querySelectorAll('div'); var maxh = 0; if(inSize){ maxh = inSize; } else { divs.forEach( div => { divb = parseInt(div.offsetTop) + parseInt(div.offsetHeight); //console.log('mkyF DIV -> '+div.id,divb); if (divb > maxh){ maxh = divb; console.log('mkyF Max -> '+div.id,maxh); } }); } maxh += 150; var mdx = document.getElementById('wzMainTableID'); var cdx = document.getElementById('wzChatterCol'); var tdx = document.getElementById('wzBrowser'); console.log('MKFoffset'+maxh,fr.offsetHeight); if (maxh > minh){ cdx.style.height = maxh+'px'; tdx.style.height = maxh+'px'; mdx.style.height = maxh+'px'; fr.style.height = (maxh-150) +'px'; } } } function onPageFrameLoad(){ onPageFrameResize(); rotateAdSpot(); doUserActionLog(); scrollTo(0,0); } function wzAPI_showPage(URL, w, h, xoff, yoff) { console.log('pgViewerFram w: ',w); if ( URL.indexOf("youtube.com/v") >1 ) h = 500; var onCtrl = ""; if (wzUserID){ onCtrl = " "; onCtrl = onCtrl + "About[+] "; onCtrl = onCtrl + "Settings[+] "; //onCtrl = onCtrl + "Notifications[+]"; onCtrl = onCtrl + " "; onCtrl = onCtrl + ""; onCtrl = onCtrl + "My Hut[+] "; } onCtrl = onCtrl + ""; if (URL == '/'){URL = 'homepgzero';} if (URL == "/"){ URL = "/whzon/public/homepg.php?wzID=" + sID + "&fwzUserID=0&fscope=myCity&fmyMode=mbrs"; } var fh = '100dv'; //h - 23; //alert('Showing Page:'+ URL); var html = ''; console.log('homepgzero',URL); if (URL == 'homepgzero'){ html = "
"; html += "
"; } pgViewer.innerHTML = html; pgViewer.style.width = w+'px'; pgViewer.style.height = h+'px'; pgViewer.style.left = xoff+'px'; pgViewer.style.top = yoff+'px'; pgViewer.style.display = "inline-block"; pgViewer.style.visibility = "visible"; pgViewer.style.zIndex = wzFocuslayer(); if (URL == 'homepgzero') { fetchHomepgZero('homepgZero'); } handlePgSizeChangeOnce(w); } function fetchHomepgZero(id){ var div = document.getElementById(id); if (!div) { alert ('homepgzero div not found'); return; } var onexml = getHttpConnection(); var currentTime = new Date(); var ranTime = currentTime.getMilliseconds(); var url = '/whzon/public/homepgCache.php' + '?xr=' + ranTime; onexml.timeout = 20*1000; onexml.ontimeout = function (){ alert('Fetch Homepgzero Time out'); } onexml.onerror = function (){ alert('Fetch Homepagezero Failed'); } onexml.open("GET", url, true); onexml.onreadystatechange = function(){ if (onexml.readyState == 4){ if(onexml.status == 200){ var jdata = mkyTrim(onexml.responseText); div.innerHTML = jdata; div.style.background = 'black'; } } }; onexml.send(null); } function wzAPI_forcePage(URL, w, h, xoff, yoff) { if ( URL.indexOf("youtube.com/v") >1 ) h = 500; var onCtrl = ""; if (wzUserID){ onCtrl = " My Account[+] Settings[+]"; onCtrl = onCtrl + " My Hut[+]"; } var fh = h - 23; pgViewer.innerHTML = "
home.[+]" + onCtrl + "
"; pgViewer.style.width = w+'px'; pgViewer.style.height = h+'px'; pgViewer.style.left = xoff+'px'; pgViewer.style.top = yoff+'px'; pgViewer.style.display = "inline-block"; pgViewer.style.visibility = "visible"; pgViewer.style.zIndex = wzFocuslayer(); } function handlePgSizeChangeOnce(pgxw){ wzSetPageMargins(); if (reSizePgTimer) {clearTimeout(reSizePgTimer);} if (pgViewXW !== pgxw){ reSizePgTimer = setTimeout(reloadPage,900); } } function handlePgSizeChange(){ console.log('handlePgSizeChange'); wzSetPageMargins(); if (reSizePgTimer) {clearTimeout(reSizePgTimer);} reSizePgTimer = setTimeout(reloadPage,900); } function wzAPI_reSizePage(w) { pgViewer.style.width = w+'px'; vidViewer.style.width = w+'px'; wzNetView.style.width = w+'px'; } function wzAPI_closePage() { wzGetPage('/'); } function wzAPI_hidePage() { wzGetPage('/'); } // videoViewr Controls function onVideoFrameLoad(){ var fr = document.getElementById('vidViewFrame'); if (fr){ fr.contentWindow.document.querySelector('body'); fr.style.color = 'white'; const divs = fr.contentWindow.document.querySelectorAll('div'); var maxh = 0; divs.forEach( div => { divb = parseInt(div.offsetTop) + parseInt(div.offsetHeight); //console.log('mkyF DIV -> '+div.id,divb); if (divb > maxh){ maxh = divb; console.log('mkyF Max -> '+div.id,maxh); } }); maxh += 150; var mdx = document.getElementById('wzMainTableID'); var cdx = document.getElementById('wzChatterCol'); var tdx = document.getElementById('wzBrowser'); cdx.style.height = maxh+'px'; tdx.style.height = maxh+'px'; mdx.style.height = maxh+'px'; fr.style.height = (maxh-100) +'px'; } rotateAdSpot(); // doUserVideoActionLog(); scrollTo(0,0); } function wzGetVideoPage(url) { wzAPI_closeMosh(); dxOff = document.getElementById('wzBrowser').offsetLeft; dyOff = wzAPI_getOffset(browsDiv).top; wzAPI_showVideoPage(url,pgViewXW , appPgHeight, dxOff, layersViewTop); } function wzAPI_showVideoPage(vURL, w, h, xoff, yoff) { dbug("showing video viewer"); var URL = vURL; var onCtrl = ""; if (wzUserID){ onCtrl = " | My Account[+]"; onCtrl = onCtrl + " | My Hut[+]"; } var fh = h - 23; vidViewer.innerHTML = "
home.[+]" + onCtrl + "
" + "Close Video Viwer[x]
"; vidViewer.style.width = w+'px'; vidViewer.style.height = h+'px'; vidViewer.style.left = xoff+'px'; vidViewer.style.top = yoff+'px'; var vidIcon = " "; vidwControl.innerHTML = "Video Viewer [-][+][x]"; vidViewer.style.display = "inline-block"; vidViewer.style.visibility = "visible"; vidViewer.style.zIndex = wzFocuslayer(); handlePgSizeChangeOnce(w); } function wzAPI_reSizeVideoPage(w) { vidViewer.style.width = w+'px'; vfram = document.getElementById('vidViewFrame'); if (vfram){ vfram.style.width = w + 'px'; } } function wzAPI_closeVideoPage() { scrollTo(0,0); vidwControl.innerHTML = "" vidViewer.style.display = "none"; vidViewer.innerHTML = ""; vidViewer.style.zIndex = moszLayer; } function wzAPI_hideVideoPage() { wzGetPage('/'); } function wzAPI_focusVideoPage() { vidViewer.style.display = "inline-block"; vidViewer.style.zIndex = wzFocuslayer(); } // wzNet View Web Browser Controls function onBrowserFrameLoad(){ rotateAdSpot(); // doBrowserActionLog(); scrollTo(0,0); } function wzSurfTo(url) { window.scrollTo(0, 0); dxOff = document.getElementById('wzBrowser').offsetLeft; dyOff = wzAPI_getOffset(browsDiv).top; wzAPI_showURL(url,pgViewXW , 2450, dxOff, layersViewTop); netViewURL = url; } function wzAPI_showURL(URL, w, h, xoff, yoff) { if (netViewURL != URL || URL== "/" || URL== "") { if (URL == "/" || URL== "http://" || URL== "http://"){ URL = "/whzon/public/homepg.php?wzID=" + sID; } var fh = h - 28; var htm = "
"; htm = htm + "
Browse To: "; htm = htm + " - hide[+]
"; wzNetView.innerHTML = htm; wzNetView.style.width = w+'px'; wzNetView.style.height = h+'px'; wzNetView.style.left = xoff+'px'; wzNetView.style.top = yoff+'px'; } wzNetView.style.display = "inline-block"; wzNetView.style.visibility = "visible"; wzNetView.style.zIndex = wzFocuslayer(); } function wzAPI_fetchURL() { var url = document.getElementById("wzNetSearch").elements["furl"].value; url = mkyTrim(url); if (url.indexOf('http://')!= 0 && url.indexOf('https://')!= 0){ url = 'http://' + url; } wzSurfTo(url); return false; } function wzAPI_closeURL() { wzNetView.style.visibility = "hidden"; wzNetView.innerHTML = ""; wzNetView.style.zIndex = brwzLayer; } function wzAPI_hideURL() { wzNetView.style.visibility = "hidden"; wzNetView.style.zIndex = brwzLayer; } // Video Chat Controls function wzEnterVC(roomNbr,VCname) { doUserActionLog(); var pvc = "/vChat/2wvideochat.php?r=" + roomNbr + "&fusername=" + VCname; window.scrollTo(0, 0); dxOff = document.getElementById('wzBrowser').offsetLeft; dyOff = wzAPI_getOffset(browsDiv).top; wzAPI_showVChat(pvc, pgViewXW, 800, dxOff, layersViewTop); } function wzAPI_closeVChat() { vidDiv.style.visibility = "hidden"; vidDiv.innerHTML = ""; vidDiv.style.zIndex = brwzLayer; vChatStarted = false; vchatControl.innerHTML = "" } function wzAPI_hideVChat() { vidDiv.style.visibility = "hidden"; vidDiv.style.zIndex = brwzLayer; } function wzAPI_focusVChat() { vidDiv.style.visibility = "visible"; vidDiv.style.zIndex = wzFocuslayer(); } // wzAPI functions var wzAppXML = getHttpConnection(); var timeout = 500; var closetimer = 0; var refreshPg = 0; var noreload = 0; function wzAPI_setRefreshPg(inV){ refreshPg = inV; } function wzAPI_showWin(URL,w,h,xoff,yoff){ wzAPI_getHTML(URL); var wzoutput = document.getElementById("wzPopContainer"); 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){ noreload = 1; mcancelclosetime(); var fh = h-33; var wzoutput = document.getElementById("wzPopContainer"); 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"; wzoutput.style.borderRadius = "0.5em"; } function wzAPI_showFrameR(URL,w,h,xoff,yoff){ var fh = h-33; var wzoutput = document.getElementById("wzPopContainer"); 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"; wzoutput.style.borderRadius = "0.5em"; } function wzAPI_showFrame(URL,w,h,xoff,yoff,fixed=false){ if (h < 433){ h = 433; } var fh = h-33; var wzoutput = popViewer; wzoutput.innerHTML = "" + ""; console.log('showFram::fixed',fixed); //if (fixed){ wzoutput.style.position = 'fixed'; //} wzoutput.style.width = w+'px'; wzoutput.style.height = h+'px'; wzoutput.style.minHeight = '400px'; wzoutput.style.left = 'calc(100vw - '+(w+80)+'px'; wzoutput.style.borderRadius = "0.5em"; wzoutput.style.top = '6.5em'; wzoutput.style.display = "block"; popViewer.style.visibility = "visible"; popViewer.style.zIndex = '999999'; //popzLayer; popViewer.style.overflow = 'hidden'; popViewer.style.padding = '0px'; //console.log('popViewer',popViewer.style); } function wzAPI_showFrameRound(URL,w,h,xoff,yoff){ var fh = h-33; var wzoutput = popViewer; wzoutput.innerHTML = "
"+ ""+ "close[x]
"+ ""; wzoutput.style.width = w+'px'; wzoutput.style.height = h+'px'; wzoutput.style.left = 'calc(100vw - '+(w+210)+'px'; wzoutput.style.top = '6.5em'; wzoutput.style.display = "inline-block"; wzoutput.style.borderRadius = "0.5em"; popViewer.style.visibility = "visible"; popViewer.style.zIndex = popzLayer; popViewer.style.overflow = 'hidden'; popViewer.style.padding = '0px'; popViewer.style.border = '0px'; } function notifyLoaded(){ var nLoadDiv = document.getElementById('menuWaiting'); if (nLoadDiv){ nLoadDiv.innerHTML = ''; nLoadDiv.style.height = '0px'; nLoadDiv.style.display = 'none'; } } function wzAPI_showNotify(URL,w,h,xoff,yoff){ var fh = 650; h = 650; notifyView.innerHTML = "
Close[x]
"+ ""; notifyView.style.width = w+'px'; notifyView.style.height = h+'px'; notifyView.style.left = 'calc(100vw - '+(w+80)+'px'; notifyView.style.top = '6.5em'; notifyView.style.border = '0px'; notifyView.style.display = "inline-block"; notifyView.style.visibility = "visible"; notifyView.style.zIndex = notfLayer; } function wzAPI_closeNotify(){ var wzoutput = notifyView; wzoutput.style.display = "none"; wzoutput.innerHTML = ""; } function wzAPI_closeMoshMenu(){ popMoshMenu.style.display = "none"; popMoshMenu.innerHTML = ""; } function wzAPI_showMoshMenu(URL,w,h,xoff,yoff){ mcancelclosetime(); var fh = h; popMoshMenu.innerHTML = "
Close[x]
"+ ""; popMoshMenu.style.borderRadius = '5px 5px 5px 5px'; popMoshMenu.style.border = '0px solid #e0e0e0'; popMoshMenu.style.width = w+'px'; popMoshMenu.style.height = h+'px'; popMoshMenu.style.left = xoff+'px'; popMoshMenu.style.top = yoff+'px'; popMoshMenu.style.display = "inline-block"; popMoshMenu.style.visibility = "visible"; popMoshMenu.style.zIndex = popzLayer; //popMoshMenu.onmouseout = function(){wzAPI_closeMenu();}; } function wzAPI_showMenu(URL,w,h,xoff,yoff){ mcancelclosetime(); var fh = h; popViewer.innerHTML = ""; popViewer.style.borderRadius = '5px 5px 5px 5px'; popViewer.style.border = '0px solid #e0e0e0'; 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; //popViewer.onmouseout = function(){wzAPI_closeMenu();}; } function mcloseInfoPtime() { closetimer = window.setTimeout(wzAPI_closeWin, timeout); } function mclosetime() { closetimer = window.setTimeout(wzAPI_closeMenu, timeout); } function mcancelclosetime() { if(closetimer) { window.clearTimeout(closetimer);; closetimer = null; } } function wzAPI_closeMenu(){ var wzoutput = popViewer; wzoutput.style.display = "none"; wzoutput.innerHTML = ""; } function getPgViewHandle(){ var appframe = document.getElementById('pgViewerFrame'); if (appframe){ return appframe.contentWindow; } return null; } function wzAPI_closeWin(){ var wzoutput = popViewer; var appframe = document.getElementById('pgViewerFrame'); var cleanResult = null; if (wzCleanUpOn){ dbug('starting cleanup'); if (appframe){ dbug('contentWinow: ' + typeof(appframe.contentWindow.wzcleanUp)); if (typeof(appframe.contentWindow.wzcleanUp) != "undefined") { wzCleanUpOn = null; dbug('executing cleanup'); cleanResult = appframe.contentWindow.wzcleanUp(); } else { dbug('wzcleanUp() not found'); wzCleanUpOn = null; document.location.reload(); } } else { dbug('cleanup appframe not found'); wzCleanUpOn = null; } } if (!cleanResult) { wzoutput.style.display = "none"; wzoutput.style.borderRadius = "0"; wzoutput.innerHTML = ""; if (refreshPg ==1 && noreload == 0){ noreload = 0; document.location.reload(); } noreload = 0; } } function wzAPI_Left(str, n){ if (n <= 0) return ""; else if (n > String(str).length) return str; else return String(str).substring(0,n); } function wzAPI_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 wzAPI_mkyTrim(stringToTrim) { return stringToTrim.replace(/^\s+|\s+$/g,""); } 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 wzAPI_getHTML(srcURL){ var url = srcURL; wzAPI_prepUrl(url,wzAppXML); wzAppXML.onreadystatechange = wzAPI_writeHTML; wzAppXML.send(null); } function wzAPI_writeHTML(){ if (wzAppXML.readyState == 4){ var srcHTML = wzAppXML.responseText; var wzoutput = document.getElementById("wzPopContainer"); wzoutput.innerHTML = srcHTML; } } function wzAPI_declineChat(){ var xm = new Date(); var url = '/whzon/talk/declineVChat.php?wzID=' + sID + '&xm=' + xm.getTime(); wzAPI_VCxml.open("GET", url,true); wzAPI_VCxml.onreadystatechange = wzAPI_VCdeclineDone; wzAPI_VCxml.send(null); } function wzAPI_VCdeclineDone(){ if (wzAPI_VCxml.readyState == 4){ if (wzAPI_VCxml.status == 200) { wzAPI_ChatAlert(); } } } function wzAPI_DoNothing(){ } function wzAPI_ChatAlert(){ return; if (alertTimer) clearTimeout(alertTimer); var gdiv = document.getElementById("wzHeadNotify"); if (gdiv != null) { var xm = new Date(); var url = '/whzon/talk/userAlertsMain.php?wzID=' + sID + '&xm=' + xm.getMilliseconds(); wzAPI_ALxml.timeout = 22*1000; wzAPI_ALxml.ontimeout = wzAPI_ChatAlert; wzAPI_ALxml.onerror = function(){ alertTimer = setTimeout('wzAPI_ChatAlert()',22*1000); }; wzAPI_ALxml.open("GET", url, true); wzAPI_ALxml.onreadystatechange = wzAPI_WriteAlert; wzAPI_ALxml.send(null); } } function excWriteAlert(j){ var gdiv = document.getElementById("wzHeadNotify"); if (gdiv != null ) { if (j){ if (j.uam.sessStat == "SESSExpired"){ document.location.reload(); } else { gdiv.innerHTML = j.uam.html; } } else { gdiv.innerHTML = ""; } } } function wzAPI_WriteAlert(){ if (wzAPI_ALxml.readyState == 4){ alertTimer = setTimeout(wzAPI_ChatAlert, 22*1000); if(wzAPI_ALxml.status == 200){ var alert = wzAPI_ALxml.responseText; var gdiv = document.getElementById("wzHeadNotify"); if (gdiv != null ) { if (alert != ""){ if (alert.indexOf("SESSExpired") > -1){ document.location.reload(); } else { gdiv.innerHTML = alert; } } else { gdiv.innerHTML = ""; } } } } } function roomDeclinePVC(id){ var xm = new Date(); var url = '/whzon/talk/pvcDecline.php?wzID=' + sID + '&fmbrID=' + id + '&xm=' + xm.getTime(); pvcDeclcon.open("GET", url,true); pvcDeclcon.onreadystatechange = doRoomDeclinePVC; pvcDeclcon.send(null); } function doRoomDeclinePVC(){ if (pvcDeclcon.readyState == 4){ if (pvcDeclcon.status == 200) { var gdiv = document.getElementById("pvChatAlertOld"); gdiv.innerHTML = ""; } } } function roomPVChatAlert(){ return; if (rAlertTimer) {clearTimeout(rAlertTimer);} var xm = new Date(); var url = '/whzon/talk/pvcAlertRoom.php?wzID=' + sID + '&xm=' + xm.getMilliseconds(); rAlertcon.timeout = 20*1000; rAlertcon.ontimeout = roomPVChatAlert; rAlertcon.onerror = function(){ rAlertTimer = setTimeout('roomPVChatAlert()',22*1000); }; rAlertcon.open("GET", url, true); rAlertcon.onreadystatechange = doRoomPVChatAlert; rAlertcon.send(null); } function excRoomPVChatAlert(j){ var alertID = null; if (j){ alertID = j.sentBy; } else { alertID = 0; } var gdiv = document.getElementById("pvChatAlertOld"); if (gdiv != null ) { if (alertID){ gdiv.innerHTML = "

"; // if (isFocused == 0) { // var snd = new Audio("/sounds/quiteTone.wav"); // if(snd) snd.play(); // } } else { //gdiv.innerHTML = ""; } } } function doRoomPVChatAlert(){ if (rAlertcon.readyState == 4){ rAlertTimer = setTimeout(roomPVChatAlert, 12*1000); if(rAlertcon.status == 200){ var jdata = rAlertcon.responseText; var j = null; try {j = JSON.parse(jdata); } catch(err) { j = null; } if (j){ alertID = j.sentBy; } else { alertID = 0; } var gdiv = document.getElementById("pvChatAlertOld"); if (gdiv != null ) { if (alertID){ gdiv.innerHTML = "
Chat Alert!
Accept | Decline

"; // if (isFocused == 0) { // var snd = new Audio("/sounds/quiteTone.wav"); // if(snd) snd.play(); // } } else { //gdiv.innerHTML = ""; } } } } } var wzAPI_phxml; 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 chatCoreInit(){ readxml = getHttpConnection(); winxml = getHttpConnection(); synchCon = getHttpConnection(); sendmgsxml = getHttpConnection(); mutexml = getHttpConnection(); ifrm = document.getElementById("chatFrame"); cptr = ""; refresh = 2; rollRefresh = 24; lastMsgID = 0; wzChanID = "none"; listLength = 65; mblAdCnt = 2; mblAdsServed = 0; mblAdDivID = 1; mblAdMax = 3; } function formatHashTags(txt){ txt = txt.replace('#',' #'); var words = txt.split(/(\s)/); tx = ''; for (var i in words){ var str = words[i]; if (str[0] == '#'){ str = str.replace('#',''); var str = " #" + str + ""; } tx = tx + str; } return tx; } function zoomChannelConversation(id,chanID){ var imgELID = parent.document.getElementById('wzBrowser'); var xoff = parent.document.getElementById('wzBrowser').offsetLeft; parent.wzAPI_showFrame("/whzon/talk/zoomConversation.php?wzID=" + sID + "&fmbrID=" + id + '&fchanID=' + chanID,850,850,xoff,layersViewTop); parent.window.scrollTo(1, 0); } function zoomConversation(id){ var imgELID = parent.document.getElementById('wzBrowser'); var xoff = parent.document.getElementById('wzBrowser').offsetLeft; parent.wzAPI_showFrame("/whzon/talk/zoomConversation.php?wzID=" + sID + "&fmbrID=" + id,850,850,xoff,layersViewTop); parent.window.scrollTo(1, 0); } function highlightChatMsg(id){ chatMsgEL = document.getElementById('cmsgEL' + id); chatMsgELC = chatMsgEL.style.color; normalizeChatMsg(); chatELTimer = setTimeout('normalizeChatMsg()',3800); zoomImgEL = document.getElementById('zimgEL' + id); chatMsgEL.style.borderRadius = '.3em'; chatMsgEL.style.background = 'Gray'; chatMsgEL.style.color = 'white'; zoomImgEL.style.visibility = "visible"; } function normalizeChatMsg(){ if (chatMsgEL){chatMsgEL.style.background = 'none';} //#f9f9f9';} if (chatELTimer){ clearTimeout(chatELTimer); chatELTimer = null; } chatMsgEL.style.color = 'inherit'; if (zoomImgEL){ zoomImgEL.style.visibility = "hidden"; } } function initChannelID(id){ wzChanID = id; } function initRefreshRate(rate){ refresh = rate; } function initURLRoot(str){ urlroot = str; } function initUserID(id){ wzUserID = id; } function initCommentMode(){ talkmode = 'comments'; } function initNReads(n){ nDispRecs = '&fnrec=' + n; listLength = n; } function initImageSize(sz){ imgSize = '&fimg=' + sz; } function doClick(e) { var key; if(window.event){ key = window.event.keyCode; //IE } else{ key = e.which; //firefox } if (key == 13){ if(!talkmode){ sendMsg(); } else { sendComments(); } return false; } } function doChatClick(e) { // do this when no user logged in! var key; if(window.event) key = window.event.keyCode; //IE else key = e.which; //firefox if (key == 13){ document.frmTalkAI.submit(); return false; } } function doSendMsgToServer(url){ sendmgsxml.open("GET", url,true); sendmgsxml.onreadystatechange = doNothingMsg; sendmgsxml.send(null); parent.trackPage(); } function doSendCommentToServer(url){ sendmgsxml.open("GET", url,true); sendmgsxml.onreadystatechange = doSetCommentChan; sendmgsxml.send(null); } function doSetCommentChan(){ if (sendmgsxml.readyState == 4) { if (sendmgsxml.status == 200) { var cChanID = sendmgsxml.responseText; if (cChanID != "OK"){ wzChanID = parseInt(cChanID); } } } } function doMuteSelf(){ var currentTime = new Date(); var ranTime = currentTime.getMilliseconds(); var URL = '/whzon/mbr/mods/muteSelf.php?wzID=' + sID + '&fpen=30&xm=' + ranTime; if (fwarnings<10) { URL = '/whzon/mbr/mods/muteSelf.php?wzID=' + sID + '&fpen=5&xm=' + ranTime; } mutexml.open("GET", URL,true); mutexml.onreadystatechange = doNothingMsg; mutexml.send(null); } function doNothingMsg(){ } function doWarnMsg(msg){ if (msg.indexOf('@')>0 ) { msg = ''; alert('Please Send Contact Info Only In Private Conversations'); } if (msg.indexOf('http') >-1 || msg.indexOf('.com') >-1 || msg.indexOf('www') > -1 ) { msg = ''; alert('Please do not list URL`s in Public Chat'); } return msg; } function sendComments(){ if (1==2 && parent.eVerified != 1 && parent.wzUserID > 502959 ) { wzAPI_setRefreshPg(1); wzAPI_showFrame("/whzon/signup/fastJoin.php?mode=v&wzID=" + sID,400,450,50,100); } else { parent.doUserActionLog(); var msg = document.getElementById("chTxtBox").elements["fmsg"].value; msg = mkyTrim(msg); msg = doWarnMsg(msg); var chkMsg = msg; if (parent.ProfanityUsed(stripToAlpha(chkMsg))){ doMuteSelf(); alert("You Can't Talk Like That Here!"); } else{ if (msg != '') { msg = stripToLowerCase(msg); var currentTime = new Date(); var ranTime = currentTime.getMilliseconds(); var url = urlroot + '&wzID=0&fshout=' + escape(msg) + "&xm=" + ranTime; doSendCommentToServer(url); msg = doEmotes(msg); msg = formatHashTags(msg); // ifrm.scrollTo(0,0); var wzoutput = ifrm; var gdiv = document.createElement('DIV'); gdiv.innerHTML = "

I Said:
" + msg + "
"; if (wzoutput.childNodes.length == 0) wzoutput.appendChild(gdiv); else wzoutput.insertBefore(gdiv,wzoutput.firstChild); if (typeof wzMblReDrawPage == 'function') {wzMblReDrawPage();} } document.getElementById("chTxtBox").elements["fmsg"].value = ''; } //writeGglAd(); parent.rotateAdSpot(); } return false; } function sendMsg(fromWidget=null){ hideMkyDisclaimer(); if (1==2 && parent.eVerified != 1 && parent.wzUserID > 502959 ) { wzAPI_setRefreshPg(1); wzAPI_showFrame("/whzon/signup/fastJoin.php?mode=v&wzID=" + sID,400,450,50,100); } else { parent.doUserActionLog(); var msg = ''; if (fromWidget){ msg = document.getElementById("chatWidgetBox").value; hideChatWidget(); } else { msg = document.getElementById("chTxtBox").elements["fmsg"].value; } msg = mkyTrim(msg); msg = mkySanitize(mkyTrim(msg)); msg = doWarnMsg(msg); var chkMsg = msg; if (parent.ProfanityUsed(stripToAlpha(chkMsg))){ doMuteSelf(); alert("You Can't Talk Like That Here!"); } else{ if (msg != '') { msg = stripToLowerCase(msg); var currentTime = new Date(); var ranTime = currentTime.getMilliseconds(); var pchan = document.getElementById('postToChan'); if (pchan){ if (pchan.value != ''){ pchan = '&pchan=' + pchan.value; } else { pchan = ''; } } else {pchan = '';} var url = '/whzon/talk/sendChatOpt.php?wzID=' + parent.sID + '&fshout=' + escape(msg) + pchan + "&xm=" + ranTime; doSendMsgToServer(url); msg = doEmotes(msg); msg = formatHashTags(msg); // ifrm.scrollTo(0,0); var wzoutput = ifrm; var gdiv = document.createElement('DIV'); gdiv.innerHTML = "
I Said:
" + msg + "
"; if (wzoutput.childNodes.length == 0) wzoutput.appendChild(gdiv); else wzoutput.insertBefore(gdiv,wzoutput.firstChild); } document.getElementById("chTxtBox").elements["fmsg"].value = ''; } //writeGglAd(); parent.rotateAdSpot(); } return false; } function checkForInstantWinner() { var currentTime = new Date(); var ranTime = currentTime.getMilliseconds(); var url = '/whzon/talk/checkForInstantWin.php?wzID=' + parent.sID + '&xm=' + ranTime; winxml.open("GET", url, true); winxml.onreadystatechange = DoCheckForInstantWinner; winxml.send(null); } function DoCheckForInstantWinner(){ if (winxml.readyState == 4) { if (winxml.status == 200) { var isWinID = parseInt(winxml.responseText); //parent.dbug("check winner is !" + isWinID); if (isWinID > 0){ doAlertInstantWinner(isWinID); } } } } function ReadMsg() { if (isRolling){ if (talkTimer){clearTimeout(talkTimer);} talkTimer = setTimeout('ReadMsg()',rollRefresh * 1000); return; } if (chanHasChanged){ chanHasChanged = null; lastMsgID = 0; mblAdCnt = 1; mblAdsServed = 0; } var streamDiv = document.getElementById("chatLoading"); if (streamDiv){streamDiv.style.visibility = "visible";} if (talkTimer) clearTimeout(talkTimer); var currentTime = new Date(); var ranTime = currentTime.getMilliseconds(); if (!wzChanID || wzChanID == 'undefined'){ wzChanID = 1; } if (mblAdCnt == 3){ mblAdsServed = mblAdsServed + 1; } var url = '/whzon/talk/mbrChatGetJOBWC.php?fcu=' + wzUserID + '&wzID=' + parent.sID + imgSize + nDispRecs + '&fchanID=' + wzChanID + '&flmsgID=' + lastMsgID + '&adNbr=' + mblAdCnt + '&gAd=' + showGoogleAd + '&xm=' + ranTime; showGoogleAd = null; readxml.timeout = rollRefresh * 1000; readxml.ontimeout = ReadMsg; readxml.onerror = function(){ talkTimer = setTimeout('ReadMsg()',rollRefresh * 1000); } readxml.open("GET", url, true); readxml.onreadystatechange = writeMsg; readxml.send(null); //checkForInstantWinner(); } function writeMsg() { rollnNew = 0; if (readxml.readyState == 4) { talkTimer = setTimeout("ReadMsg()", rollRefresh * 1000); if (readxml.status == 200) { var streamDiv = document.getElementById("chatLoading"); if (streamDiv){streamDiv.style.visibility = "hidden";} var jdata = readxml.responseText; //console.log('jdata',jdata); jdata = jdata.replace(/gsoftADJ/g," - 0.47em"); if (jdata == '') {jdata = '{"myMsgs":[]}';} try {j = JSON.parse(jdata); } catch(err) { parent.dbug("JSON fail: writeMsgs fail" + jdata); return; } rollMsgs = j.myMsgs; if (mblAdsServed < mblAdMax && mblAdCnt > mblAdMax){ mblAdCnt = 0; } mblAdCnt = mblAdCnt + 1; rollCnt = 0; if(rollTimer){clearTimeout(rollTimer)} rollOut(); } } var maxlength = listLength + 1 + rollnNew; if (!ifrm){ return; toremove = ifrm.firstChild; } let toremove = ifrm.firstChild; if(toremove){ var gcount = 1; for(var i = 0; i < maxlength; i++){ if ( i > listLength && toremove){ toremove.innerHTML = ""; setShowGoogleAd(gcount); gcount = gcount + 1; } if (toremove) toremove = toremove.nextSibling; } if (typeof wzMblReDrawPage == 'function') {wzMblReDrawPage();} } } function rollOut(){ if (rollMsgs.length == 0){ parent.dbug('roll: empty msg buffer'); return; } var rate = Math.floor(rollRefresh * 1000 / rollMsgs.length); if (rollMsgs.length > 12){ rate = 25; } if (rollCnt < rollMsgs.length){ isRolling = true; //parent.dbug('rolling: ' + rollCnt + ' of: ' + rollMsgs.length); rollMessage(rollMsgs,rollCnt); rollTimer = setTimeout('rollOut()',rate); } else { isRolling = null; } rollCnt = rollCnt + 1; } function rollMessage(msgs,i){ var curScrollX = parent.wzScrollXis(); //parent.dbug('window Height is: ' + parent.curScrollX); var msgID = msgs[i].msgID; var blockID = msgs[i].crUserID; var blkCntry = msgs[i].country; var readChan = msgs[i].chanID; var callID = msgs[i].callID; var rawmsg = msgs[i].rawmsg; if (callID !== 0){ } if (msgID != 0) {lastMsgID = msgID;} if (!msgs[i].msg){ msgs[i].msg = ''; } if (readChan != wzChanID && readChan != 0){ return; } if ((parent.blockList[blockID] != 1 && !parent.countryIsBlocked(blkCntry)) || modSeeAll == 1) { var msg = msgs[i].msg; msg = unescape(msg.replace(/[+]/g,' ')); msg = unescape(msg); msg = msg.replace(/:300px;/g, ':99%;'); msg = msg.replace(/width:40px;height:32px/g, 'width:110px;height:80px;border-radius:0.4em;'); //msg = fixutf8(msg); //parent.dbug('rollm: ' + i + ': ' + msg); var wzoutput = ifrm; var divflg = document.getElementById(msgID); if (divflg == null) { var gdiv = document.createElement('DIV'); if (msgID == 0){ //parent.dbug('roll: add found'); gdiv.id = 'ad' + mblAdDivID; mblAdDivID = mblAdDivID + 1; talkTimer = setTimeout('ReadMsg()',2000); } else { gdiv.id = msgID; } gdiv.innerHTML = doEmotes(msg); gdiv.style.width = '100%'; rollnNew = rollnNew + 1; if (wzoutput.childNodes.length == 0){ wzoutput.appendChild(gdiv); } else { wzoutput.insertBefore(gdiv, wzoutput.firstChild); } } parent.document.documentElement.scrollTop = document.body.scrollTop = curScrollX; } } function setShowGoogleAd(n){ if (n == 1){ showGoogleAd = true; } } function fixutf8(s){ //return s; return unescape(s); //return decodeURIComponent(escape(s)); } String.prototype.replaceAll = function(search, replacement) { var target = this; return target.replace(new RegExp(search, 'g'), replacement); }; function doEmotes(msg){ return msg.replace(/~/g,':'); } function getUrl(url) { synchCon.open("GET", url, false); synchCon.send(null); return synchCon.responseText; } // utility functions 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; } function stripToLowerCase(txt){ var words = txt.split(" "); txt = ""; for(i = 0; i < words.length-1; i++){ txt = txt+ doFixWord(words[i],i) + " "; } txt = txt+doFixWord(words[words.length-1]); return txt.replace(/:/g,"~"); } function doFixWord(txt,i){ if (i == 0) { txt = txt.toLowerCase(); txt = txt.substring(0,1).toUpperCase() + txt.substring(1,txt.length); } else { txt = txt.substring(0,1) + txt.substring(1,txt.length).toLowerCase(); } return txt; } 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, ''); } function purgeList(d) { if (d){ var a = d.attributes, i, l, n; if (a) { for (i = a.length - 1; i >= 0; i -= 1) { n = a[i].name; if (typeof d[n] === 'function') { d[n] = null; } } } a = d.childNodes; if (a) { l = a.length; for (i = 0; i < l; i += 1) { purgeList(d.childNodes[i]); } } } } 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 stripTxtSpam(str){ if (!str) return " "; prevL = str[0]; Lcount = 1; var newStr = "" + prevL; for (i = 1; i < str.length;i++){ var l = str[i]; if (l == prevL) Lcount++; else Lcount = 1; if (Lcount<3) newStr = newStr+l; prevL = l; } return newStr; }