summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorCheng-Han, Wu2016-03-04 23:09:50 +0800
committerCheng-Han, Wu2016-03-04 23:09:50 +0800
commit1c859248e004f3289eefce2522cf8af75d280695 (patch)
tree09f8da8f6ff5b3e920756b23447dd6ddec6b6b7c /public
parent8b16e0723d836a2564eaee029c3e891ef28afb2e (diff)
Updated to ignore process image which already wrapped by link node
Diffstat (limited to 'public')
-rw-r--r--public/js/extra.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/public/js/extra.js b/public/js/extra.js
index a82a53c2..e0f78b22 100644
--- a/public/js/extra.js
+++ b/public/js/extra.js
@@ -260,19 +260,22 @@ function finishView(view) {
//image href new window(emoji not included)
var images = view.find("img.raw[src]").removeClass("raw");
images.each(function (key, value) {
+ // if it's already wrapped by link, then ignore
+ var $value = $(value);
+ if ($value.parent()[0].nodeName === 'A') return;
var src = $(value).attr('src');
var a = $('<a>');
if (src) {
a.attr('href', src);
a.attr('target', "_blank");
}
- var clone = $(value).clone();
+ var clone = $value.clone();
clone[0].onload = function (e) {
if(viewAjaxCallback)
viewAjaxCallback();
};
a.html(clone);
- $(value).replaceWith(a);
+ $value.replaceWith(a);
});
//blockquote
var blockquote = view.find("blockquote.raw").removeClass("raw");