mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-21 16:01:17 -04:00
commit all random stuff to repo
This commit is contained in:
76
static/candies/scripts/htmlInteraction.js
Executable file
76
static/candies/scripts/htmlInteraction.js
Executable file
@@ -0,0 +1,76 @@
|
||||
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();
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user