This commit is contained in:
12
script.js
12
script.js
@@ -4,7 +4,7 @@
|
||||
'use strict';
|
||||
|
||||
function initGalleryThumbs() {
|
||||
var imgs = document.querySelectorAll('div.filetools-gallery img[data-thumb-src]');
|
||||
var imgs = document.querySelectorAll('div.luxtools-gallery img[data-thumb-src]');
|
||||
if (!imgs || !imgs.length) return;
|
||||
|
||||
function loadThumb(img) {
|
||||
@@ -75,13 +75,13 @@
|
||||
|
||||
function openViaService(el, rawPath) {
|
||||
var baseUrl = getServiceUrl(el);
|
||||
if (!baseUrl) return Promise.reject(new Error('No opener service configured'));
|
||||
if (!baseUrl) return Promise.reject(new Error('No client service configured'));
|
||||
|
||||
var headers = {
|
||||
'Content-Type': 'application/json'
|
||||
};
|
||||
var token = getServiceToken(el);
|
||||
if (token) headers['X-Filetools-Token'] = token;
|
||||
if (token) headers['X-Luxtools-Token'] = token;
|
||||
|
||||
return window.fetch(baseUrl + '/open', {
|
||||
method: 'POST',
|
||||
@@ -131,12 +131,12 @@
|
||||
|
||||
function onClick(event) {
|
||||
var el = event.target;
|
||||
if (!el || !el.classList || !el.classList.contains('filetools-open')) return;
|
||||
if (!el || !el.classList || !el.classList.contains('luxtools-open')) return;
|
||||
|
||||
var raw = el.getAttribute('data-path') || '';
|
||||
if (!raw) return;
|
||||
|
||||
// Prefer local opener service.
|
||||
// Prefer local client service.
|
||||
openViaService(el, raw)
|
||||
.catch(function (err) {
|
||||
// If the browser blocks the request before it reaches localhost (mixed-content,
|
||||
@@ -146,7 +146,7 @@
|
||||
// Fallback to old behavior (often blocked in modern browsers).
|
||||
var url = normalizeToFileUrl(raw);
|
||||
if (!url) return;
|
||||
console.warn('Local opener service failed, falling back to file:// navigation:', err);
|
||||
console.warn('Local client service failed, falling back to file:// navigation:', err);
|
||||
try {
|
||||
window.open(url, '_blank', 'noopener');
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user