summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGit <git@what.cd>2013-08-11 08:00:48 +0000
committerGit <git@what.cd>2013-08-11 08:00:48 +0000
commitc9a8095b5a0865493094e42f2eeaf5be257f0ae7 (patch)
tree74a171315c4d41610cd16e31ff33131e89e018e9
parent21fe4e5534115f8f5f45b5d4c39901e4b12ed2ea (diff)
downloadGazelle-c9a8095b5a0865493094e42f2eeaf5be257f0ae7.zip
Gazelle-c9a8095b5a0865493094e42f2eeaf5be257f0ae7.tar.gz
Gazelle-c9a8095b5a0865493094e42f2eeaf5be257f0ae7.tar.bz2
Empty commit
-rw-r--r--sections/torrents/notify.php2
-rw-r--r--static/functions/global.js21
-rw-r--r--static/functions/notifications.js25
3 files changed, 13 insertions, 35 deletions
diff --git a/sections/torrents/notify.php b/sections/torrents/notify.php
index c8a04bc..5151504 100644
--- a/sections/torrents/notify.php
+++ b/sections/torrents/notify.php
@@ -228,7 +228,7 @@ if (empty($Results)) {
<form class="manage_form" name="torrents" id="notificationform_<?=$FilterID?>" action="">
<table class="torrent_table cats checkboxes border">
<tr class="colhead">
- <td style="text-align: center;"><input type="checkbox" name="toggle" onclick="toggleBoxes(<?=$FilterID?>, this.checked)" /></td>
+ <td style="text-align: center;"><input type="checkbox" name="toggle" onclick="toggleChecks('notificationform_<?=$FilterID?>', this, '.notify_box')" /></td>
<td class="small cats_col"></td>
<td style="width: 100%;">Name<?=$TorrentCount <= NOTIFICATIONS_MAX_SLOWSORT ? ' / <a href="'.header_link('year').'">Year</a>' : ''?></td>
<td>Files</td>
diff --git a/static/functions/global.js b/static/functions/global.js
index 389c96d..c8003f5 100644
--- a/static/functions/global.js
+++ b/static/functions/global.js
@@ -1,13 +1,16 @@
-function toggleChecks(formElem,masterElem) {
- if (masterElem.checked) {
- checked = true;
+/**
+ * Check or uncheck checkboxes in formElem
+ * If masterElem is false, toggle each box, otherwise use masterElem's status on all boxes
+ * If elemSelector is false, act on all checkboxes in formElem
+ */
+function toggleChecks(formElem, masterElem, elemSelector) {
+ elemSelector = elemSelector || 'input:checkbox';
+ if (masterElem) {
+ $('#'+formElem+' '+elemSelector).prop('checked', masterElem.checked);
} else {
- checked = false;
- }
- for (s = 0; s < $('#'+formElem).raw().elements.length; s++) {
- if ($('#'+formElem).raw().elements[s].type == "checkbox") {
- $('#'+formElem).raw().elements[s].checked=checked;
- }
+ $('#'+formElem+' '+elemSelector).each(function() {
+ this.checked = !this.checked;
+ })
}
}
diff --git a/static/functions/notifications.js b/static/functions/notifications.js
index b05a2df..7c8b826 100644
--- a/static/functions/notifications.js
+++ b/static/functions/notifications.js
@@ -23,28 +23,3 @@ function clearSelected(filterId) {
}
});
}
-
-function toggleBoxes(filterId, value) {
- var filterForm = $('#notificationform_' + filterId);
- var checkBoxes = $('.notify_box_' + filterId, filterForm);
- for (var i = checkBoxes.length - 1; i >= 0; i--) {
- $(checkBoxes[i]).prop('checked', value);
- }
-}
-
-/* Remove these */
-function GroupClear(form) {
- for (var i = 0; i < form.elements.length; i++ ) {
- if (form.elements[i].type == 'checkbox' && form.elements[i].name != 'toggle') {
- if (form.elements[i].checked == true) {
- Clear(form.elements[i].value);
- }
- }
- }
-}
-
-function SuperGroupClear() {
- for (var i = 0; i < document.forms.length; i++ ) {
- GroupClear(document.forms[i]);
- }
-}