mirror of
https://github.com/gantry/gantry5.git
synced 2026-08-19 01:15:04 -05:00
Fixed backward compatibility for custom menus where the hovering wouldn't be the default behavior (fixes #1293)
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
1. [Common](#common)
|
1. [Common](#common)
|
||||||
3. [](#bugfix)
|
3. [](#bugfix)
|
||||||
- Fixed `Warning: Zend OPcache API is restricted by "restrict_api" configuration directive`
|
- Fixed `Warning: Zend OPcache API is restricted by "restrict_api" configuration directive`
|
||||||
|
- Fixed backward compatibility for custom menus where the hovering wouldn't be the default behavior (#1293)
|
||||||
2. [Joomla](#joomla)
|
2. [Joomla](#joomla)
|
||||||
3. [](#bugfix)
|
3. [](#bugfix)
|
||||||
- Fixed media manager not rendering correctly in frontend editor (#986)
|
- Fixed media manager not rendering correctly in frontend editor (#986)
|
||||||
|
|||||||
@@ -48,10 +48,11 @@ var Menu = new prime({
|
|||||||
this.active = null;
|
this.active = null;
|
||||||
this.location = [];
|
this.location = [];
|
||||||
|
|
||||||
var mainContainer = $(this.selectors.mainContainer);
|
var mainContainer = $(this.selectors.mainContainer),
|
||||||
|
gHoverExpand = mainContainer.data('g-hover-expand');
|
||||||
if (!mainContainer) { return; }
|
if (!mainContainer) { return; }
|
||||||
|
|
||||||
this.hoverExpand = mainContainer.data('g-hover-expand') === 'true';
|
this.hoverExpand = gHoverExpand === null || gHoverExpand === 'true';
|
||||||
if (hasTouchEvents || !this.hoverExpand) {
|
if (hasTouchEvents || !this.hoverExpand) {
|
||||||
mainContainer.addClass(this.states.touchEvents);
|
mainContainer.addClass(this.states.touchEvents);
|
||||||
}
|
}
|
||||||
@@ -60,10 +61,10 @@ var Menu = new prime({
|
|||||||
},
|
},
|
||||||
|
|
||||||
attach: function() {
|
attach: function() {
|
||||||
var selectors = this.selectors,
|
var selectors = this.selectors,
|
||||||
main = $(selectors.mainContainer + ' ' + selectors.item),
|
main = $(selectors.mainContainer + ' ' + selectors.item),
|
||||||
mobileContainer = $(selectors.mobileContainer),
|
mobileContainer = $(selectors.mobileContainer),
|
||||||
body = $('body');
|
body = $('body');
|
||||||
|
|
||||||
if (!main) { return; }
|
if (!main) { return; }
|
||||||
if (this.hoverExpand) {
|
if (this.hoverExpand) {
|
||||||
@@ -111,11 +112,11 @@ var Menu = new prime({
|
|||||||
|
|
||||||
touchend: function(event) {
|
touchend: function(event) {
|
||||||
var selectors = this.selectors,
|
var selectors = this.selectors,
|
||||||
states = this.states;
|
states = this.states;
|
||||||
|
|
||||||
var target = $(event.target),
|
var target = $(event.target),
|
||||||
indicator = target.parent(selectors.item).find(selectors.touchIndicator),
|
indicator = target.parent(selectors.item).find(selectors.touchIndicator),
|
||||||
menuType = target.parent('.g-standard') ? 'standard' : 'megamenu',
|
menuType = target.parent('.g-standard') ? 'standard' : 'megamenu',
|
||||||
isGoingBack = target.parent('.g-go-back'),
|
isGoingBack = target.parent('.g-go-back'),
|
||||||
parent, isSelected;
|
parent, isSelected;
|
||||||
|
|
||||||
@@ -146,7 +147,7 @@ var Menu = new prime({
|
|||||||
if ((menuType == 'megamenu' || !parent.parent(selectors.mainContainer)) && (parent.find(' > ' + selectors.dropdown + ', > * > ' + selectors.dropdown) || isGoingBack)) {
|
if ((menuType == 'megamenu' || !parent.parent(selectors.mainContainer)) && (parent.find(' > ' + selectors.dropdown + ', > * > ' + selectors.dropdown) || isGoingBack)) {
|
||||||
var sublevel = target.parent('.g-sublevel') || target.parent('.g-toplevel'),
|
var sublevel = target.parent('.g-sublevel') || target.parent('.g-toplevel'),
|
||||||
slideout = parent.find('.g-sublevel'),
|
slideout = parent.find('.g-sublevel'),
|
||||||
columns = parent.parent('.g-dropdown-column'),
|
columns = parent.parent('.g-dropdown-column'),
|
||||||
blocks;
|
blocks;
|
||||||
|
|
||||||
if (sublevel) {
|
if (sublevel) {
|
||||||
@@ -184,7 +185,7 @@ var Menu = new prime({
|
|||||||
if (dropdown) {
|
if (dropdown) {
|
||||||
var sublevels = dropdown.search('.g-sublevel'),
|
var sublevels = dropdown.search('.g-sublevel'),
|
||||||
slideouts = dropdown.search('.g-slide-out, .' + this.states.selected),
|
slideouts = dropdown.search('.g-slide-out, .' + this.states.selected),
|
||||||
actives = dropdown.search('.' + this.states.active);
|
actives = dropdown.search('.' + this.states.active);
|
||||||
|
|
||||||
if (sublevels) { sublevels.attribute('style', null); }
|
if (sublevels) { sublevels.attribute('style', null); }
|
||||||
if (slideouts) { slideouts.removeClass('g-slide-out').removeClass(this.states.selected); }
|
if (slideouts) { slideouts.removeClass('g-slide-out').removeClass(this.states.selected); }
|
||||||
@@ -196,9 +197,9 @@ var Menu = new prime({
|
|||||||
|
|
||||||
closeAllDropdowns: function() {
|
closeAllDropdowns: function() {
|
||||||
var selectors = this.selectors,
|
var selectors = this.selectors,
|
||||||
states = this.states,
|
states = this.states,
|
||||||
topLevel = $(selectors.mainContainer + ' > .g-toplevel'),
|
topLevel = $(selectors.mainContainer + ' > .g-toplevel'),
|
||||||
roots = topLevel.search(' >' + selectors.item);
|
roots = topLevel.search(' >' + selectors.item);
|
||||||
|
|
||||||
if (roots) { roots.removeClass(states.selected); }
|
if (roots) { roots.removeClass(states.selected); }
|
||||||
if (topLevel) {
|
if (topLevel) {
|
||||||
@@ -212,7 +213,7 @@ var Menu = new prime({
|
|||||||
|
|
||||||
resetStates: function(menu) {
|
resetStates: function(menu) {
|
||||||
if (!menu) { return; }
|
if (!menu) { return; }
|
||||||
var items = menu.search('.g-toplevel, .g-dropdown-column, .g-dropdown, .g-selected, .g-active, .g-slide-out'),
|
var items = menu.search('.g-toplevel, .g-dropdown-column, .g-dropdown, .g-selected, .g-active, .g-slide-out'),
|
||||||
actives = menu.search('.g-active');
|
actives = menu.search('.g-active');
|
||||||
if (!items) { return; }
|
if (!items) { return; }
|
||||||
|
|
||||||
@@ -237,7 +238,7 @@ var Menu = new prime({
|
|||||||
from: parent[0].getBoundingClientRect(),
|
from: parent[0].getBoundingClientRect(),
|
||||||
to: (!isNavMenu ? sublevel.parent('.g-dropdown')[0] : sublevel[0]).getBoundingClientRect()
|
to: (!isNavMenu ? sublevel.parent('.g-dropdown')[0] : sublevel[0]).getBoundingClientRect()
|
||||||
},
|
},
|
||||||
height = Math.max(heights.from.height, heights.to.height);
|
height = Math.max(heights.from.height, heights.to.height);
|
||||||
|
|
||||||
if (!isGoingBack) {
|
if (!isGoingBack) {
|
||||||
// if from height is < than to height set the parent height else, set the target
|
// if from height is < than to height set the parent height else, set the target
|
||||||
@@ -247,8 +248,8 @@ var Menu = new prime({
|
|||||||
// fix sublevels heights in side menu (offcanvas etc)
|
// fix sublevels heights in side menu (offcanvas etc)
|
||||||
if (!isNavMenu) {
|
if (!isNavMenu) {
|
||||||
var maxHeight = height,
|
var maxHeight = height,
|
||||||
block = $(sublevel).parent('.g-block:not(.size-100)'),
|
block = $(sublevel).parent('.g-block:not(.size-100)'),
|
||||||
column = block ? block.parent('.g-dropdown-column') : null;
|
column = block ? block.parent('.g-dropdown-column') : null;
|
||||||
(sublevel.parents('.g-slide-out, .g-dropdown-column') || parent).forEach(function(slideout) {
|
(sublevel.parents('.g-slide-out, .g-dropdown-column') || parent).forEach(function(slideout) {
|
||||||
maxHeight = Math.max(height, parseInt(slideout.style.height || 0, 10));
|
maxHeight = Math.max(height, parseInt(slideout.style.height || 0, 10));
|
||||||
});
|
});
|
||||||
@@ -257,9 +258,9 @@ var Menu = new prime({
|
|||||||
column[0].style.height = maxHeight + 'px';
|
column[0].style.height = maxHeight + 'px';
|
||||||
|
|
||||||
var blocks = column.search('> .g-grid > .g-block'),
|
var blocks = column.search('> .g-grid > .g-block'),
|
||||||
diff = maxHeight;
|
diff = maxHeight;
|
||||||
|
|
||||||
blocks.forEach(function(block, i){
|
blocks.forEach(function(block, i) {
|
||||||
if ((i + 1) != blocks.length) {
|
if ((i + 1) != blocks.length) {
|
||||||
diff -= block.getBoundingClientRect().height;
|
diff -= block.getBoundingClientRect().height;
|
||||||
} else {
|
} else {
|
||||||
@@ -276,17 +277,17 @@ var Menu = new prime({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_calculateBreakpoint: function(value) {
|
_calculateBreakpoint: function(value) {
|
||||||
var digit = parseFloat(value.match(/^\d{1,}/).shift()),
|
var digit = parseFloat(value.match(/^\d{1,}/).shift()),
|
||||||
unit = value.match(/[a-z]{1,}$/i).shift(),
|
unit = value.match(/[a-z]{1,}$/i).shift(),
|
||||||
tolerance = unit.match(/r?em/) ? -0.062 : -1;
|
tolerance = unit.match(/r?em/) ? -0.062 : -1;
|
||||||
|
|
||||||
return (digit + tolerance) + unit;
|
return (digit + tolerance) + unit;
|
||||||
},
|
},
|
||||||
|
|
||||||
_checkQuery: function(mq) {
|
_checkQuery: function(mq) {
|
||||||
var selectors = this.options.selectors,
|
var selectors = this.options.selectors,
|
||||||
mobileContainer = $(selectors.mobileContainer),
|
mobileContainer = $(selectors.mobileContainer),
|
||||||
mainContainer = $(selectors.mainContainer + selectors.mobileTarget) || $(selectors.mainContainer),
|
mainContainer = $(selectors.mainContainer + selectors.mobileTarget) || $(selectors.mainContainer),
|
||||||
find, dropdowns;
|
find, dropdowns;
|
||||||
|
|
||||||
if (mq.matches) {
|
if (mq.matches) {
|
||||||
|
|||||||
Vendored
+25
-24
@@ -73,10 +73,11 @@ var Menu = new prime({
|
|||||||
this.active = null;
|
this.active = null;
|
||||||
this.location = [];
|
this.location = [];
|
||||||
|
|
||||||
var mainContainer = $(this.selectors.mainContainer);
|
var mainContainer = $(this.selectors.mainContainer),
|
||||||
|
gHoverExpand = mainContainer.data('g-hover-expand');
|
||||||
if (!mainContainer) { return; }
|
if (!mainContainer) { return; }
|
||||||
|
|
||||||
this.hoverExpand = mainContainer.data('g-hover-expand') === 'true';
|
this.hoverExpand = gHoverExpand === null || gHoverExpand === 'true';
|
||||||
if (hasTouchEvents || !this.hoverExpand) {
|
if (hasTouchEvents || !this.hoverExpand) {
|
||||||
mainContainer.addClass(this.states.touchEvents);
|
mainContainer.addClass(this.states.touchEvents);
|
||||||
}
|
}
|
||||||
@@ -85,10 +86,10 @@ var Menu = new prime({
|
|||||||
},
|
},
|
||||||
|
|
||||||
attach: function() {
|
attach: function() {
|
||||||
var selectors = this.selectors,
|
var selectors = this.selectors,
|
||||||
main = $(selectors.mainContainer + ' ' + selectors.item),
|
main = $(selectors.mainContainer + ' ' + selectors.item),
|
||||||
mobileContainer = $(selectors.mobileContainer),
|
mobileContainer = $(selectors.mobileContainer),
|
||||||
body = $('body');
|
body = $('body');
|
||||||
|
|
||||||
if (!main) { return; }
|
if (!main) { return; }
|
||||||
if (this.hoverExpand) {
|
if (this.hoverExpand) {
|
||||||
@@ -136,11 +137,11 @@ var Menu = new prime({
|
|||||||
|
|
||||||
touchend: function(event) {
|
touchend: function(event) {
|
||||||
var selectors = this.selectors,
|
var selectors = this.selectors,
|
||||||
states = this.states;
|
states = this.states;
|
||||||
|
|
||||||
var target = $(event.target),
|
var target = $(event.target),
|
||||||
indicator = target.parent(selectors.item).find(selectors.touchIndicator),
|
indicator = target.parent(selectors.item).find(selectors.touchIndicator),
|
||||||
menuType = target.parent('.g-standard') ? 'standard' : 'megamenu',
|
menuType = target.parent('.g-standard') ? 'standard' : 'megamenu',
|
||||||
isGoingBack = target.parent('.g-go-back'),
|
isGoingBack = target.parent('.g-go-back'),
|
||||||
parent, isSelected;
|
parent, isSelected;
|
||||||
|
|
||||||
@@ -171,7 +172,7 @@ var Menu = new prime({
|
|||||||
if ((menuType == 'megamenu' || !parent.parent(selectors.mainContainer)) && (parent.find(' > ' + selectors.dropdown + ', > * > ' + selectors.dropdown) || isGoingBack)) {
|
if ((menuType == 'megamenu' || !parent.parent(selectors.mainContainer)) && (parent.find(' > ' + selectors.dropdown + ', > * > ' + selectors.dropdown) || isGoingBack)) {
|
||||||
var sublevel = target.parent('.g-sublevel') || target.parent('.g-toplevel'),
|
var sublevel = target.parent('.g-sublevel') || target.parent('.g-toplevel'),
|
||||||
slideout = parent.find('.g-sublevel'),
|
slideout = parent.find('.g-sublevel'),
|
||||||
columns = parent.parent('.g-dropdown-column'),
|
columns = parent.parent('.g-dropdown-column'),
|
||||||
blocks;
|
blocks;
|
||||||
|
|
||||||
if (sublevel) {
|
if (sublevel) {
|
||||||
@@ -209,7 +210,7 @@ var Menu = new prime({
|
|||||||
if (dropdown) {
|
if (dropdown) {
|
||||||
var sublevels = dropdown.search('.g-sublevel'),
|
var sublevels = dropdown.search('.g-sublevel'),
|
||||||
slideouts = dropdown.search('.g-slide-out, .' + this.states.selected),
|
slideouts = dropdown.search('.g-slide-out, .' + this.states.selected),
|
||||||
actives = dropdown.search('.' + this.states.active);
|
actives = dropdown.search('.' + this.states.active);
|
||||||
|
|
||||||
if (sublevels) { sublevels.attribute('style', null); }
|
if (sublevels) { sublevels.attribute('style', null); }
|
||||||
if (slideouts) { slideouts.removeClass('g-slide-out').removeClass(this.states.selected); }
|
if (slideouts) { slideouts.removeClass('g-slide-out').removeClass(this.states.selected); }
|
||||||
@@ -221,9 +222,9 @@ var Menu = new prime({
|
|||||||
|
|
||||||
closeAllDropdowns: function() {
|
closeAllDropdowns: function() {
|
||||||
var selectors = this.selectors,
|
var selectors = this.selectors,
|
||||||
states = this.states,
|
states = this.states,
|
||||||
topLevel = $(selectors.mainContainer + ' > .g-toplevel'),
|
topLevel = $(selectors.mainContainer + ' > .g-toplevel'),
|
||||||
roots = topLevel.search(' >' + selectors.item);
|
roots = topLevel.search(' >' + selectors.item);
|
||||||
|
|
||||||
if (roots) { roots.removeClass(states.selected); }
|
if (roots) { roots.removeClass(states.selected); }
|
||||||
if (topLevel) {
|
if (topLevel) {
|
||||||
@@ -237,7 +238,7 @@ var Menu = new prime({
|
|||||||
|
|
||||||
resetStates: function(menu) {
|
resetStates: function(menu) {
|
||||||
if (!menu) { return; }
|
if (!menu) { return; }
|
||||||
var items = menu.search('.g-toplevel, .g-dropdown-column, .g-dropdown, .g-selected, .g-active, .g-slide-out'),
|
var items = menu.search('.g-toplevel, .g-dropdown-column, .g-dropdown, .g-selected, .g-active, .g-slide-out'),
|
||||||
actives = menu.search('.g-active');
|
actives = menu.search('.g-active');
|
||||||
if (!items) { return; }
|
if (!items) { return; }
|
||||||
|
|
||||||
@@ -262,7 +263,7 @@ var Menu = new prime({
|
|||||||
from: parent[0].getBoundingClientRect(),
|
from: parent[0].getBoundingClientRect(),
|
||||||
to: (!isNavMenu ? sublevel.parent('.g-dropdown')[0] : sublevel[0]).getBoundingClientRect()
|
to: (!isNavMenu ? sublevel.parent('.g-dropdown')[0] : sublevel[0]).getBoundingClientRect()
|
||||||
},
|
},
|
||||||
height = Math.max(heights.from.height, heights.to.height);
|
height = Math.max(heights.from.height, heights.to.height);
|
||||||
|
|
||||||
if (!isGoingBack) {
|
if (!isGoingBack) {
|
||||||
// if from height is < than to height set the parent height else, set the target
|
// if from height is < than to height set the parent height else, set the target
|
||||||
@@ -272,8 +273,8 @@ var Menu = new prime({
|
|||||||
// fix sublevels heights in side menu (offcanvas etc)
|
// fix sublevels heights in side menu (offcanvas etc)
|
||||||
if (!isNavMenu) {
|
if (!isNavMenu) {
|
||||||
var maxHeight = height,
|
var maxHeight = height,
|
||||||
block = $(sublevel).parent('.g-block:not(.size-100)'),
|
block = $(sublevel).parent('.g-block:not(.size-100)'),
|
||||||
column = block ? block.parent('.g-dropdown-column') : null;
|
column = block ? block.parent('.g-dropdown-column') : null;
|
||||||
(sublevel.parents('.g-slide-out, .g-dropdown-column') || parent).forEach(function(slideout) {
|
(sublevel.parents('.g-slide-out, .g-dropdown-column') || parent).forEach(function(slideout) {
|
||||||
maxHeight = Math.max(height, parseInt(slideout.style.height || 0, 10));
|
maxHeight = Math.max(height, parseInt(slideout.style.height || 0, 10));
|
||||||
});
|
});
|
||||||
@@ -282,9 +283,9 @@ var Menu = new prime({
|
|||||||
column[0].style.height = maxHeight + 'px';
|
column[0].style.height = maxHeight + 'px';
|
||||||
|
|
||||||
var blocks = column.search('> .g-grid > .g-block'),
|
var blocks = column.search('> .g-grid > .g-block'),
|
||||||
diff = maxHeight;
|
diff = maxHeight;
|
||||||
|
|
||||||
blocks.forEach(function(block, i){
|
blocks.forEach(function(block, i) {
|
||||||
if ((i + 1) != blocks.length) {
|
if ((i + 1) != blocks.length) {
|
||||||
diff -= block.getBoundingClientRect().height;
|
diff -= block.getBoundingClientRect().height;
|
||||||
} else {
|
} else {
|
||||||
@@ -301,17 +302,17 @@ var Menu = new prime({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_calculateBreakpoint: function(value) {
|
_calculateBreakpoint: function(value) {
|
||||||
var digit = parseFloat(value.match(/^\d{1,}/).shift()),
|
var digit = parseFloat(value.match(/^\d{1,}/).shift()),
|
||||||
unit = value.match(/[a-z]{1,}$/i).shift(),
|
unit = value.match(/[a-z]{1,}$/i).shift(),
|
||||||
tolerance = unit.match(/r?em/) ? -0.062 : -1;
|
tolerance = unit.match(/r?em/) ? -0.062 : -1;
|
||||||
|
|
||||||
return (digit + tolerance) + unit;
|
return (digit + tolerance) + unit;
|
||||||
},
|
},
|
||||||
|
|
||||||
_checkQuery: function(mq) {
|
_checkQuery: function(mq) {
|
||||||
var selectors = this.options.selectors,
|
var selectors = this.options.selectors,
|
||||||
mobileContainer = $(selectors.mobileContainer),
|
mobileContainer = $(selectors.mobileContainer),
|
||||||
mainContainer = $(selectors.mainContainer + selectors.mobileTarget) || $(selectors.mainContainer),
|
mainContainer = $(selectors.mainContainer + selectors.mobileTarget) || $(selectors.mainContainer),
|
||||||
find, dropdowns;
|
find, dropdowns;
|
||||||
|
|
||||||
if (mq.matches) {
|
if (mq.matches) {
|
||||||
|
|||||||
Vendored
+2
-5
@@ -27276,8 +27276,6 @@ module.exports = parse
|
|||||||
|
|
||||||
moved = true;
|
moved = true;
|
||||||
|
|
||||||
_dispatchEvent(this, rootEl, 'over', dragEl, rootEl, evt, evt.target);
|
|
||||||
|
|
||||||
if (activeGroup && !options.disabled &&
|
if (activeGroup && !options.disabled &&
|
||||||
(isOwner
|
(isOwner
|
||||||
? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
|
? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
|
||||||
@@ -27504,7 +27502,6 @@ module.exports = parse
|
|||||||
newIndex = oldIndex;
|
newIndex = oldIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.originalEvent = evt;
|
|
||||||
_dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex);
|
_dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex);
|
||||||
|
|
||||||
// Save sorting
|
// Save sorting
|
||||||
@@ -27843,7 +27840,7 @@ module.exports = parse
|
|||||||
var lastEl = el.lastElementChild,
|
var lastEl = el.lastElementChild,
|
||||||
rect = lastEl.getBoundingClientRect();
|
rect = lastEl.getBoundingClientRect();
|
||||||
|
|
||||||
return ((evt.clientY - (rect.top + rect.height) > 5) || (evt.clientX - rect.right > 5)) && lastEl; // min delta
|
return ((evt.clientY - (rect.top + rect.height) > 5) || (evt.clientX - (rect.right + rect.width) > 5)) && lastEl; // min delta
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -27948,7 +27945,7 @@ module.exports = parse
|
|||||||
|
|
||||||
|
|
||||||
// Export
|
// Export
|
||||||
Sortable.version = '1.3.0';
|
Sortable.version = '1.4.2';
|
||||||
return Sortable;
|
return Sortable;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user