Custom wjx_autoform

问卷星自动表单

  1. // ==UserScript==
  2. // @name Custom wjx_autoform
  3. // @namespace https://github.com/invobzvr
  4. // @version 0.1
  5. // @description 问卷星自动表单
  6. // @author invobzvr
  7. // @match *://www.wjx.cn/vm/*
  8. // @grant GM_getValue
  9. // @grant GM_listValues
  10. // @grant GM_setValue
  11. // @run-at document-start
  12. // @homepageURL https://github.com/invobzvr/invotoys.js/tree/main/wjx_autoform
  13. // @supportURL https://github.com/invobzvr/invotoys.js/issues
  14. // @license GPL-3.0
  15. // ==/UserScript==
  16.  
  17. (function () {
  18. function configurations() {
  19. return GM_listValues().map(key => [key, GM_getValue(key)]);
  20. }
  21.  
  22. function autoForm() {
  23. let label, input, configs = configurations();
  24. for (let field of document.querySelectorAll('.ui-field-contain')) {
  25. label = field.querySelector('.field-label').innerText;
  26. for (let [key, val] of configs) {
  27. if (label.match(key) && (input = field.querySelector('input'))) {
  28. input.value = val;
  29. break;
  30. }
  31. }
  32. }
  33. }
  34.  
  35. addEventListener('DOMContentLoaded', autoForm);
  36. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址