<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">/* eslint-disable */
'use strict';

(function () {
  var appointment2_plan_a = $('.appointment2-click-a');// 鏂版父棰勭害2.0 鎷夎捣棰勭害鐐瑰嚮鎸夐挳

  var appointment_plan_a = $('.appointment-click-a'); // a鏂规鐐瑰嚮鎸夐挳
  var appointment_plan_b = $('.appointment-click-b'); // b鏂规鐐瑰嚮鎸夐挳
  var appointment_down = $('.ui-click-appointment-down'); // 涓嬭浇app鎻愮ず寮圭獥
  var appointment_tic = $('.ui-click-appointment-tic'); // 鎷夎捣鎻愮ず寮圭獥
  var appointment_phone = $('.ui-click-appointment-phone'); // 杈撳叆鎵嬫満鍙风爜寮圭獥
  var appointment_success = $('.ui-click-appointment-success'); // 棰勭害鎴愬姛寮圭獥
  var appointment_bottom_btn = $('.yuyue-bottom-btn'); // 搴曢儴棰勭害鎸夐挳
  var app_info = $('#app-game-id');

  // 宸茬粡棰勭害鐨勬敼鍙樻寜閽姸鎬�
  init();

  /*
  * 鏂版父棰勭害2.0 澧為噺杩唬
  * 闇€姹傦細瀵逛簬棰勭害浜嬩欢涓嶅啀浣跨敤鎻愮ず寮圭獥锛岀洿鎺ユ媺璧蜂節娓竌pp
  * 澧為噺鐐癸細 澧炲姞瀵� .appointment2_plan_a 鐨勪簨浠剁洃鍚�
  * 淇敼锛� 瀵逛簬鎷夎捣鎶涘寘浣跨敤share閾炬帴褰㈠紡
  */
  appointment2_plan_a.on('click', function () {
    var _that = this;
    var gameId = app_info.data('gameId');
    var statis = app_info.data('statis')||'';
    var planId = statis.split('_')[4];
    var adCardId = statis.split('_')[5];
    var ch = 'O鈥婯_140';
    var from = 'ugt-web-reserve-'+gameId+'-jihua-'+planId+'_kapian-'+adCardId;
    gameId ? location.href = 'http://web.9game.cn/share?pageType=game_detail&amp;ch='+ch+'&amp;gameId='+gameId+'&amp;pullUpFrom='+from: '';
    window.setTimeout(function(){
      appointment2reserveDone($(_that));
    },500)
  });
// 閽堝2.0棰勭害鎸夐挳鐐瑰嚮鍚庣殑 done 閬僵
  function appointment2reserveDone(){
    for(var i in arguments){
      if (arguments[ i ].parent().attr('class').match(/appointment-2/)){
        arguments[ i ].parent().addClass('done');
      }
    }
  }
// -------鏂版父棰勭害2.0 澧為噺杩唬 end---------

  // plan A
  appointment_plan_a.on('click', function () {
    if (!localStorage.getItem(getKey())) {
      appointment_down.show();
    }
  });

  // plan B
  appointment_plan_b.on('click', function () {
    if (!localStorage.getItem(getKey())) {
      appointment_phone.show();
    }
  });

  // plan A 鐐瑰嚮瀹夎涔濇父app,鎷夎捣棰勭害
  appointment_down.find('.appointment-down-btn').on('click', function () {
    var gameId = app_info.data('gameId');
    gameId ? pullApp(getWakeupCfg(gameId)) : '';
  });

  // plan B 杈撳叆鎵嬫満鍙风爜,鐐瑰嚮棰勭害
  appointment_phone.find('.btn-down').on('click', function () {
    var phone_input = $('.phone-num .num').val();
    var gameId = app_info.data('gameId');
    if (testPhone(phone_input)) {
      ajaxAppointment({
        gameId: gameId,
        mobile: phone_input
      });
    } else {
      appointment_phone.find('.wrong-tic').show();
      if (timter) clearTimeout(timter);
      var timter = setTimeout(function () {
        appointment_phone.find('.wrong-tic').hide();
      }, 2000);
    }
  });

  // plan B 鐐瑰嚮鎴戠煡閬撲簡
  appointment_success.find('.btn-down').on('click', function () {
    appointment_success.hide();
  });

  // 缁熶竴寮圭獥鐐瑰嚮
  var mask_block = $('.mod-mask-block');
  var mask_con = $('.mod-mask-con');
  mask_block.on('click', function () {
    mask_con.hide();
  });

  function init() {
    if (localStorage.getItem(getKey())) {
      var appointment_plan = $('.appointment-text').parent();
      appointment_plan.addClass('unable');
      appointment_plan.find('.desc-tic').html('宸查绾�');
      appointment_bottom_btn.addClass('unable').html('宸查绾�');

      appointment2reserveDone(appointment_plan_b,appointment2_plan_a);
    }

    var yuyue_mask = $('.yuyue-mask');
    var WakeupCfg = getWakeupCfg(app_info.data('gameId'));
    var yuyue_down_url = NineGameClientPullUp.getSchemeDownloadUrl(WakeupCfg);
    if (yuyue_mask.length &gt; 0) {
      var yuyue_down_qrcode = xMan_qrcode({render:'canvas',width:190,height:190,correctLevel:0,text:yuyue_down_url});
      yuyue_mask.find('.qrcode').data('url', yuyue_down_url);
      yuyue_mask.find('.qrcode').append(yuyue_down_qrcode);
    }
  }

  function getKey() {
    var gameId = app_info.data('gameId');
    return 'appointment-' + gameId;
  }

  function pullApp(wakeupCfg) {
    NineGameClientPullUp.wakeup(wakeupCfg, function (error, update, result) {
      if (!error) {
        console.log('鎷夎捣鎴愬姛');
      } else {
        if (update) {
          console.log('鎷夎捣楂橀€熶笅杞藉け璐�, 闇€鍗囩骇, 涓嬭浇鍦板潃: ' + result);
          window.location.href = result;
        } else {
          console.log('鎷夎捣楂橀€熶笅杞藉け璐�, 鏈畨瑁�, 涓嬭浇鍦板潃: ' + result);
          window.location.href = result;
        }
      }
    });
  }

  function getWakeupCfg(gameId) {
    var ch = app_info.data('ch');
    var _actionpath = $('#_actionpath').val();
    return {
      udf: true,
      apkName: 'ninegame_' + ch + '.apk',
      type: 'game_detail',
      action: 'reserve',
      pullUpFrom: 'ugt_game_highspeed_' + gameId + '_' + _actionpath,
      checkTime: 1000,
      ch: ch,
      params: {
        gameId: gameId
      }
    };
  }

  function testPhone(number) {
    return /^1(3|4|5|7|8)[0-9]\d{8}$/.test(number);
  }

  function ajaxAppointment(data) {
    $.ajax({
      type: 'POST',
      url: '/reserve/add',
      data: data,
      dataType: 'json',
      success: function(response) {
        mask_con.hide();
        appointment_success.show();
        var appointment_plan = $('.appointment-text').parent();
        appointment_plan.addClass('unable');
        appointment_plan.find('.desc-tic').html('宸查绾�');
        appointment_bottom_btn.addClass('unable').html('宸查绾�');

        var pc_yuyue = $('.btn-con .yuyue');
        pc_yuyue.each(function () {
          var $this = $(this);
          if (!$this.hasClass('appointment-hhc-btn')) {
            $this.addClass('unable');
            $this.html('&lt;span class="icon"&gt;&lt;/span&gt;宸查绾�');
          } else {
            $this.addClass('no');
            $this.html('宸查绾�');
          }
        });

        appointment2reserveDone(appointment_plan_b);

        localStorage.setItem(getKey(), 'true');
      },
      error: function(error) {
        console.log(error);
      },
    });
  }
})();</pre></body></html>