Skip to content

Commit afcdbbe

Browse files
committed
Add httpRoot to LoadSave
1 parent e5e666b commit afcdbbe

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

static/loadSave.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,17 @@ function LoadSave() {
5353
this.modal.find('.save-button').click(_.bind(this.onSaveToBrowserStorage, this));
5454
this.modal.find('.save-file').click(_.bind(this.onSaveToFile, this));
5555

56+
this.base = window.httpRoot;
57+
if (!this.base.endsWith('/')) {
58+
this.base += '/';
59+
}
60+
5661
this.fetchBuiltins();
5762
}
5863

5964
LoadSave.prototype.fetchBuiltins = function () {
6065
return new Promise(_.bind(function (resolve) {
61-
$.getJSON('source/builtin/list', function (list) {
66+
$.getJSON(window.location.origin + this.base + 'source/builtin/list', function (list) {
6267
resolve(list);
6368
});
6469
}, this));
@@ -186,7 +191,7 @@ LoadSave.prototype.onSaveToFile = function (fileEditor) {
186191

187192
LoadSave.prototype.doLoad = function (element) {
188193
// TODO: handle errors. consider promises...
189-
$.getJSON('source/builtin/load/' + element.lang + '/' + element.file,
194+
$.getJSON(window.location.origin + this.base + 'source/builtin/load/' + element.lang + '/' + element.file,
190195
_.bind(function (response) {
191196
this.onLoad(response.file);
192197
}, this));

0 commit comments

Comments
 (0)