waitUntilExists

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

このスクリプトは単体で利用できません。右のようなメタデータを含むスクリプトから、ライブラリとして読み込まれます: // @require https://update.greatest.deepsurf.us/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));