autoahk.com快速水(写)文章(签到水经验)小工具

2022/8/17 上午8:55:38

// ==UserScript==
// @name        autoahk.com快速水(写)文章(签到水经验)小工具
// @namespace   Violentmonkey Scripts
// @include	   	*://www.autoahk.com/*
// @grant       none
// @version     1.1
// @author      -
// @description 2022/8/17 上午8:55:38
// ==/UserScript==




window.onkeydown = function(event) {  //添加图片^1
    if (event.ctrlKey && event.keyCode === 49) {
        document.querySelector("#b2-editor-box > div.tox.tox-tinymce.tox-tinymce--toolbar-sticky-off > div.tox-editor-container > div.tox-editor-header > div.tox-toolbar-overlord > div > div:nth-child(3) > button:nth-child(2)").click();
  DelayClick("#b2-editor-box > div.trix-dialog.trix-dialog--images.modal.show-modal > div > label");
    }
    else if (event.ctrlKey && event.keyCode === 50) { //添加代码^2
        document.querySelector("#b2-editor-box > div.tox.tox-tinymce.tox-tinymce--toolbar-sticky-off > div.tox-editor-container > div.tox-editor-header > div.tox-toolbar-overlord > div > div:nth-child(2) > button:nth-child(3)").click();
  // DelayClick("#b2-editor-box > div.trix-dialog.trix-dialog--images.modal.show-modal > div > label");
    }
    else if (event.ctrlKey && event.keyCode === 51) { //添加视频^3
        document.querySelector("#b2-editor-box > div.tox.tox-tinymce.tox-tinymce--toolbar-sticky-off > div.tox-editor-container > div.tox-editor-header > div.tox-toolbar-overlord > div > div:nth-child(3) > button:nth-child(3)").click()
;
  DelayClick("#b2-editor-box > div.trix-dialog.trix-dialog--video.modal.show-modal > div > label");
    }
    else if (event.ctrlKey && event.keyCode === 52) { //签到
document.querySelector("#content > div.aside-container > div.aside-bar > div > div.bar-normal > div.bar-item.bar-mission").click();
      DelayClick("#content > div.aside-container > div.bar-user-info > div > div > div.bar-user-info-row.bar-mission-action > div");
  }
}




function DelayClick(selector, delay){
 delay = delay || 100;
 setTimeout(function(){
        elem = document.querySelector(selector)
  elem ?  elem.click() : DelayClick(selector, delay);
 }, delay);
}