diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-06-30 17:11:32 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-06-30 17:29:12 +0200 |
| commit | 3e87925a35f73aa2261eb66df3ef4ca11b64eeea (patch) | |
| tree | 8a9a6da1f99b4480e07548ffaf5d5b4945603ba9 /public/javascripts/public.js | |
| parent | b97466cdfbcb5b02d4eaf38661c051d1a095838e (diff) | |
Replace Shadowbox with GLightbox, drop jQuery from public site
Vendors GLightbox 3.3.1 (MIT, dependency-free) as static files in
public/javascripts and public/stylesheets, replacing the Shadowbox
2009 vendor tree and its jQuery adapter. Public site no longer loads
jQuery at all.
- app/views/layouts/application.html.erb: swap Shadowbox script/style
includes and the public_bundle (jQuery) include for GLightbox's
CSS/JS
- app/views/content/_headline_image.html.erb: headline image is now
itself a GLightbox trigger; additional images are direct
a.glightbox links sharing a per-page data-gallery group, replacing
the hidden shadowbox_images div and its click-forwarding trigger
- public/javascripts/public.js: replace Shadowbox.init/setup and the
click-forwarding handler with a single GLightbox() init call;
remove the unused image_handler object
- Remove public/javascripts/shadowbox/ (including vendored Sizzle,
swfobject, and unused video/Flash players) and
public/stylesheets/shadowbox.css
- Remove app/assets/javascripts/public_bundle.js (jquery require)
Diffstat (limited to 'public/javascripts/public.js')
| -rw-r--r-- | public/javascripts/public.js | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/public/javascripts/public.js b/public/javascripts/public.js index 10f04e8..07ee05a 100644 --- a/public/javascripts/public.js +++ b/public/javascripts/public.js | |||
| @@ -1,23 +1,6 @@ | |||
| 1 | Shadowbox.init({ | ||
| 2 | skipSetup : true | ||
| 3 | }); | ||
| 4 | |||
| 5 | |||
| 6 | $(document).ready(function(){ | 1 | $(document).ready(function(){ |
| 7 | 2 | ||
| 8 | Shadowbox.setup(".shadowbox_image", {gallery : "fofo"}) | 3 | GLightbox({ selector: '.glightbox' }); |
| 9 | |||
| 10 | if ($("#headline_image img").length != 0) { | ||
| 11 | image_handler.initialize(); | ||
| 12 | } | ||
| 13 | |||
| 14 | $("div#headline_image a").bind("click", function() { | ||
| 15 | return false; | ||
| 16 | }); | ||
| 17 | |||
| 18 | $("div#headline_image a img").bind("click", function(){ | ||
| 19 | $(".shadowbox_image:first").trigger("click"); | ||
| 20 | }); | ||
| 21 | 4 | ||
| 22 | document.getElementById("light-mode").addEventListener("change", () => { | 5 | document.getElementById("light-mode").addEventListener("change", () => { |
| 23 | if (document.getElementById("light-mode").checked) | 6 | if (document.getElementById("light-mode").checked) |
| @@ -26,23 +9,3 @@ $(document).ready(function(){ | |||
| 26 | localStorage.removeItem("override-prefers-color-scheme"); | 9 | localStorage.removeItem("override-prefers-color-scheme"); |
| 27 | }); | 10 | }); |
| 28 | }); | 11 | }); |
| 29 | |||
| 30 | |||
| 31 | var image_handler = { | ||
| 32 | initialize : function() { | ||
| 33 | |||
| 34 | path_name = window.location.pathname; | ||
| 35 | locale_rexexp = /^\/(en|de)\\/; | ||
| 36 | locale_match = locale_rexexp.exec(path_name); | ||
| 37 | |||
| 38 | if (locale_match) { | ||
| 39 | locale = locale_match[0]; | ||
| 40 | } | ||
| 41 | else { | ||
| 42 | locale = "/de/"; | ||
| 43 | } | ||
| 44 | |||
| 45 | path = path_name.replace(/\/(de|en)*\/*/, ""); | ||
| 46 | gallery_path = ""; | ||
| 47 | } | ||
| 48 | }; | ||
