mirror of
https://github.com/HeyPuter/puter.git
synced 2025-02-02 23:28:39 +08:00
menuAim
should only be activated on menu items that have submenus
This commit is contained in:
parent
d2d03dee35
commit
42636ea36d
@ -75,6 +75,7 @@ function UITabAbout(){
|
||||
<li>iro.js <a target="_blank" href="https://github.com/jaames/iro.js/blob/master/LICENSE.txt">${i18n('license')}</a></li>
|
||||
<li>jQuery <a target="_blank" href="https://jquery.org/license/">${i18n('license')}</a></li>
|
||||
<li>jQuery-dragster <a target="_blank" href="https://github.com/catmanjan/jquery-dragster/blob/master/LICENSE">${i18n('license')}</a></li>
|
||||
<li>jQuery-menu-aim <a target="_blank" href="https://github.com/kamens/jQuery-menu-aim?tab=readme-ov-file#faq">${i18n('license')}</a></li>
|
||||
<li>jQuery UI <a target="_blank" href="https://jquery.org/license/">${i18n('license')}</a></li>
|
||||
<li>lodash <a target="_blank" href="https://lodash.com/license">${i18n('license')}</a></li>
|
||||
<li>mime <a target="_blank" href="https://github.com/broofa/mime/blob/main/LICENSE">${i18n('license')}</a></li>
|
||||
|
@ -148,12 +148,13 @@ function UIContextMenu(options){
|
||||
return false;
|
||||
});
|
||||
|
||||
// initialize menuAim plugin (../libs/jquery.menu-aim.js)
|
||||
// Initialize the menuAim plugin (../libs/jquery.menu-aim.js)
|
||||
$(contextMenu).menuAim({
|
||||
submenuSelector: ".context-menu-item-submenu",
|
||||
submenuDirection: function(){
|
||||
//if not submenu
|
||||
// If not submenu
|
||||
if(!options.is_submenu){
|
||||
// if submenu left postiton is greater than main menu left position
|
||||
// if submenu's left postiton is greater than main menu's left position
|
||||
if($(contextMenu).offset().left + 2 * $(contextMenu).width() + 15 < window.innerWidth ){
|
||||
return "right";
|
||||
} else {
|
||||
@ -161,12 +162,10 @@ function UIContextMenu(options){
|
||||
}
|
||||
}
|
||||
},
|
||||
//activates item when mouse enters depending in mouse position and direction
|
||||
// activates item when mouse enters depending on mouse position and direction
|
||||
activate: function (e) {
|
||||
|
||||
//activate items
|
||||
let item = $(e).closest('.context-menu-item');
|
||||
|
||||
// mark other items as inactive
|
||||
$(contextMenu).find('.context-menu-item').removeClass('context-menu-item-active');
|
||||
// mark this item as active
|
||||
@ -176,7 +175,6 @@ function UIContextMenu(options){
|
||||
// mark this context menu as active
|
||||
$(contextMenu).addClass('context-menu-active');
|
||||
|
||||
|
||||
// activate submenu
|
||||
// open submenu if applicable
|
||||
if($(e).hasClass('context-menu-item-submenu')){
|
||||
|
Loading…
Reference in New Issue
Block a user