From 5fe3347bf020af401ab3abaa7d127aa7052fd2fe Mon Sep 17 00:00:00 2001 From: pypy Date: Tue, 14 Jan 2020 23:34:05 +0900 Subject: [PATCH] code cleanup --- html/app.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/html/app.js b/html/app.js index 753082f3..0ee292f0 100644 --- a/html/app.js +++ b/html/app.js @@ -6393,15 +6393,21 @@ CefSharp.BindObjectAsync( D.instanceId = tags.join(''); }; + var getLaunchURL = function (worldId, instanceId) { + if (instanceId) { + return `https://vrchat.net/launch?worldId=${encodeURIComponent(worldId)}&instanceId=${encodeURIComponent(instanceId)}`; + } + return `https://vrchat.net/launch?worldId=${encodeURIComponent(worldId)}`; + }; + var updateLocationURL = function () { var D = this.newInstanceDialog; if (D.instanceId) { D.location = `${D.worldId}:${D.instanceId}`; - D.url = `https://vrchat.net/launch?worldId=${encodeURIComponent(D.worldId)}&instanceId=${encodeURIComponent(D.instanceId)}`; } else { D.location = D.worldId; - D.url = `https://vrchat.net/launch?worldId=${encodeURIComponent(D.worldId)}`; } + D.url = getLaunchURL(D.worldId, D.instanceId); }; $app.watch['newInstanceDialog.worldId'] = updateLocationURL; $app.watch['newInstanceDialog.instanceId'] = updateLocationURL; @@ -6472,11 +6478,10 @@ CefSharp.BindObjectAsync( var D = this.launchDialog; if (L.instanceId) { D.location = `${L.worldId}:${L.instanceId}`; - D.url = `https://vrchat.net/launch?worldId=${encodeURIComponent(L.worldId)}&instanceId=${encodeURIComponent(L.instanceId)}`; } else { D.location = L.worldId; - D.url = `https://vrchat.net/launch?worldId=${encodeURIComponent(L.worldId)}`; } + D.url = getLaunchURL(L.worldId, L.instanceId); D.visible = true; };