geno/wp-content/plugins/elementor/assets/js/elementor-admin-bar.js

461 lines
19 KiB
JavaScript
Raw Permalink Normal View History

2024-02-01 17:24:18 +05:30
/*! elementor - v3.18.0 - 20-12-2023 */
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "../node_modules/@babel/runtime/helpers/assertThisInitialized.js":
/*!***********************************************************************!*\
!*** ../node_modules/@babel/runtime/helpers/assertThisInitialized.js ***!
\***********************************************************************/
/***/ ((module) => {
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ "../node_modules/@babel/runtime/helpers/classCallCheck.js":
/*!****************************************************************!*\
!*** ../node_modules/@babel/runtime/helpers/classCallCheck.js ***!
\****************************************************************/
/***/ ((module) => {
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ "../node_modules/@babel/runtime/helpers/createClass.js":
/*!*************************************************************!*\
!*** ../node_modules/@babel/runtime/helpers/createClass.js ***!
\*************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ "../node_modules/@babel/runtime/helpers/toPropertyKey.js");
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;
}
module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ "../node_modules/@babel/runtime/helpers/get.js":
/*!*****************************************************!*\
!*** ../node_modules/@babel/runtime/helpers/get.js ***!
\*****************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var superPropBase = __webpack_require__(/*! ./superPropBase.js */ "../node_modules/@babel/runtime/helpers/superPropBase.js");
function _get() {
if (typeof Reflect !== "undefined" && Reflect.get) {
module.exports = _get = Reflect.get.bind(), module.exports.__esModule = true, module.exports["default"] = module.exports;
} else {
module.exports = _get = function _get(target, property, receiver) {
var base = superPropBase(target, property);
if (!base) return;
var desc = Object.getOwnPropertyDescriptor(base, property);
if (desc.get) {
return desc.get.call(arguments.length < 3 ? target : receiver);
}
return desc.value;
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
}
return _get.apply(this, arguments);
}
module.exports = _get, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js":
/*!****************************************************************!*\
!*** ../node_modules/@babel/runtime/helpers/getPrototypeOf.js ***!
\****************************************************************/
/***/ ((module) => {
function _getPrototypeOf(o) {
module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
return _getPrototypeOf(o);
}
module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ "../node_modules/@babel/runtime/helpers/inherits.js":
/*!**********************************************************!*\
!*** ../node_modules/@babel/runtime/helpers/inherits.js ***!
\**********************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ "../node_modules/@babel/runtime/helpers/setPrototypeOf.js");
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
Object.defineProperty(subClass, "prototype", {
writable: false
});
if (superClass) setPrototypeOf(subClass, superClass);
}
module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js":
/*!***********************************************************************!*\
!*** ../node_modules/@babel/runtime/helpers/interopRequireDefault.js ***!
\***********************************************************************/
/***/ ((module) => {
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
"default": obj
};
}
module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js":
/*!***************************************************************************!*\
!*** ../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***!
\***************************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]);
var assertThisInitialized = __webpack_require__(/*! ./assertThisInitialized.js */ "../node_modules/@babel/runtime/helpers/assertThisInitialized.js");
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return assertThisInitialized(self);
}
module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ "../node_modules/@babel/runtime/helpers/setPrototypeOf.js":
/*!****************************************************************!*\
!*** ../node_modules/@babel/runtime/helpers/setPrototypeOf.js ***!
\****************************************************************/
/***/ ((module) => {
function _setPrototypeOf(o, p) {
module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
return _setPrototypeOf(o, p);
}
module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ "../node_modules/@babel/runtime/helpers/superPropBase.js":
/*!***************************************************************!*\
!*** ../node_modules/@babel/runtime/helpers/superPropBase.js ***!
\***************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var getPrototypeOf = __webpack_require__(/*! ./getPrototypeOf.js */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js");
function _superPropBase(object, property) {
while (!Object.prototype.hasOwnProperty.call(object, property)) {
object = getPrototypeOf(object);
if (object === null) break;
}
return object;
}
module.exports = _superPropBase, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ "../node_modules/@babel/runtime/helpers/toPrimitive.js":
/*!*************************************************************!*\
!*** ../node_modules/@babel/runtime/helpers/toPrimitive.js ***!
\*************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]);
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);
}
module.exports = _toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ "../node_modules/@babel/runtime/helpers/toPropertyKey.js":
/*!***************************************************************!*\
!*** ../node_modules/@babel/runtime/helpers/toPropertyKey.js ***!
\***************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]);
var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ "../node_modules/@babel/runtime/helpers/toPrimitive.js");
function _toPropertyKey(arg) {
var key = toPrimitive(arg, "string");
return _typeof(key) === "symbol" ? key : String(key);
}
module.exports = _toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ }),
/***/ "../node_modules/@babel/runtime/helpers/typeof.js":
/*!********************************************************!*\
!*** ../node_modules/@babel/runtime/helpers/typeof.js ***!
\********************************************************/
/***/ ((module) => {
function _typeof(o) {
"@babel/helpers - typeof";
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
}
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
"use strict";
/*!*********************************************************!*\
!*** ../modules/admin-bar/assets/js/frontend/module.js ***!
\*********************************************************/
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
var _get2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/get */ "../node_modules/@babel/runtime/helpers/get.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
/* global elementorAdminBarConfig */
var AdminBar = /*#__PURE__*/function (_elementorModules$Vie) {
(0, _inherits2.default)(AdminBar, _elementorModules$Vie);
var _super = _createSuper(AdminBar);
function AdminBar() {
(0, _classCallCheck2.default)(this, AdminBar);
return _super.apply(this, arguments);
}
(0, _createClass2.default)(AdminBar, [{
key: "getDefaultSettings",
value:
/**
* @return {{}} settings
*/
function getDefaultSettings() {
return {
prefixes: {
adminBarId: 'wp-admin-bar-'
},
classes: {
adminBarItem: 'ab-item',
adminBarItemTitle: 'elementor-edit-link-title',
adminBarItemSubTitle: 'elementor-edit-link-type',
adminBarNonLinkItem: 'ab-empty-item',
adminBarSubItemsWrapper: 'ab-sub-wrapper',
adminBarSubItems: 'ab-submenu'
},
selectors: {
adminBar: '#wp-admin-bar-root-default',
editMenuItem: '#wp-admin-bar-edit',
newMenuItem: '#wp-admin-bar-new-content'
}
};
}
/**
* @return {{$adminBar: (jQuery)}} elements
*/
}, {
key: "getDefaultElements",
value: function getDefaultElements() {
var _this$getSettings = this.getSettings('selectors'),
adminBar = _this$getSettings.adminBar,
editMenuItem = _this$getSettings.editMenuItem,
newMenuItem = _this$getSettings.newMenuItem;
return {
$adminBar: jQuery(adminBar),
$editMenuItem: jQuery(editMenuItem),
$newMenuItem: jQuery(newMenuItem)
};
}
/**
* Init
*/
}, {
key: "onInit",
value: function onInit() {
(0, _get2.default)((0, _getPrototypeOf2.default)(AdminBar.prototype), "onInit", this).call(this);
this.createMenu(elementorAdminBarConfig);
}
/**
* Main method that creates the menu base on the config that provided.
*
* @param {*} adminBarConfig
*/
}, {
key: "createMenu",
value: function createMenu(adminBarConfig) {
var $items = this.createMenuItems(Object.values(adminBarConfig));
if (this.elements.$editMenuItem.length) {
// This is the normal case, when user visit a preview page of single post.
this.elements.$editMenuItem.after($items);
} else if (this.elements.$newMenuItem.length) {
// This is another case, when user visit a preview page that cannot be edited e.g: archive page.
this.elements.$newMenuItem.after($items);
} else {
// Default fallback in case there are no "new" or "edit" button.
this.elements.$adminBar.append($items);
}
}
/**
* Creates a menu items from array of declaration.
*
* @param {*} items
* @return {jQuery[]} menu items
*/
}, {
key: "createMenuItems",
value: function createMenuItems(items) {
var _this = this;
return items.map(function (item) {
return _this.createMenuItem(item);
});
}
/**
* Creates a menu item, both for menu and sub menu.
*
* @param {*} item
* @return {jQuery} menu item
*/
}, {
key: "createMenuItem",
value: function createMenuItem(item) {
var children = item.children ? Object.values(item.children) : [];
var id = "".concat(this.getSettings('prefixes.adminBarId')).concat(item.id);
var $title = jQuery('<span>', {
class: this.getSettings('classes.adminBarItemTitle'),
html: item.title
});
var $subTitle = item.sub_title ? jQuery('<span>', {
class: this.getSettings('classes.adminBarItemSubTitle'),
html: item.sub_title
}) : null;
var $item = jQuery(item.href ? '<a>' : '<div>', {
'aria-haspopup': children.length ? true : null,
class: [this.getSettings('classes.adminBarItem'), item.href ? '' : this.getSettings('classes.adminBarNonLinkItem'), item.class].join(' '),
href: item.href
}).append([$title, $subTitle]);
return jQuery('<li>', {
id: id,
class: children.length ? 'menupop' : '' + (item.parent_class || 'elementor-general-section')
}).append([$item, children.length ? this.createSubMenuItems(id, children) : null]);
}
/**
* Creates sub menu items wrapper.
*
* @param {string} parentId
* @param {Object} children
* @return {jQuery} sub-menu items
*/
}, {
key: "createSubMenuItems",
value: function createSubMenuItems(parentId, children) {
var $list = jQuery('<ul>', {
class: this.getSettings('classes.adminBarSubItems'),
id: "".concat(parentId, "-default")
}).append(this.createMenuItems(children));
return jQuery('<div>', {
class: this.getSettings('classes.adminBarSubItemsWrapper')
}).append($list);
}
}]);
return AdminBar;
}(elementorModules.ViewModule);
document.addEventListener('DOMContentLoaded', function () {
return new AdminBar();
});
})();
/******/ })()
;
//# sourceMappingURL=elementor-admin-bar.js.map