VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /var/www/html/libs/absol-full/dist/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/libs/absol-full/dist/js/mdls__absol__src__HTML5__AttachHook.js
/*** module: node_modules/absol/src/HTML5/AttachHook.js ***/
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.AttachHook = AttachHook;
exports.default = void 0;

var _AElement = _interopRequireDefault(require("./AElement"));

var _EventEmitter = _interopRequireDefault(require("./EventEmitter"));


window.pendingAttachHooks = {};
var pendingId = 0;
/***
 * @extends AElement
 * @constructor
 */

function AttachHook() {
  this._attached = false;
  this._canceled = false;
  this._pendingId = ++pendingId;
  this._eventAdded = false;
  this.counter = 0;
  this.delayTime = 0;
}

AttachHook.prototype._addAttachedEvent = function () {
  if (this._eventAdded) return;
  this.addEventListener('error', function (event) {
    if (!this._attached && this.isDescendantOf(document.body)) {
      this._attached = true;
      if (this.waitTimeout > 0) clearTimeout(this.waitTimeout);
      delete pendingAttachHooks[this._pendingId];
      if (this._canceled) return;
      this.emit('attached', event, this);
    }
  });
  this._eventAdded = true;

  if (!this._canceled) {
    pendingAttachHooks[this._pendingId] = this;
    this.waitAttaching();
  }
};

AttachHook.prototype.eventEmittorOnWithTime = function (isOnce, arg0, arg1, arg2) {
  if (arg0 === 'attached') {
    this._addAttachedEvent();

    return _AElement.default.prototype.eventEmittorOnWithTime.apply(this, arguments);
  } else {
    return _AElement.default.prototype.eventEmittorOnWithTime.apply(this, arguments);
  }
};
/*
AttachHook.prototype.on = function () {
    if (arguments[0] === 'attached') {
        this._addAttachedEvent();
        AElement.prototype.on.apply(this, arguments);
    }
    else {
        AElement.prototype.on.apply(this, arguments);
    }
    return this;
};


AttachHook.prototype.once = function () {
    if (arguments[0] === 'attached') {
        this._addAttachedEvent();
        AElement.prototype.once.apply(this, arguments);
    }
    else {
        AElement.prototype.once.apply(this, arguments);
    }
    return this;
};*/


AttachHook.render = function (data, option, domInstance) {
  var attributes = {};
  var tag;

  if (domInstance.defaultTag === 'div') {
    attributes.src = '';
    tag = 'img';
  } else {
    tag = 'image';
    attributes.href = '';
  }

  return domInstance._({
    tag: tag,
    class: 'absol-attachhook',
    extendEvent: ['attached'],
    style: {
      display: 'none'
    },
    attr: attributes,
    props: {
      domInstance: domInstance
    }
  });
};

AttachHook.prototype.waitAttaching = function () {
  if (this._canceled) return;
  var self = this; // if (BrowserDetector.browser.type.startsWith('chrome') && parseInt((BrowserDetector.browser.version || '').split('.').shift()) >= 113) {

  if (this.waitTimeout > 0) clearTimeout(this.waitTimeout);
  this.waitTimeout = setTimeout(function wait() {
    self.waitTimeout = -1;
    self.counter++;
    if (self.counter === 1) self.delayTime = 10;else if (self.counter === 5) self.delayTime = 30;else if (self.counter === 50) self.delayTime = 60;else if (self.counter === 100) self.delayTime = 100;else if (self.counter === 500) self.delayTime = 1000;

    if (!self._attached && self.isDescendantOf(document.body)) {
      self._attached = true;
      delete pendingAttachHooks[self._pendingId];
      if (self._canceled) return;
      self.emit('attached', {
        target: this
      }, self);
    } else if (!self._attached && !self._canceled) {
      self.waitTimeout = setTimeout(wait, self.delayTime);
    }
  }, this.delayTime); // }
};

AttachHook.prototype.cancelWaiting = function () {
  if (this.waitTimeout > 0) clearTimeout(this.waitTimeout);
  this._canceled = true;
  delete pendingAttachHooks[this._pendingId];
};

AttachHook.prototype.resetState = function () {
  if (this.waitTimeout > 0) clearTimeout(this.waitTimeout);
  this._attached = false;
  this._canceled = false;
  this.counter = 0;
  this.delayTime = 1;

  if (this.tagName.toLowerCase() === 'img') {
    this.attr('src', '');
  } else {
    this.attr('href', '');
  }

  pendingAttachHooks[this._pendingId] = this;
  this.waitAttaching();
};

AttachHook.property = {
  attached: {
    get: function () {
      return !!this._attached;
    }
  },
  canceled: {
    get: function () {
      return !!this._canceled;
    }
  }
};
var _default = AttachHook;
exports.default = _default;

VaKeR 2022