Split up element marking into blocks of 16 elements.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 18 Jun 2011 15:06:31 +0000 (17:06 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 18 Jun 2011 15:06:31 +0000 (17:06 +0200)
This should make it work with several thousand elements at once.

src/main/resources/static/javascript/sone.js

index d5db8ef..d6c83ae 100644 (file)
@@ -868,7 +868,11 @@ function ajaxifyNotification(notification) {
                notification.find(".text").addClass("hidden");
        }
        notification.find("form.mark-as-read button").click(function() {
-               ajaxGet("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": $(":input[name=type]", this.form).val(), "id": $(":input[name=id]", this.form).val()});
+               allIds = $(":input[name=id]", this.form).val().split(" ");
+               for (index = 0; index < allIds.length; index += 16) {
+                       ids = allIds.slice(index, index + 16).join(" ");
+                       ajaxGet("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": $(":input[name=type]", this.form).val(), "id": ids});
+               }
        });
        notification.find("a[class^='link-']").each(function() {
                linkElement = $(this);