WEB/Sammlung/Praktikum/3/ias_p2_a0.21/js/bot/botButtonStyle.js

56 lines
1.7 KiB
JavaScript
Raw Normal View History

2016-10-16 21:53:15 +02:00
function setBotButtonStyle(bot, style){
var htmlID = 0;
if(bot == 1){
if(style == 'active'){
document.getElementById('bot1Button').className = "botButtonActiveStyle";
document.getElementById('bot1Button').onclick = function onclick(event){ botStop(1);};
}
else if(style == 'inactive'){
document.getElementById('bot1Button').className = "botButtonInactiveStyle";
document.getElementById('bot1Button').onclick = function onclick(event){ botStart(1);};
}
else if(style == 'buyAction'){
document.getElementById('bot1Button').className = "botButtonBuyActionStyle";
setTimeout(function(){ botButtonStyleCheck() }, 500);
}
else{
alert("Fehler beim Stylen von Botbutton");
}
}
else if(bot == 2){
if(style == 'active'){
document.getElementById('bot2Button').className = "botButtonActiveStyle";
document.getElementById('bot2Button').onclick = function onclick(event){ botStop(2);};
}
else if(style == 'inactive'){
document.getElementById('bot2Button').className = "botButtonInactiveStyle";
document.getElementById('bot2Button').onclick = function onclick(event){ botStart(2);};
}
else if(style == 'buyAction'){
document.getElementById('bot2Button').className = "botButtonBuyActionStyle";
setTimeout(function(){ botButtonStyleCheck() }, 500);
}
else{
alert("Fehler beim Stylen von Botbutton");
}
}
else{
alert("Fehler Auswahl eines Botbuttons f<>r Styling");
}
};
function botButtonStyleCheck(){
if(bot1ID != 0){
setBotButtonStyle(1, 'active');
}
else{
setBotButtonStyle(1, 'inactive');
}
if(bot2ID !=0){
setBotButtonStyle(2, 'active');
}
else{
setBotButtonStyle(2, 'inactive');
}
};