- md5
- bedf7f60273cb512557ad85ccae1a9b2
- sha1
- 47513fdb07f1434799e6e4d967c53fe56331e0f9
- sha256
- 6154e233bfe167847e61562f671572382808a7debfd30f49ee88b8bc8cad7ad4
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
/**
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
/**
* JavaScript behavior to add front-end hover edit icons with tooltips for modules and menu items.
*/
(function($) {
$(document).ready(function () {
// Modules edit icons:
$('.jmoddiv').on({
mouseenter: function() {
// Get module editing URL and tooltip for module edit:
var self = $(this);
var moduleEditUrl = self.data('jmodediturl');
var moduleTip = self.data('jmodtip');
var moduleTarget = self.data('target');
// Stop timeout on previous tooltip and remove it:
$('btn.jmodedit').tooltip('dispose').remove();
// Add editing button with tooltip:
self.addClass('jmodinside')
.prepend('<a class="btn btn-link jmodedit" href="#" target="' + moduleTarget + '"><span class="fas fa-edit"></span></a>')
.children(":first").attr('href', moduleEditUrl).attr('title', moduleTip)
.tooltip({container: $('.jmodedit').parent(), html: true, placement: 'auto'});
},
mouseleave: function() {
// Delay remove editing button if not hovering it:
$('.btn.jmodedit').remove();
$('.tooltip').tooltip('dispose');
}
});
// Menu items edit icons:
var activePopover = null;
$('.jmoddiv[data-jmenuedittip] .nav li,.jmoddiv[data-jmenuedittip].nav li,.jmoddiv[data-jmenuedittip] .nav .nav-child li,.jmoddiv[data-jmenuedittip].nav .nav-child li').on({
mouseenter: function() {
// Get menu ItemId from the item-nnn class of the li element of the menu:
var itemids = /\bitem-(\d+)\b/.exec($(this).attr('class'));
if (typeof itemids[1] == 'string') {
// Find module editing URL from enclosing module:
var enclosingModuleDiv = $(this).closest('.jmoddiv');
var moduleEditUrl = enclosingModuleDiv.data('jmodediturl');
// Transform module editing URL into Menu Item editing url:
var menuitemEditUrl = moduleEditUrl.replace(/\/index.php\?option=com_config&view=modules([^\d]+).+$/, '/administrator/index.php?option=com_menus&view=item&layout=edit$1' + itemids[1]);
}
// Get tooltip for menu items from enclosing module
var menuEditTip = enclosingModuleDiv.data('jmenuedittip').replace('%s', itemids[1]);
var content = $('<div><a class="btn jfedit-menu" href="#" target="_blank"><span class="fas fa-edit"></span></a></div>');
content.children('a.jfedit-menu').prop('href', menuitemEditUrl).prop('title', menuEditTip);
if (activePopover) {
$(activePopover).popover('hide');
}
$(this).popover({html:true, content:content.html(), container:'body', trigger:'manual', animation:false, placement: 'bottom'}).popover('show');
activePopover = this;
$('body>div.popover').on({
mouseenter: function() {
if (activePopover) {
$(activePopover).clearQueue();
}
},
mouseleave: function() {
if (activePopover) {
$(activePopover).popover('hide');
}
}
})
.find('a.jfedit-menu').tooltip({"container": false, html: true, placement: 'bottom'});
},
mouseleave: function() {
$(this).delay(1500).queue(function(next) { $(this).popover('hide'); next() });
}
});
});
})(jQuery);
The same content is in 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.