![]() 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 : |
/*** module: node_modules/absol-tutor/js/scriptor/UserLevel2Menu.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 _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 _AElement = _interopRequireDefault(require("absol/src/HTML5/AElement")); /*** * @extends BaseState * @constructor */ function StateWaitSelectRoot() { _BaseState.default.apply(this, arguments); this.toIdx = -1; } _OOP.default.mixClass(StateWaitSelectRoot, _BaseState.default); StateWaitSelectRoot.prototype.onStart = function () { this.command.menuLevel = 0; this.command.highlightElt(this.command.elt); var itemElt = (0, _findNode.default)(this.args.menuItemPath[0], this.command.elt); this.command.menuItemElt = itemElt; if (this.command.hadWrongAction && this.args.wrongMessage) this.command.showTooltip(this.command.menuItemElt, this.args.wrongMessage); this.command.onlyClickTo(itemElt); this.toIdx = setTimeout(function () { this.command.highlightElt(itemElt); }.bind(this), 400); itemElt.on('click', this.ev_click); this.command.clickCb = this.ev_clickOut; }; StateWaitSelectRoot.prototype.onStop = function () { clearTimeout(this.toIdx); this.command.menuItemElt.off('click', this.ev_click); this.command.clickCb = null; }; StateWaitSelectRoot.prototype.ev_click = function () { this.goto('hover_next'); }; StateWaitSelectRoot.prototype.ev_clickOut = function () { this.command.hadWrongAction = true; if (this.args.wrongMessage) this.command.showTooltip(this.command.menuItemElt, this.args.wrongMessage); }; /*** * @extends BaseState * @constructor */ function StateHoverNext() { _BaseState.default.apply(this, arguments); this.toIdx = -1; this.checkInv = -1; } _OOP.default.mixClass(StateHoverNext, _BaseState.default); StateHoverNext.prototype.onStart = function () { this.command.menuLevel++; this.command.highlightElt(this.command.menuItemElt.$container); var itemElt = (0, _findNode.default)(this.args.menuItemPath[this.command.menuLevel], this.command.menuItemElt.$container); this.command.menuItemElt = itemElt; if (this.command.hadWrongAction && (this.args.wrongMessage1 || this.args.wrongMessage)) this.command.showTooltip(this.command.menuItemElt, this.args.wrongMessage1 || this.args.wrongMessage); this.command.onlyClickTo(itemElt); this.toIdx = setTimeout(function () { this.command.highlightElt(itemElt); }.bind(this), 100); this.command.menuItemElt.once('mouseenter', this.ev_mouseenter); this.checkInv = setInterval(this.checkItemVisibility.bind(this), 300); }; StateHoverNext.prototype.checkItemVisibility = function () { var c = this.command.menuItemElt; while (c) { if (c.getBoundingClientRect().width === 0) return false; if (_AElement.default.prototype.getComputedStyleValue.call(c, 'visibility') !== 'visible') { clearInterval(this.checkInv); this.command.hadWrongAction = true; this.goto('user_begin'); break; } c = c.parentElement; } }; StateHoverNext.prototype.onStop = function () { this.command.menuItemElt.off('mouseenter', this.ev_mouseenter); }; StateHoverNext.prototype.ev_mouseenter = function () { if (this.command.menuLevel + 1 >= this.args.menuItemPath.length) { this.goto('wait_click_current'); } else { this.goto('hover_next'); } }; /*** * @extends BaseState * @constructor */ function StateWaitClickCurrent() { _BaseState.default.apply(this, arguments); this.checkInv = -1; } _OOP.default.mixClass(StateWaitClickCurrent, _BaseState.default); StateWaitClickCurrent.prototype.onStart = function () { this.command.onlyClickTo(this.command.menuItemElt); this.command.highlightElt(this.command.menuItemElt); this.checkInv = setInterval(this.checkItemVisibility.bind(this), 300); this.command.menuItemElt.once('click', this.ev_click); }; StateWaitClickCurrent.prototype.onStop = function () { clearInterval(this.checkInv); this.command.menuItemElt.off('click', this.ev_click); }; StateWaitClickCurrent.prototype.ev_click = function () { this.goto('finish'); }; StateWaitClickCurrent.prototype.checkItemVisibility = StateHoverNext.prototype.checkItemVisibility; /*** * @extends UserBaseAction * @constructor */ function UserLevel2Menu() { _UserBaseAction.default.apply(this, arguments); } (0, _TCommand.inheritCommand)(UserLevel2Menu, _UserBaseAction.default); UserLevel2Menu.prototype.argNames = ['eltPath', 'menuItemPath', 'message', 'wrongMessage', 'wrongMessage1']; UserLevel2Menu.prototype.name = 'userLevel2Menu'; UserLevel2Menu.prototype.className = 'UserLevel2Menu'; UserLevel2Menu.prototype.stateClasses.user_begin = StateWaitSelectRoot; UserLevel2Menu.prototype.stateClasses.hover_next = StateHoverNext; UserLevel2Menu.prototype.stateClasses.wait_click_current = StateWaitClickCurrent; UserLevel2Menu.prototype.verifyElt = function () { var elt = this.elt; if (!elt.containsClass || !elt.containsClass('as-v-root-menu')) { return new Error('Type error: not a valid menu!'); } }; _TutorEngine.default.installClass(UserLevel2Menu); _TutorNameManager.default.addAsync('userLevel2Menu'); _TACData.default.define('userLevel2Menu', { type: 'function', args: [{ name: 'eltPath', type: '(string|AElement)' }, { name: 'menuItemPath', type: 'string[]' }, { name: 'message', type: 'string' }, { name: 'wrongMessage', type: 'string' }, { name: 'wrongMessage1', type: 'string' }] }); var _default = UserLevel2Menu; exports.default = _default;