From 0b049bd68e63ac7d4be00a2e0d110519070ef4d9 Mon Sep 17 00:00:00 2001 From: wassname Date: Sun, 25 Jun 2023 17:57:36 +0800 Subject: [PATCH] making it work with slashes --- source/scripts/services/fetch.js.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/scripts/services/fetch.js.coffee b/source/scripts/services/fetch.js.coffee index 9725a7d..32ff8e5 100644 --- a/source/scripts/services/fetch.js.coffee +++ b/source/scripts/services/fetch.js.coffee @@ -6,7 +6,7 @@ angular.module("sideBySide").factory "fetch", # @param base [String] Path to config file directory # @return [Object] Promises and config data (base) -> - file = base + 'config.json' + file = window.location.href.split('#')[0].replace(/\/$/, '') + '/config.json' $http.get(file).then (config) -> if typeof config.data != "object" throw "Config file " + file + " doesn't contain data." @@ -15,7 +15,7 @@ angular.module("sideBySide").factory "fetch", throw "Config doesn't contain a list of files." promises = config.data.files.map (poem) -> - $http.get(base + poem).then (response) -> + $http.get(window.location.href.split('#')[0].replace(/\/$/, '') + '/' + poem).then (response) -> readerFactory(poem) response.data {