nike / Kamihime Project R - Skip pending battle check

// ==UserScript==
// @name         Kamihime Project R - Skip pending battle check
// @description  Skips pending battle check when clicking on raid from raid list. Should help people stuck in pending battle bug (Oph+ mostly)
// @updateURL    https://openuserjs.org/meta/nike/Kamihime_Project_R_-_Skip_pending_battle_check.meta.js
// @license      MIT
// @match        https://gnkh-api-r.prod.nkh.dmmgames.com/front/cocos2d-proj/components-pc/game/app.html
// @run-at       document-start
// ==/UserScript==
(function () {
  var interval = setInterval(function () {
      if (typeof kh !== 'undefined' && kh.pc && kh.pc.quest && kh.pc.quest.q_006_007_008 && kh.pc.quest.q_006_007_008.SceneDelegate) {
        clearInterval(interval)
        kh.pc.quest.q_006_007_008.SceneDelegate.prototype._touchRaidPanel = function (widget, record) {
          var scene = cc.director.getRunningScene();

          if (record.is_joined) {
            // 参戦済みのレイドバトルに復帰
            kh.createInstance("router").navigate("battle", {
              "quest_type": record.quest_type,
              "a_quest_id": record.a_quest_id,
              "a_battle_id": record.a_battle_id,
              "is_own_raid": record.is_own_raid,
              "a_player_id": this.player.a_player_id
            });

            return;
          }
          else if (this.joinCount >= 3) {
            this._showPopupReachedRaidMax(scene);
          }
          else if (this.questPoint.bp < record.battle_bp) {
            // BP 不足

            var api = kh.createInstance("apiAItems");
            Q.all([
              api.getBpGain(),
              this.updateQuestPoints()
            ]).spread(function (items, questPoints) {

              this._needApBpPopupFactory = kh.createInstance("popupFactoryComNeedApBp");
              this._needApBpPopupFactory.create({
                property: "BP",
                questTitle: "Lv" + record.enemy_level + " " + record.enemy_name,
                questPoints: this.questPoint,
                items: items.body,
                component: "quest",
                onUse: this._onUseBpItem.bind(this, widget, record),
                needBattleBp: record.battle_bp
              }).open();

            }.bind(this)).fail(function (err) {
              console.error(err.stack)
            });

          }
          else {
            // 新規参戦
            var recommendedElementType = record.recommended_element_type;
            this._navigate006To009(record, this.player.a_player_id, recommendedElementType);
            return;
          }
        }
      }
    },
    10);
})();