limix / gaokao_query

// ==UserScript==
// @name         gaokao_query
// @require      https://code.jquery.com/jquery-3.6.0.min.js
// @namespace    http://www.limix.site/
// @version      0.1
// @description  查询你的高考录取结果
// @author       limix
// @match        http://cx.ahzsks.cn/pugao/pglq2021_in-00b8bd3f-d5c8-4f90-b4e7-1b76cf147bbd.php
// @icon         https://www.google.com/s2/favicons?domain=ahzsks.cn
// @grant        none
// @license CC-BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode
// @license MIT
// @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt
// ==/UserScript==
// post-submit callback
(function () {
  'use strict';

  // Your code here...
  var element = document.evaluate("/html/body/form/div[1]/div[9]", document).iterateNext();
  document.getElementById("yzm").value = element.textContent
  document.getElementById("ksh").value = "21341524111474"
  document.getElementById("sfzh").value = "34242620021002322X"
  var items = {};
  items['yzm'] = element.textContent;
  items['ksh'] = "21341524111474";
  items['sfzh'] = "34242620021002322X";
  $.ajax({
    url: $('#frm').attr("action"),
    type: 'post',
    data: items,
    async: false,
    success: function (e) {
      var result = jQuery(e)
      if (result.text().indexOf("暂无录取信息") > 1) {
        console.log("暂无结果");
      }
      else {
        alert(result.text());
        alert("输出结果", result.text());
      }
    }
  });

  function myreload() {
    location.reload()
  }
  setTimeout(myreload, 5000);
})();