function showtalen(){ if (document.getElementById("talen").style.display=="block" ){ document.getElementById("talen").style.display="none"; }else{ document.getElementById("talen").style.display="block"; } } function do_multi_uitleg(iid) { //console.log(iid); if (iid[0]=='language_90' && document.getElementById('language_90') && (document.getElementById('language_90').style.display!='none')){ window.sections9=iid[1].split("#####"); window.sections=iid[1].split("#####"); page = window.location.search.split("="); window.x9 = parseInt(page[1]); window.x = parseInt(page[1]); document.getElementById(iid[0]).innerHTML=window.sections9[window.x9]; } if (iid[0]=='language_80' && document.getElementById('language_80') && (document.getElementById('language_80').style.display!='none')){ window.sections8=iid[1].split("#####"); page = window.location.search.split("="); window.x8 = parseInt(page[1]); document.getElementById(iid[0]).innerHTML=window.sections8[window.x8]; } } function setlanguage(HTMLtochange,caller,id) //caller is the one who needs extra (like a translated question, id is the element where to place the translation) { fromgames="1"; if (caller !== undefined) { dag=getCookie('trans_dag'); $.post("get_vragen_translations.php?identifier=" +dag+"&lan="+document.getElementById("Select1").value , function(data) { document.getElementById(id).innerHTML=data; }) //alert (document.getElementById("Select1").value+" line 23 in subs_translate "+caller+" id="+id+"and dag ="+dag); fromgames="0"; } y=document.getElementById("Select1").selectedIndex; setCookie("language",document.getElementById("Select1").selectedIndex); x='img/flags/'+document.getElementById("Select1").value+'.png'; setCookie("language_flag",x); document.getElementById("flag_used").src=x; kw=document.getElementById("Select1").value; $.post("update_taal.php?taal=" + kw + "&email=" + window.email, function( data) { kww=data; }) document.getElementById("talen").style.display="none"; to=document.getElementById("Select1").value; // console.log('?frm="+window.land+"&to="+to+"&string="+HTMLtochange'); $.post("get_translations.php?frm="+window.land+"&to="+to+"&string="+HTMLtochange, function(data) { receivedstring=data; // console.log(data); res = data.split("&&"); for (J=0;J< res.length;J++){ if(res[J]!=""){ iid=res[J].split("||"); if(iid[0]=='language_90' || iid[0]=='language_80'){ do_multi_uitleg(iid); }else{ if(document.getElementById(iid[0])){ if (iid[2]=='value'){ document.getElementById(iid[0]).value=iid[1]; } if (iid[2]=='innerHTML'){ document.getElementById(iid[0]).innerHTML=iid[1]; } if (iid[2]=='placeholder'){ document.getElementById(iid[0]).placeholder=iid[1]; } if (iid[2]=='title'){ document.getElementById(iid[0]).title=iid[1]; } } } } } }) switch(land) { case "NL": window.vraag=window.NL_question; break; case "EN": window.vraag=window.EN_question; break; case "PL": window.vraag=window.PL_question; break; case "DE": window.vraag=window.DE_question; break; case "FR": window.vraag=window.FR_question; break; default: // code block } check_translations(HTMLtochange); if(fromgames=="0"){ // window.location.href = "index.php"; } } function check_translations(HTMLtochange) { // alert(HTMLtochange); // get all elements (by id) to find text that needs translation // // also, check if its already translated, if not, create a new record in the languagetable (english) and also produce the required translations. // // we do that in the php file check_translations.php // innerHTMLarray = []; languageArray = []; $('.multi_lang').each(function(i, e) { /* you can use e.id instead of $(e).attr('id') */ languageArray.push($(e).attr('id')); inner = $(e).attr('id'); // console.log(inner+" =============="); inhtml = document.getElementById(inner).innerHTML; innerHTMLarray.push(inner, inhtml); }); // console.log("innerhtmlarray" + innerHTMLarray); // console.log("languagearray" + languageArray); // // now we have in the array:innerhtmlArray all id's plus its value (text word (or phrase)) that needs translation. // this could be innerHTML, title, placeholder or value // so first we send this array to make_translations.php : check if item exists (the 'id' ), if not create it: 'id' + 'en' // indb373201_spot.tbl_translate // // we will deal with the actual translation to other languages seperately (see check_translations.php later!!!!!) var sendData = function() { $.post('../../../make_translations.php', { data: innerHTMLarray }, function(response) { // console.log(response); }); } sendData(); var translateData = function() { $.post('../../../check_translations.php', { data: innerHTMLarray }, function(response) { // console.log(response); }); } translateData(); } function dothetranslate(phrase, vertaling, lan) { alert(window.land+" phrase "+phrase+" vertaling:"+vertaling+" lam="+lan); } function dothetranslate1(phrase,vertaling,lan){ } function dothetranslatekw(phrase,vertaling,lan){ //we only do this if vertaling == space, meaning this was never translated if(vertaling == ""){ $.post("../../../translate.php?text="+phrase+"&to_lan="+lan, function (data1) { alert(data1); iets=""; for (i=0;i <= languageArray.length;i++){ // console.log(languageArray[i]+"\r\n"); iets=iets+" i="+i+" "+languageArray[i]+" "; } // alert("iets "+iets); }) } //alert(window.land+" phrase "+phrase+" vertaling:"+vertaling+" lam="+lan); } function getTimeRemaining(endtime) { var elementExists = document.getElementById("fourth"); //meaning this called by eindoplossing if (elementExists){ // console.log("elementExists="+elementExists.innerHTML+" window.xx="+window.xx); if (window.xx.substring(0, 2)=='