From 263677a46ee031277fae07109acac17b5ef821c4 Mon Sep 17 00:00:00 2001 From: yo momma Date: Tue, 3 Feb 2026 21:30:24 +0000 Subject: Refactor: extract page init snippets --- static/js/pages/directory_init.js | 11 +++++++++++ static/js/pages/expandable_login_init.js | 11 +++++++++++ static/js/pages/scroll_pane_init.js | 13 +++++++++++++ static/js/pages/search_files_init.js | 13 +++++++++++++ template/about_us.st | 12 +++--------- template/directory.st | 4 +--- template/form_login.st | 4 +--- template/frontpage copy.st | 2 +- template/frontpagePROFILE.st | 2 +- template/frontpage_halloffame.st | 2 +- template/help.st | 14 ++------------ template/search_files.st | 6 +----- 12 files changed, 59 insertions(+), 35 deletions(-) create mode 100644 static/js/pages/directory_init.js create mode 100644 static/js/pages/expandable_login_init.js create mode 100644 static/js/pages/scroll_pane_init.js create mode 100644 static/js/pages/search_files_init.js diff --git a/static/js/pages/directory_init.js b/static/js/pages/directory_init.js new file mode 100644 index 0000000..70f2017 --- /dev/null +++ b/static/js/pages/directory_init.js @@ -0,0 +1,11 @@ +// Directory page initializer. +// Keeps templates mostly data-only. + +(function() { + if (typeof jQuery !== 'function') { return; } + + jQuery(function() { + if (typeof initDirectory === 'function') { initDirectory(); } + }); +})(); + diff --git a/static/js/pages/expandable_login_init.js b/static/js/pages/expandable_login_init.js new file mode 100644 index 0000000..669836f --- /dev/null +++ b/static/js/pages/expandable_login_init.js @@ -0,0 +1,11 @@ +// Expandable login-form initializer (used by $form_login()$). +// Keeps templates mostly data-only. + +(function() { + if (typeof jQuery !== 'function') { return; } + + jQuery(function() { + if (typeof initExpandableLoginForm === 'function') { initExpandableLoginForm(); } + }); +})(); + diff --git a/static/js/pages/scroll_pane_init.js b/static/js/pages/scroll_pane_init.js new file mode 100644 index 0000000..1508418 --- /dev/null +++ b/static/js/pages/scroll_pane_init.js @@ -0,0 +1,13 @@ +// Optional jScrollPane initializer for legacy pages that use `.scroll-pane`. +// Keep it defensive: some pages may not load the plugin. + +(function() { + if (typeof jQuery !== 'function') { return; } + + jQuery(function() { + if (jQuery.fn && typeof jQuery.fn.jScrollPane === 'function') { + jQuery('.scroll-pane').jScrollPane(); + } + }); +})(); + diff --git a/static/js/pages/search_files_init.js b/static/js/pages/search_files_init.js new file mode 100644 index 0000000..661da63 --- /dev/null +++ b/static/js/pages/search_files_init.js @@ -0,0 +1,13 @@ +// Full-page search initializer. +// Keeps templates mostly data-only. + +(function() { + if (typeof jQuery !== 'function') { return; } + + jQuery(function() { + if (window.Search && typeof window.Search.initFullpage === 'function') { + window.Search.initFullpage(); + } + }); +})(); + diff --git a/template/about_us.st b/template/about_us.st index 1659f4f..b31a622 100755 --- a/template/about_us.st +++ b/template/about_us.st @@ -2,16 +2,10 @@ - - - dump.fm: about us + dump.fm: about us $head()$ + + $banner()$ diff --git a/template/form_login.st b/template/form_login.st index 95b6333..d1ebfd8 100755 --- a/template/form_login.st +++ b/template/form_login.st @@ -27,6 +27,4 @@ - + diff --git a/template/frontpage copy.st b/template/frontpage copy.st index 4549dd7..7a6b1c9 100755 --- a/template/frontpage copy.st +++ b/template/frontpage copy.st @@ -177,6 +177,6 @@ $debug_log()$ Loading... - + diff --git a/template/frontpagePROFILE.st b/template/frontpagePROFILE.st index 5fdef71..4c1b63b 100755 --- a/template/frontpagePROFILE.st +++ b/template/frontpagePROFILE.st @@ -213,6 +213,6 @@ $debug_log()$ Loading... - + diff --git a/template/frontpage_halloffame.st b/template/frontpage_halloffame.st index e2bacc1..394f527 100755 --- a/template/frontpage_halloffame.st +++ b/template/frontpage_halloffame.st @@ -177,6 +177,6 @@ $debug_log()$ Loading... - + diff --git a/template/help.st b/template/help.st index 196a6ae..3d280a2 100755 --- a/template/help.st +++ b/template/help.st @@ -2,20 +2,10 @@ - - - - dump.fm $head()$ + + - + -- cgit v1.2.3-70-g09d2