Server IP : 15.235.198.142 / Your IP : 216.73.216.78 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ballsack 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/share/bootstrap-html/js/util/ |
Upload File : |
/*! * Bootstrap backdrop.js v5.3.1 (https://getbootstrap.com/) * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('../dom/event-handler.js'), require('./config.js'), require('./index.js')) : typeof define === 'function' && define.amd ? define(['../dom/event-handler', './config', './index'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Backdrop = factory(global.EventHandler, global.Config, global.Index)); })(this, (function (EventHandler, Config, index_js) { 'use strict'; function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } /** * Constants */ var NAME = 'backdrop'; var CLASS_NAME_FADE = 'fade'; var CLASS_NAME_SHOW = 'show'; var EVENT_MOUSEDOWN = "mousedown.bs." + NAME; var Default = { className: 'modal-backdrop', clickCallback: null, isAnimated: false, isVisible: true, // if false, we use the backdrop helper without adding any element to the dom rootElement: 'body' // give the choice to place backdrop under different elements }; var DefaultType = { className: 'string', clickCallback: '(function|null)', isAnimated: 'boolean', isVisible: 'boolean', rootElement: '(element|string)' }; /** * Class definition */ var Backdrop = /*#__PURE__*/function (_Config) { _inheritsLoose(Backdrop, _Config); function Backdrop(config) { var _this; _this = _Config.call(this) || this; _this._config = _this._getConfig(config); _this._isAppended = false; _this._element = null; return _this; } // Getters var _proto = Backdrop.prototype; // Public _proto.show = function show(callback) { if (!this._config.isVisible) { index_js.execute(callback); return; } this._append(); var element = this._getElement(); if (this._config.isAnimated) { index_js.reflow(element); } element.classList.add(CLASS_NAME_SHOW); this._emulateAnimation(function () { index_js.execute(callback); }); }; _proto.hide = function hide(callback) { var _this2 = this; if (!this._config.isVisible) { index_js.execute(callback); return; } this._getElement().classList.remove(CLASS_NAME_SHOW); this._emulateAnimation(function () { _this2.dispose(); index_js.execute(callback); }); }; _proto.dispose = function dispose() { if (!this._isAppended) { return; } EventHandler.off(this._element, EVENT_MOUSEDOWN); this._element.remove(); this._isAppended = false; } // Private ; _proto._getElement = function _getElement() { if (!this._element) { var backdrop = document.createElement('div'); backdrop.className = this._config.className; if (this._config.isAnimated) { backdrop.classList.add(CLASS_NAME_FADE); } this._element = backdrop; } return this._element; }; _proto._configAfterMerge = function _configAfterMerge(config) { // use getElement() with the default "body" to get a fresh Element on each instantiation config.rootElement = index_js.getElement(config.rootElement); return config; }; _proto._append = function _append() { var _this3 = this; if (this._isAppended) { return; } var element = this._getElement(); this._config.rootElement.append(element); EventHandler.on(element, EVENT_MOUSEDOWN, function () { index_js.execute(_this3._config.clickCallback); }); this._isAppended = true; }; _proto._emulateAnimation = function _emulateAnimation(callback) { index_js.executeAfterTransition(callback, this._getElement(), this._config.isAnimated); }; _createClass(Backdrop, null, [{ key: "Default", get: function get() { return Default; } }, { key: "DefaultType", get: function get() { return DefaultType; } }, { key: "NAME", get: function get() { return NAME; } }]); return Backdrop; }(Config); return Backdrop; })); //# sourceMappingURL=backdrop.js.map