From fdf3012adebdbf18009ac20203f470d4eab726d8 Mon Sep 17 00:00:00 2001 From: Victor Date: Sun, 6 Dec 2015 20:35:55 +0200 Subject: [PATCH] Refactoring: extract base resources directory --- public_html/js/Utils.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/public_html/js/Utils.js b/public_html/js/Utils.js index a6f020a..4999312 100644 --- a/public_html/js/Utils.js +++ b/public_html/js/Utils.js @@ -1,3 +1,6 @@ +var baseResDir = 'file:///E:/everlastingsummer/'; +//var baseResDir = '/resources/es/'; + function FadeInfo() { this.fadeIn = false; this.fadeOut = false; @@ -49,25 +52,23 @@ function toColor(num) { var PathResolver = new function () { this.background = function (type, name) { - return "file:///E:/everlastingsummer/" + type.toLowerCase() + "/" + name + ".jpg"; + return baseResDir + type.toLowerCase() + "/" + name + ".jpg"; }; this.sprite = function (whoid, params) { - var path = "file:///E:/everlastingsummer/sprites/"; + var path = baseResDir + "sprites/"; path += whoid.toLowerCase() + "/"; path += (TextUtils.isEmpty(params) ? "normal" : params); path += ".png"; return path; }; this.music = function (name) { -// return "resources/music/" + name + ".ogg"; - return "file:///E:/everlastingsummer/music/" + name + ".ogg"; + return baseResDir + "music/" + name + ".ogg"; }; this.sound = function (name) { - var path = "file:///E:/everlastingsummer/sfx/"; + var path = baseResDir + "sfx/"; if (path.startsWith("sfx_")) path += name.substring(4); else path += name; path += ".ogg"; return path; -// return "resources/music/" + name + ".ogg"; }; }; \ No newline at end of file