Skip to content

Commit 01ecf2b

Browse files
feat(v4): replace magnific popup with dimbox (#567)
1 parent 7aefc5b commit 01ecf2b

File tree

14 files changed

+68
-1897
lines changed

14 files changed

+68
-1897
lines changed

v4/assets/js/_vendor/autocomplete.js

Lines changed: 2 additions & 1124 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

v4/assets/js/_vendor/clipboard.js

Lines changed: 2 additions & 332 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

v4/assets/js/_vendor/dimbox.js

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

v4/assets/js/_vendor/magnific-popup.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

v4/assets/js/theme.js

Lines changed: 3 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -76,76 +76,10 @@ $(document).ready(function () {
7676
pauseOnHover: true,
7777
});
7878

79-
// Magnific Popup for images within articles to zoom them
80-
// Rendered with Markdown
81-
$('p img, figure img').not('p a img').magnificPopup({
82-
type: "image",
83-
image: {
84-
verticalFit: true,
85-
titleSrc: 'alt'
86-
},
87-
zoom: {
88-
enabled: true
89-
},
90-
callbacks: {
91-
// Get the src directly from the img-tag instead of an additional tag
92-
elementParse: function(item) {
93-
// Function will fire for each target element
94-
// "item.el" is a target DOM element (if present)
95-
// "item.src" is a source that you may modify
96-
97-
item.src = item.el.attr('src')
98-
}
99-
},
100-
// https://github.com/dimsemenov/Magnific-Popup/pull/1017
101-
// Enabled popup only when image size is greater than content area
102-
disableOn: function(e) {
103-
let img = e.target;
104-
return img.naturalWidth > img.clientWidth;
105-
}
106-
});
107-
108-
// Magnific Popup for images within articles to zoom them
109-
// Rendered with Asciidoc
110-
$('.image-block>img').magnificPopup({
111-
type: "image",
112-
image: {
113-
verticalFit: true,
114-
titleSrc: function (item) {
115-
return item.el.parent().find('figcaption').text();
116-
}
117-
},
118-
zoom: {
119-
enabled: true
120-
},
121-
callbacks: {
122-
elementParse: function(item) {
123-
item.src = item.el.attr('src')
124-
}
125-
},
126-
// https://github.com/dimsemenov/Magnific-Popup/pull/1017
127-
// Enabled popup only when image size is greater than content area
128-
disableOn: function(e) {
129-
let img = e.target;
130-
return img.naturalWidth > img.clientWidth;
131-
}
132-
});
133-
134-
// Magnific Popup for images within articles to zoom them
135-
// Rendered with Asciidoc
136-
$('.image-block').magnificPopup({
137-
type: "image",
138-
delegate: "a",
139-
image: {
140-
titleSrc: function (item) {
141-
return item.el.parent().find('figcaption').text();
142-
},
143-
verticalFit: true
144-
},
145-
zoom: {
146-
enabled: true
147-
}
79+
dimbox.setConfig({
80+
showDownloadButton: false
14881
});
82+
dimbox.init();
14983

15084
// Back to top button
15185
$(window).scroll(function() {

v4/assets/sass/_bilberry-hugo-theme.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
@import "no-js";
22

3+
.dimbox-caption {
4+
font-size: 1.6rem;
5+
}
6+
37
.bilberry-hugo-theme {
48
background-color: $page-background-color;
59
font-family: $content-font;

0 commit comments

Comments
 (0)