waitUntilExists

Is a small one function script, my most use one I use..

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.gf.qytechs.cn/scripts/386/5026/waitUntilExists.js

  1. // ==UserScript==
  2. // @name waitUntilExists
  3. // @version 1.0
  4. // @description Is a small one function script, my most use one I use..
  5. // ==/UserScript==
  6.  
  7. (function ($) {
  8. $.fn.waitUntilExists = function (handler, shouldRunHandlerOnce, isChild) {
  9. var found = 'found';
  10. var $this = $(this.selector);
  11. var $elements = $this.not(function () { return $(this).data(found); }).each(handler).data(found, true);
  12. if (!isChild) {
  13. (window.waitUntilExists_Intervals = window.waitUntilExists_Intervals || {})[this.selector] =
  14. window.setInterval(function () { $this.waitUntilExists(handler, shouldRunHandlerOnce,
  15. true); }, 500);
  16. } else if (shouldRunHandlerOnce && $elements.length) {
  17. window.clearInterval(window.waitUntilExists_Intervals[this.selector]);
  18. }
  19. return $this;
  20. }
  21. }(jQuery));

QingJ © 2025

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