mirror of
https://github.com/glanceapp/glance.git
synced 2025-06-22 10:51:24 +02:00
Restore title-url functionality on group titles
This commit is contained in:
parent
6af666b58c
commit
79779eb721
@ -1,6 +1,6 @@
|
|||||||
import { setupPopovers } from './popover.js';
|
import { setupPopovers } from './popover.js';
|
||||||
import { setupMasonries } from './masonry.js';
|
import { setupMasonries } from './masonry.js';
|
||||||
import { throttledDebounce, isElementVisible } from './utils.js';
|
import { throttledDebounce, isElementVisible, openURLInNewTab } from './utils.js';
|
||||||
|
|
||||||
async function fetchPageContent(pageData) {
|
async function fetchPageContent(pageData) {
|
||||||
// TODO: handle non 200 status codes/time outs
|
// TODO: handle non 200 status codes/time outs
|
||||||
@ -255,8 +255,23 @@ function setupGroups() {
|
|||||||
|
|
||||||
for (let t = 0; t < titles.length; t++) {
|
for (let t = 0; t < titles.length; t++) {
|
||||||
const title = titles[t];
|
const title = titles[t];
|
||||||
|
|
||||||
|
if (title.dataset.titleUrl !== undefined) {
|
||||||
|
title.addEventListener("auxclick", (event) => {
|
||||||
|
if (event.button != 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
openURLInNewTab(title.dataset.titleUrl);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
title.addEventListener("click", () => {
|
title.addEventListener("click", () => {
|
||||||
if (t == current) {
|
if (t == current) {
|
||||||
|
if (title.dataset.titleUrl !== undefined) {
|
||||||
|
openURLInNewTab(title.dataset.titleUrl);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,3 +27,7 @@ export function isElementVisible(element) {
|
|||||||
export function clamp(value, min, max) {
|
export function clamp(value, min, max) {
|
||||||
return Math.min(Math.max(value, min), max);
|
return Math.min(Math.max(value, min), max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function openURLInNewTab(url) {
|
||||||
|
window.open(url, '_blank', 'noopener,noreferrer')?.focus();
|
||||||
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<div class="widget-group-header">
|
<div class="widget-group-header">
|
||||||
<div class="widget-header gap-20">
|
<div class="widget-header gap-20">
|
||||||
{{ range $i, $widget := .Widgets }}
|
{{ range $i, $widget := .Widgets }}
|
||||||
<button class="widget-group-title{{ if eq $i 0 }} widget-group-title-current{{ end }}">{{ $widget.Title }}</button>
|
<button class="widget-group-title{{ if eq $i 0 }} widget-group-title-current{{ end }}"{{ if ne "" .TitleURL }} data-title-url="{{ .TitleURL }}"{{ end }}>{{ $widget.Title }}</button>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user