From b065356c287c6dab005fa5d737df9f63504fecd2 Mon Sep 17 00:00:00 2001 From: rabuzarus Date: Sat, 2 Feb 2019 02:27:41 +0100 Subject: [PATCH] attachment preview: add destroy method to linkPreview.js --- view/js/linkPreview.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/view/js/linkPreview.js b/view/js/linkPreview.js index cbb5e48da3..afbb453de8 100644 --- a/view/js/linkPreview.js +++ b/view/js/linkPreview.js @@ -412,6 +412,23 @@ }); }; + var destroy = function() { + $('#' + selector).unbind(); + $('#preview_' + selector).remove(); + binurl; + block = false; + blockTitle = false; + blockDescription = false; + cache = {}; + images = ""; + isExtern = false; + photoNumber = 0; + firstPosted = false; + isActive = false; + isCrawling = false; + selector = ""; + }; + var trim = function(str) { return str.replace(/^\s+|\s+$/g, ""); }; @@ -431,8 +448,11 @@ return { // make crawlText() accessable from the outside. - crawlText: function (text) { + crawlText: function(text) { crawlText(text); + }, + destroy: function() { + destroy(); } }; }; -- 2.39.5