Skip to content

Node.js based forum software built for the modern web

feat: remove global RELATIVE_PATH

Barış Soner Uşaklı19c448612d38
diff --git a/public/.eslintrc b/public/.eslintrc
index 2f938bb71a..d328902f77 100644
--- a/public/.eslintrc
+++ b/public/.eslintrc
@@ -5,7 +5,6 @@
"socket": true,
"ajaxify": true,
"config": true,
- "RELATIVE_PATH": true,
"utils": true,
"overrides": true,
"componentHandler": true,
diff --git a/public/.jshintrc b/public/.jshintrc
index 5201bccc62..0b65b2f3db 100644
--- a/public/.jshintrc
+++ b/public/.jshintrc
@@ -63,7 +63,6 @@
"socket": true,
"ajaxify": true,
"config": true,
- "RELATIVE_PATH": true,
"utils": true,
"overrides": true,
"componentHandler": true,
diff --git a/public/src/admin/dashboard.js b/public/src/admin/dashboard.js
index 5f0fe60a68..b410d0d9bb 100644
--- a/public/src/admin/dashboard.js
+++ b/public/src/admin/dashboard.js
@@ -521,12 +521,14 @@ define('admin/dashboard', ['semver', 'Chart', 'translator', 'benchpress'], funct
function buildTopicsLegend() {
var legend = $('#topics-legend').html('');
var html = '';
- topics.forEach(function (topic, i) {
- var label = topic.count === '0' ? topic.title : '<a title="' + topic.title + '"href="' + RELATIVE_PATH + '/topic/' + topic.tid + '" target="_blank"> ' + topic.title + '</a>';
+ topics.forEach(function (t, i) {
+ var label = t.count === '0' ?
+ t.title :
+ '<a title="' + t.title + '"href="' + config.relative_path + '/topic/' + t.tid + '" target="_blank"> ' + t.title + '</a>';
html += '<li>' +
'<div style="background-color: ' + topicColors[i] + ';"></div>' +
- '<span> (' + topic.count + ') ' + label + '</span>' +
+ '<span> (' + t.count + ') ' + label + '</span>' +
'</li>';
});
legend.translateHtml(html);
diff --git a/public/src/admin/extend/widgets.js b/public/src/admin/extend/widgets.js
index 4f5ff845fd..4991b9e6d2 100644
--- a/public/src/admin/extend/widgets.js
+++ b/public/src/admin/extend/widgets.js
@@ -203,7 +203,7 @@ define('admin/extend/widgets', ['jqueryui'], function () {
return widget;
}
- $.get(RELATIVE_PATH + '/api/admin/extend/widgets', function (data) {
+ $.get(config.relative_path + '/api/admin/extend/widgets', function (data) {
var areas = data.areas;
for (var i = 0; i < areas.length; i += 1) {
diff --git a/public/src/client/topic.js b/public/src/client/topic.js
index af5e903e10..073cb393b1 100644
--- a/public/src/client/topic.js
+++ b/public/src/client/topic.js
@@ -235,7 +235,7 @@ define('forum/topic', [
history.replaceState({
url: newUrl + search,
- }, null, window.location.protocol + '//' + window.location.host + RELATIVE_PATH + '/' + newUrl + search);
+ }, null, window.location.protocol + '//' + window.location.host + config.relative_path + '/' + newUrl + search);
}
currentUrl = newUrl;
}, 500);
diff --git a/src/views/admin/header.tpl b/src/views/admin/header.tpl
index d6eba4b640..a0f5fef1e3 100644
--- a/src/views/admin/header.tpl
+++ b/src/views/admin/header.tpl
@@ -8,10 +8,8 @@
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<script>
- var RELATIVE_PATH = "{relative_path}";
var config = JSON.parse('{{configJSON}}');
var app = {
- template: "{template.name}",
user: JSON.parse('{{userJSON}}'),
config: JSON.parse(decodeURIComponent("{{adminConfigJSON}}")),
flags: {},