summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-11-16 15:31:03 -0800
committerBrion Vibber <brion@pobox.com>2010-11-16 15:31:03 -0800
commit9cdb9cc18d7aea9eaf13443413ba051e78e1f89e (patch)
tree63f99a49a866230d471b81306f077de9ee5ec095
parentf7fe3fa3868f4e7d84c7d0c8b04ccf6f0727f6bb (diff)
LinkPreview: clear preview thumbnails & data on form submission/reset
-rw-r--r--plugins/LinkPreview/linkpreview.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/plugins/LinkPreview/linkpreview.js b/plugins/LinkPreview/linkpreview.js
index 5dca3a807..641adb729 100644
--- a/plugins/LinkPreview/linkpreview.js
+++ b/plugins/LinkPreview/linkpreview.js
@@ -161,6 +161,14 @@
}
LinkPreview.links = links;
+ },
+
+ /**
+ * Clear out any link preview data.
+ */
+ clear: function() {
+ LinkPreview.links = [];
+ $('#link-preview').empty();
}
};
@@ -169,7 +177,11 @@
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;