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 = 702; 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 = "
";
}
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 = "