diff --git a/Chrome Extension/script.js b/Chrome Extension/script.js
index 228dfbc6..2abad384 100644
--- a/Chrome Extension/script.js
+++ b/Chrome Extension/script.js
@@ -15,13 +15,26 @@ function ffz_init()
var debug = localStorage.ffzDebugMode == "true";
- if ( debug )
- script.src = "//localhost:8000/script/script.js";
- else
- script.src = "//cdn.frankerfacez.com/script/script.min.js";
+ if ( debug ) {
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", "http://localhost:8000/dev_server", true);
+ xhr.onload = function(e) {
+ var resp = JSON.parse(xhr.responseText);
+ console.log("FFZ: Development Server is present. Version " + resp.version + " running from: " + resp.path);
+ script.src = "//localhost:8000/script/script.js";
+ document.body.classList.add("ffz-dev");
+ document.head.appendChild(script);
+ };
+ xhr.onerror = function(e) {
+ console.log("FFZ: Development Server is not present. Using CDN.");
+ script.src = "//cdn.frankerfacez.com/script/script.min.js";
+ document.head.appendChild(script);
+ };
+ return xhr.send(null);
+ }
- var head = document.getElementsByTagName('head')[0];
- if(head) head.appendChild(script);
+ script.src = "//cdn.frankerfacez.com/script/script.min.js";
+ document.head.appendChild(script);
}
ffz_init();
\ No newline at end of file
diff --git a/src/constants.js b/src/constants.js
index 94047010..11f85158 100644
--- a/src/constants.js
+++ b/src/constants.js
@@ -1,5 +1,5 @@
var SVGPATH = '',
- DEBUG = localStorage.ffzDebugMode == "true";
+ DEBUG = localStorage.ffzDebugMode == "true" && document.body.classList.contains('ffz-dev');
module.exports = {
DEBUG: DEBUG,
diff --git a/src/debug.js b/src/debug.js
index 1a87ef40..fe1d2093 100644
--- a/src/debug.js
+++ b/src/debug.js
@@ -1,11 +1,11 @@
var FFZ = window.FrankerFaceZ;
-// --------------------
-// Debug Command
-// --------------------
+// -----------------------
+// Developer Mode Command
+// -----------------------
-FFZ.chat_commands.debug = function(room, args) {
+FFZ.chat_commands.developer_mode = function(room, args) {
var enabled, args = args && args.length ? args[0].toLowerCase() : null;
if ( args == "y" || args == "yes" || args == "true" || args == "on" )
enabled = true;
@@ -13,10 +13,10 @@ FFZ.chat_commands.debug = function(room, args) {
enabled = false;
if ( enabled === undefined )
- enabled = !(localStorage.ffzDebugMode == "true");
+ return "Developer Mode is currently " + (localStorage.ffzDebugMode == "true" ? "enabled." : "disabled.");
localStorage.ffzDebugMode = enabled;
- return "Debug Mode is now " + (enabled ? "enabled" : "disabled") + ". Please refresh your browser.";
+ return "Developer Mode is now " + (enabled ? "enabled" : "disabled") + ". Please refresh your browser.";
}
-FFZ.chat_commands.debug.help = "Usage: /ffz debug [on|off]\nEnable or disable Debug Mode. When Debug Mode is enabled, the script will be reloaded from //localhost:8000/script.js instead of from the CDN.";
\ No newline at end of file
+FFZ.chat_commands.developer_mode.help = "Usage: /ffz developer_mode \nEnable or disable Developer Mode. When Developer Mode is enabled, the script will be reloaded from //localhost:8000/script.js instead of from the CDN.";