// ==UserScript== // @name Custom yz_tj // @namespace https://github.com/invobzvr // @version 0.3 // @description 研招网调剂增强 // @author invobzvr // @match *://yz.chsi.com.cn/sytj/tj/qecx.html* // @grant unsafeWindow // @grant GM_addStyle // @grant GM_getValue // @grant GM_setValue // @require https://greasyfork.org/scripts/443030-hook-js/code/Hookjs.js?version=1037826 // @homepageURL https://github.com/invobzvr/invotoys.js/tree/main/yz_tj // @supportURL https://github.com/invobzvr/invotoys.js/issues // @license GPL-3.0 // @downloadURL none // ==/UserScript== (function () { function inithook() { XMLHttpRequest.prototype.open.hook({ scope: XMLHttpRequest.prototype, before: function () { if (arguments[1].endsWith('/sytj/stu/sytjqexxcx.action')) { this.addEventListener('readystatechange', () => { if (this.readyState !== 4) { return; } let ret = JSON.parse(this.responseText); ret.data.vo_list.vos = ret.data.vo_list.vos.filter(ii => !ii.sfmzjybyq && !ii.sfmzyq).sort((a, b) => a.gxsj - b.gxsj); Object.defineProperty(this, 'responseText', { value: JSON.stringify(ret) }); }); } } }); unsafeWindow.template_zytb_add && unsafeWindow.template_zytb_add.hook({ scope: unsafeWindow, before: function (id) { if (zy_status.cur_num < zy_status.max_num) { open(`tbtjzy.html?zy_type=1&id=${id}`); return null; } } }); unsafeWindow.change_seach && unsafeWindow.change_seach.hook({ scope: unsafeWindow, after: function () { let stype = arguments[1][1]; GM_setValue('stype', stype); if (stype === 'accurate') { return; } let dwxx = document.querySelector('[name=dwmc2]'), tjBtn = document.querySelector('.tj-seach-btn'), ddb = dwxx.insertAdjacentElement('afterend', document.createElement('div')); ddb.className = 'dropdown-box'; dwxx.parentElement.style.position = 'relative'; dwxx.addEventListener('keydown', evt => evt.keyCode === 13 && tjBtn.click()); dwxx.addEventListener('click', evt => { evt.stopPropagation(); if (keywords.length) { ddb.classList.add('show'); ddb.innerHTML = keywords.map(ii => `