let cookiesCondition = document.getElementById("cookiesCondition")
let accept = document.querySelector("#accept")
let leaveSite = document.querySelector("#leaveSite")
let myBody = window.body;
let signup = document.querySelector("#signup");
let signin = document.querySelector("#signin");
let loginSection = document.querySelector("#loginSection")
let forgotPwd = document.querySelector("#forgotPwd");
let closeSignin = document.querySelector("#closeSignin")
let profile = document.querySelector("#profile")
var topMenuBut = document.getElementById("topMenuBut")
let profileIsOpen = false;
let menuIsOpen = false;
let aside = document.querySelector("aside");
let asideChat = document.querySelector("asideChat");
let chatLink = document.querySelector("#chatLink")
let chatPhoto = document.querySelector("#chatholder")
let chatPhoto_hover = false;
let profileField = document.querySelector("#profileField")
let img3 = document.querySelector("#img3")
let profileTopHidden = document.querySelector("#profileTopHidden")
let closeBtns = document.getElementsByClassName("closeSignin")
var tvMode = true;
console.log('topMenuBut::',topMenuBut);
for (let i = 0; i < closeBtns.length; i++) {
closeBtns[i].addEventListener("click", ()=> {
closeBtns[i].parentElement.style.display="none"
})
}
var holdButtonDisplay = null;
var searching = false;
function doNewLogin(){
var divxml = getHttpConnection();
var currentTime = new Date();
var ranTime = currentTime.getMilliseconds();
var email = encodeURIComponent(document.getElementById('femail').value);
var passw = encodeURIComponent(document.getElementById('fpassword').value);
inUrl = '/whzon/mbr/mbrLogin.php?femail='+email+'&fpassword='+passw+'&gsrc=new&xr='+ranTime;
console.log("Login::",inUrl);
divxml.open("GET", inUrl,true);
divxml.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
try {
var j = JSON.parse(divxml.responseText);
console.log('userLogind: ',j);
if (j.result == 'OK'){
document.location.href = '/newui/wzApp.php?wzID='+j.token+'&UI=new';
return;
}
else {
alert(j.err);
}
}
catch(e){
alert('Login JSON Fail::',divxml.responseText);
}
}
};
divxml.send(null);
}
var lastMkyResponse=null;
var lastQry = null;
function doAskTheMonkey(ecQry=null){
//return;
if (!ecQry) {
return;
}
if (ecQry == ''){
return;
}
var spot = findDiv('monkeyQryResponseSpot');
if (spot){
spot.style.display='block';
spot.innerHTML = "Thinking About That... Please wait!";
}
else {return;}
var divxml = getHttpConnection();
var currentTime = new Date();
var ranTime = currentTime.getMilliseconds();
var qscope = '&scope='+encodeURIComponent(btoa(JSON.stringify(qryloc)));
var pgView = document.getElementById('pgViewerFrame');
if (pgView){
console.log('doAskTheMonkey::pfFram:found',pgView.contentWindow.qryJResults);
const qryJResults = pgView.contentWindow.qryJResults;
if (typeof(qryJResults) != 'undefined'){
qscope = '&qres='+qryJResults+qscope;
console.log('qryJResults::',qscope);
}
}
inUrl = '/whzon/talk/oaiSiteMonkyQry.php?msg='+ecQry+qscope+'&xr='+ranTime;
divxml.open("GET", inUrl,true);
divxml.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var htm = divxml.responseText;
if (spot){
spot.style.display='block';
spot.innerHTML = htm;
return;
}
}
};
divxml.send(null);
}
function doSearch(){
console.log('qryLoc::',qryloc);
var newQry = document.getElementById('sQry');
var frame = document.getElementById('pgViewerFrame');
if (newQry.value.trim() != ''){
searching = true;
var but = document.getElementById('searchButton');
holdButtonDisplay = but.style.display;
but.style.display = 'none';
showDiv('parent.searchIng');
lastQry = encodeURI(newQry.value.trim());
const qscope = '&scope='+btoa(JSON.stringify(qryloc));
frame.src = 'https://www.bitmonky.com/whzon/bitMiner/newMemQry.php?search='+encodeURI(newQry.value.trim())+qscope+'&mode=PC';
}
}
function checkForEnter(event) {
if (event.key === 'Enter') {
console.log("Enter Pressed");
doSearch();
}
}
function scrollTopApp(){
window.scrollTo({
top: 0,
left: 0,
behavior: "smooth",
});
scrollTopFramePg('pgViewerFrame');
asideChat.scrollTo({
top: 0,
left: 0,
behavior: "smooth",
});
aside.scrollTo({
top: 0,
left: 0,
behavior: "smooth",
});
}
function chkYouTubeImage(){
}
function loadHashQry(id,q){
var newQry = document.getElementById('sQry');
var frame = document.getElementById('pgViewerFrame');
if (q.trim() != ''){
newQry.value = q
searching = true;
var but = document.getElementById('searchButton');
holdButtonDisplay = but.style.display;
but.style.display = 'none';
showDiv('parent.searchIng');
lastQry = encodeURI(newQry.value.trim());
frame.src = 'https://www.bitmonky.com/whzon/bitMiner/newMemQry.php?search='+encodeURI(newQry.value.trim())+'&mode=PC';
window.scrollTo({
top: 0,
left: 0,
behavior: "smooth",
});
scrollTopFramePg('pgViewerFrame');
}
}
function videoShare(id){
//wzAPI_closeWin();
wzGetVideoPage('/whzon/mbr/vidView/viewVideoPg.php?wzID=0&videoID=' + id);
}
function wzGetVideoPage(url){
wzGetPage(url);
}
function wzGetTrending(url){
showSideChat('open');
wzGetPage(url);
}
function handleBlogLinks(inUrl){
console.log('url',inUrl);
const url = new URL(inUrl,'https://www.bitmonky.com');
console.log(url);
return 'https://'+url.hostname+url.pathname+url.search+'&UI=new'+(url.hash);
}
function handleUILink(url){
url = url.trim();
if (url.includes('?')){
return url+'&UI=new';
}
return url+'?UI=new';
}
function wzGetMoshBox(){
var url = "/whzon/mytown/myTown.php?wzID="+sID+"&franCID=2&fmyMode=mosh&fscope=myWorld&fwzUserID=17621";
wzGetPage(url);
OpenGigBox(moshSelected);
}
function wzGetPage(url){
if (url == '/'){
url == '/whzon/bitMiner/newMemQry.php?search=nature&mode=PC&qdef=on';
}
moveDredge();
console.log('wzGetPage::NEWUI',url);
if (!url) return;
var frame = document.getElementById('pgViewerFrame');
if (url.trim() != ''){
if (url.includes('mbrMBLOG.php')){
url = handleBlogLinks(url);
}
else {
url = handleUILink(url);
}
console.log('wzGetPage::',url);
frame.src = url;
window.scrollTo({
top: 0,
left: 0,
behavior: "smooth",
});
scrollTopFramePg('pgViewerFrame');
}
}
function wzLink(url){
wzGetPage(url);
}
function hideTop(){
}
function scrollTopFramePg(frameID){
var appframe = document.getElementById(frameID);
if (appframe){
divh = appframe.contentWindow;
if (divh) {
divh.scrollTo({
top: 0,
left: 0,
behavior: "smooth",
});
}
}
}
function showSideChat(action='open'){
const icon = '';
if (action == 'open') {
asideChat.style.display = 'flex';
asideChat.style.width = "635px"
profile.innerHTML = icon+" Chat Room [-]"
profileField.style.display = "flex"
profileIsOpen = true;
} else {
asideChat.style.display = "node"
profile.innerHTML = icon+" Chat Room +"
profileField.style.display = "none"
profileIsOpen = false;
}
}
accept.addEventListener("click", ()=> {
mkyAcceptCKY();
return;
cookiesCondition.classList.toggle("bg-success")
cookiesCondition.firstElementChild.textContent = "Thank you for accepting our policies!"
cookiesCondition.firstElementChild.style.color = "white"
accept.style.display = "none"
leaveSite.style.display = "none"
document.getElementById('ckIfNot').style.display = "none";
setTimeout(()=> {
cookiesCondition.classList.toggle("d-none")
}, 2000)
})
leaveSite.addEventListener("click", ()=> {
cookiesCondition.style.backgroundColor = "red"
cookiesCondition.firstElementChild.textContent = "Hope to see you soon again!"
cookiesCondition.firstElementChild.style.color = "white"
accept.style.display = "none"
leaveSite.style.display = "none"
document.getElementById('ckIfNot').style.display = "none";
setTimeout(()=> {
document.location.href='https://google.com'
}, 1000)
})
if (signin){
signin.addEventListener("click", ()=> {
signin.style.visibility = "hidden"
signup.style.visibility = "hidden"
loginSection.style.display = "flex"
forgotPwd.style.display = "block"
})
closeSignin.addEventListener("click", ()=> {
loginSection.style.display = "none"
signin.style.visibility = "initial"
signup.style.visibility = "initial"
})
}
topMenuBut.addEventListener("click", ()=> {
const icon = '';
menuIsOpen = !menuIsOpen
if (menuIsOpen) {
aside.style.width = "300px"
//profile.innerHTML = icon+" Chat Room [-]"
//profileField.style.display = "flex"
} else {
aside.style.width = "120px"
//profile.innerHTML = icon+" Chat Room +"
//profileField.style.display = "none"
}
})
profile.addEventListener("click", ()=> {
const icon = '';
profileIsOpen = !profileIsOpen
if (profileIsOpen) {
asideChat.style.display = 'flex';
asideChat.style.width = "0px"
asideChat.style.width = "635px"
profile.innerHTML = icon+" Chat Room [-]"
profileField.style.display = "flex"
} else {
asideChat.style.display = "none"
profile.innerHTML = icon+" Chat Room +"
profileField.style.display = "none"
}
})
chatPhoto.addEventListener('mouseover', () => {
chatPhoto_hover = true
if (chatPhoto_hover) {
chatLink.style.right = "70px";
}
})
chatPhoto.addEventListener("mouseout", ()=> {
chatPhoto_hover = false;
chatLink.style.right = "-200px"
})
img3.addEventListener("mouseover", ()=> {
profileTopHidden.style.display = "flex"
})