From 51c361300ff7cbfe029f0319645a6623d0e58348 Mon Sep 17 00:00:00 2001 From: Lex Lim Date: Sun, 16 Jul 2023 13:42:17 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E4=BB=BB=E5=8A=A1=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E8=8E=B7=E5=8F=96=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Quests/includes/Hooks.php | 8 ------- ...t.isekai.userpoints.quests.notification.js | 22 +++++++------------ 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/Quests/includes/Hooks.php b/Quests/includes/Hooks.php index 1e3c249..5976598 100644 --- a/Quests/includes/Hooks.php +++ b/Quests/includes/Hooks.php @@ -67,13 +67,5 @@ class Hooks { public static function onBeforePageDisplay(OutputPage $out, $skin) { $out->addModules(['ext.isekai.userpoints.quests.notification']); - - $sessionManager = SessionManager::getGlobalSession(); - if ($sessionManager->exists(QuestsUtils::SESSION_KEY_QUEST_COMPLETE_NOTIFICATION)) { - $out->addJsConfigVars([ - 'wgIsekaiQuestsCompleteNotification' => $sessionManager->get(QuestsUtils::SESSION_KEY_QUEST_COMPLETE_NOTIFICATION), - ]); - $sessionManager->remove(QuestsUtils::SESSION_KEY_QUEST_COMPLETE_NOTIFICATION); - } } } diff --git a/Quests/modules/ext.isekai.userpoints.quests.notification.js b/Quests/modules/ext.isekai.userpoints.quests.notification.js index 2d459b1..63622b4 100644 --- a/Quests/modules/ext.isekai.userpoints.quests.notification.js +++ b/Quests/modules/ext.isekai.userpoints.quests.notification.js @@ -52,18 +52,12 @@ function onQuestsCompleteNotification(notificationData) { mw.hook('postEdit').add(function (data) { console.log('onPostEdit'); - var notificationData = mw.config.get('wgIsekaiQuestsCompleteNotification'); - if (notificationData) { - onQuestsCompleteNotification(notificationData); - } else { - // VE,通过API获取消息 - var mwApi = new mw.Api(); - mwApi.get({ - action: 'userquestsgetnotification', - }).done(function (data) { - if (data.userquestsgetnotification && data.userquestsgetnotification.notification) { - onQuestsCompleteNotification(data.userquestsgetnotification.notification); - } - }); - } + var mwApi = new mw.Api(); + mwApi.get({ + action: 'userquestsgetnotification', + }).done(function (data) { + if (data.userquestsgetnotification && data.userquestsgetnotification.notification) { + onQuestsCompleteNotification(data.userquestsgetnotification.notification); + } + }); }); \ No newline at end of file