]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
LinkPreview: clear preview thumbnails & data on form submission/reset
authorBrion Vibber <brion@pobox.com>
Tue, 16 Nov 2010 23:31:03 +0000 (15:31 -0800)
committerBrion Vibber <brion@pobox.com>
Tue, 16 Nov 2010 23:31:03 +0000 (15:31 -0800)
plugins/LinkPreview/linkpreview.js

index 5dca3a8071d84f1434f3c073da1d4a9eee5c8612..641adb729065a39dc6d41a47f1b241b07eb50ec7 100644 (file)
             }
 
             LinkPreview.links = links;
+        },
+
+        /**
+         * Clear out any link preview data.
+         */
+        clear: function() {
+            LinkPreview.links = [];
+            $('#link-preview').empty();
         }
     };
 
         if (params.width) oEmbed.width = params.width;
         if (params.height) oEmbed.height = params.height;
 
-        $('#form_notice').append('<div id="link-preview" class="thumbnails"></div>');
+        $('#form_notice')
+            .append('<div id="link-preview" class="thumbnails"></div>')
+            .bind('reset', function() {
+                LinkPreview.clear();
+            });
 
         // Piggyback on the counter update...
         var origCounter = SN.U.Counter;