jekyll-theme-yat 1.9.0 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac1737e727da75e5ea98d69effa7a2a6cfb67983d629ad50d7c68d53ed8e8acf
4
- data.tar.gz: a6a0d53cd3cd7f3f8ac132124212b13e11fbb9302601cfb741788294dadaac17
3
+ metadata.gz: 40afd01c8ec04c85bbbdec989574617affc46bbc654787bf274eb5b2567eab8f
4
+ data.tar.gz: d91b329158c536ef53e461fabf47adc04707f0dae3201834f1e23b54d5493b8e
5
5
  SHA512:
6
- metadata.gz: d8c7650349f043503af65a144074e800dbb51b16973d23d56d432e3b777bd86919596f94cdd5e9c55de99f3de68edc302b729a860df322a21efc20fff4da9fb9
7
- data.tar.gz: 065105e678deaf52fdef4b0f4dd89b878a84ff7e3b29ef6007d26099b5d00f079668e0fa30aaef0a2ce4258ec9823108123af80602c2b5e23088e047d52e3e0d
6
+ metadata.gz: fe439a617d9f796b358e91e7cb562efbc4653d90ad61fd2e941508f872f94abf5693eeca35dedb2519da0f1637c6e5afdfef4cc3e7f60995ba138f579a1d7db8
7
+ data.tar.gz: c12a4377a77170fe1ac27b58e8320610a31f047fbcaef5bc3baa03256c803f1e7b65a10608aecec6880cd860900a608c168cbbbab27ee5a915088aa410d9ed68
@@ -1,3 +1,4 @@
1
+ <!-- Google tag (gtag.js) -->
1
2
  <script>
2
3
  function initGoogleAnalytics() {
3
4
  var doNotTrack = (window.doNotTrack === "1" || navigator.doNotTrack === "1" ||
@@ -5,13 +6,20 @@
5
6
  var enableDNT = "{{ site.enableDNT | default: true }}" == "true";
6
7
 
7
8
  if (!enableDNT || !doNotTrack) {
8
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
9
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
10
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
11
- })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
9
+ var measurementId = '{{ site.google_analytics }}';
12
10
 
13
- ga('create', '{{ site.google_analytics }}', 'auto');
14
- ga('send', 'pageview');
11
+ (function(src) {
12
+ var tag = document.createElement('script');
13
+ tag.src = src;
14
+ tag.async = true;
15
+ var firstScriptTag = document.getElementsByTagName('script')[0];
16
+ firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
17
+ })('https://www.googletagmanager.com/gtag/js?id=' + measurementId);
18
+
19
+ window.dataLayer = window.dataLayer || [];
20
+ function gtag(){dataLayer.push(arguments);}
21
+ gtag('js', new Date());
22
+ gtag('config', measurementId);
15
23
  }
16
24
  }
17
25
  window.addEventListener("load", initGoogleAnalytics);
@@ -0,0 +1,161 @@
1
+ <script src="//cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe.min.js"></script>
2
+ <script src="//cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe-ui-default.min.js"></script>
3
+ <link
4
+ href="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe.css"
5
+ rel="stylesheet"
6
+ />
7
+ <link
8
+ href="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/default-skin/default-skin.css"
9
+ rel="stylesheet"
10
+ />
11
+ <style>
12
+ .pswp .pswp__container .pswp__img {
13
+ background-color: white;
14
+ }
15
+ </style>
16
+
17
+ <script>
18
+ function initPhotoSwipe() {
19
+ var mainEl = document.querySelector("section.main");
20
+
21
+ var imgEls = mainEl.querySelectorAll("img:not(.emoji)");
22
+ imgEls.forEach((imgEl) => {
23
+ imgEl.outerHTML = `
24
+ <a class="photo-swipe"
25
+ href="${imgEl.src}"
26
+ data-width="${imgEl.getAttribute("width") || imgEl.width * 2}"
27
+ data-height="${imgEl.getAttribute("height") || imgEl.height * 2}"
28
+ data-caption="${imgEl.getAttribute("caption") || imgEl.alt}"
29
+ target="_blank">
30
+ ${imgEl.outerHTML}
31
+ </a>`;
32
+ });
33
+
34
+ // Init empty gallery array
35
+ var container = [];
36
+
37
+ // Loop over gallery items and push it to the array
38
+ var linkEls = mainEl.querySelectorAll("a.photo-swipe");
39
+ linkEls.forEach((link) => {
40
+ var item = {
41
+ src: link.getAttribute("href"),
42
+ w: link.dataset.width,
43
+ h: link.dataset.height,
44
+ title: link.dataset.caption || "",
45
+ };
46
+ container.push(item);
47
+ });
48
+
49
+ // Define click event on gallery item
50
+ linkEls.forEach((link, index) => {
51
+ link.addEventListener("click", (event) => {
52
+ // Prevent location change
53
+ event.preventDefault();
54
+
55
+ // Define object and gallery options
56
+ var pswp = document.querySelector(".pswp");
57
+
58
+ var zoomLevel = 1;
59
+
60
+ // Define object and gallery options
61
+ var options = {
62
+ index: index,
63
+ bgOpacity: 0.85,
64
+ showHideOpacity: true,
65
+ closeOnScroll: true,
66
+ maxSpreadZoom: 1,
67
+ getDoubleTapZoom: (isMouseClick, item) => {
68
+ if (item.detail) {
69
+ zoomLevel += item.detail.origEvent.shiftKey ? -1 : 1;
70
+ item.detail = undefined;
71
+ } else {
72
+ zoomLevel = zoomLevel === 1 ? 2 : 1;
73
+ }
74
+ if (zoomLevel <= 1) {
75
+ zoomLevel = 1;
76
+ setTimeout(() => pswp.classList.remove("pswp--zoomed-in"), 0);
77
+ }
78
+ return item.initialZoomLevel * zoomLevel;
79
+ },
80
+ };
81
+
82
+ // Initialize PhotoSwipe
83
+ var gallery = new PhotoSwipe(
84
+ pswp,
85
+ PhotoSwipeUI_Default,
86
+ container,
87
+ options
88
+ );
89
+
90
+ gallery.init();
91
+
92
+ // Custom zoom event
93
+ gallery.container.addEventListener("pswpTap", (e) => {
94
+ gallery.currItem.detail = e.detail;
95
+ });
96
+ });
97
+ });
98
+ }
99
+
100
+ window.addEventListener("load", initPhotoSwipe);
101
+ </script>
102
+
103
+ <!-- Root element of PhotoSwipe. Must have class pswp. -->
104
+ <div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
105
+ <!-- Background of PhotoSwipe.
106
+ It's a separate element as animating opacity is faster than rgba(). -->
107
+ <div class="pswp__bg"></div>
108
+ <!-- Slides wrapper with overflow:hidden. -->
109
+ <div class="pswp__scroll-wrap">
110
+ <!-- Container that holds slides.
111
+ PhotoSwipe keeps only 3 of them in the DOM to save memory.
112
+ Don't modify these 3 pswp__item elements, data is added later on. -->
113
+ <div class="pswp__container">
114
+ <div class="pswp__item"></div>
115
+ <div class="pswp__item"></div>
116
+ <div class="pswp__item"></div>
117
+ </div>
118
+ <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
119
+ <div class="pswp__ui pswp__ui--hidden">
120
+ <div class="pswp__top-bar">
121
+ <!-- Controls are self-explanatory. Order can be changed. -->
122
+ <div class="pswp__counter"></div>
123
+ <button
124
+ class="pswp__button pswp__button--close"
125
+ title="Close (Esc)"
126
+ ></button>
127
+ <button class="pswp__button pswp__button--share" title="Share"></button>
128
+ <button
129
+ class="pswp__button pswp__button--fs"
130
+ title="Toggle fullscreen"
131
+ ></button>
132
+ <button
133
+ class="pswp__button pswp__button--zoom"
134
+ title="Zoom in/out"
135
+ ></button>
136
+ <!-- element will get class pswp__preloader--active when preloader is running -->
137
+ <div class="pswp__preloader">
138
+ <div class="pswp__preloader__icn">
139
+ <div class="pswp__preloader__cut">
140
+ <div class="pswp__preloader__donut"></div>
141
+ </div>
142
+ </div>
143
+ </div>
144
+ </div>
145
+ <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
146
+ <div class="pswp__share-tooltip"></div>
147
+ </div>
148
+ <button
149
+ class="pswp__button pswp__button--arrow--left"
150
+ title="Previous (arrow left)"
151
+ ></button>
152
+ <button
153
+ class="pswp__button pswp__button--arrow--right"
154
+ title="Next (arrow right)"
155
+ ></button>
156
+ <div class="pswp__caption">
157
+ <div class="pswp__caption__center"></div>
158
+ </div>
159
+ </div>
160
+ </div>
161
+ </div>
data/_includes/head.html CHANGED
@@ -14,5 +14,6 @@
14
14
  {%- include extensions/google-analytics.html -%}
15
15
  {%- endif -%}
16
16
  {%- include extensions/code-highlight.html -%}
17
+ {%- include extensions/photo-swipe.html -%}
17
18
  {%- include custom-head.html -%}
18
19
  </head>
@@ -438,6 +438,7 @@ html {
438
438
 
439
439
  img:not(.emoji), svg, iframe {
440
440
  display: block;
441
+ max-height: 50vh;
441
442
  }
442
443
 
443
444
  h2, h3, h4, h5, h6 {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-yat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jeffreytse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-19 00:00:00.000000000 Z
11
+ date: 2023-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -162,6 +162,7 @@ files:
162
162
  - _includes/extensions/google-translate.html
163
163
  - _includes/extensions/hashlocate.html
164
164
  - _includes/extensions/mathjax.html
165
+ - _includes/extensions/photo-swipe.html
165
166
  - _includes/extensions/theme-toggle.html
166
167
  - _includes/extensions/trianglify.html
167
168
  - _includes/functions.html