Store Sone ID in a variable.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 22 Jun 2011 18:56:38 +0000 (20:56 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 22 Jun 2011 19:33:38 +0000 (21:33 +0200)
src/main/resources/static/javascript/sone.js

index 383733a..05aab1d 100644 (file)
@@ -823,9 +823,10 @@ function ajaxifyPost(postElement) {
                return false;
        });
        (function(postElement) {
+               var soneId = $(".sone-id", postElement).text();
                $(".sone-post-menu .follow", postElement).click(function() {
                        var followElement = this;
-                       ajaxGet("followSone.ajax", { "sone": $(".sone-id", postElement).text(), "formPassword": getFormPassword() }, function() {
+                       ajaxGet("followSone.ajax", { "sone": soneId, "formPassword": getFormPassword() }, function() {
                                $(followElement).addClass("hidden");
                                $(followElement).parent().find(".unfollow").removeClass("hidden");
                        });
@@ -833,7 +834,7 @@ function ajaxifyPost(postElement) {
                });
                $(".sone-post-menu .unfollow", postElement).click(function() {
                        var unfollowElement = this;
-                       ajaxGet("unfollowSone.ajax", { "sone": $(".sone-id", postElement).text(), "formPassword": getFormPassword() }, function() {
+                       ajaxGet("unfollowSone.ajax", { "sone": soneId, "formPassword": getFormPassword() }, function() {
                                $(unfollowElement).addClass("hidden");
                                $(unfollowElement).parent().find(".follow").removeClass("hidden");
                        });