arrive.js (Latest)

arrive.js provides events to watch for DOM elements creation and removal. It makes use of Mutation Observers internally.

Script này sẽ không được không được cài đặt trực tiếp. Nó là một thư viện cho các script khác để bao gồm các chỉ thị meta // @require https://update.greasyfork.org/scripts/519092/1613478/arrivejs%20%28Latest%29.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

/**
 * Minified by jsDelivr using Terser v5.37.0.
 * Original file: /npm/[email protected]/src/arrive.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
var Arrive=function(e,t,n){"use strict";if(e.MutationObserver&&"undefined"!=typeof HTMLElement){var r,o=0,i=(r=HTMLElement.prototype.matches||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector,{matchesSelector:function(e,t){return e instanceof HTMLElement&&r.call(e,t)},addMethod:function(e,t,n){var r=e[t];e[t]=function(){return n.length==arguments.length?n.apply(this,arguments):"function"==typeof r?r.apply(this,arguments):void 0}},callCallbacks:function(e,t,n){if(e.length){t&&t.options.onceOnly&&(e=[e[0]],t.me.unbindEventWithSelectorAndCallback.call(t.target,t.selector,t.callback));for(var r,o=0;r=e[o];o++)r&&r.callback&&r.callback.call(r.elem,r.elem);t&&t.callback&&n&&n.addTimeoutHandler(t.target,t.selector,t.callback,t.options,t.data)}},checkChildNodesRecursively:function(e,t,n,r){for(var o,l=0;o=e[l];l++)n(o,t,r)&&r.push({callback:t.callback,elem:o}),o.childNodes.length>0&&i.checkChildNodesRecursively(o.childNodes,t,n,r)},mergeArrays:function(e,t){var n,r={};for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);for(n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);return r},toElementsArray:function(t){return void 0===t||"number"==typeof t.length&&t!==e||(t=[t]),t}}),l=function(){var e=function(){this._eventsBucket=[],this._beforeAdding=null,this._beforeRemoving=null};return e.prototype.addEvent=function(e,t,n,r,o){var i={target:e,selector:t,options:n,callback:r,data:o,firedElems:[]};return this._beforeAdding&&this._beforeAdding(i),this._eventsBucket.push(i),i},e.prototype.removeEvent=function(e){for(var t,n=this._eventsBucket.length-1;t=this._eventsBucket[n];n--)if(e(t)){this._beforeRemoving&&this._beforeRemoving(t),t.data&&t.data.timeoutId&&clearTimeout(t.data.timeoutId);var r=this._eventsBucket.splice(n,1);r&&r.length&&(r[0].callback=null)}},e.prototype.beforeAdding=function(e){this._beforeAdding=e},e.prototype.beforeRemoving=function(e){this._beforeRemoving=e},e}(),c=function(t,r){var o=new l,c=this,a={fireOnAttributesModification:!1};return o.beforeAdding((function(n){var o,i=n.target;i!==e.document&&i!==e||(i=document.getElementsByTagName("html")[0]),o=new MutationObserver((function(e){r.call(this,e,n)}));var l=t(n.options);o.observe(i,l),n.observer=o,n.me=c})),o.beforeRemoving((function(e){e.observer.disconnect()})),this.bindEvent=function(e,t,n){t=i.mergeArrays(a,t);for(var r=i.toElementsArray(this),l=0;l<r.length;l++){const i={};c.addTimeoutHandler(r[l],e,n,t,i),o.addEvent(r[l],e,t,n,i)}},this.unbindEvent=function(){var e=i.toElementsArray(this);o.removeEvent((function(t){for(var r=0;r<e.length;r++)if(this===n||t.target===e[r])return!0;return!1}))},this.unbindEventWithSelectorOrCallback=function(e){var t,r=i.toElementsArray(this),l=e;t="function"==typeof e?function(e){for(var t=0;t<r.length;t++)if((this===n||e.target===r[t])&&e.callback===l)return!0;return!1}:function(t){for(var o=0;o<r.length;o++)if((this===n||t.target===r[o])&&t.selector===e)return!0;return!1},o.removeEvent(t)},this.unbindEventWithSelectorAndCallback=function(e,t){var r=i.toElementsArray(this);o.removeEvent((function(o){for(var i=0;i<r.length;i++)if((this===n||o.target===r[i])&&o.selector===e&&o.callback===t)return!0;return!1}))},this.addTimeoutHandler=function(e,t,n,r,o){!r.timeout||r.timeout<=0||(o.timeoutId&&clearTimeout(o.timeoutId),o.timeoutId=setTimeout((()=>{c.unbindEventWithSelectorAndCallback.call(e,t,n),n.call(null,null)}),r.timeout))},this},a=new function(){var e={fireOnAttributesModification:!1,onceOnly:!1,existing:!1,timeout:0};function t(e,t,r){return!(!i.matchesSelector(e,t.selector)||(e._id===n&&(e._id=o++),-1!=t.firedElems.indexOf(e._id)))&&(t.firedElems.push(e._id),!0)}var r=(a=new c((function(e){var t={attributes:!1,childList:!0,subtree:!0};return e.fireOnAttributesModification&&(t.attributes=!0),t}),(function(e,n){e.forEach((function(e){var r=e.addedNodes,o=e.target,l=[];null!==r&&r.length>0?i.checkChildNodesRecursively(r,n,t,l):"attributes"===e.type&&t(o,n,l)&&l.push({callback:n.callback,elem:o}),i.callCallbacks(l,n,a)}))}))).bindEvent;return a.bindEvent=function(t,o,l){var c="object"==typeof o?i.mergeArrays(e,o):{...e},a="function"==typeof l?l:"function"==typeof o?o:n,u=i.toElementsArray(this);if(a||(c.onceOnly=!0),c.existing){for(var s=[],d=0;d<u.length;d++)for(var f=u[d].querySelectorAll(t),h=0;h<f.length;h++)s.push({callback:a,elem:f[h]});if(c.onceOnly&&s.length)return a?a.call(s[0].elem,s[0].elem):Promise.resolve(s[0].elem);setTimeout(i.callCallbacks,1,s)}if(!a){var v=this;return new Promise((e=>r.call(v,t,c,e)))}r.call(this,t,c,a)},a},u=new function(){var e={onceOnly:!1,timeout:0};function t(e,t){return i.matchesSelector(e,t.selector)}var r=(u=new c((function(){return{childList:!0,subtree:!0}}),(function(e,n){e.forEach((function(e){var r=e.removedNodes,o=[];null!==r&&r.length>0&&i.checkChildNodesRecursively(r,n,t,o),i.callCallbacks(o,n,u)}))}))).bindEvent;return u.bindEvent=function(t,o,l){var c="object"==typeof o?i.mergeArrays(e,o):{...e},a="function"==typeof l?l:"function"==typeof o?o:n;if(!a){c.onceOnly=!0;var u=this;return new Promise((e=>r.call(u,t,c,e)))}r.call(this,t,c,a)},u};t&&f(t.fn),f(HTMLElement.prototype),f(NodeList.prototype),f(HTMLCollection.prototype),f(HTMLDocument.prototype),f(Window.prototype);var s={};return d(a,s,"unbindAllArrive"),d(u,s,"unbindAllLeave"),s}function d(e,t,n){i.addMethod(t,n,e.unbindEvent),i.addMethod(t,n,e.unbindEventWithSelectorOrCallback),i.addMethod(t,n,e.unbindEventWithSelectorAndCallback)}function f(e){e.arrive=a.bindEvent,d(a,e,"unbindArrive"),e.leave=u.bindEvent,d(u,e,"unbindLeave")}}(window,"undefined"==typeof jQuery?null:jQuery,void 0);
//# sourceMappingURL=/sm/111de82da240d8dbde3ab2ad49933bfb890046691d2a507889e6d1a0fd1615c1.map