summaryrefslogtreecommitdiffstats
path: root/static/functions/notifications.js
diff options
context:
space:
mode:
authorGit <git@what.cd>2013-02-15 08:00:35 +0000
committerGit <git@what.cd>2013-02-15 08:00:35 +0000
commit7c7573eb4882875c1fea85dd2c56596e09398f58 (patch)
tree8404834b9a97935b6b12cb95ffd5c2242f9a8a58 /static/functions/notifications.js
parent0d95385ef1fe3d5c6f1c4e91caccab8aec07bad1 (diff)
downloadGazelle-7c7573eb4882875c1fea85dd2c56596e09398f58.zip
Gazelle-7c7573eb4882875c1fea85dd2c56596e09398f58.tar.gz
Gazelle-7c7573eb4882875c1fea85dd2c56596e09398f58.tar.bz2
Empty commit
Diffstat (limited to 'static/functions/notifications.js')
-rw-r--r--static/functions/notifications.js55
1 files changed, 38 insertions, 17 deletions
diff --git a/static/functions/notifications.js b/static/functions/notifications.js
index ad5b36c..6d184d1 100644
--- a/static/functions/notifications.js
+++ b/static/functions/notifications.js
@@ -1,29 +1,50 @@
-function Clear(torrentid) {
- ajax.get("?action=notify_clear_item&torrentid=" + torrentid + "&auth=" + authkey, function() {
- $("#torrent" + torrentid).remove();
- });
+function clearItem(torrentId) {
+ ajax.get("?action=notify_clear_item&torrentid=" + torrentId + "&auth=" + authkey, function() {
+ $("#torrent" + torrentId).remove();
+ });
}
-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 clearSelected(filterId) {
+ var checkBoxes, checkedBoxes = [];
+ if (filterId) {
+ var filterForm = $('#notificationform_'+filterId).raw();
+ checkBoxes = $('.notify_box_'+filterId, filterForm).objects;
+ } else {
+ checkBoxes = $('.notify_box').objects;
+ }
+ for (var i = checkBoxes.length - 1; i >= 0; i--) {
+ if (checkBoxes[i].checked) {
+ checkedBoxes.push(checkBoxes[i].value);
+ }
+ }
+ ajax.get("?action=notify_clear_items&torrentids=" + checkedBoxes.join(',') + "&auth=" + authkey, function() {
+ for (var i = checkedBoxes.length - 1; i >= 0; i--) {
+ $('#torrent' + checkedBoxes[i]).remove();
+ }
+ });
+}
+
+function toggleBoxes(filterId, value) {
+ var filterForm = $('#notificationform_'+filterId).raw();
+ var checkBoxes = $('.notify_box_'+filterId, filterForm).objects;
+ for (var i = checkBoxes.length - 1; i >= 0; i--) {
+ checkBoxes[i].checked = value;
}
}
-function ToggleBoxes(form, newval) {
+/* 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') {
- form.elements[i].checked = newval;
- }
+ 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]);
+ GroupClear(document.forms[i]);
}
-} \ No newline at end of file
+}