Skip to content

Node.js based forum software built for the modern web

another fix for js crashes

Baris Soner Usaklif7f5da00e177
diff --git a/public/src/app.js b/public/src/app.js
index a22b93749a..16414c8ca7 100644
--- a/public/src/app.js
+++ b/public/src/app.js
@@ -1,12 +1,10 @@
var socket,
config,
app = {},
- API_URL = null,
- RELATIVE_PATH = null;
+ API_URL = null;
+
-// todo: cleanup,etc
(function() {
- RELATIVE_PATH = $('#relative_path').attr('value');
function loadConfig() {
@@ -105,6 +103,8 @@ var socket,
});
}
+
+
// takes a string like 1000 and returns 1,000
app.addCommas = function(text) {
return text.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
@@ -238,7 +238,7 @@ var socket,
jQuery('document').ready(function() {
- loadConfig();
+
// On menu click, change "active" state
var menuEl = document.querySelector('.nav'),
@@ -260,7 +260,7 @@ var socket,
addTouchEvents();
});
-
+ loadConfig();
function addTouchEvents() {
diff --git a/public/templates/admin/header.tpl b/public/templates/admin/header.tpl
index a1f0fd7693..e600daf0f6 100644
--- a/public/templates/admin/header.tpl
+++ b/public/templates/admin/header.tpl
@@ -3,7 +3,9 @@
<head>
<title>NodeBB Administration Panel</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta id="relative_path" template-variable="relative_path" value="{relative_path}" />
+ <script>
+ var RELATIVE_PATH = "{relative_path}";
+ </script>
<link id="base-theme" href="{cssSrc}" rel="stylesheet" media="screen">
<link href="{relative_path}/vendor/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
<link rel="stylesheet" href="{relative_path}/vendor/fontawesome/css/font-awesome.min.css">
diff --git a/public/templates/header.tpl b/public/templates/header.tpl
index 54455b5929..a9b9458d9c 100644
--- a/public/templates/header.tpl
+++ b/public/templates/header.tpl
@@ -8,9 +8,9 @@
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="apple-mobile-web-app-capable" content="yes" />
-
- <meta id="relative_path" template-variable="relative_path" value="{relative_path}" />
-
+ <script>
+ var RELATIVE_PATH = "{relative_path}";
+ </script>
<link href="{cssSrc}" rel="stylesheet" media="screen">
<link href="{relative_path}/vendor/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
<link rel="stylesheet" href="{relative_path}/vendor/fontawesome/css/font-awesome.min.css">