right click for default tab favorites
This commit is contained in:
@@ -6027,6 +6027,26 @@ body[type='login'] {
|
|||||||
background: rgba(245,197,24,0.1);
|
background: rgba(245,197,24,0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Subtle dot indicator when fav tab is set as default */
|
||||||
|
.ep-tab-default::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
bottom: 2px;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
width: 5px;
|
||||||
|
height: 5px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--emoji-fav-color, #f5c518);
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
.ep-tab-default {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.ep-tab-default.active::after {
|
||||||
|
display: none; /* hide dot when the tab is actively selected — border is enough */
|
||||||
|
}
|
||||||
|
|
||||||
.ep-tab img,
|
.ep-tab img,
|
||||||
.ep-tab video,
|
.ep-tab video,
|
||||||
.ep-tab i {
|
.ep-tab i {
|
||||||
|
|||||||
@@ -4144,6 +4144,8 @@ class CommentSystem {
|
|||||||
}, delay);
|
}, delay);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
// Expose showToast so fav-tab right-click can use it
|
||||||
|
window._showEmojiToast = showToast;
|
||||||
// Click/tap overlay background to dismiss
|
// Click/tap overlay background to dismiss
|
||||||
overlay.addEventListener('click', () => window.stickerPreview.hide());
|
overlay.addEventListener('click', () => window.stickerPreview.hide());
|
||||||
// Desktop safety net: if mouse released outside the sticker, hide preview
|
// Desktop safety net: if mouse released outside the sticker, hide preview
|
||||||
@@ -4447,6 +4449,27 @@ class CommentSystem {
|
|||||||
favTab.addEventListener('mousedown', e => e.preventDefault());
|
favTab.addEventListener('mousedown', e => e.preventDefault());
|
||||||
favTab.addEventListener('click', () => showTab('__favs__'));
|
favTab.addEventListener('click', () => showTab('__favs__'));
|
||||||
addTabTouch(favTab, () => showTab('__favs__'));
|
addTabTouch(favTab, () => showTab('__favs__'));
|
||||||
|
// Right-click on fav tab → set/unset as default
|
||||||
|
favTab.addEventListener('contextmenu', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
if (navigator.maxTouchPoints > 0) return;
|
||||||
|
const KEY = 'f0ck_emoji_default_tab';
|
||||||
|
const isDefault = localStorage.getItem(KEY) === '__favs__';
|
||||||
|
if (isDefault) {
|
||||||
|
localStorage.removeItem(KEY);
|
||||||
|
favTab.classList.remove('ep-tab-default');
|
||||||
|
window._showEmojiToast?.('Favorites unset as default tab');
|
||||||
|
} else {
|
||||||
|
localStorage.setItem(KEY, '__favs__');
|
||||||
|
favTab.classList.add('ep-tab-default');
|
||||||
|
window._showEmojiToast?.('Favorites set as default tab');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Mark as default if already set
|
||||||
|
if (localStorage.getItem('f0ck_emoji_default_tab') === '__favs__') {
|
||||||
|
favTab.classList.add('ep-tab-default');
|
||||||
|
}
|
||||||
tabBar.appendChild(favTab);
|
tabBar.appendChild(favTab);
|
||||||
|
|
||||||
packs.forEach((pack, i) => {
|
packs.forEach((pack, i) => {
|
||||||
@@ -4476,8 +4499,9 @@ class CommentSystem {
|
|||||||
picker.appendChild(tabBar);
|
picker.appendChild(tabBar);
|
||||||
picker.appendChild(gridArea);
|
picker.appendChild(gridArea);
|
||||||
|
|
||||||
// Show first pack by default
|
// Show default tab (favorites if set, otherwise first pack)
|
||||||
showTab(packs[0]?.id ?? null);
|
const defaultTab = localStorage.getItem('f0ck_emoji_default_tab');
|
||||||
|
showTab(defaultTab === '__favs__' ? '__favs__' : (packs[0]?.id ?? null));
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper: close picker with the out-animation, then hide
|
// Helper: close picker with the out-animation, then hide
|
||||||
|
|||||||
@@ -1978,6 +1978,27 @@ if (window.__dmLoaded) {
|
|||||||
favsTab.innerHTML = '<i class="fa-solid fa-star" style="font-size:14px;color:var(--emoji-fav-color,#f5c518);"></i>';
|
favsTab.innerHTML = '<i class="fa-solid fa-star" style="font-size:14px;color:var(--emoji-fav-color,#f5c518);"></i>';
|
||||||
favsTab.addEventListener('mousedown', e => e.preventDefault());
|
favsTab.addEventListener('mousedown', e => e.preventDefault());
|
||||||
favsTab.addEventListener('click', () => showDmTab('__favs__', packs));
|
favsTab.addEventListener('click', () => showDmTab('__favs__', packs));
|
||||||
|
// Right-click on fav tab → set/unset as default
|
||||||
|
favsTab.addEventListener('contextmenu', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
if (navigator.maxTouchPoints > 0) return;
|
||||||
|
const KEY = 'f0ck_emoji_default_tab';
|
||||||
|
const isDefault = localStorage.getItem(KEY) === '__favs__';
|
||||||
|
if (isDefault) {
|
||||||
|
localStorage.removeItem(KEY);
|
||||||
|
favsTab.classList.remove('ep-tab-default');
|
||||||
|
window._showEmojiToast?.('Favorites unset as default tab');
|
||||||
|
} else {
|
||||||
|
localStorage.setItem(KEY, '__favs__');
|
||||||
|
favsTab.classList.add('ep-tab-default');
|
||||||
|
window._showEmojiToast?.('Favorites set as default tab');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Mark as default if already set
|
||||||
|
if (localStorage.getItem('f0ck_emoji_default_tab') === '__favs__') {
|
||||||
|
favsTab.classList.add('ep-tab-default');
|
||||||
|
}
|
||||||
dmTabBar.appendChild(favsTab);
|
dmTabBar.appendChild(favsTab);
|
||||||
|
|
||||||
// ── Pack tabs ──
|
// ── Pack tabs ──
|
||||||
@@ -2005,7 +2026,9 @@ if (window.__dmLoaded) {
|
|||||||
|
|
||||||
picker.appendChild(dmTabBar);
|
picker.appendChild(dmTabBar);
|
||||||
picker.appendChild(dmGridArea);
|
picker.appendChild(dmGridArea);
|
||||||
showDmTab(packs[0]?.id ?? null, packs);
|
// Show default tab (favorites if set, otherwise first pack)
|
||||||
|
const defaultTab = localStorage.getItem('f0ck_emoji_default_tab');
|
||||||
|
showDmTab(defaultTab === '__favs__' ? '__favs__' : (packs[0]?.id ?? null), packs);
|
||||||
|
|
||||||
// Expose refresh hook so syncFromDB can update the open favs tab
|
// Expose refresh hook so syncFromDB can update the open favs tab
|
||||||
window._emojiPickerRefresh = () => {
|
window._emojiPickerRefresh = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user