- fixed active "tooltips" inside "popover" elements did not close properly when "popover" closed

This commit is contained in:
Mark Friedrich
2018-07-06 19:01:09 +02:00
parent 3fc618acd2
commit 9ec14b06c4
9 changed files with 77 additions and 23 deletions

View File

@@ -219,7 +219,7 @@ class CharacterLogModel extends BasicModel {
public function clearCacheData(){
// clear character "LOG" cache
// -> character data without "LOG" has not changed!
if($this->characterId){
if(is_object($this->characterId)){
// characterId relation could be deleted by cron therefore check again first...
$this->characterId->clearCacheDataWithPrefix(CharacterModel::DATA_CACHE_KEY_LOG);

View File

@@ -58,8 +58,6 @@ define([
systemDialogId: 'pf-system-dialog', // id for system dialog
systemDialogSelectClass: 'pf-system-dialog-select', // class for system select Element
popoverTriggerClass: 'pf-popover-trigger', // class for "popover" trigger elements
// system security classes
systemSec: 'pf-system-sec'
};
@@ -397,7 +395,7 @@ define([
}).attr('title', 'locked'),
// System effect color
$('<i>', {
class: ['fas', 'fa-square', 'fa-fw', effectBasicClass, effectClass, config.popoverTriggerClass].join(' ')
class: ['fas', 'fa-square', 'fa-fw', effectBasicClass, effectClass, Util.config.popoverTriggerClass].join(' ')
}),
// expand option
$('<i>', {

View File

@@ -21,8 +21,6 @@ define([
mapClass: 'pf-map', // class for all maps
popoverTriggerClass: 'pf-popover-trigger', // class for "popover" trigger elements
systemHeadInfoClass: 'pf-system-head-info', // class for system info
systemHeadInfoLeftClass: 'pf-system-head-info-left', // class for left system info
systemHeadInfoRightClass: 'pf-system-head-info-right', // class for right system info
@@ -508,7 +506,7 @@ define([
headInfoRight.push(
'<span class="' +
Util.getSecurityClassForSystem(staticData.security) + ' ' +
config.popoverTriggerClass + '" data-name="' + staticData.name +
Util.config.popoverTriggerClass + '" data-name="' + staticData.name +
'">' + staticData.security + '</span>'
);
}

View File

@@ -710,12 +710,20 @@ define([
// END menu events =============================================================================
// global "popover" callback (for all popovers)
$('.' + Util.config.popoverTriggerClass).on('hide.bs.popover', function(e) {
let popoverElement = $(this).data('bs.popover').tip();
// destroy all active tooltips inside this popover
popoverElement.destroyTooltip(true);
});
// global "modal" callback (for all modals)
$('body').on('hide.bs.modal', '> .modal', function(a,b) {
$('body').on('hide.bs.modal', '> .modal', function(e) {
$(this).destroyTimestampCounter();
});
// disable memue links based on current map config
// disable menu links based on current map config
documentElement.on('pf:updateMenuOptions', function(e, data){
let hasRightMapDelete = MapUtil.checkRight('map_delete', data.mapConfig);
$('#' + Util.config.menuButtonMapDeleteId).toggleClass('disabled', !hasRightMapDelete);

View File

@@ -467,7 +467,6 @@ define([
* @returns {*}
*/
$.fn.initTooltips = function(options){
options = (typeof options === 'object') ? options : {};
let defaultOptions = {
@@ -482,6 +481,26 @@ define([
});
};
/**
* destroy popover elements
* @param recursive
* @returns {*}
*/
$.fn.destroyTooltip = function(recursive){
return this.each(function() {
let element = $(this);
let tooltipSelector = '[title]';
let tooltipElements = element.filter(tooltipSelector);
if(recursive){
tooltipElements = tooltipElements.add(element.find(tooltipSelector));
}
tooltipElements.each(function() {
$(this).tooltip('destroy');
});
});
};
/**
* adds a popup tooltip with character information (created/updated)
* @param tooltipData
@@ -585,7 +604,7 @@ define([
return elements.each(function() {
let element = $(this);
// check if tooltip already exists -> remove it
// check if popover already exists -> remove it
if(element.data('bs.popover') !== undefined){
element.off('click').popover('destroy');
}
@@ -658,6 +677,11 @@ define([
});
};
/**
* destroy popover elements
* @param recursive
* @returns {*}
*/
$.fn.destroyPopover = function(recursive){
return this.each(function() {
let element = $(this);
@@ -684,7 +708,6 @@ define([
$.fn.initPopoverClose = function(eventNamespace){
return this.each(function() {
$('body').off('click.' + eventNamespace).on('click.' + eventNamespace + ' contextmenu', function (e) {
$('.' + config.popoverTriggerClass).each(function () {
let popoverElement = $(this);
//the 'is' for buttons that trigger popups

View File

@@ -58,8 +58,6 @@ define([
systemDialogId: 'pf-system-dialog', // id for system dialog
systemDialogSelectClass: 'pf-system-dialog-select', // class for system select Element
popoverTriggerClass: 'pf-popover-trigger', // class for "popover" trigger elements
// system security classes
systemSec: 'pf-system-sec'
};
@@ -397,7 +395,7 @@ define([
}).attr('title', 'locked'),
// System effect color
$('<i>', {
class: ['fas', 'fa-square', 'fa-fw', effectBasicClass, effectClass, config.popoverTriggerClass].join(' ')
class: ['fas', 'fa-square', 'fa-fw', effectBasicClass, effectClass, Util.config.popoverTriggerClass].join(' ')
}),
// expand option
$('<i>', {

View File

@@ -21,8 +21,6 @@ define([
mapClass: 'pf-map', // class for all maps
popoverTriggerClass: 'pf-popover-trigger', // class for "popover" trigger elements
systemHeadInfoClass: 'pf-system-head-info', // class for system info
systemHeadInfoLeftClass: 'pf-system-head-info-left', // class for left system info
systemHeadInfoRightClass: 'pf-system-head-info-right', // class for right system info
@@ -508,7 +506,7 @@ define([
headInfoRight.push(
'<span class="' +
Util.getSecurityClassForSystem(staticData.security) + ' ' +
config.popoverTriggerClass + '" data-name="' + staticData.name +
Util.config.popoverTriggerClass + '" data-name="' + staticData.name +
'">' + staticData.security + '</span>'
);
}

View File

@@ -710,12 +710,20 @@ define([
// END menu events =============================================================================
// global "popover" callback (for all popovers)
$('.' + Util.config.popoverTriggerClass).on('hide.bs.popover', function(e) {
let popoverElement = $(this).data('bs.popover').tip();
// destroy all active tooltips inside this popover
popoverElement.destroyTooltip(true);
});
// global "modal" callback (for all modals)
$('body').on('hide.bs.modal', '> .modal', function(a,b) {
$('body').on('hide.bs.modal', '> .modal', function(e) {
$(this).destroyTimestampCounter();
});
// disable memue links based on current map config
// disable menu links based on current map config
documentElement.on('pf:updateMenuOptions', function(e, data){
let hasRightMapDelete = MapUtil.checkRight('map_delete', data.mapConfig);
$('#' + Util.config.menuButtonMapDeleteId).toggleClass('disabled', !hasRightMapDelete);

View File

@@ -467,7 +467,6 @@ define([
* @returns {*}
*/
$.fn.initTooltips = function(options){
options = (typeof options === 'object') ? options : {};
let defaultOptions = {
@@ -482,6 +481,26 @@ define([
});
};
/**
* destroy popover elements
* @param recursive
* @returns {*}
*/
$.fn.destroyTooltip = function(recursive){
return this.each(function() {
let element = $(this);
let tooltipSelector = '[title]';
let tooltipElements = element.filter(tooltipSelector);
if(recursive){
tooltipElements = tooltipElements.add(element.find(tooltipSelector));
}
tooltipElements.each(function() {
$(this).tooltip('destroy');
});
});
};
/**
* adds a popup tooltip with character information (created/updated)
* @param tooltipData
@@ -585,7 +604,7 @@ define([
return elements.each(function() {
let element = $(this);
// check if tooltip already exists -> remove it
// check if popover already exists -> remove it
if(element.data('bs.popover') !== undefined){
element.off('click').popover('destroy');
}
@@ -658,6 +677,11 @@ define([
});
};
/**
* destroy popover elements
* @param recursive
* @returns {*}
*/
$.fn.destroyPopover = function(recursive){
return this.each(function() {
let element = $(this);
@@ -684,7 +708,6 @@ define([
$.fn.initPopoverClose = function(eventNamespace){
return this.each(function() {
$('body').off('click.' + eventNamespace).on('click.' + eventNamespace + ' contextmenu', function (e) {
$('.' + config.popoverTriggerClass).each(function () {
let popoverElement = $(this);
//the 'is' for buttons that trigger popups