mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-28 08:30:28 -04:00
77 lines
2.0 KiB
JavaScript
Executable File
77 lines
2.0 KiB
JavaScript
Executable File
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;
|
|
},
|
|
|
|
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();
|
|
}
|
|
};
|