summaryrefslogtreecommitdiff
path: root/public/javascripts/public.js
blob: 10f04e82192ba93948225175539a08bab6660640 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Shadowbox.init({
  skipSetup : true
});


$(document).ready(function(){

  Shadowbox.setup(".shadowbox_image", {gallery : "fofo"})
    
  if ($("#headline_image img").length != 0) {
    image_handler.initialize();
  }
  
  $("div#headline_image a").bind("click", function() {
    return false;
  });
  
  $("div#headline_image a img").bind("click", function(){
    $(".shadowbox_image:first").trigger("click");
  });

  document.getElementById("light-mode").addEventListener("change", () => {
    if (document.getElementById("light-mode").checked)
      localStorage.setItem("override-prefers-color-scheme", 1);
    else
      localStorage.removeItem("override-prefers-color-scheme");
  });
});


var image_handler = {
  initialize : function() {
        
    path_name     = window.location.pathname;
    locale_rexexp = /^\/(en|de)\\/;
    locale_match  = locale_rexexp.exec(path_name);
    
    if (locale_match) {
      locale = locale_match[0];
    }
    else {
      locale = "/de/";
    }
    
    path = path_name.replace(/\/(de|en)*\/*/, "");
    gallery_path = "";
  }
};