LinkPreview: clear preview thumbnails & data on form submission/reset

This commit is contained in:
Brion Vibber 2010-11-16 15:31:03 -08:00
parent f7fe3fa386
commit 9cdb9cc18d
1 changed files with 13 additions and 1 deletions

View File

@ -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;