Replace URIjs with native URLSearchParams

This commit is contained in:
Pavel Djundik 2018-05-28 10:16:00 +03:00
parent 0de90daa64
commit 929047b6a5

View file

@ -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(/^[#&!+]/)) {