summaryrefslogtreecommitdiff
path: root/public/js/extra.js
diff options
context:
space:
mode:
authorWu Cheng-Han2015-07-02 20:29:31 +0800
committerWu Cheng-Han2015-07-02 20:29:31 +0800
commitf8ef5341c70a2aee6b22751eebc500ed24c7825f (patch)
treec179325c94fe94df8e0a8071b3f555895210c570 /public/js/extra.js
parent71303791a6edaf5d4b3923115ec898ea49a1b135 (diff)
Optimized image rendering, avoid duplicated image load when content changed
Diffstat (limited to 'public/js/extra.js')
-rw-r--r--public/js/extra.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/public/js/extra.js b/public/js/extra.js
index f6d47647..084ebe8a 100644
--- a/public/js/extra.js
+++ b/public/js/extra.js
@@ -128,7 +128,7 @@ function finishView(view) {
}
});
//image href new window(emoji not included)
- var images = view.find("p > img[src]:not([class])");
+ var images = view.find("img.raw[src]").removeClass("raw");
images.each(function (key, value) {
var src = $(value).attr('src');
var a = $('<a>');
@@ -136,7 +136,12 @@ function finishView(view) {
a.attr('href', src);
a.attr('target', "_blank");
}
- a.html($(value).clone());
+ var clone = $(value).clone();
+ clone[0].onload = function (e) {
+ if(viewAjaxCallback)
+ viewAjaxCallback();
+ };
+ a.html(clone);
$(value).replaceWith(a);
});
//blockquote