1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-24 10:22:23 +00:00

edit ditto.js

This commit is contained in:
ruanyf 2016-01-01 21:08:40 +08:00
parent a37ce6fca3
commit 1af516535c

View File

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