油猴tampermonkey 与jquery 根据传参,自动操作页面

// ==UserScript==
// @name         提现审批同意
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @run-at       document-body
// @match        https://a.58ccp.com/admin/inoutCash/outCash/supplierIndex.jhtml*
// @require      https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js
// @require      https://cdn.bootcdn.net/ajax/libs/lodash.js/4.17.19/lodash.js
// @require      https://cdn.bootcdn.net/ajax/libs/mobx/5.15.5/mobx.umd.js
// @require      https://cdn.bootcdn.net/ajax/libs/layer/3.1.1/layer.min.js
// @require      https://cdn.bootcdn.net/ajax/libs/dayjs/1.8.32/dayjs.min.js
/* globals layer */
/* globals _ */
/* globals mobx */
/* globals dayjs */
/* globals jQuery, $, waitForKeyElements */
// @grant  GM_addStyle
// @grant GM_setClipboard
// ==/UserScript==


// window._jquery = $.noConflict(true);
// window._lodash = _.noConflict();

function getQueryVariable(variable)
{
       var query = window.location.search.substring(1);
       var vars = query.split("&");
       for (var i=0;i<vars.length;i++) {
               var pair = vars[i].split("=");
               if(pair[0] == variable){return pair[1];}
       }
       return(false);
}

function querySelectorIncludesText (selector, text){
  return Array.from(document.querySelectorAll(selector))
    .find(el => el.textContent.includes(text));
}

(function () {
    'use strict';
    var act = getQueryVariable("act");
    if(act=='agree'){
        	setTimeout(function() {
                document.querySelector('.auditDraw').click();
                setTimeout(function() {
                    document.getElementsByName("auditOpinion")[0].value = "同意";
                     setTimeout(function() {
                         querySelectorIncludesText('button', '提交').click();
                    }, 500);
                }, 500);
			}, 1000);
    }
})();

  

上一篇:Spring Cloud【Finchley】实战-07异步下单


下一篇:orb_slam2和3安装