From 12e8f7f45f7f6575db474d60d02af5d3d0f9486a Mon Sep 17 00:00:00 2001 From: pypy Date: Sun, 12 Jan 2020 21:50:12 +0900 Subject: [PATCH] chagne menu item order, cleanup code --- html/app.js | 46 ++++++++++++++++++++++++++-------------------- html/index.html | 8 +++++--- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/html/app.js b/html/app.js index 828151fb..e994715f 100644 --- a/html/app.js +++ b/html/app.js @@ -1803,6 +1803,20 @@ CefSharp.BindObjectAsync( return ''; }; + API.parseInviteLocation = function (ref) { + try { + var L = API.parseLocation(ref.details.worldId); + if (L.worldId !== '' && L.instanceId !== '') { + return `${ref.details.worldName} #${L.instanceName} ${L.accessType}`; + } + return ref.message || + ref.details.worldId || + ref.details.worldName; + } catch (err) { + return ''; + } + }; + // API: PlayerModeration API.cachedPlayerModerations = new Map(); @@ -4834,20 +4848,21 @@ CefSharp.BindObjectAsync( }); API.$on('PLAYER-MODERATION', function (args) { + var { ref } = args; var insertOrUpdate = $app.playerModerationTable.data.some((val, idx, arr) => { - if (val.id === args.ref.id) { - if (args.ref.$isExpired) { + if (val.id === ref.id) { + if (ref.$isExpired) { Vue.delete(arr, idx); } else { - Vue.set(arr, idx, args.ref); + Vue.set(arr, idx, ref); } return true; } return false; }); if (!insertOrUpdate && - !args.ref.$isExpired) { - $app.playerModerationTable.data.push(args.ref); + !ref.$isExpired) { + $app.playerModerationTable.data.push(ref); $app.notifyMenu('moderation'); } }); @@ -4920,20 +4935,21 @@ CefSharp.BindObjectAsync( }); API.$on('NOTIFICATION', function (args) { + var { ref } = args; var insertOrUpdate = $app.notificationTable.data.some((val, idx, arr) => { - if (val.id === args.ref.id) { - if (args.ref.$isExpired) { + if (val.id === ref.id) { + if (ref.$isExpired) { Vue.delete(arr, idx); } else { - Vue.set(arr, idx, args.ref); + Vue.set(arr, idx, ref); } return true; } return false; }); if (!insertOrUpdate && - !args.ref.$isExpired) { - $app.notificationTable.data.push(args.ref); + !ref.$isExpired) { + $app.notificationTable.data.push(ref); $app.notifyMenu('notification'); } }); @@ -4948,16 +4964,6 @@ CefSharp.BindObjectAsync( }); }); - $app.methods.parseInviteLocation = function (row) { - try { - var L = API.parseLocation(row.details.worldId); - return `${row.details.worldName} #${L.instanceName} ${L.accessType}`; - } catch (err) { - console.error(err); - return ''; - } - }; - $app.methods.acceptNotification = function (row) { // FIXME: 메시지 수정 this.$confirm('Continue? Accept Friend Request', 'Confirm', { diff --git a/html/index.html b/html/index.html index f7217962..b61e6d28 100644 --- a/html/index.html +++ b/html/index.html @@ -510,7 +510,7 @@