homepage/js/script.js
2021-09-09 16:30:52 +02:00

150 lines
2.9 KiB
JavaScript

var cookie = {SYNO:"<?php echo $cookie[0]; ?>","SYNO-B3":"<?php echo $cookie[1]; ?>",ESXI:"<?php echo $cookie[2]; ?>",majalis:"<?php echo $cookie[3]; ?>",RAS:"<?php echo $cookie[4]; ?>"};
var distant = {SYNO:"1","SYNO-B3":"0",ESXI:"1",majalis:"0",RAS:"0"};
var host = document.location.hostname;
var domaine1=host.search("netdldata");
var domaine2=host.search("192.168.110.");
var domaine;
if(domaine1!=-1) {
domaine=0;
document.title="NetDLData";
}
if(domaine2!=-1) {
domaine=1;
document.title="NetDLData_IP";
}
if(host=="liolo70.ddns.net") {
domaine=2;
document.title="NetDLData_Distant";
for (var i in distant) {
var id = document.getElementById(i);
if (distant[i]==0) {
id.disabled = true;
id.className += " distant";
}
}
}
for (var i in cookie) {
var id = document.getElementById(i);
if (cookie[i]==0) {
id.disabled = true;
id.className += " cache eteint";
}
if (cookie[i]==1) {
id.className += " allumer";
}
}
var shut = {DHCP:"1",PMA:"0",OWC:"0"};
for (var i in shut) {
var id = document.getElementById(i);
if (shut[i]==0) {
id.disabled = true;
id.className += " cache eteint";
}
if (shut[i]==1) {
id.className += " allumer";
}
}
function cookies() {
document.getElementById("reload").style.cursor = "wait";
document.body.style.cursor = "wait";
var path = document.location.pathname;
document.cookie = "socket=; expires=Thu, 01 Jan 1970 00:00:00 UTC;";
window.location.href = path;
}
function site(button,page) {
var host_L="";
var http="";
var port_L="";
var port_D="";
var url="";
var port="";
var doc_L="";
var doc_D="";
var reseau="192.168.110.";
var ndns="";
switch(button) {
case 'DHCP':
http="http://";
host_L="31";
doc_L="/html/";
doc_D="/html/";
ndns="netdldata.lan";
break;
case 'PMA':
http="https://";
host_L="31";
doc_L="/phpmyadmin/";
doc_D="/phpmyadmin/";
ndns="netdldata.lan";
break;
case 'SYNO':
http="https://";
host_L="22";
port_L="5001";
port_D="36";
ndns="synology.lan";
break;
case 'SYNO-B3':
http="https://";
host_L="23";
port_L="5001";
ndns="syno-b3.lan";
break;
case 'ESXI':
http="https://";
host_L="21";
port_D="35";
ndns="esxi.lan";
break;
case 'majalis':
http="https://";
host_L="31";
port_L="10000";
ndns="majalis.lan";
break;
case 'OWC':
http="https://";
host_L="31";
ndns="owncloud.lan";
break;
case 'RAS':
http="http://";
host_L="18";
ndns="raspberry.lan";
doc_D="/raspberry";
break;
default:
console.log("erreur");
}
switch(domaine) {
case 0:
url=http+ndns+":"+port_L+doc_L;
break;
case 1:
url=http+reseau+host_L+":"+port_L+doc_L;
break;
case 2:
url=http+host+":"+port_D+doc_D;
break;
default:
console.log("erreur");
}
console.log(page);
if (page=0) {}
document.location.href=url;
{}
if (page=1) {
//window.open(url);
}
}