mirror of
https://github.com/2009scape/2009scape.github.io.git
synced 2024-09-11 19:02:31 +02:00
78 lines
2.0 KiB
JavaScript
78 lines
2.0 KiB
JavaScript
var htmlInteraction = {
|
|
|
|
setElementDisplay : function(id, display){
|
|
document.getElementById(id).style.display = display;
|
|
},
|
|
|
|
getElement : function(id){
|
|
return document.getElementById(id);
|
|
},
|
|
|
|
setElementVisibility : function(id, bool){
|
|
if(bool) document.getElementById(id).style.visibility = "visible";
|
|
else document.getElementById(id).style.visibility = "hidden";
|
|
},
|
|
|
|
isElementVisible : function(id){
|
|
if(document.getElementById(id).style.visibility == "hidden") return false;
|
|
return true;
|
|
},
|
|
|
|
setInnerHtml : function(id, value){
|
|
document.getElementById(id).innerHTML = value;
|
|
darkMode.update();
|
|
},
|
|
|
|
disableButton : function(id){
|
|
this.getElement(id).disabled = "disabled";
|
|
},
|
|
|
|
disableButtonClass : function(id){
|
|
var arr = document.getElementsByClassName(id);
|
|
for(var i = 0; i < arr.length; i++){
|
|
arr[i].disabled = "disabled";
|
|
}
|
|
},
|
|
|
|
enableButton : function(id){
|
|
this.getElement(id).disabled = "";
|
|
},
|
|
|
|
enableButtonClass : function(id){
|
|
var arr = document.getElementsByClassName(id);
|
|
for(var i = 0; i < arr.length; i++){
|
|
arr[i].disabled = "";
|
|
}
|
|
},
|
|
|
|
showButton : function(id){
|
|
htmlInteraction.setElementVisibility(id, true);
|
|
},
|
|
|
|
showButtonClass : function(id){
|
|
var arr = document.getElementsByClassName(id);
|
|
for(var i = 0; i < arr.length; i++){
|
|
arr[i].style.visibility = "visible";
|
|
}
|
|
},
|
|
|
|
hideButton : function(id){
|
|
htmlInteraction.setElementVisibility(id, false);
|
|
},
|
|
|
|
hideButtonClass : function(id){
|
|
var arr = document.getElementsByClassName(id);
|
|
for(var i = 0; i < arr.length; i++){
|
|
arr[i].style.visibility = "hidden";
|
|
}
|
|
},
|
|
|
|
setButtonOnclick : function(id, value){
|
|
this.getElement(id).onclick = value;
|
|
},
|
|
|
|
focusElement : function(id){
|
|
this.getElement(id).focus();
|
|
}
|
|
};
|