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-tutor__js__scriptor__UserQuickMenu.js
/*** module: node_modules/absol-tutor/js/scriptor/UserQuickMenu.js ***/
"use strict";

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

var _UserBaseAction = _interopRequireDefault(require("./UserBaseAction"));

var _OOP = _interopRequireDefault(require("absol/src/HTML5/OOP"));

var _TutorNameManager = _interopRequireDefault(require("./TutorNameManager"));

var _Core = require("../dom/Core");

var _findNode = _interopRequireDefault(require("../util/findNode"));

var _TACData = _interopRequireDefault(require("./TACData"));

var _TutorEngine = _interopRequireDefault(require("./TutorEngine"));

var _TCommand = require("../engine/TCommand");

var _BaseState = _interopRequireDefault(require("./BaseState"));

var _QuickMenu = _interopRequireDefault(require("absol-acomp/js/QuickMenu"));


/***
 * @extends BaseState
 * @constructor
 */
function StateWaitMenu() {
  _BaseState.default.apply(this, arguments);

  this.wcIdx = -1;
}

_OOP.default.mixClass(StateWaitMenu, _BaseState.default);

StateWaitMenu.prototype.onStart = function () {
  this.command.highlightElt(this.command.elt);
  this.command.onlyClickTo(this.command.elt);
  if (this.command.hadWrongAction && this.args.wrongMessage) this.command.showTooltip(this.command.elt, this.args.wrongMessage);
  this.command.elt.on('click', this.ev_click);
  this.command.clickCb = this.ev_clickOut;
};

StateWaitMenu.prototype.onStop = function () {
  clearTimeout(this.wcIdx);
};

StateWaitMenu.prototype.ev_clickOut = function () {
  this.command.hadWrongAction = true;
  if (this.args.wrongMessage) this.command.showTooltip(this.command.elt, this.args.wrongMessage);
};

StateWaitMenu.prototype.checkMenu = function () {
  if (_QuickMenu.default.$elt && _QuickMenu.default.$elt.getBoundingClientRect().width > 0) {
    this.goto('wait_click');
  }
};

StateWaitMenu.prototype.ev_click = function () {
  clearTimeout(this.wcIdx);
  this.wcIdx = setTimeout(this.checkMenu.bind(this), 10);
};
/***
 * @extends BaseState
 * @constructor
 */


function StateWaitClick() {
  _BaseState.default.apply(this, arguments);

  this.checkMenuIdx = -1;
  this.blindIdx = -1;
}

_OOP.default.mixClass(StateWaitClick, _BaseState.default);

StateWaitClick.prototype.onStart = function () {
  this.command.highlightElt(_QuickMenu.default.$elt);
  this.itemElt = (0, _findNode.default)(this.args.selectId, _QuickMenu.default.$elt);

  if (!this.itemElt) {
    this.command.reject(new Error("QuickMenu do not contain " + this.args.selectId));
    return;
  }

  this.itemElt.once('click', this.ev_clickItem);
  if (this.command.hadWrongAction && this.args.wrongMessage) this.command.showTooltip(_QuickMenu.default.$elt, this.args.wrongMessage);
  this.command.onlyClickTo(this.itemElt);
  this.blindIdx = setTimeout(function () {
    this.command.highlightElt(this.itemElt);
  }.bind(this), 400);
  this.checkMenuIdx = setInterval(this.checkMenu.bind(this), 200);
  this.command.clickCb = this.checkMenu.bind(this);
};

StateWaitClick.prototype.onStop = function () {
  clearInterval(this.checkMenuIdx);
  clearInterval(this.blindIdx);
  this.itemElt.off('click', this.ev_clickItem);
  this.command.clickCb = null;
};

StateWaitClick.prototype.checkMenu = function () {
  if (_QuickMenu.default.$elt.getBoundingClientRect().width === 0) {
    this.goto('user_begin');
  }
};

StateWaitClick.prototype.ev_clickItem = function () {
  this.goto('finish');
};
/***
 * @extends UserBaseAction
 * @constructor
 */


function UserQuickMenu() {
  _UserBaseAction.default.apply(this, arguments);
}

(0, _TCommand.inheritCommand)(UserQuickMenu, _UserBaseAction.default);
UserQuickMenu.prototype.className = 'UserQuickMenu';
UserQuickMenu.prototype.name = 'userQuickMenu';
UserQuickMenu.prototype.argNames = ['eltPath', 'selectId', 'message', 'wrongMessage'];
UserQuickMenu.prototype.stateClasses['user_begin'] = StateWaitMenu;
UserQuickMenu.prototype.stateClasses['wait_click'] = StateWaitClick;

UserQuickMenu.prototype.verifyElt = function () {
  // if (!this.elt.classList.contains('as-quick-menu-trigger')) {
  //     return new Error('Type error: not a quick-menu trigger');
  // }
  return null;
};

_TutorEngine.default.installClass(UserQuickMenu);

_TutorEngine.default.installFunction('getAllQuickMenuTriggers', function () {
  return (0, _Core.$$)('.as-quick-menu-trigger');
});

_TutorNameManager.default.addAsync('userQuickMenu').addSync('getAllQuickMenuTriggers');

_TACData.default.define('userQuickMenu', {
  type: 'function',
  args: [{
    name: 'eltPath',
    type: '(string|AElement)'
  }, {
    name: 'selectId',
    type: 'string'
  }, {
    name: 'message',
    type: 'string'
  }, {
    name: 'wrongMessage',
    type: 'string'
  }]
}).define('getAllQuickMenuTriggers', {
  type: 'function',
  args: [],
  returns: 'QuickMenuTriggers[]'
});

var _default = UserQuickMenu;
exports.default = _default;

VaKeR 2022