summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--static/js/pages/directory_init.js11
-rw-r--r--static/js/pages/expandable_login_init.js11
-rw-r--r--static/js/pages/fullscreen_front_run.js7
-rw-r--r--static/js/pages/scroll_pane_init.js13
-rw-r--r--static/js/pages/search_files_init.js13
-rwxr-xr-xtemplate/about_us.st12
-rwxr-xr-xtemplate/altar_log.st7
-rwxr-xr-xtemplate/altar_user_log.st7
-rwxr-xr-xtemplate/directory.st4
-rwxr-xr-xtemplate/form_login.st4
-rwxr-xr-xtemplate/frontpage copy.st2
-rwxr-xr-xtemplate/frontpagePROFILE.st9
-rwxr-xr-xtemplate/frontpage_halloffame.st2
-rwxr-xr-xtemplate/fullscreen_front.st4
-rwxr-xr-xtemplate/help.st14
-rwxr-xr-xtemplate/hiscore_test.st7
-rw-r--r--template/json_tags_block.st7
-rwxr-xr-xtemplate/log.st7
-rwxr-xr-xtemplate/newlog.st7
-rwxr-xr-xtemplate/search_files.st6
-rwxr-xr-xtemplate/simplerlog.st7
21 files changed, 81 insertions, 80 deletions
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/fullscreen_front_run.js b/static/js/pages/fullscreen_front_run.js
new file mode 100644
index 0000000..1116b7a
--- /dev/null
+++ b/static/js/pages/fullscreen_front_run.js
@@ -0,0 +1,7 @@
+// Runs `initFullscreen()` for `template/fullscreen_front.st` without inline JS.
+(function() {
+ if (typeof window.initFullscreen === 'function') {
+ window.initFullscreen();
+ }
+})();
+
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 @@
<head>
<link href="/static/css/pages.css?v=20260130" rel="stylesheet" type="text/css" media="screen" />
<link href="/static/css/header.css?v=20260130" rel="stylesheet" type="text/css" media="screen" />
- <script type="text/javascript" src="/static/js/win.js"></script>
- <script type="text/javascript">
-
-jQuery(function()
-{
- jQuery('.scroll-pane').jScrollPane();
-});
- </script>
- <title>dump.fm: about us</title>
+ <title>dump.fm: about us</title>
$head()$
+ <script type="text/javascript" src="/static/js/win.js"></script>
+ <script type="text/javascript" src="/static/js/pages/scroll_pane_init.js?v=20260203"></script>
</head>
<body class="profile" onload="
javascript:CreateDropdownWindow('about the site', '360px', true, 'news', 70, 75);
diff --git a/template/altar_log.st b/template/altar_log.st
index 40704ee..5d64397 100755
--- a/template/altar_log.st
+++ b/template/altar_log.st
@@ -20,12 +20,7 @@ $banner()$
<span class="content"><center>
$dumps: { d | $log_dump(dump=d)$ }$
</center></span>
- $if(json_tags)$
- <script>
- $json_tags: { j | $j$;
- }$
- </script>
- $endif$
+ $json_tags_block(json_tags=json_tags)$
$else$
No dumps!
$endif$
diff --git a/template/altar_user_log.st b/template/altar_user_log.st
index b3c197c..fe1065b 100755
--- a/template/altar_user_log.st
+++ b/template/altar_user_log.st
@@ -20,12 +20,7 @@
<span class="content">
$dumps: { d | $log_dump(dump=d)$ }$
</span>
- $if(json_tags)$
- <script>
- $json_tags: { j | $j$;
- }$
- </script>
- $endif$
+ $json_tags_block(json_tags=json_tags)$
$else$
No dumps!
$endif$
diff --git a/template/directory.st b/template/directory.st
index 149f284..9b6ff76 100755
--- a/template/directory.st
+++ b/template/directory.st
@@ -6,9 +6,7 @@
<title>dump.fm directory</title>
$endif$
$head()$
- <script>
- jQuery(document).ready(initDirectory);
- </script>
+ <script type="text/javascript" src="/static/js/pages/directory_init.js?v=20260203"></script>
</head>
<body class="profile">
$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 @@
</fieldset>
</div>
<script src="/static/js/home.js?v=20260126" type="text/javascript"></script>
-<script type="text/javascript">
- jQuery(document).ready(initExpandableLoginForm)
-</script>
+<script type="text/javascript" src="/static/js/pages/expandable_login_init.js?v=20260203"></script>
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()$
<span class="loading-bar-label">Loading...</span>
<span class="loading-bar-track"><span id="LB1" class="loading-bar-fill"></span></span>
</span>
-<script type="text/javascript">m00=document.getElementsByTagName("img");m01=m00.length;function images_loading_bar(){m02=0;for(i=0;i<m01;i++)m02+=(m00[i].complete)?1:0;document.getElementById("LB1").style.width=Math.round(m02/m01*100)+'px';if(m02==m01)setTimeout("document.getElementById('LB0').style.display='none'",128); else setTimeout("images_loading_bar()", 64);};images_loading_bar();</script>
+<script type="text/javascript">if (typeof images_loading_bar === "function") { images_loading_bar(); }</script>
</body>
</html>
diff --git a/template/frontpagePROFILE.st b/template/frontpagePROFILE.st
index 5fdef71..6f64d61 100755
--- a/template/frontpagePROFILE.st
+++ b/template/frontpagePROFILE.st
@@ -156,12 +156,7 @@ You are viewing the current trending images posted to dump.fm; a super fun commu
$dumps: { d | $hall_log_dump(dump=d)$ }$
- $if(json_tags)$
- <script>
- $json_tags: { j | $j$;
- }$
- </script>
- $endif$
+ $json_tags_block(json_tags=json_tags)$
$else$
No dumps!
$endif$
@@ -213,6 +208,6 @@ $debug_log()$
<span class="loading-bar-label">Loading...</span>
<span class="loading-bar-track"><span id="LB1" class="loading-bar-fill"></span></span>
</span>
-<script type="text/javascript">m00=document.getElementsByTagName("img");m01=m00.length;function images_loading_bar(){m02=0;for(i=0;i<m01;i++)m02+=(m00[i].complete)?1:0;document.getElementById("LB1").style.width=Math.round(m02/m01*100)+'px';if(m02==m01)setTimeout("document.getElementById('LB0').style.display='none'",128); else setTimeout("images_loading_bar()", 64);};images_loading_bar();</script>
+<script type="text/javascript">if (typeof images_loading_bar === "function") { images_loading_bar(); }</script>
</body>
</html>
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()$
<span class="loading-bar-label">Loading...</span>
<span class="loading-bar-track"><span id="LB1" class="loading-bar-fill"></span></span>
</span>
-<script type="text/javascript">m00=document.getElementsByTagName("img");m01=m00.length;function images_loading_bar(){m02=0;for(i=0;i<m01;i++)m02+=(m00[i].complete)?1:0;document.getElementById("LB1").style.width=Math.round(m02/m01*100)+'px';if(m02==m01)setTimeout("document.getElementById('LB0').style.display='none'",128); else setTimeout("images_loading_bar()", 64);};images_loading_bar();</script>
+<script type="text/javascript">if (typeof images_loading_bar === "function") { images_loading_bar(); }</script>
</body>
</html>
diff --git a/template/fullscreen_front.st b/template/fullscreen_front.st
index 9f0e869..2eadf1f 100755
--- a/template/fullscreen_front.st
+++ b/template/fullscreen_front.st
@@ -13,8 +13,6 @@
<link rel="stylesheet" type="text/css" href="/static/css/fullscreen_bigtext.css?v=20260129">
</head>
<body>
- <script>
- initFullscreen()
- </script>
+ <script type="text/javascript" src="/static/js/pages/fullscreen_front_run.js?v=20260203"></script>
</body>
</html>
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 @@
<head>
<link href="/static/css/pages.css?v=20260130" rel="stylesheet" type="text/css" media="screen"/>
<link href="/static/css/header.css?v=20260130" rel="stylesheet" type="text/css" media="screen"/>
- <script type="text/javascript" src="/static/js/win.js"></script>
-
- <script type="text/javascript">
-
-jQuery(function()
-{
- jQuery('.scroll-pane').jScrollPane();
-});
-
-
- </script>
-
<title>dump.fm</title>
$head()$
+ <script type="text/javascript" src="/static/js/win.js"></script>
+ <script type="text/javascript" src="/static/js/pages/scroll_pane_init.js?v=20260203"></script>
</head>
<body class="profile" onload="
javascript:CreateDropdownWindow('dump.fm', '360px', true, 'news', 30, 115);
diff --git a/template/hiscore_test.st b/template/hiscore_test.st
index 7e0c679..1c2739f 100755
--- a/template/hiscore_test.st
+++ b/template/hiscore_test.st
@@ -25,12 +25,7 @@ $banner()$
<span class="content"><center>
$dumps: { d | $log_dump(dump=d)$ }$
</center></span>
- $if(json_tags)$
- <script>
- $json_tags: { j | $j$;
- }$
- </script>
- $endif$
+ $json_tags_block(json_tags=json_tags)$
$else$
No dumps!
$endif$
diff --git a/template/json_tags_block.st b/template/json_tags_block.st
new file mode 100644
index 0000000..17a8ea4
--- /dev/null
+++ b/template/json_tags_block.st
@@ -0,0 +1,7 @@
+$if(json_tags)$
+<script>
+ $json_tags: { j | $j$;
+ }$
+</script>
+$endif$
+
diff --git a/template/log.st b/template/log.st
index 241a06a..718f360 100755
--- a/template/log.st
+++ b/template/log.st
@@ -20,12 +20,7 @@
<span class="content">
$dumps: { d | $log_dump(dump=d)$ }$
</span>
- $if(json_tags)$
- <script>
- $json_tags: { j | $j$;
- }$
- </script>
- $endif$
+ $json_tags_block(json_tags=json_tags)$
$else$
No dumps!
$endif$
diff --git a/template/newlog.st b/template/newlog.st
index e1f987a..15da014 100755
--- a/template/newlog.st
+++ b/template/newlog.st
@@ -128,12 +128,7 @@ window.location = "/error/ie";
$dumps: { d | $log_dump(dump=d)$ }$
- $if(json_tags)$
- <script>
- $json_tags: { j | $j$;
- }$
- </script>
- $endif$
+ $json_tags_block(json_tags=json_tags)$
$else$
No dumps!
$endif$
diff --git a/template/search_files.st b/template/search_files.st
index 4e55e0f..459a86a 100755
--- a/template/search_files.st
+++ b/template/search_files.st
@@ -4,11 +4,7 @@
<title>dump.fm image search</title>
$head()$
<link rel="stylesheet" type="text/css" href="/static/css/search_files.css?v=20260129">
- <script>
-
-jQuery(document).ready(Search.initFullpage)
-
-</script>
+ <script type="text/javascript" src="/static/js/pages/search_files_init.js?v=20260203"></script>
</head>
<body>
diff --git a/template/simplerlog.st b/template/simplerlog.st
index 9acc742..819f808 100755
--- a/template/simplerlog.st
+++ b/template/simplerlog.st
@@ -147,12 +147,7 @@ dump.fm lets you talk with pictures! Paste an image url, upload, or snap a pic r
$dumps: { d | $log_dump(dump=d)$ }$
- $if(json_tags)$
- <script>
- $json_tags: { j | $j$;
- }$
- </script>
- $endif$
+ $json_tags_block(json_tags=json_tags)$
$else$
No dumps!
$endif$