From 929047b6a5a898006c7ba4d1613b774e1035cde1 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Mon, 28 May 2018 10:16:00 +0300 Subject: [PATCH] Replace URIjs with native URLSearchParams --- client/js/socket-events/configuration.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/client/js/socket-events/configuration.js b/client/js/socket-events/configuration.js index e2674b9a..3465cdb3 100644 --- a/client/js/socket-events/configuration.js +++ b/client/js/socket-events/configuration.js @@ -1,7 +1,6 @@ "use strict"; const $ = require("jquery"); -const URI = require("urijs"); const socket = require("../socket"); const templates = require("../../views"); const options = require("../options"); @@ -86,10 +85,10 @@ socket.on("configuration", function(data) { }); }); - if ($(document.body).hasClass("public")) { - const params = URI(document.location.search).search(true); + if ($(document.body).hasClass("public") && "URLSearchParams" in window) { + const params = new URLSearchParams(document.location.search); - for (let key in params) { + for (let [key, value] of params) { // Support `channels` as a compatibility alias with other clients if (key === "channels") { key = "join"; @@ -99,8 +98,6 @@ socket.on("configuration", function(data) { continue; } - let value = params[key]; - if (key === "join") { value = value.split(",").map((chan) => { if (!chan.match(/^[#&!+]/)) {