Commit Graph

344 Commits

Author SHA1 Message Date
Matt Mascarenhas 14dafa4abe cinera.c: Fix stack-use-after-return segfault
The ClashResolver, or a memory_book variable therein, triggered a
stack-use-after-return segfault. Fixed by initialising the ClashResolver
in main() and passing it to InitClashResolver() by pointer, rather than
initialising it in InitClashResolver().
2024-03-12 13:03:08 +00:00
Matt Mascarenhas 213bb2f882 cinera.c: Fix colouring of topic dots
The colour computed for topic dots and put into cinera_topics.css in HSL
format has its lightness value modified depending on whether it's on a
dark or light background. Web browsers do not tell us an element's
computed colour in HSL format, but in RGB, so we would need to convert
it from RGB to HSL when setting the lightness. Previously, this
conversion was busted, calculating too small a value for the saturation.

This commit obviates the need for any RGB→HSL conversion by writing the
hue and saturation values as attributes to the elements, which the
function responsible for setting the lightness may use directly.
2024-02-21 20:52:34 +00:00
Matt Mascarenhas 77aec74483 cinera_player_post.js: Fix fullscreen handling
It is possible to bring our player out of fullscreen mode without using
the provided views menu or keyboard shortcut, e.g. by pressing Escape.
Doing so leaves our state in the SUPERTHEATRE view, which omits
SUPERtheatre mode itself from the views menu. This commit fixes this by
switching our state to the THEATRE view.

Thanks to Aske Bisgaard Vammen for the report.
2024-01-30 15:41:30 +00:00
Matt Mascarenhas 6852d06e04 cinera_player_pre.js: Unset focused menu
When hiding any menu, set this.MenusFocused.MenuID = menu_id.UNSET, to
let hovering over the markers focus them after hiding the link menu.
2023-03-25 01:51:40 +00:00
Matt Mascarenhas 52d6d989f8 cinera_player_pre.js: Fix scoping of "this" 2023-03-25 01:31:13 +00:00
Matt Mascarenhas df93674bf7 cinera: Increase precision to milliseconds
This commit simply adds millisecond precision of timecodes. It includes
small changes to hmmlib.h, cinera.c and the frontend JS files.
2023-03-25 00:04:34 +00:00
Matt Mascarenhas 026585e50b cinera: Fix mobile scrolling and centring
This commit fixes spurious scrolling in DeriveReliableWindowDimensions()
on mobile. It also fixes centring of Vimeo videos on mobile.

In addition, it replaces some deprecated JavaScript:
•   window.orientation → screen.orientation.type
•   window.onorientationchange → screen.orientation.onchange
2023-03-21 19:34:24 +00:00
Matt Mascarenhas 9d5f0f9146 cinera_player_pre.js: Fix scoping of "this" 2023-03-18 01:54:42 +00:00
Matt Mascarenhas a7694d4c3b cinera: Improve keyboard controls and scrolling
This commit adds keyboard navigation of the indices, documented in the
"Help" text box. It also improves scrolling of menus to follow progress
through the video, with the ability to centre the scrolling around a
range of references. Finally in this UI work, it enables the keyboard
and mouse to work more cooperatively.

Other changes:

• Added a "Clear" so the player's initial sizing happens invisibly.
• Fixed getBackgroundColourRGB() to handle both rgb() and rgba().
• Deduplicated code, including spurious querySelectorAll() calls.
• Moved global variables into the Player object.
2023-03-18 01:27:05 +00:00
Matt Mascarenhas c9bf96c7aa cinera_player_pre.js: Improve sizing and scrolling
This commit fixes the sizing of the player's menus to not protrude below
the player.

It also adds scrolling of the references menu to the first menu item
cited in the newly-current timestamp, and fixes scrolling of the markers
container when switching to a timestamp after the user has scrolled the
container away from its default position.
2023-02-20 20:29:16 +00:00
Matt Mascarenhas 44a5008aa7 cinera: Resolve output location clashes
This commit adds support for tracking and resolving clashes of output
locations. Previously open-ended clash dependency chains could passively
resolve across multiple Cinera invocations (undesirable, but possible);
whereas closed-loop dependency chains could not resolve without the user
manually resolving them by moving one clash to a temporary location (not
acceptable). This new support handles such clashes in one fell swoop.

Other smaller changes in this commit:

•   Change message_control to use memory_book
•   Fix deletion of old .index files when reorganising projects
•   Fix deletion of moved entries when subdividing projects
2023-02-10 23:12:21 +00:00
Matt Mascarenhas 6576a91d11 cinera: Support message deduplication
This commit adds support for deduplication of messages emitted by
PrintEdit(). It's a first pass, only supporting single-line messages and
ones no larger than 512 bytes.

It also fixes StringContains() to skip strings shorter than the search
substring, and emits a more sensible error on empty "output" value.
2023-01-13 20:31:44 +00:00
Matt Mascarenhas 1280142d45 cinera.c: Clean up string copy functions
This commit replaces ClearCopyStringNoFormat() with
ClearCopyStringNoFormatOrTerminate(). All calls to that function
passed an implicitly 0-terminated string as the destination, meaning
that we don't need to 0-terminate them and, in not doing, we free up a
byte to store data.

It also deduplicates code as CopyBytes(), and does a little bounds
checking before actually trying to copy.
2023-01-13 12:01:26 +00:00
Matt Mascarenhas 6b09247cd2 cinera.c: Enable default closed captions
This commit adds support for configurably enabling closed captions by
default. Set the "default_cc_lang" in a config file, or "cc_lang" in the
[video] node of an .hmml file. Once set, videos which contain captions
for this langage will be initialised with these captions enabled.

New config setting:

New [video] node field:
2023-01-11 19:24:41 +00:00
Matt Mascarenhas 554f7393ff cinera_search_pre.js: Fix scrolling bug
This commit fixes ResizeFunction() to scroll back to the original Y
position, rather than the nexus (i.e. the grid or list), after resizing
the grid as a result of the window having been resized.
2023-01-10 12:39:06 +00:00
Matt Mascarenhas e8ed2f0143 cinera.c: Fix buffer overflow copying "output"
This is a hotfix made just to allow using a max-length "output" value.
Next commit should fix buffer overflows for all copies to implicitly
null-terminated destinations.
2022-12-15 20:23:30 +00:00
Matt Mascarenhas ac4b155e73 cinera.c: Add Donorbox as default support platform 2022-12-06 18:22:06 +00:00
Matt Mascarenhas 0f15957cb5 cinera.c: Abbreviate names better
This commit makes the auto-derivation of name abbreviations code handle
quoted nicknames and lower-cased surname prefixes (e.g. du Pré). It also
upstreams the abbreviation to config parse time, and introduces config
fields in the person scope to allow overwriting the auto-derived ones.

Bug fixes:
    •   Fix null pointer dereference in InsertProjectIntoDB(), due to a
        rogue WriteFromByteToPointer() call left in when removing the
        _TopLevel() database modification functions in v0.10.14
    •   Fix config file locking by closing all config files on detecting
        a config file change, even if we had no prior working config
    •   Increase IncludesSearch buffer size from 2 to 4KB

New config fields in the person scope:
    •   abbrev_initial
    •   abbrev_given_or_nickname
    •   abbrev_dotted_initial_and_surname
2022-11-25 21:12:59 +00:00
Matt Mascarenhas 68d1469212 cinera.c: Add Ko-fi as a default support platform 2022-10-13 20:21:48 +01:00
Matt Mascarenhas f321a6b6bf Update 2022-09-23 18:39:01 +01:00
Matt Mascarenhas 6ea5cb6d22 Update 2022-09-23 17:47:12 +01:00
Matt Mascarenhas 0825cbb5ff Update 2022-09-23 17:42:18 +01:00
Matt Mascarenhas 6e9c7edd1d Update 2022-09-23 17:39:07 +01:00
Matt Mascarenhas b8f143e350 cinera: Add database structure specification
This commit aims to generalise database structures such that any block
may be traversed without the need for specific functions for each type.
Concretely, it replaces functions like SkipAsset() and SkipProject()
with a generic SkipHeaderedSectionRecursively(). The change also paves
the way for the plethora of new block types due in CINERA_DB_VERSION 6.
2022-09-19 17:22:19 +01:00
Matt Mascarenhas f60cf3087f cinera: Lock database and config files
This commit aims to help Cinera instances coordinate themselves by
throwing an error upon being instructed to use a database or config
file currently in use by another instance.
2022-09-16 16:10:19 +01:00
Matt Mascarenhas 1cf703e346 cinera: Fully handle auto-numbering
•   Renumber affected entries when inserting / deleting an entry of an
    auto-numbered project
•   Prohibit an entry from sharing an "output" with another entry
•   Prohibit an entry's "output" from containing a slash
•   Fix entry HTML deletion to use OutputLocation, not BaseFilename
2022-08-30 19:15:44 +01:00
Matt Mascarenhas 26e304f62c cinera: Add IRC unfurl tags and GitHub sponsors
New config field:
2022-08-23 22:36:20 +01:00
Matt Mascarenhas 8dffa513cc cinera: Add tag __CINERA_PROJECT_LINEAGE _ 2022-08-21 19:15:10 +01:00
Matt Mascarenhas e17c3aa78c cinera.c: Handle overlong "output" attribute 2022-08-03 22:56:24 +01:00
Matt Mascarenhas 84a35b9ece cinera: Add numbering and fix sizes
New config options:
    numbering_filename_prefix (string)
        Defaults to $project
        filename_derived (default)
    numbering_start (number)
        May be used to 0-index the set
    numbering_unit (renamed from "unit")
    numbering_zero_pad (boolean)

This commit also fixes the size of the "?" help button and category dots
when the wider site uses box-sizing: border-box
2022-08-01 20:58:55 +01:00
Matt Mascarenhas ef9937e95b hmmlib.h: Add "number" parameter to [video] node 2022-08-01 20:33:38 +01:00
Matt Mascarenhas 652d8f186f Revert "Introduce threading and clean some code"
This reverts commit f7a6df994f.
2022-07-21 20:04:50 +01:00
Matt Mascarenhas 91c33c580b cinera.c: Add a break to a switch case 2022-07-21 19:50:18 +01:00
Matt Mascarenhas f7a6df994f Introduce threading and clean some code
This is an unversioned interim commit with unfinalised code.

The threading code establishes job queues.
The code cleanup removes various _TopLevel functions pertaining to
database operations.
2022-05-20 17:32:28 +01:00
Matt Mascarenhas b6fb755d29 cinera.css: Set margin on search page links
This commit enables Google's Mobile Usability checker to proceed beyond
its quick initial validation, after finding the previous fixes failed.
2021-10-08 15:18:23 +01:00
Matt Mascarenhas d036145b7f cinera.css: Let tall menus scroll 2021-10-06 17:38:18 +01:00
Matt Mascarenhas 60615322dd cinera.css: Apply min-height more broadly
This commit enables Google's Mobile Usability checker to proceed beyond
its quick initial validation.
2021-10-06 17:12:26 +01:00
Matt Mascarenhas 2deb244cce cinera.css: Set min-height on search page links
This commit tries to fix a "Clickable elements too close together"
2021-10-06 16:38:21 +01:00
Matt Mascarenhas 4dc034ecc3 cinera.c: Use html_title in Welcome / End markers 2021-10-06 15:45:19 +01:00
Matt Mascarenhas ee788b0c30 cinera_player_pre.js: Fix YouTube initialisation
Initialise the player if the YouTube API loads before us
2021-09-01 16:38:23 +01:00
Matt Mascarenhas c839e2ed85 cinera.c: Add "direct" video support
• Rename Annotation → Timestamp in cinera_player_*.js
• Redo VideoIsPrivate() to only return once, at the end
2021-07-07 16:33:54 +01:00
Matt Mascarenhas 012d1608a0 cinera.c: Mention "vimeo" in the help text
Also remove HMMLIB_MAJOR_VERSION #defined out code
2021-06-28 13:32:15 +01:00
Matt Mascarenhas 97806c2c9c cinera_player_post.js: s/setTime/setTimeThenPlay
Thanks to @nairou on twitter for the report
2021-06-27 19:13:18 +01:00
Matt Mascarenhas dd33bb49b3 cinera_player_pre.js: Add Vimeo support

• Fix fullscreen
• Pause whenever / however following a reference or credit URL
2021-06-23 15:13:41 +01:00
Matt Mascarenhas e39a09c0ad cinera: Code clean-up
• Make vod_platform an enum
• Unionise config_int_pair and config_bool_pair in config_pair
2021-06-17 13:32:53 +01:00
Matt Mascarenhas 744515dac4 cinera_clear.js: Fix the placement of the clear 2021-06-11 17:39:48 +01:00
Matt Mascarenhas 209979f63a cinera.js: Add a "Clear" element
To use it, source the cinera_clear.js file at the position in the HTML
file to be obscured while further processing occurs. (Make sure not to
"defer" it.)

After processing is complete, call FlipClear()
2021-06-11 16:38:38 +01:00
Matt Mascarenhas 12b06812bf cinera.js: Improve style
•   Do not modify visibility of list view during resize
•   Stabilise player sizing across fullscreen toggle and resize
2021-06-11 14:03:13 +01:00
Matt Mascarenhas 373195069a cinera.css: Use rem unit for font-size 2021-06-09 16:30:06 +01:00
Matt Mascarenhas 07795b7cbd cinera.c: Fix segfault on partial hmmlib1 credit 2021-06-07 13:19:03 +01:00