diff --git a/client.js b/client.js index 9f6750cc..1777fb77 100644 --- a/client.js +++ b/client.js @@ -618,7 +618,7 @@ function instanceManagement() { publicIP: config.publicIP, // IP of the server should be global for all instances, so we pull that straight from the config mods:modHashes, instanceName: instance, - playerCount, + playerCount:playerCount.replace(/(\r\n\t|\n|\r\t)/gm, ""), } function callback(err, mac) { diff --git a/static/main.js b/static/main.js index 0cdcc55c..5316a6a7 100644 --- a/static/main.js +++ b/static/main.js @@ -81,6 +81,18 @@ function djb2(str){ } return hash; } + +// get queryString parameters +function getParameterByName(name, url) { + if (!url) url = window.location.href; + name = name.replace(/[\[\]]/g, "\\$&"); + var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), + results = regex.exec(url); + if (!results) return null; + if (!results[2]) return ''; + return decodeURIComponent(results[2].replace(/\+/g, " ")); +} + // callback(err, json) function getJSON(url, callback) { return new Promise((resolve, reject) => {