From 1af516535c2e2e7fd23734567b054cb2665b30db Mon Sep 17 00:00:00 2001 From: ruanyf Date: Fri, 1 Jan 2016 21:08:40 +0800 Subject: [PATCH] edit ditto.js --- js/ditto.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/ditto.js b/js/ditto.js index afd2825..6ee7c5e 100644 --- a/js/ditto.js +++ b/js/ditto.js @@ -193,6 +193,7 @@ function normalize_paths() { $(ditto.content_id + " img").map(function() { var src = $(this).attr("src").replace("./", ""); if ($(this).attr("src").slice(0, 5) !== "http") { + var pathname = location.pathname.substr(0, location.pathname.length - 1); var url = location.hash.replace("#", ""); // split and extract base dir @@ -200,7 +201,7 @@ function normalize_paths() { var base_dir = url.slice(0, url.length - 1).toString(); // normalize the path (i.e. make it absolute) - $(this).attr("src", location.pathname + base_dir + "/" + src); + $(this).attr("src", pathname + base_dir + "/" + src); } }); }