summaryrefslogtreecommitdiffstats
path: root/public/media/js/user.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/media/js/user.js')
-rw-r--r--public/media/js/user.js88
1 files changed, 88 insertions, 0 deletions
diff --git a/public/media/js/user.js b/public/media/js/user.js
index 488ab45..01c4721 100644
--- a/public/media/js/user.js
+++ b/public/media/js/user.js
@@ -17,3 +17,91 @@ $(document).ready(function(){
});
}
});
+
+function checkAllCheckBoxes(exceptions) {
+ var elements = document.getElementsByTagName('input');
+ if(!elements) {
+ return;
+ }
+ var countElements = elements.length;
+ var countExceptions;
+ if(exceptions) {
+ countExceptions = exceptions.length;
+ } else {
+ countExceptions = 0;
+ }
+ var foundException = false;
+ if(!countElements) {
+ if(elements.getAttribute('type') == 'checkbox') {
+ for(var j = 0; j < countExceptions; j++) {
+ if(elements.getAttribute('name') == exceptions[j]) {
+ foundException = true
+ break;
+ }
+ }
+ if(!foundException) {
+ elements.checked = true;
+ }
+ foundException = false;
+ }
+ } else {
+ for(var i = 0; i < countElements; i++) {
+ if(elements[i].getAttribute('type') == 'checkbox') {
+ for(var j = 0; j < countExceptions; j++) {
+ if(elements[i].getAttribute('name') == exceptions[j]) {
+ foundException = true
+ break;
+ }
+ }
+ if(!foundException) {
+ elements[i].checked = true;
+ }
+ foundException = false;
+ }
+ }
+ }
+}
+
+function uncheckAllCheckBoxes(exceptions) {
+ var elements = document.getElementsByTagName('input');
+ if(!elements) {
+ return;
+ }
+ var countElements = elements.length;
+ var countExceptions;
+ if(exceptions) {
+ countExceptions = exceptions.length;
+ } else {
+ countExceptions = 0;
+ }
+ var foundException = false;
+ if(!countElements) {
+ if(elements.getAttribute('type') == 'checkbox') {
+ for(var j = 0; j < countExceptions; j++) {
+ if(elements.getAttribute('name') == exceptions[j]) {
+ foundException = true
+ break;
+ }
+ }
+ if(!foundException) {
+ elements.checked = false;
+ }
+ foundException = false;
+ }
+ } else {
+ for(var i = 0; i < countElements; i++) {
+ if(elements[i].getAttribute('type') == 'checkbox') {
+ for(var j = 0; j < countExceptions; j++) {
+ if(elements[i].getAttribute('name') == exceptions[j]) {
+ foundException = true
+ break;
+ }
+ }
+ if(!foundException) {
+ elements[i].checked = false;
+ }
+ foundException = false;
+ }
+ }
+ }
+} \ No newline at end of file