~dricottone/blog

ref: 360e020f286673ef32cd7a32f4454f4b46a5fd5c blog/layouts/partials/head.html -rw-r--r-- 1.9 KiB
360e020fDominic Ricottone Simple HTML sanitization 2 years ago
                                                                                
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
49
50
<head>
  <meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1">

  <!-- Page titles
        + Use "MyFileTitle | Dominic Ricottone"
        + Exceptions for...
           + site homepage
           + if "site_title = true" is set in the file
          ... in which case use just "Dominic Ricottone"
    -->
  {{ $title := print .Title " | " .Site.Title }}
  {{ if or (.IsHome) (.Params.site_title) }}{{ $title = .Site.Title }}{{ end }}
  <title>{{ $title }}</title>

  <!--Stylesheets-->
  <link rel="stylesheet" type="text/css" href="/css/common.css" />
  <link rel="stylesheet" type="text/css" href="/css/header.css" />
  <link rel="stylesheet" type="text/css" href="/css/blog.css" />
  {{ if .Params.cgit }}     <link rel="stylesheet" type="text/css" href="/css/cgit.css" /> {{ end }}
  {{ if .Params.lightbox }} <link rel="stylesheet" type="text/css" href="/css/gallery.css" /> {{ end }}
  {{ if .Params.lightbox }} <link rel="stylesheet" type="text/css" href="/css/lightbox-2.11.3.min.css" /> {{ end }}

  <!--JavaScript-->
  <script src="/js/jquery-3.5.1.min.js"></script>
  {{ if .Params.chat }}     <script src="/js/chat.js"></script> {{ end }}
  {{ if .Params.lightbox }} <script src="/js/lightbox-2.11.3.min.js"></script> {{ end }}
  <script>
$(document).ready(function() {
  $(".trigger").on("click keypress", function(event) {
    if (event.type === "keypress") {
      //jQuery's `which` normalizes `keyCode` and `charCode`
      if (event.which !== 13) {
        return;
      }
    }

    // Add `selection` class to this element
    $(this).toggleClass("selection");

    // Add `shown` class to children elements
    let all_classes = this.className.split(/\s+/);
    let classes = all_classes.filter(c => c.startsWith("target-"));
    for (let c = 0; c < classes.length; c++) {
      let target = "." + classes[c].split(/\-/)[1];
      $(target).toggleClass("shown");
    }
  });
});
  </script>
</head>