Greasy Fork is available in English.

jQuery-loadedNode

检测节点是否完全加载

بۇ قوليازمىنى بىۋاسىتە قاچىلاشقا بولمايدۇ. بۇ باشقا قوليازمىلارنىڭ ئىشلىتىشى ئۈچۈن تەمىنلەنگەن ئامبار بولۇپ، ئىشلىتىش ئۈچۈن مېتا كۆرسەتمىسىگە قىستۇرىدىغان كود: // @require https://update.greatest.deepsurf.us/scripts/399868/790609/jQuery-loadedNode.js

  1. // ==UserScript==
  2. // @name jQuery-loadedNode
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.3
  5. // @description 检测节点是否完全加载
  6. // @author YiJie
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10. (function() {
  11. 'use strict';
  12. try{
  13. if(typeof jQuery=="undefined") return;
  14. }catch{return;}
  15. jQuery.fn.loadedNode = function (selector, func, times, interval) {
  16. var _times = times || -1,
  17. _interval = interval || 100,
  18. _self = $(_selector),
  19. _selector = selector,
  20. _iIntervalID;
  21. if( _self.length ){
  22. func && func.call(_self);
  23. } else {
  24. _iIntervalID = setInterval(function() {
  25. if(!_times) {
  26. clearInterval(_iIntervalID);
  27. }
  28. _times <= 0 || _times--;
  29. _self = $(_selector);
  30. if( _self.length ) {
  31. func && func.call(_self);
  32. clearInterval(_iIntervalID);
  33. }
  34. }, _interval);
  35. }
  36. return this;
  37. }
  38. })();