Compare commits

..

30 Commits

Author SHA1 Message Date
luxick 33180c8be8 Update Readme 2026-05-08 10:16:40 +02:00
luxick ba10fd2573 Update dropdown styling 2026-05-08 09:56:30 +02:00
luxick 922f2e02ec Update editor toolbar.
Unify dropdown handling, refactor crowded toolbar
2026-05-08 09:29:31 +02:00
luxick fcbfeeb96a Reorganize assets folder 2026-05-08 08:34:23 +02:00
luxick d8089d9cb3 Make page rewrite optional 2026-05-07 19:35:10 +02:00
luxick a18f991c0b TOC refinements 2026-05-07 18:56:00 +02:00
luxick cc264daa79 Include Listings in TOC 2026-05-07 14:16:18 +02:00
luxick 8521c1dc6e Disble tabbing trough breadcrumbs 2026-05-07 09:47:14 +02:00
luxick d26a74ff3d Add search index 2026-05-07 09:41:20 +02:00
luxick 2a85492489 Add page footer with request time display 2026-05-07 08:19:39 +02:00
luxick e8c3e53685 Update wikilink syntax
This prevents interference with markdown tables
2026-05-07 07:55:33 +02:00
luxick 0d6aac7844 Replace textarea.value calls 2026-05-04 11:54:58 +02:00
luxick 0d0d06d265 Refinements for tree picker 2026-05-04 11:49:42 +02:00
luxick 66b4374b48 Allow checking off tasks from rendered pages 2026-05-04 11:37:38 +02:00
luxick bdac2ca9a0 Move actions into floatin action button 2026-05-04 10:10:20 +02:00
luxick 99579ba7e5 Update search function 2026-05-04 10:03:53 +02:00
luxick be035bf478 Add separator for search header 2026-05-04 09:49:43 +02:00
luxick ce27c52a48 Refactor CSS styling 2026-04-29 19:38:41 +02:00
luxick 86f2b7c34f Refactor Layout and improve search 2026-04-29 19:26:01 +02:00
luxick c688761e89 Full-text search v1 2026-04-29 14:30:37 +02:00
luxick 174e2dd1cd exclude .zed dir 2026-04-29 14:18:27 +02:00
luxick a9ca40c2bd Resolve symlink root in search 2026-04-29 14:17:52 +02:00
luxick eae5d1cc25 Search phase 1 2026-04-29 14:12:18 +02:00
luxick 1d8dfdb1da Force external links into new tabs 2026-04-29 13:17:42 +02:00
luxick 6c268aa829 Adjust anchor icon style 2026-04-28 17:49:00 +02:00
luxick 73a8b4f78f Improve sections 2026-04-28 17:43:20 +02:00
luxick 1f7cfd637a Use placeholder svg 2026-04-23 20:58:33 +02:00
luxick 02a1482789 Add thumbnailing for photo grids 2026-04-23 20:43:05 +02:00
luxick 60b514eae7 Prefill Empty pages 2026-04-23 14:34:07 +02:00
luxick dedeeb77a8 Migrate movie info downloader 2026-04-23 14:20:53 +02:00
+10 -66
View File
@@ -1,7 +1,8 @@
window.EditorMovie = (function () {
'use strict';
var STORAGE_KEY = 'omdb-api-key';
// OMDb API key. Shipped to the browser; acceptable for a single-user LAN tool.
var OMDB_API_KEY = 'c906744f';
var BEGIN = '<!-- BEGIN MOVIE -->';
var END = '<!-- END MOVIE -->';
@@ -72,8 +73,8 @@ window.EditorMovie = (function () {
}
}
function fetchMovie(key, title, year) {
var url = 'https://www.omdbapi.com/?apikey=' + encodeURIComponent(key) +
function fetchMovie(title, year) {
var url = 'https://www.omdbapi.com/?apikey=' + encodeURIComponent(OMDB_API_KEY) +
'&type=movie&t=' + encodeURIComponent(title);
if (year) url += '&y=' + encodeURIComponent(year);
return fetch(url).then(function (r) { return r.json(); });
@@ -83,54 +84,17 @@ window.EditorMovie = (function () {
openModal({ title: title, body: msg, confirm: { label: 'OK' } });
}
function promptForKey(rejected, onSaved) {
var body = document.createDocumentFragment();
if (rejected) {
var notice = document.createElement('p');
notice.textContent = 'The previously stored key was rejected by OMDb.';
body.appendChild(notice);
function run(textarea) {
if (!OMDB_API_KEY) {
showMessage('Movie import', 'OMDb API key is not set. Edit assets/editor/movie.js.');
return;
}
var info = document.createElement('p');
info.appendChild(document.createTextNode('Enter your OMDb API key. Get one at '));
var link = document.createElement('a');
link.href = 'https://www.omdbapi.com/apikey.aspx';
link.target = '_blank';
link.rel = 'noopener';
link.textContent = 'omdbapi.com/apikey.aspx';
info.appendChild(link);
info.appendChild(document.createTextNode('.'));
body.appendChild(info);
var input = document.createElement('input');
input.type = 'text';
input.className = 'modal-input';
input.placeholder = 'OMDb API key';
body.appendChild(input);
openModal({
title: 'OMDb API key required',
body: body,
confirm: {
label: 'SAVE',
onConfirm: function () {
var key = input.value.trim();
if (!key) return;
localStorage.setItem(STORAGE_KEY, key);
closeModal();
onSaved(key);
},
},
});
}
function importWithKey(textarea, key, initialTitle) {
var input = document.createElement('input');
input.type = 'text';
input.className = 'modal-input';
input.placeholder = 'Title, optionally with (YYYY)';
input.value = initialTitle;
input.value = firstHeading(textarea.value || '');
openModal({
title: 'Import movie',
@@ -142,16 +106,8 @@ window.EditorMovie = (function () {
if (!raw) return;
var parsed = parseTitleYear(raw);
closeModal();
fetchMovie(key, parsed.title, parsed.year)
fetchMovie(parsed.title, parsed.year)
.then(function (data) {
if (data && data.Response === 'False' &&
data.Error === 'Invalid API key!') {
localStorage.removeItem(STORAGE_KEY);
promptForKey(true, function (newKey) {
importWithKey(textarea, newKey, raw);
});
return;
}
if (!data || data.Response === 'False') {
showMessage('Not found',
(data && data.Error) || 'Movie not found.');
@@ -167,17 +123,5 @@ window.EditorMovie = (function () {
});
}
function run(textarea) {
var initialTitle = firstHeading(textarea.value || '');
var key = localStorage.getItem(STORAGE_KEY);
if (!key) {
promptForKey(false, function (newKey) {
importWithKey(textarea, newKey, initialTitle);
});
return;
}
importWithKey(textarea, key, initialTitle);
}
return { run: run };
})();