var requestParameterOpen = ''; var documentRoot='overviews/allSubleagues/'; var showx ='a'; var showy ='4'; var showO = 1; var showP = 1; var subleagues_id; var ownSubleague; var subleague; var thisOwnSubl; var haveSubl; var timer; var signupNow = false; var signedUp = false; var subleaguesOpen_id; var ownSubleagueOpen; var subleagueOpen; var thisOwnSublOpen; var haveSublOpen; var timerOpen; var signupNowOpen = false; var signedUpOpen = false; var logins_id_global = 0; var parameters; !function($) { 'use strict'; $(function() { if (requestParameter!=='') { parameters = requestParameter.split('~~'); if (parameters[0]==='signup') { signupNow = true; subleagues_id = parameters[1]; $('#a1-tab').tab('show'); } else { if (parameters[0]==='signedup') { signupNow = true; signedUp = true; subleagues_id = parameters[1]; } } if (parameters[0]==='sel') { subleagues_id = parameters[1]; //console.log('NODE A1 SHOW'); $('#a1-tab').tab('show'); // triggerPanel(3); } } if (requestParameterOpen!=='') { parameters = requestParameterOpen.split('~~'); if (parameters[0]==='signup') { signupNowOpen = true; subleaguesOpen_id = parameters[1]; $('#sub2-tab').tab('show'); $('#b1-tab').tab('show'); } else { if (parameters[0]==='signedup') { signupNowOpen = true; signedUpOpen = true; subleaguesOpen_id = parameters[1]; } } if (parameters[0]==='sel') { subleaguesOpen_id = parameters[1]; //console.log('NODE B1 SHOW'); $('#sub2-tab').tab('show'); $('#b1-tab').tab('show'); //triggerPanel('b'); //triggerPanel(3); } } }); }(jQuery); function openPrize(id ) { window.location = 'main.php?module=allSubleagues&games_id=4151&requestParameter=signup~~'+id; } function openOpen(id ) { window.location = 'main.php?module=allSubleagues&games_id=4151&requestParameterOpen=signup~~'+id+'#subleague-tab-2'; } $('#passwordField').keyup(function (e) { if (e.keyCode === 13) { sublAanmelden_confirm(0); return false; } }); $('#passwordFieldOpen').keyup(function (e) { if (e.keyCode === 13) { sublAanmeldenOpen_confirm(0); return false; } }); function setPrivate(priv) { $.get( realUrl+path+'setPrivate.php', {'subleagues_id': subleagues_id, 'private': priv, 'games_id': '4151'}, function(feedback) { if (priv===1) { $('#setPriv img').attr('src', '../../main/images/icons/lock_cross.png'); var t = $("#setPriv span").html().replace('Gjør privat', 'Gjør offentlig'); $('#setPriv').attr('onclick', 'setPrivate(0)'); } else { $('#setPriv img').attr('src', '../../main/images/icons/lock.png'); var t = $('#setPriv span').html().replace('Gjør offentlig', 'Gjør privat'); $('#setPriv').attr('onclick', 'setPrivate(1)'); } $('#setPriv span').html(t); boxAlert(feedback, 20, ''); } ); } function setPrivateOpen(priv) { $.get( realUrl+path+'setPrivateOpen.php', {'subleagues_id': subleagues_idOpen, 'private': priv, 'games_id': '4151'}, function(feedback) { if (priv==1) { $('#setPrivOpen img').attr('src', '../../main/images/icons/lock_cross.png'); var t = $('#setPriv span').html().replace("Gjør privat", "Gjør offentlig"); $('#setPrivOpen').attr('onclick', 'setPrivateOpen(0)'); } else { $('#setPrivOpen img').attr('src', '../../main/images/icons/lock.png'); var t = $('#setPrivOpen span').html().replace("Gjør offentlig", "Gjør privat"); $('#setPrivOpen').attr('onclick', 'setPrivateOpen(1)'); } $('#setPrivOpen span').html(t); boxAlert(feedback,20,''); } ); } function nextSLP() { $('#node_a4 .aslpage').hide(); if ($('#node_a4 .page'+(++showP)).size()) { var newp = showP; } else { var newp = 1; } $('#node_a4 .page'+newp).show(); showP = newp; } function nextSLO() { $('#sub2-tab').tab('show'); $('#node_b4 .aslpage').hide(); if ($('#node_b4 .page'+(++showO)).size()) { var newp = showP; } else { var newp = 1; } $('#node_b4 .page'+newp).show(); showO = newp; } function getPageP (p) { $('.slrow').hide(); $('.slrow_'+p).show(); $('.p_page_link').removeClass('cur'); $('.p_page_'+p).addClass('cur'); } function getPageO (p) { $('.slrowo').hide(); $('.slrowo_'+p).show(); $('.o_page_link').removeClass('cur'); $('.o_page_'+p).addClass('cur'); } function showcontent (x,y) { $('#node_'+x+y).show(); } $(document).ready(function() { $('.headerc').addClass('col-xs-offset-3'); preload(); }); function preload(){ selFilterSubl(); $('.sblswitcher').css( 'display', 'none' ); subleagues_id = document.frmMyPrize.subleagues_id.value; ownSubleague = document.frmMyPrize.ownSubleague.value; thisOwnSubl = document.frmMyPrize.thisOwnSubl.value; haveSubl = document.frmMyPrize.haveSubl.value; subleague = document.frmMyPrize.subleague.value; if (thisOwnSubl) { signupNow = false; laadShouts(); timer = setInterval('laadShouts()', 5000); } if (signupNow) { if (===0) { newPlayerSubl(); } else { sublAanmelden(); } } subleaguesOpen_id = document.frmMyOpen.subleagues_id.value; ownSubleagueOpen = document.frmMyOpen.ownSubleague.value; thisOwnSublOpen = document.frmMyOpen.thisOwnSubl.value; haveSublOpen = document.frmMyOpen.haveSubl.value; subleagueOpen = document.frmMyOpen.subleague.value; if (thisOwnSublOpen) { signupNowOpen = false; laadShoutsOpen(); timerOpen = setInterval("laadShoutsOpen()",5000); } if (signupNowOpen) { if (==0) { newPlayerSublOpen(); } else { sublAanmeldenOpen(); } } parameters = requestParameterOpen.split("~~"); if (parameters[0]=="sel" || parameters[0]==="signup") { //console.log('SIGNUP'); // triggerPanel('b'); // triggerPanel(1); } parameters = requestParameter.split("~~"); if (parameters[0]=="sel" || parameters[0]=="signup") { // triggerPanel(1); } } function deletePlayer(logins_id, player) { logins_id_global = logins_id; if (logins_id == '') { boxAlert("Du kan ikke slette deg selv fra underligaen, fordi du er opprettholder.", 20, ''); return; } var tekst = 'Ønsker du virkelig å slette spiller_player_ fra denne underligaen?'; tekst = tekst.replace('_player_', player); boxConfirm(tekst, 50, 'deletePlayer_confirm()'); } function deletePlayerOpen(logins_id, player) { logins_id_global = logins_id; if (logins_id == "") { boxAlert("Du kan ikke slette deg selv fra underligaen, fordi du er opprettholder.", 20, ''); return; } var tekst = "Ønsker du virkelig å slette spiller_player_ fra denne underligaen?"; tekst = tekst.replace("_player_", player); boxConfirm(tekst, 50, "deletePlayer_confirmOpen()"); } function deletePlayer_confirm() { //console.log ('delpconfirm' + logins_id); logins_id = logins_id_global; var parameters = new Array( "logins_id=" + logins_id, "subleagues_id=" + subleagues_id ); voegToeBuffer( "deletePlayer_fb", "deletePlayer.php", parameters); } function deletePlayer_confirmOpen() { logins_id_global = logins_id; var parameters = new Array( "logins_id=" + logins_id, "subleagues_id=" + subleagues_id ); voegToeBuffer( "deletePlayerOpen_fb", "deletePlayerOpen.php", parameters); } function deletePlayer_fb() { if (xmlHttp.readyState!=4 && xmlHttp.readyState!="complete") return false; boxAlert(xmlHttp.responseText, 20, ''); verwijderBuffer("deletePlayer_fb"); window.location.reload(true); } function deletePlayerOpen_fb() { if (xmlHttp.readyState!=4 && xmlHttp.readyState!="complete") return false; boxAlert(xmlHttp.responseText, 20, ''); verwijderBuffer("deletePlayerOpen_fb"); window.location.reload(true); } function newPlayerSubl() { if (signedUp==true) { document.getElementById("extraMessage").innerHTML="U bent ingeschreven bij Zweeler.com. U kunt nu hieronder inloggen, om verder te gaan met uw aanmelding bij de subleague "+subleague+"."; } boxFromDiv('notLoggedIn'); boxResize(400, 300); boxShow(); } function newPlayerSublOpen() { if (signedUp==true) { document.getElementById("extraMessage").innerHTML="U bent ingeschreven bij Zweeler.com. U kunt nu hieronder inloggen, om verder te gaan met uw aanmelding bij de subleague "+subleague+"."; } boxFromDiv("notLoggedIn",1); boxResize(400, 300); boxShow(); } function askPassword(messageTo, logins_id_to) { boxFromDiv("sendMessage"); //boxShow(); //document.getElementById("messageTo").innerHTML = messageTo; document.frmMyPrize.fromLogins_id.value = logins_id_to; } function askPasswordOpen(messageTo, logins_id_to) { boxFromDiv("sendMessageOpen", 1); //boxShow(); //document.getElementById("messageTo").innerHTML = messageTo; document.frmMyOpen.fromLogins_id.value = logins_id_to; } function sendMessage() { var params = new Array( "subleagues_id="+subleagues_id, "message="+document.frmMyPrize.boodschap.value ); voegToeBuffer( "requestPassword", "requestPassword.php", params); } function sendMessageOpen() { var params = new Array( "subleagues_id="+subleaguesOpen_id, "message="+document.frmMyOpen.boodschap.value ); voegToeBuffer( "requestPassword", "requestPasswordOpen.php", params); } function requestPassword() { if (xmlHttp.readyState!=4 && xmlHttp.readyState!="complete") return false; giveMessage(xmlHttp.responseText); boxEmpty(); boxHide(); } function giveMessage(message) { document.getElementById("boxMessageContent").innerHTML = message; document.getElementById("boxMessage").style.display="block"; } function giveMessageOpen(message) { document.getElementById("boxMessageContentOpen").innerHTML = message; document.getElementById("boxMessageOpen").style.display="block"; } function laadShouts() { var params = { "subleagues_id": subleagues_id, "games_id": games_id }; $.post(realUrl+path+'getShoutbox.php',params, function(feedback) { document.getElementById("shoutbox").innerHTML=feedback; }); } function laadShoutsOpen() { var params = { "subleagues_id": subleaguesOpen_id, "games_id": games_id }; $.post(realUrl+path+'getShoutboxOpen.php',params, function(feedback) { document.getElementById("shoutboxOpen").innerHTML=feedback; }); } function deleteSubleague() { callSublDelete(0) } function callSublDelete(force) { var parameters = new Array( "subleagues_id=" + subleagues_id, "force=" + force ); voegToeBuffer( "deleteSubleague_fb", "deleteSubleague.php", parameters); } function deleteSubleagueOpen() { callSublDeleteOpen(0) } function callSublDeleteOpen(force) { var parameters = new Array( "subleagues_id=" + subleaguesOpen_id, "force=" + force ); voegToeBuffer( "deleteSubleagueOpen_fb", "deleteSubleagueOpen.php", parameters); } function deleteSubleague_fb() { if (xmlHttp.readyState!=4 && xmlHttp.readyState!="complete") return false; var feedback = xmlHttp.responseText.split("~~"); verwijderBuffer("deleteSubleague_fb"); if (feedback[0]==1) { window.location.reload(true); return; } if (confirm("Ønsker du virkelig å slette denne underligaen?")) callSublDelete(1); } function deleteSubleagueOpen_fb() { if (xmlHttp.readyState!=4 && xmlHttp.readyState!="complete") return false; var feedback = xmlHttp.responseText.split("~~"); verwijderBuffer("deleteSubleagueOpen_fb"); if (feedback[0]==1) { window.location.reload(true); return; } if (confirm("Ønsker du virkelig å slette denne underligaen?")) callSublDeleteOpen(1); } function plaatsBericht() { if (document.frmMyPrize.bericht.value=="" || document.frmMyPrize.bericht.value=="Skriv inn din melding") { boxAlert("Skriv inn en melding for å poste", 20, ""); return; } var params = { "subleagues_id": subleagues_id, "message": document.frmMyPrize.bericht.value, "games_id": games_id }; document.frmMyPrize.bericht.value=""; $.post(realUrl+path+'getShoutbox.php',params, function(feedback) { document.getElementById("shoutbox").innerHTML=feedback; }); } function plaatsBerichtOpen() { if (document.frmMyOpen.bericht.value=="" || document.frmMyOpen.bericht.value=="Skriv inn din melding") { boxAlert("Skriv inn en melding for å poste", 20, ""); return; } var params = { "subleagues_id": subleaguesOpen_id, "message": document.frmMyOpen.bericht.value, "games_id": games_id }; document.frmMyOpen.bericht.value=""; $.post(realUrl+path+'getShoutboxOpen.php',params, function(feedback) { document.getElementById("shoutboxOpen").innerHTML=feedback; }); } function meedoen() { if (thisOwnSubl) sublAfmelden(); else sublAanmelden(); } function meedoenOpen() { if (thisOwnSublOpen) sublAfmeldenOpen(); else sublAanmeldenOpen(); } function sublAanmelden () { boxFromDiv("joinConfirm"); boxShow(); } function sublAanmeldenOpen () { boxFromDiv("joinConfirmOpen",1); boxShow(); } function sublAanmelden_deny() { boxToDiv("joinConfirm"); boxEmpty(); boxHide(); } function sublAanmelden_denyOpen() { boxToDiv("joinConfirmOpen",1); boxEmpty(1); boxHide(1); } function sublAanmelden_confirm(force) { boxToDiv("joinConfirm",1); callSignUp(force, "signin"); } function sublAanmelden_confirmOpen(force) { console.log ('step _confirmOpen'); boxToDiv("joinConfirmOpen",1); callSignUpOpen(force, "signin"); } function signUp_fb() { if (xmlHttp.readyState!=4 && xmlHttp.readyState!="complete") return false; var feedback = xmlHttp.responseText.split("~~"); verwijderBuffer("signUp_fb"); if (feedback[0]==1) { confirmLeave(feedback[1]); return; } if (feedback[0]>1) { //alert(feedback[1]); window.location.href=thisbase; } giveMessage(feedback[1]); } function signUp_fbOpen() { if (xmlHttp.readyState!=4 && xmlHttp.readyState!="complete") return false; var feedback = xmlHttp.responseText.split("~~"); verwijderBuffer("signUp_fbOpen"); if (feedback[0]==1) { confirmLeaveOpen(feedback[1]); return; } if (feedback[0]>1) { //alert(feedback[1]); window.location.href=thisbase; } giveMessageOpen(feedback[1]); } function confirmLeave(subleagueOwn) { //alert(subleague); var tekst = "Du kan kun spille i en underliga på en gang. Når du fortsetter vil du bli skrevet ut av underligaen _subleague_. Er det greit?"; tekst = tekst.replace("_subleague_", subleagueOwn); boxConfirm(tekst, 50, "sublAanmelden_confirm(1)"); } function confirmLeaveOpen(subleagueOwnOpen) { //alert(subleague); var tekst = "Du kan kun spille i en underliga på en gang. Når du fortsetter vil du bli skrevet ut av underligaen _subleague_. Er det greit?"; tekst = tekst.replace("_subleague_", subleagueOwnOpen); boxConfirm(tekst, 50, "sublAanmelden_confirmOpen(1)"); } function sublAfmelden() { var tekst = "Ønsker du å skrive deg ut av en underliga _subleauge_?"; tekst = tekst.replace("_subleague_", subleague); boxConfirm(tekst, 50, "sublAfmelden_confirm()"); } function sublAfmeldenOpen() { var tekst = "Ønsker du å skrive deg ut av en underliga _subleauge_?"; tekst = tekst.replace("_subleague_", subleagueOpen); boxConfirm(tekst, 50, "sublAfmelden_confirmOpen()"); } function sublAfmelden_confirm() { callSignUp(0, "signout"); } function sublAfmelden_confirmOpen() { callSignUpOpen(0, "signout"); } function callSignUp(force, task) { boxEmpty(); boxHide(); var pwd = ''; if (document.getElementById("passwordField")) pwd = document.getElementById("passwordField").value var parameters = new Array( "subleagues_id=" + subleagues_id, "subleague=" + subleague, "password=" + pwd, "force="+force, "task="+task ); voegToeBuffer( "signUp_fb", "signUp.php", parameters); } function callSignUpOpen(force, task) { boxEmpty(1); boxHide(1); var pwd = ''; if (document.getElementById("passwordFieldOpen")) pwd = document.getElementById("passwordFieldOpen").value var parameters = new Array( "subleagues_id=" + subleaguesOpen_id, "subleague=" + subleagueOpen, "password=" + pwd, "force="+force, "task="+task ); voegToeBuffer( "signUp_fbOpen", "signUpOpen.php", parameters); } function boxAlert(text, height, confirmFunc) { styling = "text-align:center; "; text = "