jquery removed, gallery rebuilded, author front matter added,
21
README.ko.md
|
@ -20,6 +20,7 @@ Zzo theme을 이용할 시 가장 매력적인 포인트 한가지는, 한글로
|
|||
* [갤러리](#gallery)
|
||||
* [컨택 페이지](#contact-page)
|
||||
* [다국어](#multi-language)
|
||||
* [저자](#author)
|
||||
* [커스터마이징](#customizing)
|
||||
* [외부 라이브러리 사용](#external-library)
|
||||
* [Shortcodes](#shortcodes)
|
||||
|
@ -232,7 +233,6 @@ enableThemeChange = true # site color theme
|
|||
|
||||
# body
|
||||
enableBreadcrumb = true # breadcrumb for list, single page
|
||||
enablePhotoSwipe = true # image viewer for gallery, single page
|
||||
enableSearch = true # site search with fuse
|
||||
enableSearchHighlight = true # when true, search keyword will be highlighted
|
||||
enableGoToTop = true # scroll to top
|
||||
|
@ -918,6 +918,25 @@ copyright = This is my {} copyright text
|
|||
|
||||
root/static 폴더에 파비콘을 넣어서 테마의 favicon을 overriding 하시면 됩니다.
|
||||
|
||||
## Author
|
||||
|
||||
포스트의 저자에 대한 정보를 front matter를 통해서 명시할 수 있습니다.
|
||||
|
||||
```yaml
|
||||
---
|
||||
title:
|
||||
...
|
||||
author: # author name
|
||||
authorEmoji: 🤖 # emoji for subtitle, summary meta data
|
||||
authorImage: "/images/whoami/avatar.jpg" # image path in the static folder
|
||||
authorDesc: # author description
|
||||
socialOptions: # override params.toml file socialOptions
|
||||
email: ""
|
||||
facebook: ""
|
||||
...
|
||||
---
|
||||
```
|
||||
|
||||
## External Library
|
||||
|
||||
현재 지원하는 외부 라이브러리는 Katex, MathJax, Mermaid, Flowchart.js, chart.js, viz-graph, wavedrom, js-sequence-diagram 입니다. front-matter에 값을 넣어주시면 해당 라이브러리가 로드됩니다.
|
||||
|
|
25
README.md
|
@ -20,6 +20,7 @@ Thank you for click me!. Zzo theme is a blog theme powered by Hugo with free(alw
|
|||
* [Contact Page](#contact-page)
|
||||
* [Talks Page](#talks-page)
|
||||
* [Multi Language](#multi-language)
|
||||
* [Author](#author)
|
||||
* [Customizing](#customizing)
|
||||
* [External libraries](#external-library)
|
||||
* [Shortcodes](#shortcodes)
|
||||
|
@ -36,8 +37,8 @@ Thank you for click me!. Zzo theme is a blog theme powered by Hugo with free(alw
|
|||
* Multilingual (i18n)
|
||||
* Responsive design
|
||||
* RSS and JSON feeds with full content
|
||||
* Search with Fuse
|
||||
* Gallery with Masonry, Photoswipe
|
||||
* Search
|
||||
* Gallery
|
||||
* Fast code highlighting
|
||||
* Talks page for external links
|
||||
|
||||
|
@ -226,7 +227,6 @@ enableThemeChange = true # site color theme
|
|||
|
||||
# body
|
||||
enableBreadcrumb = true # breadcrumb for list, single page
|
||||
enablePhotoSwipe = true # image viewer for gallery, single page
|
||||
enableSearch = true # site search with Fuse
|
||||
enableSearchHighlight = true # when true, search keyword will be highlighted
|
||||
enableGoToTop = true # scroll to top
|
||||
|
@ -918,6 +918,25 @@ The {} part will be your copyright link.
|
|||
|
||||
Override the default favicon by adding your favicon at root/static folder
|
||||
|
||||
## Author
|
||||
|
||||
We have some front matters for specifying the author.
|
||||
|
||||
```yaml
|
||||
---
|
||||
title:
|
||||
...
|
||||
author: # author name
|
||||
authorEmoji: 🤖 # emoji for subtitle, summary meta data
|
||||
authorImage: "/images/whoami/avatar.jpg" # image path in the static folder
|
||||
authorDesc: # author description
|
||||
socialOptions: # override params.toml file socialOptions
|
||||
email: ""
|
||||
facebook: ""
|
||||
...
|
||||
---
|
||||
```
|
||||
|
||||
## External Library
|
||||
|
||||
If you want use external libraries, this theme currently supporting Katex, MathJax, Mermaid, Flowchart.js, chart.js, viz-graph, wavedrom, js-sequence-diagram. Just add some variable to a front-matter.
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
title: "{{ replace .Name "-" " " | title }}"
|
||||
date: {{ .Date }}
|
||||
description:
|
||||
tags:
|
||||
-
|
||||
series:
|
||||
-
|
||||
categories:
|
||||
-
|
||||
author:
|
||||
authorEmoji: 🤖
|
||||
authorImage: "/images/whoami/avatar.jpg"
|
||||
authorDesc:
|
||||
socialOptions:
|
||||
email: ""
|
||||
facebook: ""
|
||||
twitter: ""
|
||||
github: ""
|
||||
stack-overflow: ""
|
||||
instagram: ""
|
||||
google-plus: ""
|
||||
youtube: ""
|
||||
medium: ""
|
||||
tumblr: ""
|
||||
linkedin: ""
|
||||
pinterest: ""
|
||||
stack-exchange: ""
|
||||
telegram: ""
|
||||
steam: ""
|
||||
weibo: ""
|
||||
douban: ""
|
||||
csdn: ""
|
||||
zhihu: ""
|
||||
gitlab: ""
|
||||
mastodon: ""
|
||||
jianshu: ""
|
||||
---
|
|
@ -0,0 +1,12 @@
|
|||
var closest = function(node, selector) {
|
||||
return (node.closest || function (_selector) {
|
||||
do {
|
||||
if ((node.matches || node.msMatchesSelector).call(node, _selector)) {
|
||||
return node;
|
||||
}
|
||||
node = node.parentElement || node.parentNode;
|
||||
} while (node !== null && node.nodeType === 1);
|
||||
|
||||
return null;
|
||||
}).call(node, selector);
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
var fadeOut = function(node, duration) {
|
||||
node.style.opacity = 1;
|
||||
|
||||
var start = performance.now();
|
||||
|
||||
requestAnimationFrame(function tick(timestamp) {
|
||||
var easing = (timestamp - start) / duration;
|
||||
node.style.opacity = Math.max(1 - easing, 0);
|
||||
|
||||
if (easing < 1) {
|
||||
requestAnimationFrame(tick);
|
||||
} else {
|
||||
node.style.opacity = '';
|
||||
node.style.display = 'none';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var fadeIn = function (node, duration) {
|
||||
if (getComputedStyle(node).display !== 'none') return;
|
||||
|
||||
if (node.style.display === 'none') {
|
||||
node.style.display = '';
|
||||
} else {
|
||||
node.style.display = 'block';
|
||||
}
|
||||
node.style.opacity = 0;
|
||||
|
||||
var start = performance.now();
|
||||
|
||||
requestAnimationFrame(function tick(timestamp) {
|
||||
var easing = (timestamp - start) / duration;
|
||||
node.style.opacity = Math.min(easing, 1);
|
||||
|
||||
if (easing < 1) {
|
||||
requestAnimationFrame(tick);
|
||||
} else {
|
||||
node.style.opacity = '';
|
||||
}
|
||||
});
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* Get all DOM element up the tree that contain a class, ID, or data attribute
|
||||
* @param {Node} elem The base element
|
||||
* @param {String} selector The class, id, data attribute, or tag to look for
|
||||
* @return {Array} Null if no match
|
||||
*/
|
||||
var getParents = function (elem, selector) {
|
||||
|
||||
var parents = [];
|
||||
var firstChar;
|
||||
if (selector) {
|
||||
firstChar = selector.charAt(0);
|
||||
}
|
||||
|
||||
// Get matches
|
||||
for (; elem && elem !== document; elem = elem.parentNode) {
|
||||
if (selector) {
|
||||
|
||||
// If selector is a class
|
||||
if (firstChar === '.') {
|
||||
if (elem.classList.contains(selector.substr(1))) {
|
||||
parents.push(elem);
|
||||
}
|
||||
}
|
||||
|
||||
// If selector is an ID
|
||||
if (firstChar === '#') {
|
||||
if (elem.id === selector.substr(1)) {
|
||||
parents.push(elem);
|
||||
}
|
||||
}
|
||||
|
||||
// If selector is a data attribute
|
||||
if (firstChar === '[') {
|
||||
if (elem.hasAttribute(selector.substr(1, selector.length - 1))) {
|
||||
parents.push(elem);
|
||||
}
|
||||
}
|
||||
|
||||
// If selector is a tag
|
||||
if (elem.tagName.toLowerCase() === selector) {
|
||||
parents.push(elem);
|
||||
}
|
||||
|
||||
} else {
|
||||
parents.push(elem);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Return parents if any exist
|
||||
if (parents.length === 0) {
|
||||
return null;
|
||||
} else {
|
||||
return parents;
|
||||
}
|
||||
|
||||
};
|
|
@ -0,0 +1,7 @@
|
|||
function next(node, selector) {
|
||||
if (selector && document.querySelector(selector) !== node.nextElementSibling) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return node.nextElementSibling;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
var prev = function(node, selector) {
|
||||
if (selector && document.querySelector(selector) !== node.previousElementSibling) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return node.previousElementSibling;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
var prop = function (node, name, value) {
|
||||
if (typeof value === 'undefined') {
|
||||
return node[name];
|
||||
}
|
||||
node[name] = value;
|
||||
};
|
|
@ -0,0 +1,828 @@
|
|||
/*!
|
||||
* Swipe 2.2.14
|
||||
*
|
||||
* Brad Birdsall
|
||||
* Copyright 2013, MIT License
|
||||
*
|
||||
*/
|
||||
|
||||
// if the module has no dependencies, the above pattern can be simplified to
|
||||
// eslint-disable-next-line no-extra-semi
|
||||
; (function (root, factory) {
|
||||
// eslint-disable-next-line no-undef
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
// eslint-disable-next-line no-undef
|
||||
define([], function () {
|
||||
root.Swipe = factory();
|
||||
return root.Swipe;
|
||||
});
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// Node. Does not work with strict CommonJS, but
|
||||
// only CommonJS-like environments that support module.exports,
|
||||
// like Node.
|
||||
module.exports = factory();
|
||||
} else {
|
||||
// Browser globals
|
||||
root.Swipe = factory();
|
||||
}
|
||||
}(this, function () {
|
||||
// Establish the root object, `window` (`self`) in the browser, `global`
|
||||
// on the server, or `this` in some virtual machines. We use `self`
|
||||
// instead of `window` for `WebWorker` support.
|
||||
var root = typeof self == 'object' && self.self === self && self ||
|
||||
typeof global == 'object' && global.global === global && global ||
|
||||
this;
|
||||
|
||||
var _document = root.document;
|
||||
|
||||
function Swipe(container, options) {
|
||||
|
||||
'use strict';
|
||||
|
||||
options = options || {};
|
||||
|
||||
// setup initial vars
|
||||
var start = {};
|
||||
var delta = {};
|
||||
var isScrolling;
|
||||
|
||||
// setup auto slideshow
|
||||
var delay = options.auto || 0;
|
||||
var interval;
|
||||
|
||||
var disabled = false;
|
||||
|
||||
// utilities
|
||||
// simple no operation function
|
||||
var noop = function () { };
|
||||
// offload a functions execution
|
||||
var offloadFn = function (fn) { setTimeout(fn || noop, 0); };
|
||||
// Returns a function, that, as long as it continues to be invoked, will not
|
||||
// be triggered.
|
||||
var throttle = function (fn, threshhold) {
|
||||
threshhold = threshhold || 100;
|
||||
var timeout = null;
|
||||
|
||||
function cancel() {
|
||||
if (timeout) clearTimeout(timeout);
|
||||
}
|
||||
|
||||
function throttledFn() {
|
||||
var context = this;
|
||||
var args = arguments;
|
||||
cancel();
|
||||
timeout = setTimeout(function () {
|
||||
timeout = null;
|
||||
fn.apply(context, args);
|
||||
}, threshhold);
|
||||
}
|
||||
|
||||
// allow remove throttled timeout
|
||||
throttledFn.cancel = cancel;
|
||||
|
||||
return throttledFn;
|
||||
};
|
||||
|
||||
function getScrollbarWidth() {
|
||||
return root.innerWidth - _document.documentElement.clientWidth;
|
||||
}
|
||||
|
||||
// check whether event is cancelable
|
||||
var isCancelable = function (event) {
|
||||
if (!event) return false;
|
||||
return typeof event.cancelable !== 'boolean' || event.cancelable;
|
||||
};
|
||||
|
||||
// check browser capabilities
|
||||
var browser = {
|
||||
addEventListener: !!root.addEventListener,
|
||||
passiveEvents: (function () {
|
||||
// Test via a getter in the options object to see if the passive property is accessed
|
||||
var supportsPassive = false;
|
||||
try {
|
||||
var opts = Object.defineProperty({}, 'passive', {
|
||||
// eslint-disable-next-line getter-return
|
||||
get: function () {
|
||||
supportsPassive = true;
|
||||
}
|
||||
});
|
||||
root.addEventListener('testEvent', null, opts);
|
||||
root.removeEventListener('testEvent', null, opts);
|
||||
}
|
||||
catch (e) {
|
||||
supportsPassive = false;
|
||||
}
|
||||
return supportsPassive;
|
||||
})(),
|
||||
// eslint-disable-next-line no-undef
|
||||
touch: ('ontouchstart' in root) || root.DocumentTouch && _document instanceof DocumentTouch,
|
||||
transitions: (function (temp) {
|
||||
var props = ['transitionProperty', 'WebkitTransition', 'MozTransition', 'OTransition', 'msTransition'];
|
||||
for (var i in props) {
|
||||
if (temp.style[props[i]] !== undefined) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
})(_document.createElement('swipe'))
|
||||
};
|
||||
|
||||
// quit if no root element
|
||||
if (!container) return;
|
||||
|
||||
var element = container.children[0];
|
||||
var slides, slidePos, width, length;
|
||||
var index = parseInt(options.startSlide, 10) || 0;
|
||||
var speed = options.speed || 300;
|
||||
options.continuous = options.continuous !== undefined ? options.continuous : true;
|
||||
|
||||
// check text direction
|
||||
var slideDir = (function (el, prop, dir) {
|
||||
if (el.currentStyle) {
|
||||
dir = el.currentStyle[prop];
|
||||
} else if (root.getComputedStyle) {
|
||||
dir = root.getComputedStyle(el, null).getPropertyValue(prop);
|
||||
}
|
||||
return 'rtl' === dir ? 'right' : 'left';
|
||||
})(container, 'direction');
|
||||
|
||||
// AutoRestart option: auto restart slideshow after user's touch event
|
||||
options.autoRestart = options.autoRestart !== undefined ? options.autoRestart : false;
|
||||
|
||||
// throttled setup
|
||||
var throttledSetup = throttle(setup);
|
||||
|
||||
// setup event capturing
|
||||
var events = {
|
||||
|
||||
handleEvent: function (event) {
|
||||
if (disabled) return;
|
||||
|
||||
switch (event.type) {
|
||||
case 'mousedown':
|
||||
case 'touchstart': this.start(event); break;
|
||||
case 'mousemove':
|
||||
case 'touchmove': this.move(event); break;
|
||||
case 'mouseup':
|
||||
case 'mouseleave':
|
||||
case 'touchend': this.end(event); break;
|
||||
case 'webkitTransitionEnd':
|
||||
case 'msTransitionEnd':
|
||||
case 'oTransitionEnd':
|
||||
case 'otransitionend':
|
||||
case 'transitionend': this.transitionEnd(event); break;
|
||||
case 'resize': throttledSetup(); break;
|
||||
}
|
||||
|
||||
if (options.stopPropagation) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
},
|
||||
|
||||
start: function (event) {
|
||||
var touches;
|
||||
|
||||
if (isMouseEvent(event)) {
|
||||
touches = event;
|
||||
event.preventDefault(); // For desktop Safari drag
|
||||
} else {
|
||||
touches = event.touches[0];
|
||||
}
|
||||
|
||||
// measure start values
|
||||
start = {
|
||||
|
||||
// get initial touch coords
|
||||
x: touches.pageX,
|
||||
y: touches.pageY,
|
||||
|
||||
// store time to determine touch duration
|
||||
time: +new Date()
|
||||
|
||||
};
|
||||
|
||||
// used for testing first move event
|
||||
isScrolling = undefined;
|
||||
|
||||
// reset delta and end measurements
|
||||
delta = {};
|
||||
|
||||
// attach touchmove and touchend listeners
|
||||
if (isMouseEvent(event)) {
|
||||
element.addEventListener('mousemove', this, false);
|
||||
element.addEventListener('mouseup', this, false);
|
||||
element.addEventListener('mouseleave', this, false);
|
||||
} else {
|
||||
element.addEventListener('touchmove', this, browser.passiveEvents ? { passive: false } : false);
|
||||
element.addEventListener('touchend', this, false);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
move: function (event) {
|
||||
var touches;
|
||||
|
||||
if (isMouseEvent(event)) {
|
||||
touches = event;
|
||||
} else {
|
||||
// ensure swiping with one touch and not pinching
|
||||
if (event.touches.length > 1 || event.scale && event.scale !== 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// we can disable scrolling unless it is already in progress
|
||||
if (options.disableScroll && isCancelable(event)) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
touches = event.touches[0];
|
||||
}
|
||||
|
||||
// measure change in x and y
|
||||
delta = {
|
||||
x: touches.pageX - start.x,
|
||||
y: touches.pageY - start.y
|
||||
};
|
||||
|
||||
// determine if scrolling test has run - one time test
|
||||
if (typeof isScrolling === 'undefined') {
|
||||
isScrolling = !!(isScrolling || Math.abs(delta.x) < Math.abs(delta.y));
|
||||
}
|
||||
|
||||
// if user is not trying to scroll vertically
|
||||
if (!isScrolling) {
|
||||
|
||||
// if it is not already scrolling
|
||||
if (isCancelable(event)) {
|
||||
// prevent native scrolling
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
// stop slideshow
|
||||
stop();
|
||||
|
||||
// increase resistance if first or last slide
|
||||
if (options.continuous) { // we don't add resistance at the end
|
||||
|
||||
translate(circle(index - 1), delta.x + slidePos[circle(index - 1)], 0);
|
||||
translate(index, delta.x + slidePos[index], 0);
|
||||
translate(circle(index + 1), delta.x + slidePos[circle(index + 1)], 0);
|
||||
|
||||
} else {
|
||||
|
||||
delta.x =
|
||||
delta.x /
|
||||
((!index && delta.x > 0 || // if first slide and sliding left
|
||||
index === slides.length - 1 && // or if last slide and sliding right
|
||||
delta.x < 0 // and if sliding at all
|
||||
) ?
|
||||
(Math.abs(delta.x) / width + 1) // determine resistance level
|
||||
: 1); // no resistance if false
|
||||
|
||||
// translate 1:1
|
||||
translate(index - 1, delta.x + slidePos[index - 1], 0);
|
||||
translate(index, delta.x + slidePos[index], 0);
|
||||
translate(index + 1, delta.x + slidePos[index + 1], 0);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
end: function (event) {
|
||||
|
||||
// measure duration
|
||||
var duration = +new Date() - start.time;
|
||||
|
||||
// determine if slide attempt triggers next/prev slide
|
||||
var isValidSlide =
|
||||
Number(duration) < 250 && // if slide duration is less than 250ms
|
||||
Math.abs(delta.x) > 20 || // and if slide amt is greater than 20px
|
||||
Math.abs(delta.x) > width / 2; // or if slide amt is greater than half the width
|
||||
|
||||
// determine if slide attempt is past start and end
|
||||
var isPastBounds =
|
||||
!index && delta.x > 0 || // if first slide and slide amt is greater than 0
|
||||
index === slides.length - 1 && delta.x < 0; // or if last slide and slide amt is less than 0
|
||||
|
||||
if (options.continuous) {
|
||||
isPastBounds = false;
|
||||
}
|
||||
|
||||
// OLD determine direction of swipe (true:right, false:left)
|
||||
// determine direction of swipe (1: backward, -1: forward)
|
||||
var direction = Math.abs(delta.x) / delta.x;
|
||||
|
||||
// if not scrolling vertically
|
||||
if (!isScrolling) {
|
||||
|
||||
if (isValidSlide && !isPastBounds) {
|
||||
|
||||
// if we're moving right
|
||||
if (direction < 0) {
|
||||
|
||||
if (options.continuous) { // we need to get the next in this direction in place
|
||||
|
||||
move(circle(index - 1), -width, 0);
|
||||
move(circle(index + 2), width, 0);
|
||||
|
||||
} else {
|
||||
move(index - 1, -width, 0);
|
||||
}
|
||||
|
||||
move(index, slidePos[index] - width, speed);
|
||||
move(circle(index + 1), slidePos[circle(index + 1)] - width, speed);
|
||||
index = circle(index + 1);
|
||||
|
||||
} else {
|
||||
if (options.continuous) { // we need to get the next in this direction in place
|
||||
|
||||
move(circle(index + 1), width, 0);
|
||||
move(circle(index - 2), -width, 0);
|
||||
|
||||
} else {
|
||||
move(index + 1, width, 0);
|
||||
}
|
||||
|
||||
move(index, slidePos[index] + width, speed);
|
||||
move(circle(index - 1), slidePos[circle(index - 1)] + width, speed);
|
||||
index = circle(index - 1);
|
||||
}
|
||||
|
||||
runCallback(getPos(), slides[index], direction);
|
||||
|
||||
} else {
|
||||
|
||||
if (options.continuous) {
|
||||
|
||||
move(circle(index - 1), -width, speed);
|
||||
move(index, 0, speed);
|
||||
move(circle(index + 1), width, speed);
|
||||
|
||||
} else {
|
||||
|
||||
move(index - 1, -width, speed);
|
||||
move(index, 0, speed);
|
||||
move(index + 1, width, speed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// kill touchmove and touchend event listeners until touchstart called again
|
||||
if (isMouseEvent(event)) {
|
||||
element.removeEventListener('mousemove', events, false);
|
||||
element.removeEventListener('mouseup', events, false);
|
||||
element.removeEventListener('mouseleave', events, false);
|
||||
} else {
|
||||
element.removeEventListener('touchmove', events, browser.passiveEvents ? { passive: false } : false);
|
||||
element.removeEventListener('touchend', events, false);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
transitionEnd: function (event) {
|
||||
var currentIndex = parseInt(event.target.getAttribute('data-index'), 10);
|
||||
if (currentIndex === index) {
|
||||
if (delay || options.autoRestart) restart();
|
||||
|
||||
runTransitionEnd(getPos(), slides[index]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// trigger setup
|
||||
setup();
|
||||
|
||||
// start auto slideshow if applicable
|
||||
begin();
|
||||
|
||||
// Expose the Swipe API
|
||||
return {
|
||||
// initialize
|
||||
setup: setup,
|
||||
|
||||
// go to slide
|
||||
slide: function (to, speed) {
|
||||
stop();
|
||||
slide(to, speed);
|
||||
},
|
||||
|
||||
// move to previous
|
||||
prev: function () {
|
||||
stop();
|
||||
prev();
|
||||
},
|
||||
|
||||
// move to next
|
||||
next: function () {
|
||||
stop();
|
||||
next();
|
||||
},
|
||||
|
||||
// Restart slideshow
|
||||
restart: restart,
|
||||
|
||||
// cancel slideshow
|
||||
stop: stop,
|
||||
|
||||
// return current index position
|
||||
getPos: getPos,
|
||||
|
||||
// disable slideshow
|
||||
disable: disable,
|
||||
|
||||
// enable slideshow
|
||||
enable: enable,
|
||||
|
||||
// return total number of slides
|
||||
getNumSlides: function () { return length; },
|
||||
|
||||
// completely remove swipe
|
||||
kill: kill
|
||||
};
|
||||
|
||||
// remove all event listeners
|
||||
function detachEvents() {
|
||||
if (browser.addEventListener) {
|
||||
// remove current event listeners
|
||||
element.removeEventListener('touchstart', events, browser.passiveEvents ? { passive: true } : false);
|
||||
element.removeEventListener('mousedown', events, false);
|
||||
element.removeEventListener('webkitTransitionEnd', events, false);
|
||||
element.removeEventListener('msTransitionEnd', events, false);
|
||||
element.removeEventListener('oTransitionEnd', events, false);
|
||||
element.removeEventListener('otransitionend', events, false);
|
||||
element.removeEventListener('transitionend', events, false);
|
||||
root.removeEventListener('resize', events, false);
|
||||
} else {
|
||||
root.onresize = null;
|
||||
}
|
||||
}
|
||||
|
||||
// add event listeners
|
||||
function attachEvents() {
|
||||
if (browser.addEventListener) {
|
||||
|
||||
// set touchstart event on element
|
||||
if (browser.touch) {
|
||||
element.addEventListener('touchstart', events, browser.passiveEvents ? { passive: true } : false);
|
||||
}
|
||||
|
||||
if (options.draggable) {
|
||||
element.addEventListener('mousedown', events, false);
|
||||
}
|
||||
|
||||
if (browser.transitions) {
|
||||
element.addEventListener('webkitTransitionEnd', events, false);
|
||||
element.addEventListener('msTransitionEnd', events, false);
|
||||
element.addEventListener('oTransitionEnd', events, false);
|
||||
element.addEventListener('otransitionend', events, false);
|
||||
element.addEventListener('transitionend', events, false);
|
||||
}
|
||||
|
||||
// set resize event on window
|
||||
root.addEventListener('resize', events, false);
|
||||
|
||||
} else {
|
||||
root.onresize = throttledSetup; // to play nice with old IE
|
||||
}
|
||||
}
|
||||
|
||||
// clone nodes when there is only two slides
|
||||
function cloneNode(el) {
|
||||
var clone = el.cloneNode(true);
|
||||
element.appendChild(clone);
|
||||
|
||||
// tag these slides as clones (to remove them on kill)
|
||||
clone.setAttribute('data-cloned', true);
|
||||
|
||||
// Remove id from element
|
||||
clone.removeAttribute('id');
|
||||
}
|
||||
|
||||
function setup(opts) {
|
||||
// Overwrite options if necessary
|
||||
if (opts != null) {
|
||||
for (var prop in opts) {
|
||||
options[prop] = opts[prop];
|
||||
}
|
||||
}
|
||||
|
||||
// cache slides
|
||||
slides = element.children;
|
||||
length = slides.length;
|
||||
|
||||
// slides length correction, minus cloned slides
|
||||
for (var i = 0; i < slides.length; i++) {
|
||||
if (slides[i].getAttribute('data-cloned')) length--;
|
||||
}
|
||||
|
||||
// set continuous to false if only one slide
|
||||
if (slides.length < 2) {
|
||||
options.continuous = false;
|
||||
}
|
||||
|
||||
// special case if two slides
|
||||
if (browser.transitions && options.continuous && slides.length < 3) {
|
||||
cloneNode(slides[0]);
|
||||
cloneNode(slides[1]);
|
||||
|
||||
slides = element.children;
|
||||
}
|
||||
|
||||
// adjust style on rtl
|
||||
if ('right' === slideDir) {
|
||||
for (var j = 0; j < slides.length; j++) {
|
||||
slides[j].style.float = 'right';
|
||||
}
|
||||
}
|
||||
|
||||
// create an array to store current positions of each slide
|
||||
slidePos = new Array(slides.length);
|
||||
|
||||
// determine width of each slide
|
||||
//width = container.getBoundingClientRect().width || container.offsetWidth;
|
||||
width = root.innerWidth - getScrollbarWidth();
|
||||
element.style.width = (slides.length * width * 2) + 'px';
|
||||
// stack elements
|
||||
var pos = slides.length;
|
||||
while (pos--) {
|
||||
var slide = slides[pos];
|
||||
|
||||
slide.style.width = width + 'px';
|
||||
slide.setAttribute('data-index', pos);
|
||||
|
||||
if (browser.transitions) {
|
||||
slide.style[slideDir] = (pos * -width) + 'px';
|
||||
move(pos, index > pos ? -width : (index < pos ? width : 0), 0);
|
||||
}
|
||||
}
|
||||
|
||||
// reposition elements before and after index
|
||||
if (options.continuous && browser.transitions) {
|
||||
move(circle(index - 1), -width, 0);
|
||||
move(circle(index + 1), width, 0);
|
||||
}
|
||||
|
||||
if (!browser.transitions) {
|
||||
element.style[slideDir] = (index * -width) + 'px';
|
||||
}
|
||||
|
||||
container.style.visibility = 'visible';
|
||||
|
||||
// reinitialize events
|
||||
detachEvents();
|
||||
attachEvents();
|
||||
}
|
||||
|
||||
function prev() {
|
||||
if (disabled) return;
|
||||
|
||||
if (options.continuous) {
|
||||
slide(index - 1);
|
||||
} else if (index) {
|
||||
slide(index - 1);
|
||||
}
|
||||
}
|
||||
|
||||
function next() {
|
||||
if (disabled) return;
|
||||
if (options.continuous) {
|
||||
slide(index + 1);
|
||||
} else if (index < slides.length - 1) {
|
||||
slide(index + 1);
|
||||
}
|
||||
}
|
||||
|
||||
function runCallback(pos, index, dir) {
|
||||
if (options.callback) {
|
||||
options.callback(pos, index, dir);
|
||||
}
|
||||
}
|
||||
|
||||
function runTransitionEnd(pos, index) {
|
||||
if (options.transitionEnd) {
|
||||
options.transitionEnd(pos, index);
|
||||
}
|
||||
}
|
||||
|
||||
function circle(index) {
|
||||
|
||||
// a simple positive modulo using slides.length
|
||||
return (slides.length + (index % slides.length)) % slides.length;
|
||||
}
|
||||
|
||||
function getPos() {
|
||||
// Fix for the clone issue in the event of 2 slides
|
||||
var currentIndex = index;
|
||||
|
||||
if (currentIndex >= length) {
|
||||
currentIndex = currentIndex - length;
|
||||
}
|
||||
|
||||
return currentIndex;
|
||||
}
|
||||
|
||||
function slide(to, slideSpeed) {
|
||||
|
||||
// ensure to is of type 'number'
|
||||
to = typeof to !== 'number' ? parseInt(to, 10) : to;
|
||||
|
||||
// do nothing if already on requested slide
|
||||
if (index === to) return;
|
||||
|
||||
if (browser.transitions) {
|
||||
|
||||
var direction = Math.abs(index - to) / (index - to); // 1: backward, -1: forward
|
||||
|
||||
// get the actual position of the slide
|
||||
if (options.continuous) {
|
||||
var natural_direction = direction;
|
||||
direction = -slidePos[circle(to)] / width;
|
||||
|
||||
// if going forward but to < index, use to = slides.length + to
|
||||
// if going backward but to > index, use to = -slides.length + to
|
||||
if (direction !== natural_direction) {
|
||||
to = -direction * slides.length + to;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var diff = Math.abs(index - to) - 1;
|
||||
|
||||
// move all the slides between index and to in the right direction
|
||||
while (diff--) {
|
||||
move(circle((to > index ? to : index) - diff - 1), width * direction, 0);
|
||||
}
|
||||
|
||||
to = circle(to);
|
||||
|
||||
move(index, width * direction, slideSpeed || speed);
|
||||
move(to, 0, slideSpeed || speed);
|
||||
|
||||
if (options.continuous) { // we need to get the next in place
|
||||
move(circle(to - direction), -(width * direction), 0);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
to = circle(to);
|
||||
animate(index * -width, to * -width, slideSpeed || speed);
|
||||
// no fallback for a circular continuous if the browser does not accept transitions
|
||||
}
|
||||
|
||||
index = to;
|
||||
offloadFn(function () {
|
||||
runCallback(getPos(), slides[index], direction);
|
||||
});
|
||||
}
|
||||
|
||||
function move(index, dist, speed) {
|
||||
translate(index, dist, speed);
|
||||
slidePos[index] = dist;
|
||||
}
|
||||
|
||||
function translate(index, dist, speed) {
|
||||
|
||||
var slide = slides[index];
|
||||
var style = slide && slide.style;
|
||||
|
||||
if (!style) return;
|
||||
|
||||
style.webkitTransitionDuration =
|
||||
style.MozTransitionDuration =
|
||||
style.msTransitionDuration =
|
||||
style.OTransitionDuration =
|
||||
style.transitionDuration = speed + 'ms';
|
||||
|
||||
style.webkitTransform =
|
||||
style.msTransform =
|
||||
style.MozTransform =
|
||||
style.OTransform =
|
||||
style.transform = 'translateX(' + dist + 'px)';
|
||||
}
|
||||
|
||||
function animate(from, to, speed) {
|
||||
|
||||
// if not an animation, just reposition
|
||||
if (!speed) {
|
||||
element.style[slideDir] = to + 'px';
|
||||
return;
|
||||
}
|
||||
|
||||
var start = +new Date();
|
||||
|
||||
var timer = setInterval(function () {
|
||||
var timeElap = +new Date() - start;
|
||||
|
||||
if (timeElap > speed) {
|
||||
|
||||
element.style[slideDir] = to + 'px';
|
||||
|
||||
if (delay || options.autoRestart) restart();
|
||||
|
||||
runTransitionEnd(getPos(), slides[index]);
|
||||
|
||||
clearInterval(timer);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
element.style[slideDir] = (((to - from) * (Math.floor((timeElap / speed) * 100) / 100)) + from) + 'px';
|
||||
}, 4);
|
||||
|
||||
}
|
||||
|
||||
function begin() {
|
||||
delay = options.auto || 0;
|
||||
if (delay) interval = setTimeout(next, delay);
|
||||
}
|
||||
|
||||
function stop() {
|
||||
delay = 0;
|
||||
clearTimeout(interval);
|
||||
}
|
||||
|
||||
function restart() {
|
||||
stop();
|
||||
begin();
|
||||
}
|
||||
|
||||
function disable() {
|
||||
stop();
|
||||
disabled = true;
|
||||
}
|
||||
|
||||
function enable() {
|
||||
disabled = false;
|
||||
restart();
|
||||
}
|
||||
|
||||
function isMouseEvent(e) {
|
||||
return /^mouse/.test(e.type);
|
||||
}
|
||||
|
||||
function kill() {
|
||||
// cancel slideshow
|
||||
stop();
|
||||
|
||||
// remove inline styles
|
||||
container.style.visibility = '';
|
||||
|
||||
// reset element
|
||||
element.style.width = '';
|
||||
element.style[slideDir] = '';
|
||||
|
||||
// reset slides
|
||||
var pos = slides.length;
|
||||
while (pos--) {
|
||||
|
||||
if (browser.transitions) {
|
||||
translate(pos, 0, 0);
|
||||
}
|
||||
|
||||
var slide = slides[pos];
|
||||
|
||||
// if the slide is tagged as clone, remove it
|
||||
if (slide.getAttribute('data-cloned')) {
|
||||
var _parent = slide.parentElement;
|
||||
_parent.removeChild(slide);
|
||||
}
|
||||
|
||||
// remove styles
|
||||
slide.style.width = '';
|
||||
slide.style[slideDir] = '';
|
||||
|
||||
slide.style.webkitTransitionDuration =
|
||||
slide.style.MozTransitionDuration =
|
||||
slide.style.msTransitionDuration =
|
||||
slide.style.OTransitionDuration =
|
||||
slide.style.transitionDuration = '';
|
||||
|
||||
slide.style.webkitTransform =
|
||||
slide.style.msTransform =
|
||||
slide.style.MozTransform =
|
||||
slide.style.OTransform = '';
|
||||
|
||||
// remove custom attributes (?)
|
||||
// slide.removeAttribute('data-index');
|
||||
}
|
||||
|
||||
// remove all events
|
||||
detachEvents();
|
||||
|
||||
// remove throttled function timeout
|
||||
throttledSetup.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
if (root.jQuery || root.Zepto) {
|
||||
(function ($) {
|
||||
$.fn.Swipe = function (params) {
|
||||
return this.each(function () {
|
||||
$(this).data('Swipe', new Swipe($(this)[0], params));
|
||||
});
|
||||
};
|
||||
})(root.jQuery || root.Zepto);
|
||||
}
|
||||
|
||||
return Swipe;
|
||||
}));
|
188
assets/js/zzo.js
|
@ -1,188 +0,0 @@
|
|||
$(document).ready(function() {
|
||||
// theme change
|
||||
var localTheme = localStorage.getItem('theme');
|
||||
if (localTheme) {
|
||||
$('.select-theme__item').each(function () {
|
||||
$(this).removeClass('is-active');
|
||||
});
|
||||
$(`.select-theme a:contains("${localTheme}")`).addClass('is-active');
|
||||
}
|
||||
|
||||
$('.select-theme__item').click(function (e) {
|
||||
var selectedThemeVariant = $(e.target).text().trim();
|
||||
localStorage.setItem('theme', selectedThemeVariant);
|
||||
|
||||
if ($(this).attr('class').trim() === selectedThemeVariant) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$('#root').removeAttr('class').addClass(`theme__${selectedThemeVariant}`);
|
||||
var nodes = $('.select-theme').children('.dropdown-item');
|
||||
|
||||
nodes.each(function () {
|
||||
if ($(this).text().trim() === selectedThemeVariant) {
|
||||
if (!$(this).hasClass('is-active')) {
|
||||
$(this).addClass('is-active');
|
||||
}
|
||||
} else {
|
||||
if ($(this).hasClass('is-active')) {
|
||||
$(this).removeClass('is-active');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (window.mermaid) {
|
||||
if (selectedThemeVariant === "dark" || selectedThemeVariant === "hacker") {
|
||||
mermaid.initialize({ theme: 'dark' });
|
||||
location.reload();
|
||||
} else {
|
||||
mermaid.initialize({ theme: 'default' });
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
var utterances = document.querySelector('iframe');
|
||||
if (utterances) {
|
||||
utterances.contentWindow.postMessage({
|
||||
type: 'set-theme',
|
||||
theme: selectedThemeVariant === "dark" || selectedThemeVariant === "hacker" ? 'photon-dark' : 'github-light',
|
||||
}, 'https://utteranc.es');
|
||||
}
|
||||
});
|
||||
|
||||
// go to top
|
||||
$('.gtt').click(function () {
|
||||
$("html, body").animate({ scrollTop: 0 }, 250);
|
||||
});
|
||||
|
||||
if ($(window).scrollTop() === 0) {
|
||||
$('.gtt').hide(200);
|
||||
} else if ($(this).scrollTop() > $(document).height() - $(window).height() - 250) { // near the bottom
|
||||
$('.gtt').show(200);
|
||||
} else {
|
||||
$('.gtt').hide(200);
|
||||
}
|
||||
|
||||
// scroll
|
||||
var position = $(window).scrollTop();
|
||||
$(window).scroll(function () {
|
||||
var navbar = $('.navbar');
|
||||
|
||||
var scroll = $(window).scrollTop();
|
||||
if (scroll > position) { // scroll down
|
||||
if (scroll < 250) {
|
||||
$('.gtt').hide(200);
|
||||
} else {
|
||||
$('.gtt').show(200);
|
||||
}
|
||||
|
||||
if (scroll < 45) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!navbar.hasClass('navbar--hide')) {
|
||||
navbar.addClass('navbar--hide');
|
||||
} else if (navbar.hasClass('navbar--show')) {
|
||||
navbar.removeClass('navbar--show');
|
||||
}
|
||||
|
||||
$(".single__contents :header").each(function () {
|
||||
if (!$("#toggle-toc").is(":checked")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($(window).scrollTop() >= $(this).position().top) {
|
||||
var id = $(this).attr('id');
|
||||
$('.toc a').removeClass('active');
|
||||
$('.toc a[href="#' + id + '"]').addClass('active');
|
||||
|
||||
$('#TableOfContents > ul > li').each(function () {
|
||||
$(this).find('ul').css('display', 'none');
|
||||
});
|
||||
$(`#TableOfContents [href="#${id}"]`).next().css('display', 'block');
|
||||
$(`#TableOfContents [href="#${id}"]`).parents('ul').css('display', 'block');
|
||||
}
|
||||
});
|
||||
} else { // scroll up
|
||||
if (scroll < 250) {
|
||||
$('.gtt').hide(200);
|
||||
}
|
||||
|
||||
if (navbar.hasClass('navbar--hide')) {
|
||||
navbar.removeClass('navbar--hide');
|
||||
} else if (!navbar.hasClass('navbar--show')) {
|
||||
navbar.addClass('navbar--show');
|
||||
}
|
||||
|
||||
$(".single__contents :header").each(function () {
|
||||
if (!$("#toggle-toc").is(":checked")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($(window).scrollTop() >= $(this).position().top) {
|
||||
var id = $(this).attr('id');
|
||||
$('.toc a').removeClass('active');
|
||||
$('.toc a[href="#' + id + '"]').addClass('active');
|
||||
|
||||
$('#TableOfContents > ul > li').each(function () {
|
||||
$(this).find('ul').css('display', 'none');
|
||||
});
|
||||
$(`#TableOfContents [href="#${id}"]`).next().css('display', 'block');
|
||||
$(`#TableOfContents [href="#${id}"]`).parents('ul').css('display', 'block');
|
||||
}
|
||||
});
|
||||
}
|
||||
position = scroll;
|
||||
});
|
||||
|
||||
// navbar
|
||||
$('.navbar__burger').click(function() {
|
||||
if ($(this).hasClass('is-active')) {
|
||||
$(this).removeClass('is-active');
|
||||
$('.navbar__menu').removeClass('is-active');
|
||||
} else {
|
||||
$(this).addClass('is-active');
|
||||
$('.navbar__menu').addClass('is-active');
|
||||
}
|
||||
});
|
||||
|
||||
// mobile search
|
||||
$('.mobile-search').hide(200);
|
||||
$('#mobileSearchBtn').click(function() {
|
||||
$('#search-mobile-container').fadeIn(250);
|
||||
$('#search-mobile').focus();
|
||||
$('html').css('overflow-y', 'hidden');
|
||||
});
|
||||
$('#search-mobile-close').click(function() {
|
||||
$('#search-mobile-container').fadeOut(250);
|
||||
$('#search-mobile').val('');
|
||||
$('#search-mobile-results').empty();
|
||||
$('html').css('overflow-y', 'visible');
|
||||
});
|
||||
$('#search-mobile').keydown(function(e) {
|
||||
// e.key === "Enter"
|
||||
if (e.key === "Escape") {
|
||||
$('#search-mobile-container').fadeOut(250);
|
||||
$('#search-mobile').val('');
|
||||
$('#search-mobile-results').empty();
|
||||
$('html').css('overflow-y', 'visible');
|
||||
}
|
||||
});
|
||||
|
||||
// markdown table
|
||||
const tables = document.querySelectorAll('.single__contents > table');
|
||||
for (let i = 0; i < tables.length; i++) {
|
||||
const table = tables[i];
|
||||
const wrapper = document.createElement('div');
|
||||
wrapper.className = 'table-wrapper';
|
||||
table.parentElement.replaceChild(wrapper, table);
|
||||
wrapper.appendChild(table);
|
||||
}
|
||||
|
||||
// utils
|
||||
$.fn.digits = function() {
|
||||
return this.each(function() {
|
||||
$(this).text($(this).text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,"));
|
||||
})
|
||||
}
|
||||
});
|
|
@ -1,586 +0,0 @@
|
|||
/*! PhotoSwipe Default UI CSS by Dmitry Semenov | photoswipe.com | MIT license */
|
||||
/*
|
||||
Contents:
|
||||
1. Buttons
|
||||
2. Share modal and links
|
||||
3. Index indicator ("1 of X" counter)
|
||||
4. Caption
|
||||
5. Loading indicator
|
||||
6. Additional styles (root element, top bar, idle state, hidden state, etc.)
|
||||
*/
|
||||
/*
|
||||
|
||||
1. Buttons
|
||||
*/
|
||||
/* <button> css reset */
|
||||
.pswp__button {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
position: relative;
|
||||
background: none;
|
||||
cursor: pointer;
|
||||
overflow: visible;
|
||||
-webkit-appearance: none;
|
||||
display: block;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
float: right;
|
||||
opacity: 0.75;
|
||||
-webkit-transition: opacity 0.2s;
|
||||
transition: opacity 0.2s;
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.pswp__button:focus,
|
||||
.pswp__button:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.pswp__button:active {
|
||||
outline: none;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.pswp__button::-moz-focus-inner {
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
/* pswp__ui--over-close class it added when mouse is over element that should close gallery */
|
||||
.pswp__ui--over-close .pswp__button--close {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.pswp__button,
|
||||
.pswp__button--arrow--left:before,
|
||||
.pswp__button--arrow--right:before {
|
||||
background: url(../../images/photoswipe/default-skin.png) 0 0 no-repeat;
|
||||
background-size: 264px 88px;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
}
|
||||
|
||||
@media (-webkit-min-device-pixel-ratio: 1.1),
|
||||
(-webkit-min-device-pixel-ratio: 1.09375),
|
||||
(min-resolution: 105dpi),
|
||||
(min-resolution: 1.1dppx) {
|
||||
|
||||
/* Serve SVG sprite if browser supports SVG and resolution is more than 105dpi */
|
||||
.pswp--svg .pswp__button,
|
||||
.pswp--svg .pswp__button--arrow--left:before,
|
||||
.pswp--svg .pswp__button--arrow--right:before {
|
||||
background-image: url(../../images/photoswipe/default-skin.svg);
|
||||
}
|
||||
|
||||
.pswp--svg .pswp__button--arrow--left,
|
||||
.pswp--svg .pswp__button--arrow--right {
|
||||
background: none;
|
||||
}
|
||||
}
|
||||
|
||||
.pswp__button--close {
|
||||
background-position: 0 -44px;
|
||||
}
|
||||
|
||||
.pswp__button--share {
|
||||
background-position: -44px -44px;
|
||||
}
|
||||
|
||||
.pswp__button--fs {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.pswp--supports-fs .pswp__button--fs {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.pswp--fs .pswp__button--fs {
|
||||
background-position: -44px 0;
|
||||
}
|
||||
|
||||
.pswp__button--zoom {
|
||||
display: none;
|
||||
background-position: -88px 0;
|
||||
}
|
||||
|
||||
.pswp--zoom-allowed .pswp__button--zoom {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.pswp--zoomed-in .pswp__button--zoom {
|
||||
background-position: -132px 0;
|
||||
}
|
||||
|
||||
/* no arrows on touch screens */
|
||||
.pswp--touch .pswp__button--arrow--left,
|
||||
.pswp--touch .pswp__button--arrow--right {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/*
|
||||
Arrow buttons hit area
|
||||
(icon is added to :before pseudo-element)
|
||||
*/
|
||||
.pswp__button--arrow--left,
|
||||
.pswp__button--arrow--right {
|
||||
background: none;
|
||||
top: 50%;
|
||||
margin-top: -50px;
|
||||
width: 50px;
|
||||
height: 100px;
|
||||
position: absolute;
|
||||
background-color: #212121;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
|
||||
.pswp__button--arrow--left {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.pswp__button--arrow--right {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.pswp__button--arrow--left:before,
|
||||
.pswp__button--arrow--right:before {
|
||||
content: '';
|
||||
top: 35px;
|
||||
color: #fff;
|
||||
height: 30px;
|
||||
width: 32px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.pswp__button--arrow--left:before {
|
||||
left: 6px;
|
||||
background-position: -138px -44px;
|
||||
}
|
||||
|
||||
.pswp__button--arrow--right:before {
|
||||
right: 6px;
|
||||
background-position: -94px -44px;
|
||||
}
|
||||
|
||||
/*
|
||||
2. Share modal/popup and links
|
||||
*/
|
||||
.pswp__counter,
|
||||
.pswp__share-modal {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.pswp__share-modal {
|
||||
display: block;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
padding: 10px;
|
||||
position: absolute;
|
||||
z-index: 1600;
|
||||
opacity: 0;
|
||||
-webkit-transition: opacity 0.25s ease-out;
|
||||
transition: opacity 0.25s ease-out;
|
||||
-webkit-backface-visibility: hidden;
|
||||
will-change: opacity;
|
||||
}
|
||||
|
||||
.pswp__share-modal--hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.pswp__share-tooltip {
|
||||
z-index: 1620;
|
||||
position: absolute;
|
||||
background: #403E41;
|
||||
top: 56px;
|
||||
border-radius: 2px;
|
||||
display: block;
|
||||
width: auto;
|
||||
right: 44px;
|
||||
-webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
|
||||
-webkit-transform: translateY(6px);
|
||||
-ms-transform: translateY(6px);
|
||||
transform: translateY(6px);
|
||||
-webkit-transition: -webkit-transform 0.25s;
|
||||
transition: transform 0.25s;
|
||||
-webkit-backface-visibility: hidden;
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.pswp__share-tooltip a {
|
||||
display: block;
|
||||
padding: 8px 12px;
|
||||
color: #FCFCFA;
|
||||
text-decoration: none;
|
||||
font-size: 14px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.pswp__share-tooltip a:hover {
|
||||
text-decoration: none;
|
||||
color: #FCFCFA;
|
||||
}
|
||||
|
||||
.pswp__share-tooltip a:first-child {
|
||||
/* round corners on the first/last list item */
|
||||
border-radius: 2px 2px 0 0;
|
||||
}
|
||||
|
||||
.pswp__share-tooltip a:last-child {
|
||||
border-radius: 0 0 2px 2px;
|
||||
}
|
||||
|
||||
.pswp__share-modal--fade-in {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.pswp__share-modal--fade-in .pswp__share-tooltip {
|
||||
-webkit-transform: translateY(0);
|
||||
-ms-transform: translateY(0);
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
/* increase size of share links on touch devices */
|
||||
.pswp--touch .pswp__share-tooltip a {
|
||||
padding: 16px 12px;
|
||||
}
|
||||
|
||||
a.pswp__share--facebook:before {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
top: -12px;
|
||||
right: 15px;
|
||||
border: 6px solid transparent;
|
||||
border-bottom-color: #403E41;
|
||||
-webkit-pointer-events: none;
|
||||
-moz-pointer-events: none;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
a.pswp__share--facebook:hover {
|
||||
background: #727072;
|
||||
color: #FCFCFA;
|
||||
}
|
||||
|
||||
a.pswp__share--facebook:hover:before {
|
||||
border-bottom-color: #727072;
|
||||
}
|
||||
|
||||
a.pswp__share--twitter:hover {
|
||||
background: #727072;
|
||||
color: #FCFCFA;
|
||||
}
|
||||
|
||||
a.pswp__share--pinterest:hover {
|
||||
background: #727072;
|
||||
color: #FCFCFA;
|
||||
}
|
||||
|
||||
a.pswp__share--download:hover {
|
||||
background: #727072;
|
||||
color: #FCFCFA;
|
||||
}
|
||||
|
||||
/*
|
||||
3. Index indicator ("1 of X" counter)
|
||||
*/
|
||||
.pswp__counter {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
height: 44px;
|
||||
font-size: 13px;
|
||||
line-height: 44px;
|
||||
color: #FFF;
|
||||
opacity: 0.75;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
4. Caption
|
||||
*/
|
||||
.pswp__caption {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
min-height: 44px;
|
||||
}
|
||||
|
||||
.pswp__caption small {
|
||||
font-size: 11px;
|
||||
color: #BBB;
|
||||
}
|
||||
|
||||
.pswp__caption__center {
|
||||
text-align: left;
|
||||
max-width: 420px;
|
||||
margin: 0 auto;
|
||||
font-size: 13px;
|
||||
padding: 10px;
|
||||
line-height: 20px;
|
||||
color: #CCC;
|
||||
}
|
||||
|
||||
.pswp__caption--empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Fake caption element, used to calculate height of next/prev image */
|
||||
.pswp__caption--fake {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/*
|
||||
5. Loading indicator (preloader)
|
||||
You can play with it here - http://codepen.io/dimsemenov/pen/yyBWoR
|
||||
*/
|
||||
.pswp__preloader {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
margin-left: -22px;
|
||||
opacity: 0;
|
||||
-webkit-transition: opacity 0.25s ease-out;
|
||||
transition: opacity 0.25s ease-out;
|
||||
will-change: opacity;
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
.pswp__preloader__icn {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin: 12px;
|
||||
}
|
||||
|
||||
.pswp__preloader--active {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.pswp__preloader--active .pswp__preloader__icn {
|
||||
/* We use .gif in browsers that don't support CSS animation */
|
||||
background: url(../../images/photoswipe/preloader.gif) 0 0 no-repeat;
|
||||
}
|
||||
|
||||
.pswp--css_animation .pswp__preloader--active {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.pswp--css_animation .pswp__preloader--active .pswp__preloader__icn {
|
||||
-webkit-animation: clockwise 500ms linear infinite;
|
||||
animation: clockwise 500ms linear infinite;
|
||||
}
|
||||
|
||||
.pswp--css_animation .pswp__preloader--active .pswp__preloader__donut {
|
||||
-webkit-animation: donut-rotate 1000ms cubic-bezier(0.4, 0, 0.22, 1) infinite;
|
||||
animation: donut-rotate 1000ms cubic-bezier(0.4, 0, 0.22, 1) infinite;
|
||||
}
|
||||
|
||||
.pswp--css_animation .pswp__preloader__icn {
|
||||
background: none;
|
||||
opacity: 0.75;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
position: absolute;
|
||||
left: 15px;
|
||||
top: 15px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.pswp--css_animation .pswp__preloader__cut {
|
||||
/*
|
||||
The idea of animating inner circle is based on Polymer ("material") loading indicator
|
||||
by Keanu Lee https://blog.keanulee.com/2014/10/20/the-tale-of-three-spinners.html
|
||||
*/
|
||||
position: relative;
|
||||
width: 7px;
|
||||
height: 14px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.pswp--css_animation .pswp__preloader__donut {
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border: 2px solid #FFF;
|
||||
border-radius: 50%;
|
||||
border-left-color: transparent;
|
||||
border-bottom-color: transparent;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1024px) {
|
||||
.pswp__preloader {
|
||||
position: relative;
|
||||
left: auto;
|
||||
top: auto;
|
||||
margin: 0;
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes clockwise {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotate(360deg);
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes clockwise {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotate(360deg);
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes donut-rotate {
|
||||
0% {
|
||||
-webkit-transform: rotate(0);
|
||||
transform: rotate(0);
|
||||
}
|
||||
|
||||
50% {
|
||||
-webkit-transform: rotate(-140deg);
|
||||
transform: rotate(-140deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotate(0);
|
||||
transform: rotate(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes donut-rotate {
|
||||
0% {
|
||||
-webkit-transform: rotate(0);
|
||||
transform: rotate(0);
|
||||
}
|
||||
|
||||
50% {
|
||||
-webkit-transform: rotate(-140deg);
|
||||
transform: rotate(-140deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotate(0);
|
||||
transform: rotate(0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
6. Additional styles
|
||||
*/
|
||||
/* root element of UI */
|
||||
.pswp__ui {
|
||||
-webkit-font-smoothing: auto;
|
||||
visibility: visible;
|
||||
opacity: 1;
|
||||
z-index: 1550;
|
||||
}
|
||||
|
||||
/* top black bar with buttons and "1 of X" indicator */
|
||||
.pswp__top-bar {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
height: 44px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.pswp__caption,
|
||||
.pswp__top-bar,
|
||||
.pswp--has_mouse .pswp__button--arrow--left,
|
||||
.pswp--has_mouse .pswp__button--arrow--right {
|
||||
-webkit-backface-visibility: hidden;
|
||||
will-change: opacity;
|
||||
-webkit-transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1);
|
||||
transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1);
|
||||
}
|
||||
|
||||
/* pswp--has_mouse class is added only when two subsequent mousemove events occur */
|
||||
.pswp--has_mouse .pswp__button--arrow--left,
|
||||
.pswp--has_mouse .pswp__button--arrow--right {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.pswp__top-bar,
|
||||
.pswp__caption {
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
/* pswp__ui--fit class is added when main image "fits" between top bar and bottom bar (caption) */
|
||||
.pswp__ui--fit .pswp__top-bar,
|
||||
.pswp__ui--fit .pswp__caption {
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
/* pswp__ui--idle class is added when mouse isn't moving for several seconds (JS option timeToIdle) */
|
||||
.pswp__ui--idle .pswp__top-bar {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.pswp__ui--idle .pswp__button--arrow--left,
|
||||
.pswp__ui--idle .pswp__button--arrow--right {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/*
|
||||
pswp__ui--hidden class is added when controls are hidden
|
||||
e.g. when user taps to toggle visibility of controls
|
||||
*/
|
||||
.pswp__ui--hidden .pswp__top-bar,
|
||||
.pswp__ui--hidden .pswp__caption,
|
||||
.pswp__ui--hidden .pswp__button--arrow--left,
|
||||
.pswp__ui--hidden .pswp__button--arrow--right {
|
||||
/* Force paint & create composition layer for controls. */
|
||||
opacity: 0.001;
|
||||
}
|
||||
|
||||
/* pswp__ui--one-slide class is added when there is just one item in gallery */
|
||||
.pswp__ui--one-slide .pswp__button--arrow--left,
|
||||
.pswp__ui--one-slide .pswp__button--arrow--right,
|
||||
.pswp__ui--one-slide .pswp__counter {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.pswp__element--disabled {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.pswp--minimal--dark .pswp__top-bar {
|
||||
background: none;
|
||||
}
|
||||
|
||||
.pswp__bg {
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
}
|
|
@ -1,204 +0,0 @@
|
|||
/*! PhotoSwipe main CSS by Dmitry Semenov | photoswipe.com | MIT license */
|
||||
/*
|
||||
Styles for basic PhotoSwipe functionality (sliding area, open/close transitions)
|
||||
*/
|
||||
/* pswp = photoswipe */
|
||||
.pswp {
|
||||
display: none;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
overflow: hidden;
|
||||
-ms-touch-action: none;
|
||||
touch-action: none;
|
||||
z-index: 1500;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
/* create separate layer, to avoid paint on window.onscroll in webkit/blink */
|
||||
-webkit-backface-visibility: hidden;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.pswp * {
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.pswp img {
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
/* style is added when JS option showHideOpacity is set to true */
|
||||
.pswp--animate_opacity {
|
||||
/* 0.001, because opacity:0 doesn't trigger Paint action, which causes lag at start of transition */
|
||||
opacity: 0.001;
|
||||
will-change: opacity;
|
||||
/* for open/close transition */
|
||||
-webkit-transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1);
|
||||
transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1);
|
||||
}
|
||||
|
||||
.pswp--open {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.pswp--zoom-allowed .pswp__img {
|
||||
/* autoprefixer: off */
|
||||
cursor: -webkit-zoom-in;
|
||||
cursor: -moz-zoom-in;
|
||||
cursor: zoom-in;
|
||||
}
|
||||
|
||||
.pswp--zoomed-in .pswp__img {
|
||||
/* autoprefixer: off */
|
||||
cursor: -webkit-grab;
|
||||
cursor: -moz-grab;
|
||||
cursor: grab;
|
||||
}
|
||||
|
||||
.pswp--dragging .pswp__img {
|
||||
/* autoprefixer: off */
|
||||
cursor: -webkit-grabbing;
|
||||
cursor: -moz-grabbing;
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
/*
|
||||
Background is added as a separate element.
|
||||
As animating opacity is much faster than animating rgba() background-color.
|
||||
*/
|
||||
.pswp__bg {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #000;
|
||||
opacity: 0;
|
||||
-webkit-transform: translateZ(0);
|
||||
transform: translateZ(0);
|
||||
-webkit-backface-visibility: hidden;
|
||||
will-change: opacity;
|
||||
}
|
||||
|
||||
.pswp__scroll-wrap {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.pswp__container,
|
||||
.pswp__zoom-wrap {
|
||||
-ms-touch-action: none;
|
||||
touch-action: none;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
/* Prevent selection and tap highlights */
|
||||
.pswp__container,
|
||||
.pswp__img {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
-webkit-touch-callout: none;
|
||||
}
|
||||
|
||||
.pswp__zoom-wrap {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
-webkit-transform-origin: left top;
|
||||
-ms-transform-origin: left top;
|
||||
transform-origin: left top;
|
||||
/* for open/close transition */
|
||||
-webkit-transition: -webkit-transform 333ms cubic-bezier(0.4, 0, 0.22, 1);
|
||||
transition: transform 333ms cubic-bezier(0.4, 0, 0.22, 1);
|
||||
}
|
||||
|
||||
.pswp__bg {
|
||||
will-change: opacity;
|
||||
/* for open/close transition */
|
||||
-webkit-transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1);
|
||||
transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1);
|
||||
}
|
||||
|
||||
.pswp--animated-in .pswp__bg,
|
||||
.pswp--animated-in .pswp__zoom-wrap {
|
||||
-webkit-transition: none;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
.pswp__container,
|
||||
.pswp__zoom-wrap {
|
||||
-webkit-backface-visibility: hidden;
|
||||
}
|
||||
|
||||
.pswp__item {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.pswp__img {
|
||||
position: absolute;
|
||||
width: auto;
|
||||
height: auto;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
/*
|
||||
stretched thumbnail or div placeholder element (see below)
|
||||
style is added to avoid flickering in webkit/blink when layers overlap
|
||||
*/
|
||||
.pswp__img--placeholder {
|
||||
-webkit-backface-visibility: hidden;
|
||||
}
|
||||
|
||||
/*
|
||||
div element that matches size of large image
|
||||
large image loads on top of it
|
||||
*/
|
||||
.pswp__img--placeholder--blank {
|
||||
background: #222;
|
||||
}
|
||||
|
||||
.pswp--ie .pswp__img {
|
||||
width: 100% !important;
|
||||
height: auto !important;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Error message appears when image is not loaded
|
||||
(JS option errorMsg controls markup)
|
||||
*/
|
||||
.pswp__error-msg {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
line-height: 16px;
|
||||
margin-top: -8px;
|
||||
color: #CCC;
|
||||
}
|
||||
|
||||
.pswp__error-msg a {
|
||||
color: #CCC;
|
||||
text-decoration: underline;
|
||||
}
|
|
@ -0,0 +1,182 @@
|
|||
.modal {
|
||||
&__overlay {
|
||||
z-index: z('modal');
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0,0,0,0.7);
|
||||
@include flexbox();
|
||||
@include justify-content(center);
|
||||
@include align-items(center);
|
||||
}
|
||||
|
||||
&__container {
|
||||
background-color: transparent;
|
||||
border-radius: 0.25rem;
|
||||
overflow-y: auto;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&__content {
|
||||
margin: auto;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&__header {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
background: rgba(0,0,0,0.45);
|
||||
}
|
||||
|
||||
&__caption {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
width: 100%;
|
||||
background: rgba(0,0,0,0.45);
|
||||
|
||||
@include no-select;
|
||||
@include translateX(-50%);
|
||||
|
||||
&--text {
|
||||
text-align: center;
|
||||
font-family: $title-font;
|
||||
font-size: 14px;
|
||||
padding: 0.5rem;
|
||||
width: 40%;
|
||||
height: auto;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
|
||||
&__paging {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100px;
|
||||
padding: 0.8rem;
|
||||
height: auto;
|
||||
font-family: $title-font;
|
||||
font-size: 16px;
|
||||
background: transparent;
|
||||
|
||||
@include no-select;
|
||||
}
|
||||
|
||||
&__icon {
|
||||
margin: 0;
|
||||
padding: 0.4rem;
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
border-radius: 0.25rem;
|
||||
|
||||
@include flexbox();
|
||||
@include align-items(center);
|
||||
@include justify-content(center);
|
||||
}
|
||||
|
||||
&__toolbar {
|
||||
@include themify($themes) {
|
||||
color: themed('gtt-color');
|
||||
|
||||
@include on-event {
|
||||
color: themed('gtt-hover-color');
|
||||
background: rgba(0,0,0,0.4);
|
||||
}
|
||||
}
|
||||
|
||||
&--close {
|
||||
top: 0.4rem;
|
||||
right: 0.25rem;
|
||||
}
|
||||
|
||||
&--full {
|
||||
top: 0.4rem;
|
||||
right: 2.8rem;
|
||||
}
|
||||
|
||||
&--normal {
|
||||
top: 0.4rem;
|
||||
right: 2.8rem;
|
||||
}
|
||||
}
|
||||
|
||||
&__arrow {
|
||||
@include themify($themes) {
|
||||
color: themed('gtt-color');
|
||||
background: rgba(0,0,0,0.45);
|
||||
|
||||
@include on-event {
|
||||
color: themed('gtt-hover-color');
|
||||
background: rgba(0,0,0,0.5);
|
||||
}
|
||||
}
|
||||
|
||||
&--left {
|
||||
left: 0.5rem;
|
||||
top: 50%;
|
||||
@include translateY(-50%);
|
||||
}
|
||||
|
||||
&--right {
|
||||
right: 0.5rem;
|
||||
top: 50%;
|
||||
@include translateY(-50%);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes mmfadeIn {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
|
||||
@keyframes mmfadeOut {
|
||||
from { opacity: 1; }
|
||||
to { opacity: 0; }
|
||||
}
|
||||
|
||||
@keyframes mmslideIn {
|
||||
from { transform: translateY(4%); }
|
||||
to { transform: translateY(0); }
|
||||
}
|
||||
|
||||
@keyframes mmslideOut {
|
||||
from { transform: translateY(0); }
|
||||
to { transform: translateY(-2%); }
|
||||
}
|
||||
|
||||
.micromodal-slide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.micromodal-slide.is-open {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.micromodal-slide[aria-hidden="false"] .modal__overlay {
|
||||
animation: mmfadeIn .3s cubic-bezier(0.0, 0.0, 0.2, 1);
|
||||
}
|
||||
|
||||
.micromodal-slide[aria-hidden="false"] .modal__container {
|
||||
animation: mmslideIn .3s cubic-bezier(0, 0, .2, 1);
|
||||
}
|
||||
|
||||
.micromodal-slide[aria-hidden="true"] .modal__overlay {
|
||||
animation: mmfadeOut .3s cubic-bezier(0.0, 0.0, 0.2, 1);
|
||||
}
|
||||
|
||||
.micromodal-slide[aria-hidden="true"] .modal__container {
|
||||
animation: mmslideOut .3s cubic-bezier(0, 0, .2, 1);
|
||||
}
|
||||
|
||||
.micromodal-slide .modal__container,
|
||||
.micromodal-slide .modal__overlay {
|
||||
will-change: transform;
|
||||
}
|
|
@ -18,3 +18,24 @@
|
|||
background: themed('navbar-title-active-color') !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.swipe {
|
||||
overflow: hidden;
|
||||
visibility: hidden;
|
||||
position: relative;
|
||||
}
|
||||
.swipe-wrap {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
.swipe-wrap > div {
|
||||
float: left;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
object-fit: contain;
|
||||
|
||||
@include flexbox();
|
||||
@include justify-content(center);
|
||||
@include align-items(center);
|
||||
}
|
|
@ -6,6 +6,7 @@
|
|||
font-size: 0.85rem;
|
||||
padding-left: 0.5rem;
|
||||
z-index: z('toc');
|
||||
@include no-select;
|
||||
|
||||
#TableOfContents {
|
||||
position: relative;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
&__image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
object-fit: contain;
|
||||
border-radius: 0.25rem;
|
||||
@include box-shadow(0, 2px, 3px, 0, rgba(0, 0, 0, 0.25));
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ $content-font: {{ .Site.Data.font.content_font }};
|
|||
@import 'components/busuanzi';
|
||||
@import 'components/donation';
|
||||
@import 'components/box';
|
||||
@import 'components/modal';
|
||||
|
||||
@import 'pages/404';
|
||||
@import 'pages/about';
|
||||
|
|
|
@ -32,14 +32,18 @@
|
|||
|
||||
/* ---- .grid-item ---- */
|
||||
|
||||
.grid-sizer {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.grid-sizer,
|
||||
.grid-item {
|
||||
width: 33.333%;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.grid-item {
|
||||
float: left;
|
||||
float: left;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
|
||||
.grid-item img {
|
||||
|
@ -78,10 +82,9 @@
|
|||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
padding: 0.5rem;
|
||||
width: calc(100% - 1rem);
|
||||
height: calc(100% - 1rem);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 0.25rem;
|
||||
z-index: z('gallery-mask');
|
||||
font-family: $title-font;
|
||||
|
|
|
@ -140,7 +140,7 @@
|
|||
padding: 2px 7px;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
z-index: 1;
|
||||
z-index: z('content');
|
||||
line-height: 30px;
|
||||
font-size: $code-font-size;
|
||||
font-family: $title-font;
|
||||
|
@ -407,7 +407,7 @@ pre:not(.chroma) {
|
|||
padding: 2px 7px;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
z-index: 0;
|
||||
z-index: z('toc');
|
||||
border-top-left-radius: 0.25rem;
|
||||
border-top-right-radius: 0.25rem;
|
||||
content: '';
|
||||
|
@ -423,7 +423,7 @@ pre:not(.chroma) {
|
|||
margin: 1em 0;
|
||||
border-radius: 5px;
|
||||
box-shadow: 1px 1px 2px rgba(0,0,0,0.125);
|
||||
z-index: 1;
|
||||
z-index: z('content');
|
||||
overflow-x: auto;
|
||||
|
||||
@include themify($codeblock) {
|
||||
|
@ -440,7 +440,7 @@ pre:not(.chroma) {
|
|||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 2;
|
||||
z-index: z('grid');
|
||||
padding: 2px 7px;
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
|
@ -466,7 +466,7 @@ pre:not(.chroma) {
|
|||
|
||||
&:first-child {
|
||||
width: 10px;
|
||||
user-select: none;
|
||||
@include no-select;
|
||||
|
||||
pre {
|
||||
margin: 0;
|
||||
|
|
|
@ -2,7 +2,7 @@ $hacker: (
|
|||
footer-background-color: #252526,
|
||||
footer-color: #C7BA00,
|
||||
link: #E08C48,
|
||||
link-hover: #FF6188,
|
||||
link-hover: #E08C48,
|
||||
title-color: #A1AD64,
|
||||
meta-color: #CDF5CC,
|
||||
body-color: #1FFF2A,
|
||||
|
@ -63,7 +63,7 @@ $hacker: (
|
|||
toc-label-color: #727072,
|
||||
toc-title-color: #727072,
|
||||
toc-vertical-line: #727072,
|
||||
toc-vertical-line-active: #FF6188,
|
||||
toc-vertical-line-active: #E08C48,
|
||||
search-placeholder-color: #727072,
|
||||
search-color: #1FFF2A,
|
||||
search-icon-color: #727072,
|
||||
|
|
|
@ -2,7 +2,7 @@ $light: (
|
|||
footer-background-color: #eceff1,
|
||||
footer-color: #424242,
|
||||
link: #607d8b,
|
||||
link-hover: #FF6188,
|
||||
link-hover: #26a69a,
|
||||
title-color: #607d8b,
|
||||
meta-color: #424242,
|
||||
body-color: #424242,
|
||||
|
@ -63,7 +63,7 @@ $light: (
|
|||
toc-label-color: #727072,
|
||||
toc-title-color: #727072,
|
||||
toc-vertical-line: #727072,
|
||||
toc-vertical-line-active: #FF6188,
|
||||
toc-vertical-line-active: #26a69a,
|
||||
search-placeholder-color: #bdbdbd,
|
||||
search-color: #424242,
|
||||
search-icon-color: #bdbdbd,
|
||||
|
|
|
@ -63,7 +63,7 @@ $solarized: (
|
|||
toc-label-color: #727072,
|
||||
toc-title-color: #727072,
|
||||
toc-vertical-line: #727072,
|
||||
toc-vertical-line-active: #FF6188,
|
||||
toc-vertical-line-active: #268bd2,
|
||||
search-placeholder-color: #B58900,
|
||||
search-color: #B58900,
|
||||
search-border-color: darken(#FBF1D1, 10%),
|
||||
|
|
|
@ -32,14 +32,8 @@
|
|||
name = "photo"
|
||||
url = "gallery/photo"
|
||||
|
||||
[[main]]
|
||||
identifier = "talks"
|
||||
name = "talks"
|
||||
url = "talks"
|
||||
weight = 5
|
||||
|
||||
[[main]]
|
||||
identifier = "posts"
|
||||
name = "posts"
|
||||
url = "posts"
|
||||
weight = 6
|
||||
weight = 5
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
title: "Talks"
|
||||
date: 2019-12-30T11:14:14+09:00
|
||||
description: Talks Page
|
||||
---
|
|
@ -1,22 +0,0 @@
|
|||
---
|
||||
title: "My Awesome Events"
|
||||
date: 2019-12-31T00:04:50+09:00
|
||||
publishDate: 2023-04-19
|
||||
description: "My Awesome events"
|
||||
tags:
|
||||
-
|
||||
series:
|
||||
-
|
||||
categories:
|
||||
-
|
||||
links:
|
||||
- link: "https://gohugo.io/"
|
||||
title: "Video Link Title"
|
||||
type: "video"
|
||||
- link: "https://github.com/gohugoio/hugo"
|
||||
title: "PPT Link Title"
|
||||
type: "ppt"
|
||||
- link: "https://discourse.gohugo.io/"
|
||||
title: "Event Link Title"
|
||||
type: "event"
|
||||
---
|
|
@ -1,22 +0,0 @@
|
|||
---
|
||||
title: "My Awesome Events2"
|
||||
date: 2019-12-31T00:04:50+09:00
|
||||
publishDate: 2022-04-19
|
||||
description: "My Awesome events2"
|
||||
tags:
|
||||
-
|
||||
series:
|
||||
-
|
||||
categories:
|
||||
-
|
||||
links:
|
||||
- link: "https://gohugo.io/"
|
||||
title: "Video Link Title"
|
||||
type: "video"
|
||||
- link: "https://github.com/gohugoio/hugo"
|
||||
title: "PPT Link Title"
|
||||
type: "ppt"
|
||||
- link: "https://discourse.gohugo.io/"
|
||||
title: "Event Link Title"
|
||||
type: "event"
|
||||
---
|
|
@ -1,22 +0,0 @@
|
|||
---
|
||||
title: "My Awesome links"
|
||||
date: 2019-12-31T00:04:50+09:00
|
||||
publishDate: 2022-01-11
|
||||
description: "My Awesome links"
|
||||
tags:
|
||||
-
|
||||
series:
|
||||
-
|
||||
categories:
|
||||
-
|
||||
links:
|
||||
- link: "https://gohugo.io/"
|
||||
title: "Video Link Title"
|
||||
type: "video"
|
||||
- link: "https://github.com/gohugoio/hugo"
|
||||
title: "PPT Link Title"
|
||||
type: "ppt"
|
||||
- link: "https://discourse.gohugo.io/"
|
||||
title: "Event Link Title"
|
||||
type: "event"
|
||||
---
|
|
@ -1,22 +0,0 @@
|
|||
---
|
||||
title: "My Awesome links2"
|
||||
date: 2019-12-31T00:04:50+09:00
|
||||
publishDate: 2021-01-11
|
||||
description: "My Awesome links2"
|
||||
tags:
|
||||
-
|
||||
series:
|
||||
-
|
||||
categories:
|
||||
-
|
||||
links:
|
||||
- link: "https://gohugo.io/"
|
||||
title: "Video Link Title"
|
||||
type: "video"
|
||||
- link: "https://github.com/gohugoio/hugo"
|
||||
title: "PPT Link Title"
|
||||
type: "ppt"
|
||||
- link: "https://discourse.gohugo.io/"
|
||||
title: "Event Link Title"
|
||||
type: "event"
|
||||
---
|
|
@ -1,22 +0,0 @@
|
|||
---
|
||||
title: "My Awesome Ppts"
|
||||
date: 2019-12-31T00:04:50+09:00
|
||||
publishDate: 2021-03-05
|
||||
description: "My Awesome ppts"
|
||||
tags:
|
||||
-
|
||||
series:
|
||||
-
|
||||
categories:
|
||||
-
|
||||
links:
|
||||
- link: "https://gohugo.io/"
|
||||
title: "Video Link Title"
|
||||
type: "video"
|
||||
- link: "https://github.com/gohugoio/hugo"
|
||||
title: "PPT Link Title"
|
||||
type: "ppt"
|
||||
- link: "https://discourse.gohugo.io/"
|
||||
title: "Event Link Title"
|
||||
type: "event"
|
||||
---
|
|
@ -1,22 +0,0 @@
|
|||
---
|
||||
title: "My Awesome Talks"
|
||||
date: 2019-12-31T00:04:50+09:00
|
||||
publishDate: 2022-02-22
|
||||
description: "My Awesome talks"
|
||||
tags:
|
||||
-
|
||||
series:
|
||||
-
|
||||
categories:
|
||||
-
|
||||
links:
|
||||
- link: "https://gohugo.io/"
|
||||
title: "Video Link Title"
|
||||
type: "video"
|
||||
- link: "https://github.com/gohugoio/hugo"
|
||||
title: "PPT Link Title"
|
||||
type: "ppt"
|
||||
- link: "https://discourse.gohugo.io/"
|
||||
title: "Event Link Title"
|
||||
type: "event"
|
||||
---
|
|
@ -10,18 +10,318 @@
|
|||
|
||||
{{ $fuse := resources.Get "js/fuse.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $fuse.RelPermalink }}"></script>
|
||||
{{ $getParents := resources.Get "js/helper/getParents.js" | resources.Minify | resources.Fingerprint }}
|
||||
<script defer src="{{ $getParents.RelPermalink }}"></script>
|
||||
{{ $fadeinout := resources.Get "js/helper/fadeinout.js" | resources.Minify | resources.Fingerprint }}
|
||||
<script defer src="{{ $fadeinout.RelPermalink }}"></script>
|
||||
|
||||
<script>
|
||||
// search
|
||||
var runSearch = function() {
|
||||
"use strict";
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
// ========================= go to top =========================
|
||||
var gttBtn = document.getElementById("gtt");
|
||||
gttBtn.style.display = "none";
|
||||
gttBtn.addEventListener('click', function () {
|
||||
scrollToTop(250);
|
||||
});
|
||||
|
||||
function scrollToTop(scrollDuration) {
|
||||
var scrollStep = -window.scrollY / (scrollDuration / 15);
|
||||
var scrollInterval = setInterval(function () {
|
||||
if (window.scrollY != 0) {
|
||||
window.scrollBy(0, scrollStep);
|
||||
}
|
||||
else clearInterval(scrollInterval);
|
||||
}, 15);
|
||||
}
|
||||
|
||||
var scrollFunction = function () {
|
||||
if (document.body.scrollTop > 250 || document.documentElement.scrollTop > 250) {
|
||||
gttBtn.style.display = "block";
|
||||
} else {
|
||||
gttBtn.style.display = "none";
|
||||
}
|
||||
}
|
||||
// ============================================================
|
||||
|
||||
|
||||
// ========================== scroll ==========================
|
||||
var lastScrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
||||
var tableOfContentsElem = document.getElementById('TableOfContents');
|
||||
var tocElem = document.querySelector('.toc');
|
||||
var toggleTocElem = document.getElementById('toggle-toc');
|
||||
var singleContentsElem = document.querySelector('.single__contents');
|
||||
var navbar = document.querySelector('.navbar');
|
||||
|
||||
window.onscroll = function () {
|
||||
scrollFunction();
|
||||
|
||||
var st = window.pageYOffset || document.documentElement.scrollTop;
|
||||
if (st > lastScrollTop) { // scroll down
|
||||
if (st < 250) {
|
||||
gttBtn.style.display = "none";
|
||||
} else {
|
||||
gttBtn.style.display = "block";
|
||||
}
|
||||
|
||||
if (st < 45) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!navbar.classList.contains('navbar--hide')) {
|
||||
navbar.classList.add('navbar--hide');
|
||||
} else if (navbar.classList.contains('navbar--show')) {
|
||||
navbar.classList.remove('navbar--show');
|
||||
}
|
||||
|
||||
singleContentsElem ?
|
||||
singleContentsElem.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach(function(elem) {
|
||||
if (toggleTocElem && !toggleTocElem.checked) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (document.documentElement.scrollTop >= elem.offsetTop) {
|
||||
var id = elem.getAttribute('id');
|
||||
tocElem.querySelectorAll('a').forEach(function (elem) {
|
||||
elem.classList.remove('active');
|
||||
});
|
||||
tocElem.querySelector('a[href="#' + id + '"]').classList.add('active');
|
||||
|
||||
document.querySelectorAll('#TableOfContents > ul > li').forEach(function(liElem) {
|
||||
liElem.querySelectorAll('ul').forEach(function(ulElem) {
|
||||
ulElem.style.display = 'none';
|
||||
});
|
||||
});
|
||||
|
||||
var curElem = tableOfContentsElem.querySelector(`[href="#${id}"]`);
|
||||
if (curElem.nextElementSibling) {
|
||||
curElem.nextElementSibling.style.display = 'block';
|
||||
}
|
||||
getParents(curElem, 'ul').forEach(function(elem) {
|
||||
elem.style.display = 'block';
|
||||
});
|
||||
}
|
||||
}) : null;
|
||||
} else { // scroll up
|
||||
if (st < 250) {
|
||||
gttBtn.style.display = "none";
|
||||
}
|
||||
|
||||
if (navbar.classList.contains('navbar--hide')) {
|
||||
navbar.classList.remove('navbar--hide');
|
||||
} else if (!navbar.classList.contains('navbar--show')) {
|
||||
navbar.classList.add('navbar--show');
|
||||
}
|
||||
|
||||
singleContentsElem ?
|
||||
singleContentsElem.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach(function(elem) {
|
||||
if (toggleTocElem && !toggleTocElem.checked) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (document.documentElement.scrollTop >= elem.offsetTop) {
|
||||
var id = elem.getAttribute('id');
|
||||
tocElem.querySelectorAll('a').forEach(function (elem) {
|
||||
elem.classList.remove('active');
|
||||
});
|
||||
tocElem.querySelector('a[href="#' + id + '"]').classList.add('active');
|
||||
|
||||
document.querySelectorAll('#TableOfContents > ul > li').forEach(function (liElem) {
|
||||
liElem.querySelectorAll('ul').forEach(function (ulElem) {
|
||||
ulElem.style.display = 'none';
|
||||
});
|
||||
});
|
||||
|
||||
var curElem = tableOfContentsElem.querySelector(`[href="#${id}"]`);
|
||||
if (curElem.nextElementSibling) {
|
||||
curElem.nextElementSibling.style.display = 'block';
|
||||
}
|
||||
getParents(curElem, 'ul').forEach(function (elem) {
|
||||
elem.style.display = 'block';
|
||||
});
|
||||
}
|
||||
}) : null;
|
||||
|
||||
if (tableOfContentsElem && document.documentElement.scrollTop < 250) {
|
||||
tableOfContentsElem.querySelectorAll('ul > li').forEach(function (liElem) {
|
||||
liElem.querySelectorAll('ul').forEach(function (ulElem) {
|
||||
ulElem.style.display = 'none';
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
lastScrollTop = st <= 0 ? 0 : st;
|
||||
};
|
||||
// ============================================================
|
||||
|
||||
|
||||
// ========================== navbar ==========================
|
||||
var navbarBurgerElem = document.querySelector('.navbar__burger');
|
||||
var navbarMenuElem = document.querySelector('.navbar__menu');
|
||||
navbarBurgerElem ?
|
||||
navbarBurgerElem.addEventListener('click', function () {
|
||||
if (navbarBurgerElem.classList.contains('is-active')) {
|
||||
navbarBurgerElem.classList.remove('is-active');
|
||||
navbarMenuElem.classList.remove('is-active');
|
||||
} else {
|
||||
navbarBurgerElem.classList.add('is-active');
|
||||
navbarMenuElem.classList.add('is-active');
|
||||
}
|
||||
}) : null;
|
||||
// ============================================================
|
||||
|
||||
|
||||
// ====================== mobile search =======================
|
||||
var mobileSearchInputElem = document.querySelector('#search-mobile');
|
||||
var mobileSearchClassElem = document.querySelector('.mobile-search');
|
||||
var mobileSearchBtnElem = document.querySelector('#mobileSearchBtn');
|
||||
var mobileSearchCloseBtnElem = document.querySelector('#search-mobile-close');
|
||||
var mobileSearchContainer = document.querySelector('#search-mobile-container');
|
||||
var mobileSearchResultsElem = document.querySelector('#search-mobile-results');
|
||||
var htmlElem = document.querySelector('html');
|
||||
|
||||
if (mobileSearchClassElem) {
|
||||
mobileSearchClassElem.style.display = 'none';
|
||||
}
|
||||
|
||||
mobileSearchBtnElem ?
|
||||
mobileSearchBtnElem.addEventListener('click', function () {
|
||||
if (mobileSearchContainer) {
|
||||
mobileSearchContainer.style.display = 'block';
|
||||
}
|
||||
|
||||
if (mobileSearchInputElem) {
|
||||
mobileSearchInputElem.focus();
|
||||
}
|
||||
|
||||
if (htmlElem) {
|
||||
htmlElem.style.overflowY = 'hidden';
|
||||
}
|
||||
}) : null;
|
||||
|
||||
mobileSearchCloseBtnElem ?
|
||||
mobileSearchCloseBtnElem.addEventListener('click', function() {
|
||||
if (mobileSearchContainer) {
|
||||
mobileSearchContainer.style.display = 'none';
|
||||
}
|
||||
|
||||
if (mobileSearchInputElem) {
|
||||
mobileSearchInputElem.value = '';
|
||||
}
|
||||
|
||||
if (mobileSearchResultsElem) {
|
||||
while (mobileSearchResultsElem.firstChild) {
|
||||
mobileSearchResultsElem.removeChild(mobileSearchResultsElem.firstChild);
|
||||
}
|
||||
}
|
||||
|
||||
if (htmlElem) {
|
||||
htmlElem.style.overflowY = 'visible';
|
||||
}
|
||||
}) : null;
|
||||
|
||||
mobileSearchInputElem ?
|
||||
mobileSearchInputElem.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Escape') {
|
||||
if (mobileSearchContainer) {
|
||||
mobileSearchContainer.style.display = 'none';
|
||||
}
|
||||
|
||||
if (mobileSearchInputElem) {
|
||||
mobileSearchInputElem.value = '';
|
||||
}
|
||||
|
||||
if (mobileSearchResultsElem) {
|
||||
while (mobileSearchResultsElem.firstChild) {
|
||||
mobileSearchResultsElem.removeChild(mobileSearchResultsElem.firstChild);
|
||||
}
|
||||
}
|
||||
if (htmlElem) {
|
||||
htmlElem.style.overflowY = 'visible';
|
||||
}
|
||||
}
|
||||
}) : null;
|
||||
// ============================================================
|
||||
|
||||
|
||||
// ======================= theme change =======================
|
||||
var localTheme = localStorage.getItem('theme');
|
||||
var rootEleme = document.getElementById('root');
|
||||
var selectThemeElem = document.querySelectorAll('.select-theme');
|
||||
var selectThemeItemElem = document.querySelectorAll('.select-theme__item');
|
||||
|
||||
if (localTheme) {
|
||||
selectThemeItemElem ?
|
||||
selectThemeItemElem.forEach(function (elem) {
|
||||
if (elem.text.trim() === localTheme) {
|
||||
elem.classList.add('is-active');
|
||||
} else {
|
||||
elem.classList.remove('is-active');
|
||||
}
|
||||
}) : null;
|
||||
}
|
||||
|
||||
selectThemeItemElem ?
|
||||
selectThemeItemElem.forEach(function (v, i) {
|
||||
v.addEventListener('click', function (e) {
|
||||
var selectedThemeVariant = e.target.text.trim();
|
||||
localStorage.setItem('theme', selectedThemeVariant);
|
||||
|
||||
rootEleme.removeAttribute('class');
|
||||
rootEleme.classList.add(`theme__${selectedThemeVariant}`);
|
||||
selectThemeElem.forEach(function(rootElem) {
|
||||
rootElem.querySelectorAll('a').forEach(function (elem) {
|
||||
if (elem.classList) {
|
||||
if (elem.text.trim() === selectedThemeVariant) {
|
||||
if (!elem.classList.contains('is-active')) {
|
||||
elem.classList.add('is-active');
|
||||
}
|
||||
} else {
|
||||
if (elem.classList.contains('is-active')) {
|
||||
elem.classList.remove('is-active');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (window.mermaid) {
|
||||
if (selectedThemeVariant === "dark" || selectedThemeVariant === "hacker") {
|
||||
mermaid.initialize({ theme: 'dark' });
|
||||
location.reload();
|
||||
} else {
|
||||
mermaid.initialize({ theme: 'default' });
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
var utterances = document.querySelector('iframe');
|
||||
if (utterances) {
|
||||
utterances.contentWindow.postMessage({
|
||||
type: 'set-theme',
|
||||
theme: selectedThemeVariant === "dark" || selectedThemeVariant === "hacker" ? 'photon-dark' : 'github-light',
|
||||
}, 'https://utteranc.es');
|
||||
}
|
||||
});
|
||||
}) : null;
|
||||
// ============================================================
|
||||
|
||||
|
||||
// ========================== search ==========================
|
||||
{{ if .Site.IsMultiLingual }}
|
||||
var baseurl = "{{.Site.BaseURL}}{{.Site.LanguagePrefix}}";
|
||||
{{ else }}
|
||||
var baseurl = "{{.Site.BaseURL}}";
|
||||
{{ end }}
|
||||
|
||||
|
||||
var searchResults = null;
|
||||
var searchMenu = null;
|
||||
var searchText = null;
|
||||
|
||||
{{ $enableSearchHighlight := ($.Param "enableSearchHighlight") }}
|
||||
var enableSearchHighlight = JSON.parse({{ $enableSearchHighlight | jsonify }});
|
||||
|
||||
var fuse = null;
|
||||
|
||||
function endsWith(str, suffix) {
|
||||
|
@ -33,24 +333,30 @@
|
|||
baseurl = baseurl + '/';
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: baseurl + "index.json",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
})
|
||||
.done(function (index) {
|
||||
fuse = new Fuse(index, {
|
||||
keys: ['title', 'description', 'content']
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', baseurl + "index.json");
|
||||
xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
|
||||
xhr.onload = function () {
|
||||
if (xhr.status === 200) {
|
||||
fuse = new Fuse(JSON.parse(xhr.response.toString('utf-8')), {
|
||||
keys: ['title', 'description', 'content'],
|
||||
includeMatches: enableSearchHighlight,
|
||||
shouldSort: true,
|
||||
threshold: 0.4,
|
||||
location: 0,
|
||||
distance: 100,
|
||||
maxPatternLength: 32,
|
||||
minMatchCharLength: 1,
|
||||
});
|
||||
})
|
||||
.fail(function (jqxhr, textStatus, error) {
|
||||
var err = textStatus + ", " + error;
|
||||
console.error("Error getting Hugo index file:", err);
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.error(`[${xhr.status}]Error:`, xhr.statusText);
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function renderSearchResults(results) {
|
||||
function renderSearchResults(results) { // [{}, {}, ...] or [{item: {}, matches: []}, ...]
|
||||
searchResults = document.getElementById('search-results');
|
||||
searchMenu = document.getElementById('search-menu');
|
||||
searchResults.setAttribute('class', 'dropdown is-active');
|
||||
|
@ -81,6 +387,37 @@
|
|||
searchMenu.appendChild(content);
|
||||
}
|
||||
|
||||
function renderSearchHighlightResults(results) {
|
||||
searchResults = document.getElementById('search-results');
|
||||
searchMenu = document.getElementById('search-menu');
|
||||
searchResults.setAttribute('class', 'dropdown is-active');
|
||||
|
||||
var content = document.createElement('div');
|
||||
content.setAttribute('class', 'dropdown-content search-content');
|
||||
|
||||
if (results.length > 0) {
|
||||
results.forEach(function (result) {
|
||||
var item = document.createElement('a');
|
||||
item.setAttribute('href', result.item.uri);
|
||||
item.setAttribute('class', 'dropdown-item');
|
||||
item.innerHTML = `<div class="menu-item"><div class="menu-item__title">📄 ${generateHighlightedText(result.item.title, result.matches[0].indices)}</div><div class="menu-item__desc">${result.matches[1] ? generateHighlightedText(result.item.description, result.matches[1].indices) : result.matches[2] ? generateHighlightedText(result.item.content, result.matches[2].indices) : ''}</div></div>`;
|
||||
content.appendChild(item);
|
||||
});
|
||||
} else {
|
||||
var item = document.createElement('span');
|
||||
item.setAttribute('class', 'dropdown-item');
|
||||
item.innerText = 'No results found';
|
||||
content.appendChild(item);
|
||||
}
|
||||
|
||||
while (searchMenu.hasChildNodes()) {
|
||||
searchMenu.removeChild(
|
||||
searchMenu.lastChild
|
||||
);
|
||||
}
|
||||
searchMenu.appendChild(content);
|
||||
}
|
||||
|
||||
function renderSearchResultsMobile(results) {
|
||||
searchResults = document.getElementById('search-mobile-results');
|
||||
|
||||
|
@ -99,75 +436,186 @@
|
|||
content.appendChild(item);
|
||||
}
|
||||
|
||||
$('#search-mobile-results').empty();
|
||||
let wrap = document.getElementById('search-mobile-results');
|
||||
while (wrap.firstChild) {
|
||||
wrap.removeChild(wrap.firstChild)
|
||||
}
|
||||
searchResults.appendChild(content);
|
||||
}
|
||||
|
||||
function renderSearchHighlightResultsMobile(results) {
|
||||
searchResults = document.getElementById('search-mobile-results');
|
||||
|
||||
var content = document.createElement('div');
|
||||
content.setAttribute('class', 'mobile-search__content');
|
||||
|
||||
if (results.length > 0) {
|
||||
results.forEach(function (result) {
|
||||
var item = document.createElement('a');
|
||||
item.setAttribute('href', result.item.uri);
|
||||
item.innerHTML = `<div class="mobile-search__item"><div class="mobile-search__item--title">📄 ${generateHighlightedText(result.item.title, result.matches[0].indices)}</div><div class="mobile-search__item--desc">${result.matches[1] ? generateHighlightedText(result.item.description, result.matches[1].indices) : result.matches[2] ? generateHighlightedText(result.item.content, result.matches[2].indices) : ''}</div></div>`;
|
||||
content.appendChild(item);
|
||||
});
|
||||
} else {
|
||||
var item = document.createElement('span');
|
||||
content.appendChild(item);
|
||||
}
|
||||
|
||||
let wrap = document.getElementById('search-mobile-results');
|
||||
while (wrap.firstChild) {
|
||||
wrap.removeChild(wrap.firstChild)
|
||||
}
|
||||
searchResults.appendChild(content);
|
||||
}
|
||||
|
||||
function generateHighlightedText(text, regions) {
|
||||
if(!regions) return text;
|
||||
|
||||
var content = '', nextUnhighlightedRegionStartingIndex = 0;
|
||||
|
||||
regions.forEach(function(region) {
|
||||
content += '' +
|
||||
text.substring(nextUnhighlightedRegionStartingIndex, region[0]) +
|
||||
'<span class="search__highlight">' +
|
||||
text.substring(region[0], region[1] + 1) +
|
||||
'</span>' +
|
||||
'';
|
||||
nextUnhighlightedRegionStartingIndex = region[1] + 1;
|
||||
});
|
||||
|
||||
content += text.substring(nextUnhighlightedRegionStartingIndex);
|
||||
|
||||
return content;
|
||||
};
|
||||
|
||||
initFuse();
|
||||
|
||||
$("#search").on('input', function (e) {
|
||||
var searchElem = document.getElementById('search');
|
||||
var searchMobile = document.getElementById('search-mobile');
|
||||
|
||||
searchElem.addEventListener('input', function(e) {
|
||||
if (!e.target.value) {
|
||||
$('#search-results').attr('class', 'dropdown');
|
||||
document.getElementById('search-results').setAttribute('class', 'dropdown');
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($(window).width() < 770) {
|
||||
if (window.innerWidth < 770) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
searchText = e.target.value;
|
||||
var results = fuse.search(e.target.value);
|
||||
renderSearchResults(results);
|
||||
if (enableSearchHighlight) {
|
||||
renderSearchHighlightResults(results);
|
||||
} else {
|
||||
renderSearchResults(results);
|
||||
}
|
||||
});
|
||||
|
||||
$('#search').on('blur', function () {
|
||||
if ($(window).width() < 770) {
|
||||
searchElem.addEventListener('blur', function() {
|
||||
if (window.innerWidth < 770) {
|
||||
return null;
|
||||
}
|
||||
setTimeout(function () {
|
||||
$('#search-results').attr('class', 'dropdown');
|
||||
document.getElementById('search-results').setAttribute('class', 'dropdown');
|
||||
}, 100);
|
||||
});
|
||||
|
||||
$('#search').on('click', function (e) {
|
||||
if ($(window).width() < 770) {
|
||||
searchElem.addEventListener('click', function(e) {
|
||||
if (window.innerWidth < 770) {
|
||||
return null;
|
||||
}
|
||||
if (!e.target.value) {
|
||||
$('#search-results').attr('class', 'dropdown');
|
||||
document.getElementById('search-results').setAttribute('class', 'dropdown');
|
||||
return null;
|
||||
}
|
||||
|
||||
searchText = e.target.value;
|
||||
var results = fuse.search(e.target.value);
|
||||
renderSearchResults(results);
|
||||
if (enableSearchHighlight) {
|
||||
renderSearchHighlightResults(results);
|
||||
} else {
|
||||
renderSearchResults(results);
|
||||
}
|
||||
});
|
||||
|
||||
function indexInParent(node) {
|
||||
var children = node.parentNode.childNodes;
|
||||
var num = 0;
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
if (children[i] == node) return num;
|
||||
if (children[i].nodeType == 1) num++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
$('#search').on('keydown', function (e) {
|
||||
if ($(window).width() < 770) {
|
||||
var searchMenuElem = document.getElementById("search-menu");
|
||||
var activeItem = document.querySelector('#search-menu .dropdown-item.is-active');
|
||||
var activeIndex = null;
|
||||
var items = null;
|
||||
var searchContainerMaxHeight = 350;
|
||||
|
||||
searchElem.addEventListener('keydown', function(e) {
|
||||
if (window.innerWidth < 770) {
|
||||
return null;
|
||||
}
|
||||
var items = $('#search-menu .dropdown-item');
|
||||
var activeIndex = $('#search-menu .dropdown-item.is-active').index();
|
||||
|
||||
items.removeClass('is-active');
|
||||
var items = document.querySelectorAll('#search-menu .dropdown-item');
|
||||
|
||||
if (e.key === 'ArrowDown') {
|
||||
items.eq(activeIndex + 1).addClass('is-active');
|
||||
if (activeIndex === null) {
|
||||
activeIndex = 0;
|
||||
items[activeIndex].classList.remove('is-active');
|
||||
} else {
|
||||
items[activeIndex].classList.remove('is-active');
|
||||
activeIndex = activeIndex === items.length - 1 ? 0 : activeIndex + 1;
|
||||
}
|
||||
items[activeIndex].classList.add('is-active');
|
||||
|
||||
let overflowedPixel = items[activeIndex].offsetTop + items[activeIndex].clientHeight - searchContainerMaxHeight;
|
||||
if (overflowedPixel > 0) {
|
||||
document.querySelector(".search-content").scrollTop = overflowedPixel;
|
||||
} else if (activeIndex === 0) {
|
||||
document.querySelector(".search-content").scrollTop = 0;
|
||||
}
|
||||
} else if (e.key === 'ArrowUp') {
|
||||
items.eq(activeIndex - 1).addClass('is-active');
|
||||
if (activeIndex === null) {
|
||||
activeIndex = items.length - 1;
|
||||
items[activeIndex].classList.remove('is-active');
|
||||
} else {
|
||||
items[activeIndex].classList.remove('is-active');
|
||||
activeIndex = activeIndex === 0 ? items.length - 1 : activeIndex - 1;
|
||||
}
|
||||
items[activeIndex].classList.add('is-active');
|
||||
|
||||
let overflowedPixel = items[activeIndex].offsetTop + items[activeIndex].clientHeight - searchContainerMaxHeight;
|
||||
document.querySelector(".search-content").scrollTop = items[activeIndex].offsetTop;
|
||||
} else if (e.key === 'Enter') {
|
||||
var currentItemLink = items.eq(activeIndex).attr('href');
|
||||
var currentItemLink = items[activeIndex].getAttribute('href');
|
||||
if (currentItemLink) {
|
||||
location.href = currentItemLink;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("#search-mobile").on('input', function(e) {
|
||||
searchMobile.addEventListener('input', function(e) {
|
||||
if (!e.target.value) {
|
||||
$('#search-mobile-results').empty();
|
||||
let wrap = document.getElementById('search-mobile-results');
|
||||
while (wrap.firstChild) {
|
||||
wrap.removeChild(wrap.firstChild);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
searchText = e.target.value;
|
||||
var results = fuse.search(e.target.value);
|
||||
renderSearchResultsMobile(results);
|
||||
if (enableSearchHighlight) {
|
||||
renderSearchHighlightResultsMobile(results);
|
||||
} else {
|
||||
renderSearchResultsMobile(results);
|
||||
}
|
||||
});
|
||||
}
|
||||
// ============================================================
|
||||
});
|
||||
</script>
|
Before Width: | Height: | Size: 547 B |
|
@ -1 +0,0 @@
|
|||
<svg width="264" height="88" viewBox="0 0 264 88" xmlns="http://www.w3.org/2000/svg"><title>default-skin 2</title><g fill="none" fill-rule="evenodd"><g><path d="M67.002 59.5v3.768c-6.307.84-9.184 5.75-10.002 9.732 2.22-2.83 5.564-5.098 10.002-5.098V71.5L73 65.585 67.002 59.5z" id="Shape" fill="#fff"/><g fill="#fff"><path d="M13 29v-5h2v3h3v2h-5zM13 15h5v2h-3v3h-2v-5zM31 15v5h-2v-3h-3v-2h5zM31 29h-5v-2h3v-3h2v5z" id="Shape"/></g><g fill="#fff"><path d="M62 24v5h-2v-3h-3v-2h5zM62 20h-5v-2h3v-3h2v5zM70 20v-5h2v3h3v2h-5zM70 24h5v2h-3v3h-2v-5z"/></g><path d="M20.586 66l-5.656-5.656 1.414-1.414L22 64.586l5.656-5.656 1.414 1.414L23.414 66l5.656 5.656-1.414 1.414L22 67.414l-5.656 5.656-1.414-1.414L20.586 66z" fill="#fff"/><path d="M111.785 65.03L110 63.5l3-3.5h-10v-2h10l-3-3.5 1.785-1.468L117 59l-5.215 6.03z" fill="#fff"/><path d="M152.215 65.03L154 63.5l-3-3.5h10v-2h-10l3-3.5-1.785-1.468L147 59l5.215 6.03z" fill="#fff"/><g><path id="Rectangle-11" fill="#fff" d="M160.957 28.543l-3.25-3.25-1.413 1.414 3.25 3.25z"/><path d="M152.5 27c3.038 0 5.5-2.462 5.5-5.5s-2.462-5.5-5.5-5.5-5.5 2.462-5.5 5.5 2.462 5.5 5.5 5.5z" id="Oval-1" stroke="#fff" stroke-width="1.5"/><path fill="#fff" d="M150 21h5v1h-5z"/></g><g><path d="M116.957 28.543l-1.414 1.414-3.25-3.25 1.414-1.414 3.25 3.25z" fill="#fff"/><path d="M108.5 27c3.038 0 5.5-2.462 5.5-5.5s-2.462-5.5-5.5-5.5-5.5 2.462-5.5 5.5 2.462 5.5 5.5 5.5z" stroke="#fff" stroke-width="1.5"/><path fill="#fff" d="M106 21h5v1h-5z"/><path fill="#fff" d="M109.043 19.008l-.085 5-1-.017.085-5z"/></g></g></g></svg>
|
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 866 B |
|
@ -30,7 +30,7 @@
|
|||
</aside>
|
||||
{{ end }}
|
||||
<script>
|
||||
enquire.register("screen and (max-width: 769px)", {
|
||||
enquire.register("screen and (max-width: 769px)", {
|
||||
match: function () {
|
||||
if (document.getElementsByTagName('main')[0]) {
|
||||
document.getElementsByTagName('main')[0].className = "main";
|
||||
|
@ -46,9 +46,15 @@
|
|||
if (document.getElementsByTagName('aside')[0]) {
|
||||
document.getElementsByTagName('aside')[0].className = "main-side";
|
||||
}
|
||||
document.getElementsByClassName('navbar__burger')[0].classList.remove('is-active');
|
||||
document.getElementsByClassName('navbar__menu')[0].classList.remove('is-active');
|
||||
document.getElementsByClassName('mobile-search')[0].classList.add('hide');
|
||||
if (document.getElementsByClassName('navbar__burger')[0]) {
|
||||
document.getElementsByClassName('navbar__burger')[0].classList.remove('is-active');
|
||||
}
|
||||
if (document.getElementsByClassName('navbar__menu')[0]) {
|
||||
document.getElementsByClassName('navbar__menu')[0].classList.remove('is-active');
|
||||
}
|
||||
if (document.getElementsByClassName('mobile-search')[0]) {
|
||||
document.getElementsByClassName('mobile-search')[0].classList.add('hide');
|
||||
}
|
||||
},
|
||||
setup: function () { },
|
||||
deferSetup: true,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{{ $params := .Params }}
|
||||
<div class="single__infos">
|
||||
<span class="single__info" title="{{ i18n "tooltip-written" }}">📅 {{ .Date.Format (i18n "single-dateformat") }} </span> {{ if .GitInfo }} <span class="single__info" title="{{ i18n "tooltip-modified" }}"> 📝{{ .Lastmod.Format (i18n "single-dateformat") }} </span> {{ end }} · <span class="single__info" title="{{ i18n "tooltip-reading-time" }}"> ☕{{ .ReadingTime }} {{ i18n "reading-time" }} </span>
|
||||
<span class="single__info" title="{{ i18n "tooltip-written" }}">📅 {{ .Date.Format (i18n "single-dateformat") }} </span> {{ if .GitInfo }} <span class="single__info" title="{{ i18n "tooltip-modified" }}"> 📝{{ .Lastmod.Format (i18n "single-dateformat") }} </span> {{ end }} · <span class="single__info" title="{{ i18n "tooltip-reading-time" }}"> ☕{{ .ReadingTime }} {{ i18n "reading-time" }} </span>{{ with .Params.Author }}· <span class="single__info" title="{{ i18n "single-writtenBy" }}">{{if $params.AuthorEmoji }}{{ $params.AuthorEmoji }}{{ else }}✍️{{ end }} {{ . }}</span>{{ end }}
|
||||
<span class="single__info">
|
||||
{{ if (and .Site.Params.enableBusuanzi .Site.Params.busuanziPagePV) }} · 👀<span id="busuanzi_value_page_pv">...</span> {{ i18n "counter-page-pv" }}{{ end }}
|
||||
</span>
|
||||
|
|
|
@ -1,70 +1,272 @@
|
|||
{{ if $.Param "enablePhotoSwipe" }}
|
||||
|
||||
<!-- Root element of PhotoSwipe. Must have class pswp. -->
|
||||
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
|
||||
<!-- Background of PhotoSwipe.
|
||||
It's a separate element as animating opacity is faster than rgba(). -->
|
||||
<div class="pswp__bg"></div>
|
||||
|
||||
<!-- Slides wrapper with overflow:hidden. -->
|
||||
<div class="pswp__scroll-wrap">
|
||||
|
||||
<!-- Container that holds slides.
|
||||
PhotoSwipe keeps only 3 of them in the DOM to save memory.
|
||||
Don't modify these 3 pswp__item elements, data is added later on. -->
|
||||
<div class="pswp__container">
|
||||
<div class="pswp__item"></div>
|
||||
<div class="pswp__item"></div>
|
||||
<div class="pswp__item"></div>
|
||||
</div>
|
||||
|
||||
<!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
|
||||
<div class="pswp__ui pswp__ui--hidden">
|
||||
|
||||
<div class="pswp__top-bar">
|
||||
|
||||
<!-- Controls are self-explanatory. Order can be changed. -->
|
||||
|
||||
<div class="pswp__counter"></div>
|
||||
|
||||
<button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
|
||||
|
||||
<button class="pswp__button pswp__button--share" title="Share"></button>
|
||||
|
||||
<button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
|
||||
|
||||
<button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
|
||||
|
||||
<!-- Preloader demo https://codepen.io/dimsemenov/pen/yyBWoR -->
|
||||
<!-- element will get class pswp__preloader--active when preloader is running -->
|
||||
<div class="pswp__preloader">
|
||||
<div class="pswp__preloader__icn">
|
||||
<div class="pswp__preloader__cut">
|
||||
<div class="pswp__preloader__donut"></div>
|
||||
</div>
|
||||
{{ printf "%#v" .Params.Type }}
|
||||
<div class="modal micromodal-slide" id="modal" aria-hidden="true">
|
||||
<div class="modal__overlay" tabindex="-1" data-micromodal-close>
|
||||
<div class="modal__container" role="dialog" aria-modal="true" aria-labelledby="modal-title">
|
||||
|
||||
<div class="modal__content" id="modal-content">
|
||||
<div id="mySwipe" class="swipe">
|
||||
<div class="swipe-wrap">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
|
||||
<div class="pswp__share-tooltip"></div>
|
||||
</div>
|
||||
<span class="modal__items">
|
||||
|
||||
<span class="modal__header">
|
||||
<div class="modal__paging" title="Page Info" aria-label="Current Page">
|
||||
</div>
|
||||
<div class="modal__icon modal__toolbar modal__toolbar--close" title="Close" aria-label="Close Button" data-micromodal-close>
|
||||
{{ partial "svgs/etc/close.svg" (dict "width" 25 "height" 25) }}
|
||||
</div>
|
||||
<div class="modal__icon modal__toolbar modal__toolbar--full" title="Full Screen" aria-label="Full Screen Button">
|
||||
{{ partial "svgs/etc/full-screen.svg" (dict "width" 25 "height" 25) }}
|
||||
</div>
|
||||
<div class="modal__icon modal__toolbar modal__toolbar--normal" title="Normal Screen" aria-label="Normal Screen Button">
|
||||
{{ partial "svgs/etc/normal-screen.svg" (dict "width" 25 "height" 25) }}
|
||||
</div>
|
||||
</span>
|
||||
|
||||
<div class="modal__icon modal__arrow modal__arrow--left" title="Arrow Left" aria-label="Arrow Left Button">
|
||||
{{ partial "svgs/arrow/arrow-left.svg" (dict "width" 28 "height" 28) }}
|
||||
</div>
|
||||
|
||||
<div class="modal__icon modal__arrow modal__arrow--right" title="Arrow Right" aria-label="Arrow Right Button">
|
||||
|
||||
<button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
|
||||
</button>
|
||||
{{ partial "svgs/arrow/arrow-right.svg" (dict "width" 28 "height" 28) }}
|
||||
</div>
|
||||
|
||||
<button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
|
||||
</button>
|
||||
|
||||
<div class="pswp__caption">
|
||||
<div class="pswp__caption__center"></div>
|
||||
</div>
|
||||
<div class="modal__caption">
|
||||
<div class="modal__caption--text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{{ end }}
|
||||
{{ $swipe := resources.Get "js/swipe.js" | resources.Minify | resources.Fingerprint }}
|
||||
<script defer src="{{ $swipe.RelPermalink }}"></script>
|
||||
{{ $micromodal := resources.Get "js/micromodal.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $micromodal.RelPermalink }}"></script>
|
||||
{{ $fadeinout := resources.Get "js/helper/fadeinout.js" | resources.Minify }}
|
||||
<script defer src="{{ $fadeinout.RelPermalink }}"></script>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
// ============================ gallery ============================
|
||||
/* Get the documentElement (<html>) to display the page in fullscreen */
|
||||
var docElem = document.documentElement;
|
||||
|
||||
/* View in fullscreen */
|
||||
function openFullscreen() {
|
||||
if (docElem.requestFullscreen) {
|
||||
docElem.requestFullscreen();
|
||||
} else if (docElem.mozRequestFullScreen) { /* Firefox */
|
||||
docElem.mozRequestFullScreen();
|
||||
} else if (docElem.webkitRequestFullscreen) { /* Chrome, Safari and Opera */
|
||||
docElem.webkitRequestFullscreen();
|
||||
} else if (docElem.msRequestFullscreen) { /* IE/Edge */
|
||||
docElem.msRequestFullscreen();
|
||||
}
|
||||
}
|
||||
|
||||
/* Close fullscreen */
|
||||
function closeFullscreen() {
|
||||
if (document.fullscreenElement ||
|
||||
document.webkitFullscreenElement ||
|
||||
document.mozFullScreenElement) {
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen();
|
||||
} else if (document.mozCancelFullScreen) { /* Firefox */
|
||||
document.mozCancelFullScreen();
|
||||
} else if (document.webkitExitFullscreen) { /* Chrome, Safari and Opera */
|
||||
document.webkitExitFullscreen();
|
||||
} else if (document.msExitFullscreen) { /* IE/Edge */
|
||||
document.msExitFullscreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var singleContentsElem = document.querySelector('.single__contents');
|
||||
var swipeWrapElem = document.querySelector('.swipe-wrap');
|
||||
var mySwipeElem = document.getElementById('mySwipe');
|
||||
var arrowLeftElem = document.querySelector('.modal__arrow--left');
|
||||
var arrowRightElem = document.querySelector('.modal__arrow--right');
|
||||
var closeElem = document.querySelector('.modal__toolbar--close');
|
||||
var fullElem = document.querySelector('.modal__toolbar--full');
|
||||
var normalElem = document.querySelector('.modal__toolbar--normal');
|
||||
var captionElem = document.querySelector('.modal__caption');
|
||||
var pagingElem = document.querySelector('.modal__paging');
|
||||
var itemsElem = document.querySelector('.modal__items');
|
||||
var imgTotalNum = singleContentsElem.querySelectorAll('img').length;
|
||||
var myFadeTimeout = null;
|
||||
var mySwipe = null;
|
||||
var keydownFunction = function (e) {
|
||||
if (e.key === 'ArrowRight') {
|
||||
mySwipe.next();
|
||||
} else if (e.key === 'ArrowLeft') {
|
||||
mySwipe.prev();
|
||||
}
|
||||
}
|
||||
|
||||
MicroModal.init({
|
||||
onClose: () => {
|
||||
if (mySwipe) {
|
||||
mySwipe.kill();
|
||||
mySwipe = null;
|
||||
closeFullscreen();
|
||||
}
|
||||
window.removeEventListener('keydown', keydownFunction);
|
||||
},
|
||||
disableScroll: true,
|
||||
disableFocus: true,
|
||||
awaitOpenAnimation: false,
|
||||
awaitCloseAnimation: false,
|
||||
debugMode: false,
|
||||
});
|
||||
|
||||
singleContentsElem.querySelectorAll('img').forEach(function (elem, idx) {
|
||||
elem.style.cursor = 'pointer';
|
||||
|
||||
var clonedElem = elem.cloneNode(true);
|
||||
clonedElem.style.maxHeight = '100vh';
|
||||
clonedElem.onclick = function (e) {
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
var wrapper = document.createElement('div');
|
||||
wrapper.style.width = '100%';
|
||||
wrapper.style.height = '100vh';
|
||||
wrapper.setAttribute('data-micromodal-close', '');
|
||||
wrapper.onclick = function () {
|
||||
if (mySwipe) {
|
||||
mySwipe.kill();
|
||||
mySwipe = null;
|
||||
}
|
||||
}
|
||||
wrapper.onmouseenter = function () {
|
||||
clearTimeout(myFadeTimeout);
|
||||
fadeIn(itemsElem, 200);
|
||||
};
|
||||
wrapper.onmouseleave = function () {
|
||||
myFadeTimeout = setTimeout(function () {
|
||||
fadeOut(itemsElem, 200);
|
||||
}, 1000);
|
||||
}
|
||||
wrapper.append(clonedElem);
|
||||
swipeWrapElem.append(wrapper);
|
||||
|
||||
elem.addEventListener('click', function (e) {
|
||||
MicroModal.show('modal');
|
||||
if (mySwipe) {
|
||||
mySwipe.kill();
|
||||
mySwipe = null;
|
||||
}
|
||||
|
||||
// swipe initialize
|
||||
mySwipe = new Swipe(mySwipeElem, {
|
||||
startSlide: idx,
|
||||
draggable: true,
|
||||
autoRestart: false,
|
||||
continuous: false,
|
||||
disableScroll: true,
|
||||
stopPropagation: true,
|
||||
callback: function (index, element) {
|
||||
// caption
|
||||
var imgElem = element.querySelector('img');
|
||||
if (captionElem && imgElem) {
|
||||
var caption = null;
|
||||
if (imgElem.getAttribute('data-caption')) {
|
||||
caption = imgElem.getAttribute('data-caption');
|
||||
} else if (imgElem.getAttribute('title')) {
|
||||
caption = imgElem.getAttribute('title');
|
||||
} else if (imgElem.getAttribute('alt')) {
|
||||
caption = imgElem.getAttribute('alt');
|
||||
} else {
|
||||
caption = imgElem.getAttribute('src');
|
||||
}
|
||||
|
||||
captionElem.querySelector('.modal__caption--text').innerText = caption;
|
||||
pagingElem.innerText = (index + 1) + ' / ' + imgTotalNum;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
fadeIn(itemsElem);
|
||||
|
||||
// caption
|
||||
if (captionElem) {
|
||||
var caption = null;
|
||||
if (e.target.getAttribute('data-caption')) {
|
||||
caption = e.target.getAttribute('data-caption');
|
||||
} else if (e.target.getAttribute('title')) {
|
||||
caption = e.target.getAttribute('title');
|
||||
} else if (e.target.getAttribute('alt')) {
|
||||
caption = e.target.getAttribute('alt');
|
||||
} else {
|
||||
caption = e.target.getAttribute('src');
|
||||
}
|
||||
|
||||
captionElem.querySelector('.modal__caption--text').innerText = caption;
|
||||
pagingElem.innerText = (idx + 1) + ' / ' + imgTotalNum;
|
||||
}
|
||||
|
||||
if (normalElem && fullElem) {
|
||||
normalElem.style.zIndex = -1;
|
||||
normalElem.style.opacity = 0;
|
||||
fullElem.style.zIndex = 25;
|
||||
fullElem.style.opacity = 1;
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener('keydown', keydownFunction);
|
||||
});
|
||||
|
||||
arrowLeftElem ?
|
||||
arrowLeftElem.addEventListener('click', function () {
|
||||
if (mySwipe) {
|
||||
mySwipe.prev();
|
||||
}
|
||||
}) : null;
|
||||
arrowRightElem ?
|
||||
arrowRightElem.addEventListener('click', function () {
|
||||
if (mySwipe) {
|
||||
mySwipe.next();
|
||||
}
|
||||
}) : null;
|
||||
|
||||
closeElem ?
|
||||
closeElem.addEventListener('click', function () {
|
||||
if (mySwipe) {
|
||||
mySwipe.kill();
|
||||
mySwipe = null;
|
||||
}
|
||||
closeFullscreen();
|
||||
MicroModal.close('modal');
|
||||
}) : null;
|
||||
|
||||
fullElem ?
|
||||
fullElem.addEventListener('click', function (e) {
|
||||
openFullscreen();
|
||||
if (normalElem) {
|
||||
normalElem.style.zIndex = 25;
|
||||
normalElem.style.opacity = 1;
|
||||
fullElem.style.zIndex = -1;
|
||||
fullElem.style.opacity = 0;
|
||||
}
|
||||
}) : null;
|
||||
|
||||
normalElem ?
|
||||
normalElem.addEventListener('click', function (e) {
|
||||
closeFullscreen();
|
||||
if (fullElem) {
|
||||
fullElem.style.zIndex = 25;
|
||||
fullElem.style.opacity = 1;
|
||||
normalElem.style.zIndex = -1;
|
||||
normalElem.style.opacity = 0;
|
||||
}
|
||||
}) : null;
|
||||
// =================================================================
|
||||
});
|
||||
</script>
|
|
@ -4,19 +4,19 @@
|
|||
<section class="whoami">
|
||||
<div class="whoami__image-wrapper">
|
||||
{{ $src := "" }}
|
||||
{{ if site.Params.useGravatar }}
|
||||
{{ if site.Params.useGravatar }}
|
||||
{{ $src = printf "https://s.gravatar.com/avatar/%s?s=200" (md5 .Site.Params.email) }}
|
||||
<img src="{{ $src }}" alt="{{ if .Site.Params.myname }}{{ .Site.Params.myname }}{{ else }}Avatar{{ end }}" class="whoami__image"/>
|
||||
{{ else }}
|
||||
{{ if (fileExists "static/images/whoami/avatar.png") }}
|
||||
{{ if .Params.authorImage }}
|
||||
<img data-src="{{ .Params.authorImage | relURL }}" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='24pt' height='24pt' viewBox='0 0 24 24' version='1.1'%3E%3Cg id='surface1035795'%3E%3Cpath style=' stroke:none;fill-rule:nonzero;fill:rgb(80%25,80%25,80%25);fill-opacity:1;' d='M 4 4 C 2.90625 4 2 4.90625 2 6 L 2 18 C 2 19.09375 2.90625 20 4 20 L 20 20 C 21.09375 20 22 19.09375 22 18 L 22 6 C 22 4.90625 21.09375 4 20 4 Z M 4 6 L 20 6 L 20 18 L 4 18 Z M 4 6 '/%3E%3C/g%3E%3C/svg%3E%0A" alt="{{ if .Site.Params.myname }}{{ .Site.Params.myname }}{{ else }}Avatar{{ end }}" class="lazyload whoami__image"/>
|
||||
{{ else if (fileExists "static/images/whoami/avatar.png") }}
|
||||
<img data-src="{{ "images/whoami/avatar.png" | relURL }}" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='24pt' height='24pt' viewBox='0 0 24 24' version='1.1'%3E%3Cg id='surface1035795'%3E%3Cpath style=' stroke:none;fill-rule:nonzero;fill:rgb(80%25,80%25,80%25);fill-opacity:1;' d='M 4 4 C 2.90625 4 2 4.90625 2 6 L 2 18 C 2 19.09375 2.90625 20 4 20 L 20 20 C 21.09375 20 22 19.09375 22 18 L 22 6 C 22 4.90625 21.09375 4 20 4 Z M 4 6 L 20 6 L 20 18 L 4 18 Z M 4 6 '/%3E%3C/g%3E%3C/svg%3E%0A" alt="{{ if .Site.Params.myname }}{{ .Site.Params.myname }}{{ else }}Avatar{{ end }}" class="lazyload whoami__image"/>
|
||||
{{ else if (fileExists "static/images/whoami/avatar.jpg") }}
|
||||
<img data-src="{{ "images/whoami/avatar.jpg" | relURL }}" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='24pt' height='24pt' viewBox='0 0 24 24' version='1.1'%3E%3Cg id='surface1035795'%3E%3Cpath style=' stroke:none;fill-rule:nonzero;fill:rgb(80%25,80%25,80%25);fill-opacity:1;' d='M 4 4 C 2.90625 4 2 4.90625 2 6 L 2 18 C 2 19.09375 2.90625 20 4 20 L 20 20 C 21.09375 20 22 19.09375 22 18 L 22 6 C 22 4.90625 21.09375 4 20 4 Z M 4 6 L 20 6 L 20 18 L 4 18 Z M 4 6 '/%3E%3C/g%3E%3C/svg%3E%0A" alt="{{ if .Site.Params.myname }}{{ .Site.Params.myname }}{{ else }}Avatar{{ end }}" class="lazyload whoami__image"/>
|
||||
{{ else if (fileExists "static/images/whoami/avatar.svg") }}
|
||||
<img data-src="{{ "images/whoami/avatar.svg" | relURL }}" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='24pt' height='24pt' viewBox='0 0 24 24' version='1.1'%3E%3Cg id='surface1035795'%3E%3Cpath style=' stroke:none;fill-rule:nonzero;fill:rgb(80%25,80%25,80%25);fill-opacity:1;' d='M 4 4 C 2.90625 4 2 4.90625 2 6 L 2 18 C 2 19.09375 2.90625 20 4 20 L 20 20 C 21.09375 20 22 19.09375 22 18 L 22 6 C 22 4.90625 21.09375 4 20 4 Z M 4 6 L 20 6 L 20 18 L 4 18 Z M 4 6 '/%3E%3C/g%3E%3C/svg%3E%0A" alt="{{ if .Site.Params.myname }}{{ .Site.Params.myname }}{{ else }}Avatar{{ end }}" class="lazyload whoami__image"/>
|
||||
{{ else }}
|
||||
<img data-src="{{ "images/whoami/avatar.jpg" | relURL }}" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='24pt' height='24pt' viewBox='0 0 24 24' version='1.1'%3E%3Cg id='surface1035795'%3E%3Cpath style=' stroke:none;fill-rule:nonzero;fill:rgb(80%25,80%25,80%25);fill-opacity:1;' d='M 4 4 C 2.90625 4 2 4.90625 2 6 L 2 18 C 2 19.09375 2.90625 20 4 20 L 20 20 C 21.09375 20 22 19.09375 22 18 L 22 6 C 22 4.90625 21.09375 4 20 4 Z M 4 6 L 20 6 L 20 18 L 4 18 Z M 4 6 '/%3E%3C/g%3E%3C/svg%3E%0A" alt="{{ if .Site.Params.myname }}{{ .Site.Params.myname }}{{ else }}Avatar{{ end }}" class="lazyload whoami__image"/>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="whoami__contents">
|
||||
|
@ -24,10 +24,18 @@
|
|||
{{ T "single-writtenBy" }}
|
||||
</div>
|
||||
<div class="whoami__title">
|
||||
{{ .Site.Params.myname }}
|
||||
{{ if .Params.Author }}
|
||||
{{ .Params.Author }}
|
||||
{{ else }}
|
||||
{{ .Site.Params.myname }}
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="whoami__desc">
|
||||
{{ .Site.Params.whoami }}
|
||||
{{ if .Params.AuthorDesc }}
|
||||
{{ .Params.AuthorDesc }}
|
||||
{{ else }}
|
||||
{{ .Site.Params.whoami }}
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="whoami__social">
|
||||
{{ range $name, $path := $.Param "socialOptions" }}
|
||||
|
|
|
@ -20,10 +20,4 @@
|
|||
<link rel="shortcut icon" href="{{ "favicon.png" | relURL }}" type="image/x-icon">
|
||||
<link rel="shortcut icon" href="{{ "favicon.ico" | relURL }}" type="image/x-icon">
|
||||
<link rel="icon" href="{{ "logo.svg" | relURL }}" sizes="any" type="image/svg+xml" />
|
||||
<link rel="manifest" href="{{ "manifest.json" | relURL }}">
|
||||
|
||||
{{ if $.Param "realfavicongenerator" -}}
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{{ "favicon-32x32.png" | relURL }}">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{{ "favicon-16x16.png" | relURL }}">
|
||||
<link rel="mask-icon" href="{{ "safari-pinned-tab.svg" | relURL }}" color="{{ $.Param "safaripinnedcolor" | default "#000000" }}">
|
||||
{{ end -}}
|
||||
<link rel="manifest" href="{{ "manifest.json" | relURL }}">
|
|
@ -10,16 +10,311 @@
|
|||
|
||||
{{ $fuse := resources.Get "js/fuse.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $fuse.RelPermalink }}"></script>
|
||||
{{ $getParents := resources.Get "js/helper/getParents.js" | resources.Minify | resources.Fingerprint }}
|
||||
<script defer src="{{ $getParents.RelPermalink }}"></script>
|
||||
{{ $fadeinout := resources.Get "js/helper/fadeinout.js" | resources.Minify | resources.Fingerprint }}
|
||||
<script defer src="{{ $fadeinout.RelPermalink }}"></script>
|
||||
|
||||
<script>
|
||||
// search
|
||||
var baseurl = null;
|
||||
{{ $siteBaseURL := .Site.BaseURL }}
|
||||
var siteBaseURL = JSON.parse({{ $siteBaseURL | jsonify }});
|
||||
var siteBaseChecker = /\/\w+\//i;
|
||||
var isSlug = siteBaseChecker.test(siteBaseURL);
|
||||
|
||||
var runSearch = function() {
|
||||
"use strict";
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
// ========================= go to top =========================
|
||||
var gttBtn = document.getElementById("gtt");
|
||||
gttBtn.style.display = "none";
|
||||
gttBtn.addEventListener('click', function () {
|
||||
scrollToTop(250);
|
||||
});
|
||||
|
||||
function scrollToTop(scrollDuration) {
|
||||
var scrollStep = -window.scrollY / (scrollDuration / 15);
|
||||
var scrollInterval = setInterval(function () {
|
||||
if (window.scrollY != 0) {
|
||||
window.scrollBy(0, scrollStep);
|
||||
}
|
||||
else clearInterval(scrollInterval);
|
||||
}, 15);
|
||||
}
|
||||
|
||||
var scrollFunction = function () {
|
||||
if (document.body.scrollTop > 250 || document.documentElement.scrollTop > 250) {
|
||||
gttBtn.style.display = "block";
|
||||
} else {
|
||||
gttBtn.style.display = "none";
|
||||
}
|
||||
}
|
||||
// ============================================================
|
||||
|
||||
|
||||
// ========================== scroll ==========================
|
||||
var lastScrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
||||
var tableOfContentsElem = document.getElementById('TableOfContents');
|
||||
var tocElem = document.querySelector('.toc');
|
||||
var toggleTocElem = document.getElementById('toggle-toc');
|
||||
var singleContentsElem = document.querySelector('.single__contents');
|
||||
var navbar = document.querySelector('.navbar');
|
||||
|
||||
window.onscroll = function () {
|
||||
scrollFunction();
|
||||
|
||||
var st = window.pageYOffset || document.documentElement.scrollTop;
|
||||
if (st > lastScrollTop) { // scroll down
|
||||
if (st < 250) {
|
||||
gttBtn.style.display = "none";
|
||||
} else {
|
||||
gttBtn.style.display = "block";
|
||||
}
|
||||
|
||||
if (st < 45) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!navbar.classList.contains('navbar--hide')) {
|
||||
navbar.classList.add('navbar--hide');
|
||||
} else if (navbar.classList.contains('navbar--show')) {
|
||||
navbar.classList.remove('navbar--show');
|
||||
}
|
||||
|
||||
singleContentsElem ?
|
||||
singleContentsElem.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach(function(elem) {
|
||||
if (toggleTocElem && !toggleTocElem.checked) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (document.documentElement.scrollTop >= elem.offsetTop) {
|
||||
var id = elem.getAttribute('id');
|
||||
tocElem.querySelectorAll('a').forEach(function (elem) {
|
||||
elem.classList.remove('active');
|
||||
});
|
||||
tocElem.querySelector('a[href="#' + id + '"]').classList.add('active');
|
||||
|
||||
document.querySelectorAll('#TableOfContents > ul > li').forEach(function(liElem) {
|
||||
liElem.querySelectorAll('ul').forEach(function(ulElem) {
|
||||
ulElem.style.display = 'none';
|
||||
});
|
||||
});
|
||||
|
||||
var curElem = tableOfContentsElem.querySelector(`[href="#${id}"]`);
|
||||
if (curElem.nextElementSibling) {
|
||||
curElem.nextElementSibling.style.display = 'block';
|
||||
}
|
||||
getParents(curElem, 'ul').forEach(function(elem) {
|
||||
elem.style.display = 'block';
|
||||
});
|
||||
}
|
||||
}) : null;
|
||||
} else { // scroll up
|
||||
if (st < 250) {
|
||||
gttBtn.style.display = "none";
|
||||
}
|
||||
|
||||
if (navbar.classList.contains('navbar--hide')) {
|
||||
navbar.classList.remove('navbar--hide');
|
||||
} else if (!navbar.classList.contains('navbar--show')) {
|
||||
navbar.classList.add('navbar--show');
|
||||
}
|
||||
|
||||
singleContentsElem ?
|
||||
singleContentsElem.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach(function(elem) {
|
||||
if (toggleTocElem && !toggleTocElem.checked) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (document.documentElement.scrollTop >= elem.offsetTop) {
|
||||
var id = elem.getAttribute('id');
|
||||
tocElem.querySelectorAll('a').forEach(function (elem) {
|
||||
elem.classList.remove('active');
|
||||
});
|
||||
tocElem.querySelector('a[href="#' + id + '"]').classList.add('active');
|
||||
|
||||
document.querySelectorAll('#TableOfContents > ul > li').forEach(function (liElem) {
|
||||
liElem.querySelectorAll('ul').forEach(function (ulElem) {
|
||||
ulElem.style.display = 'none';
|
||||
});
|
||||
});
|
||||
|
||||
var curElem = tableOfContentsElem.querySelector(`[href="#${id}"]`);
|
||||
if (curElem.nextElementSibling) {
|
||||
curElem.nextElementSibling.style.display = 'block';
|
||||
}
|
||||
getParents(curElem, 'ul').forEach(function (elem) {
|
||||
elem.style.display = 'block';
|
||||
});
|
||||
}
|
||||
}) : null;
|
||||
|
||||
if (tableOfContentsElem && document.documentElement.scrollTop < 250) {
|
||||
tableOfContentsElem.querySelectorAll('ul > li').forEach(function (liElem) {
|
||||
liElem.querySelectorAll('ul').forEach(function (ulElem) {
|
||||
ulElem.style.display = 'none';
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
lastScrollTop = st <= 0 ? 0 : st;
|
||||
};
|
||||
// ============================================================
|
||||
|
||||
|
||||
// ========================== navbar ==========================
|
||||
var navbarBurgerElem = document.querySelector('.navbar__burger');
|
||||
var navbarMenuElem = document.querySelector('.navbar__menu');
|
||||
navbarBurgerElem ?
|
||||
navbarBurgerElem.addEventListener('click', function () {
|
||||
if (navbarBurgerElem.classList.contains('is-active')) {
|
||||
navbarBurgerElem.classList.remove('is-active');
|
||||
navbarMenuElem.classList.remove('is-active');
|
||||
} else {
|
||||
navbarBurgerElem.classList.add('is-active');
|
||||
navbarMenuElem.classList.add('is-active');
|
||||
}
|
||||
}) : null;
|
||||
// ============================================================
|
||||
|
||||
|
||||
// ====================== mobile search =======================
|
||||
var mobileSearchInputElem = document.querySelector('#search-mobile');
|
||||
var mobileSearchClassElem = document.querySelector('.mobile-search');
|
||||
var mobileSearchBtnElem = document.querySelector('#mobileSearchBtn');
|
||||
var mobileSearchCloseBtnElem = document.querySelector('#search-mobile-close');
|
||||
var mobileSearchContainer = document.querySelector('#search-mobile-container');
|
||||
var mobileSearchResultsElem = document.querySelector('#search-mobile-results');
|
||||
var htmlElem = document.querySelector('html');
|
||||
|
||||
if (mobileSearchClassElem) {
|
||||
mobileSearchClassElem.style.display = 'none';
|
||||
}
|
||||
|
||||
mobileSearchBtnElem ?
|
||||
mobileSearchBtnElem.addEventListener('click', function () {
|
||||
if (mobileSearchContainer) {
|
||||
mobileSearchContainer.style.display = 'block';
|
||||
}
|
||||
|
||||
if (mobileSearchInputElem) {
|
||||
mobileSearchInputElem.focus();
|
||||
}
|
||||
|
||||
if (htmlElem) {
|
||||
htmlElem.style.overflowY = 'hidden';
|
||||
}
|
||||
}) : null;
|
||||
|
||||
mobileSearchCloseBtnElem ?
|
||||
mobileSearchCloseBtnElem.addEventListener('click', function() {
|
||||
if (mobileSearchContainer) {
|
||||
mobileSearchContainer.style.display = 'none';
|
||||
}
|
||||
|
||||
if (mobileSearchInputElem) {
|
||||
mobileSearchInputElem.value = '';
|
||||
}
|
||||
|
||||
if (mobileSearchResultsElem) {
|
||||
while (mobileSearchResultsElem.firstChild) {
|
||||
mobileSearchResultsElem.removeChild(mobileSearchResultsElem.firstChild);
|
||||
}
|
||||
}
|
||||
|
||||
if (htmlElem) {
|
||||
htmlElem.style.overflowY = 'visible';
|
||||
}
|
||||
}) : null;
|
||||
|
||||
mobileSearchInputElem ?
|
||||
mobileSearchInputElem.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Escape') {
|
||||
if (mobileSearchContainer) {
|
||||
mobileSearchContainer.style.display = 'none';
|
||||
}
|
||||
|
||||
if (mobileSearchInputElem) {
|
||||
mobileSearchInputElem.value = '';
|
||||
}
|
||||
|
||||
if (mobileSearchResultsElem) {
|
||||
while (mobileSearchResultsElem.firstChild) {
|
||||
mobileSearchResultsElem.removeChild(mobileSearchResultsElem.firstChild);
|
||||
}
|
||||
}
|
||||
if (htmlElem) {
|
||||
htmlElem.style.overflowY = 'visible';
|
||||
}
|
||||
}
|
||||
}) : null;
|
||||
// ============================================================
|
||||
|
||||
|
||||
// ======================= theme change =======================
|
||||
var localTheme = localStorage.getItem('theme');
|
||||
var rootEleme = document.getElementById('root');
|
||||
var selectThemeElem = document.querySelectorAll('.select-theme');
|
||||
var selectThemeItemElem = document.querySelectorAll('.select-theme__item');
|
||||
|
||||
if (localTheme) {
|
||||
selectThemeItemElem ?
|
||||
selectThemeItemElem.forEach(function (elem) {
|
||||
if (elem.text.trim() === localTheme) {
|
||||
elem.classList.add('is-active');
|
||||
} else {
|
||||
elem.classList.remove('is-active');
|
||||
}
|
||||
}) : null;
|
||||
}
|
||||
|
||||
selectThemeItemElem ?
|
||||
selectThemeItemElem.forEach(function (v, i) {
|
||||
v.addEventListener('click', function (e) {
|
||||
var selectedThemeVariant = e.target.text.trim();
|
||||
localStorage.setItem('theme', selectedThemeVariant);
|
||||
|
||||
rootEleme.removeAttribute('class');
|
||||
rootEleme.classList.add(`theme__${selectedThemeVariant}`);
|
||||
selectThemeElem.forEach(function(rootElem) {
|
||||
rootElem.querySelectorAll('a').forEach(function (elem) {
|
||||
if (elem.classList) {
|
||||
if (elem.text.trim() === selectedThemeVariant) {
|
||||
if (!elem.classList.contains('is-active')) {
|
||||
elem.classList.add('is-active');
|
||||
}
|
||||
} else {
|
||||
if (elem.classList.contains('is-active')) {
|
||||
elem.classList.remove('is-active');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (window.mermaid) {
|
||||
if (selectedThemeVariant === "dark" || selectedThemeVariant === "hacker") {
|
||||
mermaid.initialize({ theme: 'dark' });
|
||||
location.reload();
|
||||
} else {
|
||||
mermaid.initialize({ theme: 'default' });
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
var utterances = document.querySelector('iframe');
|
||||
if (utterances) {
|
||||
utterances.contentWindow.postMessage({
|
||||
type: 'set-theme',
|
||||
theme: selectedThemeVariant === "dark" || selectedThemeVariant === "hacker" ? 'photon-dark' : 'github-light',
|
||||
}, 'https://utteranc.es');
|
||||
}
|
||||
});
|
||||
}) : null;
|
||||
// ============================================================
|
||||
|
||||
|
||||
// ========================== search ==========================
|
||||
var baseurl = null;
|
||||
{{ $siteBaseURL:= .Site.BaseURL }}
|
||||
var siteBaseURL = JSON.parse({{ $siteBaseURL | jsonify }});
|
||||
var siteBaseChecker = /\/\w+\//i;
|
||||
var isSlug = siteBaseChecker.test(siteBaseURL);
|
||||
|
||||
{{ if .Site.IsMultiLingual }}
|
||||
var hasLangPostfix = location.pathname.includes("/{{.Site.Language.Lang}}");
|
||||
if (hasLangPostfix) {
|
||||
|
@ -61,14 +356,12 @@
|
|||
baseurl = baseurl + '/';
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: baseurl + "index.json",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
})
|
||||
.done(function (index) {
|
||||
fuse = new Fuse(index, {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', baseurl + "index.json");
|
||||
xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
|
||||
xhr.onload = function () {
|
||||
if (xhr.status === 200) {
|
||||
fuse = new Fuse(JSON.parse(xhr.response.toString('utf-8')), {
|
||||
keys: ['title', 'description', 'content'],
|
||||
includeMatches: enableSearchHighlight,
|
||||
shouldSort: true,
|
||||
|
@ -78,11 +371,12 @@
|
|||
maxPatternLength: 32,
|
||||
minMatchCharLength: 1,
|
||||
});
|
||||
})
|
||||
.fail(function (jqxhr, textStatus, error) {
|
||||
var err = textStatus + ", " + error;
|
||||
console.error("Error getting Hugo index file:", err);
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.error(`[${xhr.status}]Error:`, xhr.statusText);
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function renderSearchResults(results) { // [{}, {}, ...] or [{item: {}, matches: []}, ...]
|
||||
|
@ -165,8 +459,11 @@
|
|||
content.appendChild(item);
|
||||
}
|
||||
|
||||
$('#search-mobile-results').empty();
|
||||
searchResults.appendChild(content);
|
||||
let wrap = document.getElementById('search-mobile-results');
|
||||
while (wrap.firstChild) {
|
||||
wrap.removeChild(wrap.firstChild)
|
||||
}
|
||||
searchResults.appendChild(content);
|
||||
}
|
||||
|
||||
function renderSearchHighlightResultsMobile(results) {
|
||||
|
@ -187,7 +484,10 @@
|
|||
content.appendChild(item);
|
||||
}
|
||||
|
||||
$('#search-mobile-results').empty();
|
||||
let wrap = document.getElementById('search-mobile-results');
|
||||
while (wrap.firstChild) {
|
||||
wrap.removeChild(wrap.firstChild)
|
||||
}
|
||||
searchResults.appendChild(content);
|
||||
}
|
||||
|
||||
|
@ -213,15 +513,18 @@
|
|||
|
||||
initFuse();
|
||||
|
||||
$("#search").on('input', function (e) {
|
||||
var searchElem = document.getElementById('search');
|
||||
var searchMobile = document.getElementById('search-mobile');
|
||||
|
||||
searchElem.addEventListener('input', function(e) {
|
||||
if (!e.target.value) {
|
||||
$('#search-results').attr('class', 'dropdown');
|
||||
document.getElementById('search-results').setAttribute('class', 'dropdown');
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($(window).width() < 770) {
|
||||
if (window.innerWidth < 770) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
searchText = e.target.value;
|
||||
var results = fuse.search(e.target.value);
|
||||
|
@ -232,24 +535,24 @@
|
|||
}
|
||||
});
|
||||
|
||||
$('#search').on('blur', function () {
|
||||
if ($(window).width() < 770) {
|
||||
searchElem.addEventListener('blur', function() {
|
||||
if (window.innerWidth < 770) {
|
||||
return null;
|
||||
}
|
||||
setTimeout(function () {
|
||||
$('#search-results').attr('class', 'dropdown');
|
||||
document.getElementById('search-results').setAttribute('class', 'dropdown');
|
||||
}, 100);
|
||||
});
|
||||
|
||||
$('#search').on('click', function (e) {
|
||||
if ($(window).width() < 770) {
|
||||
searchElem.addEventListener('click', function(e) {
|
||||
if (window.innerWidth < 770) {
|
||||
return null;
|
||||
}
|
||||
if (!e.target.value) {
|
||||
$('#search-results').attr('class', 'dropdown');
|
||||
document.getElementById('search-results').setAttribute('class', 'dropdown');
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
searchText = e.target.value;
|
||||
var results = fuse.search(e.target.value);
|
||||
if (enableSearchHighlight) {
|
||||
|
@ -258,30 +561,72 @@
|
|||
renderSearchResults(results);
|
||||
}
|
||||
});
|
||||
|
||||
function indexInParent(node) {
|
||||
var children = node.parentNode.childNodes;
|
||||
var num = 0;
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
if (children[i] == node) return num;
|
||||
if (children[i].nodeType == 1) num++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
$('#search').on('keydown', function (e) {
|
||||
if ($(window).width() < 770) {
|
||||
var searchMenuElem = document.getElementById("search-menu");
|
||||
var activeItem = document.querySelector('#search-menu .dropdown-item.is-active');
|
||||
var activeIndex = null;
|
||||
var items = null;
|
||||
var searchContainerMaxHeight = 350;
|
||||
|
||||
searchElem.addEventListener('keydown', function(e) {
|
||||
if (window.innerWidth < 770) {
|
||||
return null;
|
||||
}
|
||||
var items = $('#search-menu .dropdown-item');
|
||||
var activeIndex = $('#search-menu .dropdown-item.is-active').index();
|
||||
|
||||
items.removeClass('is-active');
|
||||
var items = document.querySelectorAll('#search-menu .dropdown-item');
|
||||
|
||||
if (e.key === 'ArrowDown') {
|
||||
items.eq(activeIndex + 1).addClass('is-active');
|
||||
if (activeIndex === null) {
|
||||
activeIndex = 0;
|
||||
items[activeIndex].classList.remove('is-active');
|
||||
} else {
|
||||
items[activeIndex].classList.remove('is-active');
|
||||
activeIndex = activeIndex === items.length - 1 ? 0 : activeIndex + 1;
|
||||
}
|
||||
items[activeIndex].classList.add('is-active');
|
||||
|
||||
let overflowedPixel = items[activeIndex].offsetTop + items[activeIndex].clientHeight - searchContainerMaxHeight;
|
||||
if (overflowedPixel > 0) {
|
||||
document.querySelector(".search-content").scrollTop = overflowedPixel;
|
||||
} else if (activeIndex === 0) {
|
||||
document.querySelector(".search-content").scrollTop = 0;
|
||||
}
|
||||
} else if (e.key === 'ArrowUp') {
|
||||
items.eq(activeIndex - 1).addClass('is-active');
|
||||
if (activeIndex === null) {
|
||||
activeIndex = items.length - 1;
|
||||
items[activeIndex].classList.remove('is-active');
|
||||
} else {
|
||||
items[activeIndex].classList.remove('is-active');
|
||||
activeIndex = activeIndex === 0 ? items.length - 1 : activeIndex - 1;
|
||||
}
|
||||
items[activeIndex].classList.add('is-active');
|
||||
|
||||
let overflowedPixel = items[activeIndex].offsetTop + items[activeIndex].clientHeight - searchContainerMaxHeight;
|
||||
document.querySelector(".search-content").scrollTop = items[activeIndex].offsetTop;
|
||||
} else if (e.key === 'Enter') {
|
||||
var currentItemLink = items.eq(activeIndex).attr('href');
|
||||
var currentItemLink = items[activeIndex].getAttribute('href');
|
||||
if (currentItemLink) {
|
||||
location.href = currentItemLink;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("#search-mobile").on('input', function(e) {
|
||||
searchMobile.addEventListener('input', function(e) {
|
||||
if (!e.target.value) {
|
||||
$('#search-mobile-results').empty();
|
||||
let wrap = document.getElementById('search-mobile-results');
|
||||
while (wrap.firstChild) {
|
||||
wrap.removeChild(wrap.firstChild);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -294,5 +639,6 @@
|
|||
renderSearchResultsMobile(results);
|
||||
}
|
||||
});
|
||||
}
|
||||
// ============================================================
|
||||
});
|
||||
</script>
|
|
@ -1,7 +1,7 @@
|
|||
{{ if $.Param "enableThemeChange" }}
|
||||
<div class="theme-mobile">
|
||||
<div class="dropdown">
|
||||
<button class="dropdown-trigger navbar__slide-down" aria-label="Invert Colors" style="{{ if .Site.Params.enableSearch }}{{ else }}position: absolute; top: 0;{{ end }}">
|
||||
<button class="dropdown-trigger navbar__slide-down" aria-label="Select Theme Button" style="{{ if .Site.Params.enableSearch }}{{ else }}position: absolute; top: 0;{{ end }}">
|
||||
{{ partial "svgs/etc/invert-colors.svg" (dict "width" 22 "height" 22) }}
|
||||
</button>
|
||||
<div class="dropdown-content select-theme">
|
||||
|
|
|
@ -1,14 +1,4 @@
|
|||
{{ $jquery := resources.Get "js/jquery.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $jquery.RelPermalink }}"></script>
|
||||
{{ $enquire := resources.Get "js/enquire.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $enquire.RelPermalink }}"></script>
|
||||
{{ $lazysizes := resources.Get "js/lazysizes.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $lazysizes.RelPermalink }}"></script>
|
||||
{{ $zzo := resources.Get "js/zzo.js" | resources.Minify | resources.Fingerprint }}
|
||||
<script defer src="{{ $zzo.RelPermalink }}"></script>
|
||||
|
||||
<script>
|
||||
window.onload = function() {
|
||||
runSearch();
|
||||
}
|
||||
</script>
|
|
@ -1,14 +1,4 @@
|
|||
{{ $jquery := resources.Get "js/jquery.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $jquery.RelPermalink }}"></script>
|
||||
{{ $enquire := resources.Get "js/enquire.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $enquire.RelPermalink }}"></script>
|
||||
{{ $lazysizes := resources.Get "js/lazysizes.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $lazysizes.RelPermalink }}"></script>
|
||||
{{ $zzo := resources.Get "js/zzo.js" | resources.Minify | resources.Fingerprint }}
|
||||
<script defer src="{{ $zzo.RelPermalink }}"></script>
|
||||
|
||||
<script>
|
||||
window.onload = function () {
|
||||
runSearch();
|
||||
}
|
||||
</script>
|
|
@ -1,14 +1,4 @@
|
|||
{{ $jquery := resources.Get "js/jquery.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $jquery.RelPermalink }}"></script>
|
||||
{{ $enquire := resources.Get "js/enquire.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $enquire.RelPermalink }}"></script>
|
||||
{{ $lazysizes := resources.Get "js/lazysizes.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $lazysizes.RelPermalink }}"></script>
|
||||
{{ $zzo := resources.Get "js/zzo.js" | resources.Minify | resources.Fingerprint }}
|
||||
<script defer src="{{ $zzo.RelPermalink }}"></script>
|
||||
|
||||
<script>
|
||||
window.onload = function () {
|
||||
runSearch();
|
||||
}
|
||||
</script>
|
|
@ -1,153 +1,122 @@
|
|||
{{ $jquery := resources.Get "js/jquery.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $jquery.RelPermalink }}"></script>
|
||||
{{ $enquire := resources.Get "js/enquire.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $enquire.RelPermalink }}"></script>
|
||||
{{ $masonry := resources.Get "js/masonry.pkgd.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $masonry.RelPermalink }}"></script>
|
||||
{{ $imagesloaded := resources.Get "js/imagesloaded.pkgd.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $imagesloaded.RelPermalink }}"></script>
|
||||
{{ $zzo := resources.Get "js/zzo.js" | resources.Minify | resources.Fingerprint }}
|
||||
<script defer src="{{ $zzo.RelPermalink }}"></script>
|
||||
{{ $lazysizes := resources.Get "js/lazysizes.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $lazysizes.RelPermalink }}"></script>
|
||||
{{ $photoSwipe := resources.Get "lib/photoswipe/photoswipe.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $photoSwipe.RelPermalink }}"></script>
|
||||
{{ $photoSwipeUi := resources.Get "lib/photoswipe/photoswipe-ui-default.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $photoSwipeUi.RelPermalink }}"></script>
|
||||
{{ $photoSwipeStyle := resources.Get "lib/photoswipe/photoswipe.css" | resources.Minify }}
|
||||
<link rel="stylesheet" href="{{ $photoSwipeStyle.RelPermalink }}">
|
||||
{{ $photoSwipeSkin := resources.Get "lib/photoswipe/custom-skin.css" | resources.Minify }}
|
||||
<link rel="stylesheet" href="{{ $photoSwipeSkin.RelPermalink }}">
|
||||
|
||||
<script>
|
||||
window.onload = function() {
|
||||
// search
|
||||
runSearch();
|
||||
|
||||
// masonry
|
||||
var $grid = $('.grid').masonry({
|
||||
// ========================= masonry =========================
|
||||
var grid = document.querySelector('.grid');
|
||||
var msnry = new Masonry(grid, {
|
||||
itemSelector: '.grid-item',
|
||||
columnWidth: '.grid-sizer',
|
||||
percentPosition: true,
|
||||
});
|
||||
$grid.imagesLoaded().progress(function () {
|
||||
$grid.masonry();
|
||||
imagesLoaded(grid).on('progress', function () {
|
||||
msnry.layout();
|
||||
});
|
||||
|
||||
$('.grid-item').mouseenter(function () {
|
||||
$(this).children('.grid-item__desc').show();
|
||||
});
|
||||
|
||||
$('.grid-item').mouseleave(function () {
|
||||
$(this).children('.grid-item__desc').hide();
|
||||
document.querySelectorAll('.grid-item').forEach(function(elem) {
|
||||
elem.addEventListener('mouseenter', function() {
|
||||
elem.querySelector('.grid-item__desc').style.display = 'block';
|
||||
elem.querySelector('.grid-item__desc').onclick = function(e) {
|
||||
e.target.previousElementSibling.click();
|
||||
}
|
||||
});
|
||||
elem.addEventListener('mouseleave', function () {
|
||||
elem.querySelector('.grid-item__desc').style.display = 'none';
|
||||
});
|
||||
});
|
||||
|
||||
enquire.register("screen and (max-width:1200px)", {
|
||||
match: function () {
|
||||
$('.grid-item').addClass('quarter');
|
||||
$('.grid-sizer').addClass('quarter');
|
||||
$('.grid-item').removeClass('fifth');
|
||||
$('.grid-sizer').removeClass('fifth');
|
||||
document.querySelectorAll('.grid-item').forEach(function(elem) {
|
||||
elem.classList.add('quarter');
|
||||
elem.classList.remove('fifth');
|
||||
});
|
||||
document.querySelectorAll('.grid-sizer').forEach(function (elem) {
|
||||
elem.classList.add('quarter');
|
||||
elem.classList.remove('fifth');
|
||||
});
|
||||
},
|
||||
unmatch: function () {
|
||||
$('.grid-item').addClass('fifth');
|
||||
$('.grid-sizer').addClass('fifth');
|
||||
$('.grid-item').removeClass('quarter');
|
||||
$('.grid-sizer').removeClass('quarter');
|
||||
document.querySelectorAll('.grid-item').forEach(function (elem) {
|
||||
elem.classList.add('fifth');
|
||||
elem.classList.remove('quarter');
|
||||
});
|
||||
document.querySelectorAll('.grid-sizer').forEach(function (elem) {
|
||||
elem.classList.add('fifth');
|
||||
elem.classList.remove('quarter');
|
||||
});
|
||||
},
|
||||
}).register("screen and (max-width:900px)", {
|
||||
match: function () {
|
||||
$('.grid-item').addClass('third');
|
||||
$('.grid-sizer').addClass('third');
|
||||
$('.grid-item').removeClass('quarter');
|
||||
$('.grid-sizer').removeClass('quarter');
|
||||
document.querySelectorAll('.grid-item').forEach(function (elem) {
|
||||
elem.classList.add('third');
|
||||
elem.classList.remove('quarter');
|
||||
});
|
||||
document.querySelectorAll('.grid-sizer').forEach(function (elem) {
|
||||
elem.classList.add('third');
|
||||
elem.classList.remove('quarter');
|
||||
});
|
||||
},
|
||||
unmatch: function () {
|
||||
$('.grid-item').addClass('quarter');
|
||||
$('.grid-sizer').addClass('quarter');
|
||||
$('.grid-item').removeClass('third');
|
||||
$('.grid-sizer').removeClass('third');
|
||||
document.querySelectorAll('.grid-item').forEach(function (elem) {
|
||||
elem.classList.add('quarter');
|
||||
elem.classList.remove('third');
|
||||
});
|
||||
document.querySelectorAll('.grid-sizer').forEach(function (elem) {
|
||||
elem.classList.add('quarter');
|
||||
elem.classList.remove('third');
|
||||
});
|
||||
},
|
||||
}).register("screen and (max-width:700px)", {
|
||||
match: function () {
|
||||
$('.grid-item').addClass('half');
|
||||
$('.grid-sizer').addClass('half');
|
||||
$('.grid-item').removeClass('third');
|
||||
$('.grid-sizer').removeClass('third');
|
||||
document.querySelectorAll('.grid-item').forEach(function (elem) {
|
||||
elem.classList.add('half');
|
||||
elem.classList.remove('third');
|
||||
});
|
||||
document.querySelectorAll('.grid-sizer').forEach(function (elem) {
|
||||
elem.classList.add('half');
|
||||
elem.classList.remove('third');
|
||||
});
|
||||
},
|
||||
unmatch: function () {
|
||||
$('.grid-item').addClass('third');
|
||||
$('.grid-sizer').addClass('third');
|
||||
$('.grid-item').removeClass('half');
|
||||
$('.grid-sizer').removeClass('half');
|
||||
document.querySelectorAll('.grid-item').forEach(function (elem) {
|
||||
elem.classList.add('third');
|
||||
elem.classList.remove('half');
|
||||
});
|
||||
document.querySelectorAll('.grid-sizer').forEach(function (elem) {
|
||||
elem.classList.add('third');
|
||||
elem.classList.remove('half');
|
||||
});
|
||||
},
|
||||
}).register("screen and (max-width:500px)", {
|
||||
match: function () {
|
||||
$('.grid-item').addClass('full');
|
||||
$('.grid-sizer').addClass('full');
|
||||
$('.grid-item').removeClass('half');
|
||||
$('.grid-sizer').removeClass('half');
|
||||
document.querySelectorAll('.grid-item').forEach(function (elem) {
|
||||
elem.classList.add('full');
|
||||
elem.classList.remove('half');
|
||||
});
|
||||
document.querySelectorAll('.grid-sizer').forEach(function (elem) {
|
||||
elem.classList.add('full');
|
||||
elem.classList.remove('half');
|
||||
});
|
||||
},
|
||||
unmatch: function () {
|
||||
$('.grid-item').addClass('half');
|
||||
$('.grid-sizer').addClass('half');
|
||||
$('.grid-item').removeClass('full');
|
||||
$('.grid-sizer').removeClass('full');
|
||||
document.querySelectorAll('.grid-item').forEach(function (elem) {
|
||||
elem.classList.add('half');
|
||||
elem.classList.remove('full');
|
||||
});
|
||||
document.querySelectorAll('.grid-sizer').forEach(function (elem) {
|
||||
elem.classList.add('half');
|
||||
elem.classList.remove('full');
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
// gallery
|
||||
var pswpElement = $('.pswp')[0];
|
||||
var imgElements = $('.single__contents').find('img');
|
||||
var items = [];
|
||||
|
||||
{{ $mode:= .Params.Mode }}
|
||||
var mode = JSON.parse({{ $mode | jsonify }});
|
||||
|
||||
imgElements.each(function (i, v) {
|
||||
$(this).parent().click(function (e) {
|
||||
initGallery(i);
|
||||
});
|
||||
$(this).css('cursor', 'pointer');
|
||||
|
||||
var caption = null;
|
||||
if (mode && mode.toLowerCase().includes('one')) {
|
||||
caption = $(this).attr('alt');
|
||||
} else {
|
||||
caption = filename(v['src']);
|
||||
}
|
||||
|
||||
items.push({
|
||||
src: v['src'],
|
||||
w: 0,
|
||||
h: 0,
|
||||
title: caption,
|
||||
});
|
||||
});
|
||||
|
||||
function filename(str) {
|
||||
var s = str.replace(/\\/g, '/');
|
||||
s = s.substring(s.lastIndexOf('/') + 1);
|
||||
return str ? s.replace(/[?#].+$/, '') : s.split('.')[0];
|
||||
}
|
||||
|
||||
function initGallery(index) {
|
||||
var options = { index: index };
|
||||
var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
|
||||
gallery.listen('imageLoadComplete', function (index, item) {
|
||||
if (item.h < 1 || item.w < 1) {
|
||||
let img = new Image();
|
||||
img.onload = () => {
|
||||
item.w = img.width;
|
||||
item.h = img.height;
|
||||
gallery.invalidateCurrItems();
|
||||
gallery.updateSize(true);
|
||||
}
|
||||
img.src = item.src;
|
||||
}
|
||||
});
|
||||
|
||||
gallery.init();
|
||||
}
|
||||
// ===========================================================
|
||||
}
|
||||
</script>
|
|
@ -1,21 +1,16 @@
|
|||
{{ $jquery := resources.Get "js/jquery.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $jquery.RelPermalink }}"></script>
|
||||
{{ $lazysizes := resources.Get "js/lazysizes.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $lazysizes.RelPermalink }}"></script>
|
||||
{{ $zzo := resources.Get "js/zzo.js" | resources.Minify | resources.Fingerprint }}
|
||||
<script defer src="{{ $zzo.RelPermalink }}"></script>
|
||||
|
||||
<script>
|
||||
window.onload = function() {
|
||||
// search
|
||||
runSearch();
|
||||
|
||||
// counter
|
||||
{{ $enableBusuanzi := .Site.Params.enableBusuanzi }}
|
||||
var enableBusuanzi = JSON.parse({{ $enableBusuanzi | jsonify }});
|
||||
if (enableBusuanzi) {
|
||||
$('#busuanzi_value_site_uv').digits();
|
||||
$('#busuanzi_value_site_pv').digits();
|
||||
var sitePvElem = document.querySelector('#busuanzi_value_site_pv');
|
||||
var siteUvElem = document.querySelector('#busuanzi_value_site_uv');
|
||||
sitePvElem.textContent = sitePvElem.textContent.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
|
||||
siteUvElem.textContent = siteUvElem.textContent.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -1,15 +1,4 @@
|
|||
{{ $jquery := resources.Get "js/jquery.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $jquery.RelPermalink }}"></script>
|
||||
{{ $enquire := resources.Get "js/enquire.min.js" | resources.Fingerprint }}
|
||||
<script src="{{ $enquire.RelPermalink }}"></script>
|
||||
{{ $lazysizes := resources.Get "js/lazysizes.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $lazysizes.RelPermalink }}"></script>
|
||||
{{ $zzo := resources.Get "js/zzo.js" | resources.Minify | resources.Fingerprint }}
|
||||
<script defer src="{{ $zzo.RelPermalink }}"></script>
|
||||
|
||||
<script>
|
||||
window.onload = function() {
|
||||
// search
|
||||
runSearch();
|
||||
}
|
||||
</script>
|
|
@ -1,40 +1,40 @@
|
|||
{{ $reveal := .Site.Data.lib.reveal }}
|
||||
|
||||
{{ $reveal_style := resources.Get "lib/reveal/reveal.css" | resources.Minify| resources.Fingerprint }}
|
||||
{{ $reveal_style := resources.Get "lib/reveal/reveal.css" | resources.Minify | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $reveal_style.RelPermalink }}">
|
||||
|
||||
{{ if eq .Params.revealTheme "bagie" }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/beige.css" | resources.Minify| resources.Fingerprint }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/beige.css" | resources.Minify | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $theme_style.RelPermalink }}">
|
||||
{{ else if eq .Params.revealTheme "black" }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/black.css" | resources.Minify| resources.Fingerprint }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/black.css" | resources.Minify | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $theme_style.RelPermalink }}">
|
||||
{{ else if eq .Params.revealTheme "blood" }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/blood.css" | resources.Minify| resources.Fingerprint }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/blood.css" | resources.Minify | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $theme_style.RelPermalink }}">
|
||||
{{ else if eq .Params.revealTheme "league" }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/league.css" | resources.Minify| resources.Fingerprint }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/league.css" | resources.Minify | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $theme_style.RelPermalink }}">
|
||||
{{ else if eq .Params.revealTheme "moon" }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/moon.css" | resources.Minify| resources.Fingerprint }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/moon.css" | resources.Minify | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $theme_style.RelPermalink }}">
|
||||
{{ else if eq .Params.revealTheme "night" }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/night.css" | resources.Minify| resources.Fingerprint }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/night.css" | resources.Minify | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $theme_style.RelPermalink }}">
|
||||
{{ else if eq .Params.revealTheme "serif" }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/serif.css" | resources.Minify| resources.Fingerprint }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/serif.css" | resources.Minify | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $theme_style.RelPermalink }}">
|
||||
{{ else if eq .Params.revealTheme "sky" }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/sky.css" | resources.Minify| resources.Fingerprint }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/sky.css" | resources.Minify | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $theme_style.RelPermalink }}">
|
||||
{{ else if eq .Params.revealTheme "solarized" }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/solarized.css" | resources.Minify| resources.Fingerprint }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/solarized.css" | resources.Minify | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $theme_style.RelPermalink }}">
|
||||
{{ else if eq .Params.revealTheme "white" }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/white.css" | resources.Minify| resources.Fingerprint }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/white.css" | resources.Minify | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $theme_style.RelPermalink }}">
|
||||
{{ else }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/simple.css" | resources.Minify| resources.Fingerprint }}
|
||||
{{ $theme_style := resources.Get "lib/reveal/theme/simple.css" | resources.Minify | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $theme_style.RelPermalink }}">
|
||||
{{ end }}
|
||||
|
||||
|
@ -46,10 +46,10 @@
|
|||
{{ if in .Params.Plugins "highlight" }}
|
||||
|
||||
{{ if eq .Params.highlightTheme "zenburn" }}
|
||||
{{ $highlight_style := resources.Get "lib/reveal/highlight/zenburn.css" | resources.Minify| resources.Fingerprint }}
|
||||
{{ $highlight_style := resources.Get "lib/reveal/highlight/zenburn.css" | resources.Minify | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $highlight_style.RelPermalink }}">
|
||||
{{ else }}
|
||||
{{ $highlight_style := resources.Get "lib/reveal/highlight/monokai.css" | resources.Minify| resources.Fingerprint }}
|
||||
{{ $highlight_style := resources.Get "lib/reveal/highlight/monokai.css" | resources.Minify | resources.Fingerprint }}
|
||||
<link rel="stylesheet" href="{{ $highlight_style.RelPermalink }}">
|
||||
{{ end }}
|
||||
|
||||
|
|
|
@ -1,27 +1,22 @@
|
|||
{{ $js := .Site.Data.lib.js }}
|
||||
{{ $css := .Site.Data.lib.css }}
|
||||
|
||||
{{ $jquery := resources.Get "js/jquery.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $jquery.RelPermalink }}"></script>
|
||||
{{ $enquire := resources.Get "js/enquire.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $enquire.RelPermalink }}"></script>
|
||||
{{ $clipboard := resources.Get "js/clipboard.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $clipboard.RelPermalink }}"></script>
|
||||
{{ $lazysizes := resources.Get "js/lazysizes.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $lazysizes.RelPermalink }}"></script>
|
||||
{{ $zzo := resources.Get "js/zzo.js" | resources.Minify | resources.Fingerprint }}
|
||||
<script defer src="{{ $zzo.RelPermalink }}"></script>
|
||||
|
||||
{{ if $.Param "enablePhotoSwipe" }}
|
||||
{{ $photoSwipe := resources.Get "lib/photoswipe/photoswipe.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $photoSwipe.RelPermalink }}"></script>
|
||||
{{ $photoSwipeUi := resources.Get "lib/photoswipe/photoswipe-ui-default.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $photoSwipeUi.RelPermalink }}"></script>
|
||||
{{ $photoSwipeStyle := resources.Get "lib/photoswipe/photoswipe.css" | resources.Minify }}
|
||||
<link rel="stylesheet" href="{{ $photoSwipeStyle.RelPermalink }}">
|
||||
{{ $photoSwipeSkin := resources.Get "lib/photoswipe/custom-skin.css" | resources.Minify }}
|
||||
<link rel="stylesheet" href="{{ $photoSwipeSkin.RelPermalink }}">
|
||||
{{ end }}
|
||||
{{ $getParents := resources.Get "js/helper/getParents.js" | resources.Minify }}
|
||||
<script defer src="{{ $getParents.RelPermalink }}"></script>
|
||||
{{ $closest := resources.Get "js/helper/closest.js" | resources.Minify }}
|
||||
<script defer src="{{ $closest.RelPermalink }}"></script>
|
||||
{{ $prev := resources.Get "js/helper/prev.js" | resources.Minify }}
|
||||
<script defer src="{{ $prev.RelPermalink }}"></script>
|
||||
{{ $prop := resources.Get "js/helper/prop.js" | resources.Minify }}
|
||||
<script defer src="{{ $prop.RelPermalink }}"></script>
|
||||
{{ $fadeinout := resources.Get "js/helper/fadeinout.js" | resources.Minify }}
|
||||
<script defer src="{{ $fadeinout.RelPermalink }}"></script>
|
||||
|
||||
{{ if in .Params.Libraries "mermaid" }}
|
||||
<script defer src="{{ $js.mermaid.url }}" integrity="{{ $js.mermaid.sri }}" crossorigin="anonymous"></script>
|
||||
|
@ -66,45 +61,54 @@
|
|||
|
||||
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
window.onload = function() {
|
||||
var navbar = document.querySelector('.navbar');
|
||||
|
||||
// ====================== markdown code block ======================
|
||||
function wrap(el, wrapper) {
|
||||
el.parentNode.insertBefore(wrapper, el);
|
||||
wrapper.appendChild(el);
|
||||
}
|
||||
|
||||
(function () {
|
||||
document.querySelectorAll('.single__contents > pre > code')
|
||||
.forEach((element) => {
|
||||
if (!$(element).attr('data-lang')) {
|
||||
$(element).parent().wrap('<div data-lang="Code" class="language-code"></div>');
|
||||
.forEach((elem) => {
|
||||
var dataLang = elem.getAttribute('data-lang');
|
||||
if (!dataLang) {
|
||||
var dataLangWrapper = document.createElement('div');
|
||||
dataLangWrapper.setAttribute('data-lang', 'Code');
|
||||
dataLangWrapper.className = 'language-code';
|
||||
wrap(elem.parentNode, dataLangWrapper);
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
function mapLang(name) {
|
||||
return {
|
||||
coffeescript: 'CoffeeScript',
|
||||
cpp: 'C++',
|
||||
cs: 'C#',
|
||||
js: 'JavaScript',
|
||||
json: 'JSON',
|
||||
objectivec: 'Objective-C',
|
||||
ts: 'TypeScript',
|
||||
typescript: 'TypeScript',
|
||||
}[name] || name.toUpperCase();
|
||||
}
|
||||
var langCodeElem = document.querySelectorAll('.language-code');
|
||||
langCodeElem ? langCodeElem.forEach(function (elem) {
|
||||
var newElem = document.createElement('span');
|
||||
newElem.className = 'copy-to-clipboard';
|
||||
newElem.setAttribute('title', 'Copy to clipboard');
|
||||
elem.append(newElem);
|
||||
}) : null;
|
||||
// =================================================================
|
||||
|
||||
// search
|
||||
runSearch();
|
||||
|
||||
// counter
|
||||
// ======================= busuanzi counter ========================
|
||||
{{ $enableBusuanzi := .Site.Params.enableBusuanzi }}
|
||||
{{ $busuanziPagePV := .Site.Params.busuanziPagePV }}
|
||||
var enableBusuanzi = JSON.parse({{ $enableBusuanzi | jsonify }});
|
||||
var busuanziPagePV = JSON.parse({{ $busuanziPagePV | jsonify }});
|
||||
|
||||
if (enableBusuanzi && busuanziPagePV) {
|
||||
$('#busuanzi_value_page_pv').digits();
|
||||
if (enableBusuanzi && busuanziPagePV) {
|
||||
var pagePvElem = document.querySelector('#busuanzi_value_page_pv');
|
||||
pagePvElem.textContent = pagePvElem.textContent.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
|
||||
}
|
||||
// =================================================================
|
||||
|
||||
var navbar = $('.navbar');
|
||||
|
||||
// toc
|
||||
// ============================== toc ==============================
|
||||
{{ $enableToc := ($.Param "enableToc") }}
|
||||
{{ $toc := ($.Param "toc") }}
|
||||
{{ $hideToc := ($.Param "hideToc") }}
|
||||
|
@ -113,93 +117,174 @@
|
|||
var hideToc = JSON.parse({{ $hideToc | jsonify }});
|
||||
|
||||
if (enableToc || toc) {
|
||||
$('#TableOfContents > ul > li').each(function () {
|
||||
$(this).find('ul').css('display', 'none');
|
||||
var tableOfContentsElem = document.getElementById('TableOfContents');
|
||||
tableOfContentsElem.querySelectorAll('ul > li').forEach(function (liElem) {
|
||||
liElem.querySelectorAll('ul').forEach(function (ulElem) {
|
||||
ulElem.style.display = 'none';
|
||||
});
|
||||
});
|
||||
$('#TableOfContents a').each(function () {
|
||||
$(this).click(function () {
|
||||
navbar.removeClass('navbar--show');
|
||||
navbar.removeClass('navbar--hide');
|
||||
navbar.addClass('navbar--hide');
|
||||
|
||||
$(".single__contents :header").each(function () {
|
||||
$('.toc a').removeClass('active');
|
||||
});
|
||||
$(this).addClass('active');
|
||||
tableOfContentsElem.querySelectorAll('a').forEach(function(elem) {
|
||||
elem.addEventListener('click', function() {
|
||||
var id = elem.getAttribute('id');
|
||||
navbar.classList.remove('navbar--show');
|
||||
navbar.classList.remove('navbar--hide');
|
||||
navbar.classList.add('navbar--hide');
|
||||
|
||||
$('#TableOfContents > ul > li').each(function () {
|
||||
$(this).find('ul').css('display', 'none');
|
||||
document.querySelector('.toc').querySelectorAll('a').forEach(function(elem) {
|
||||
elem.classList.remove('active');
|
||||
});
|
||||
$(this).next().css('display', 'block');
|
||||
$(this).parents('ul').css('display', 'block');
|
||||
elem.classList.add('active');
|
||||
|
||||
tableOfContentsElem.querySelectorAll('ul > li').forEach(function (liElem) {
|
||||
liElem.querySelectorAll('ul').forEach(function(ulElem) {
|
||||
ulElem.style.display = 'none';
|
||||
});
|
||||
});
|
||||
|
||||
var curElem = tableOfContentsElem.querySelector(`[href="#${id}"]`);
|
||||
if (curElem && curElem.nextElementSibling) {
|
||||
curElem.nextElementSibling.style.display = 'block';
|
||||
}
|
||||
if (curElem) {
|
||||
getParents(curElem, 'ul').forEach(function (elem) {
|
||||
elem.style.display = 'block';
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// toc visibility
|
||||
$("#toggle-toc").change(function () {
|
||||
if (this.checked) {
|
||||
$('.toc').fadeIn(200);
|
||||
$('main').removeClass('main-main').removeClass('main').addClass('main-main');
|
||||
$('side').removeClass('main-side');
|
||||
$('.toc__flexbox').attr('data-position', 'fixed');
|
||||
var toggleTocElem = document.querySelector("#toggle-toc");
|
||||
var tocElem = document.querySelector('.toc');
|
||||
var mainElem = document.querySelector('main');
|
||||
var sideElem = document.querySelector('side');
|
||||
var tocFlexboxElem = document.querySelector('.toc__flexbox');
|
||||
|
||||
toggleTocElem ?
|
||||
toggleTocElem.addEventListener('change', function(e) {
|
||||
if (e.target.checked) {
|
||||
if (tocElem) {
|
||||
fadeIn(tocElem, 200);
|
||||
}
|
||||
if (tocFlexboxElem) {
|
||||
tocFlexboxElem.setAttribute('data-position', 'fixed');
|
||||
}
|
||||
|
||||
if (mainElem) {
|
||||
mainElem.classList.remove('main-main');
|
||||
mainElem.classList.remove('main');
|
||||
mainElem.classList.add('main-main');
|
||||
}
|
||||
if (sideElem) {
|
||||
sideElem.classList.remove('main-side');
|
||||
}
|
||||
} else {
|
||||
$('.toc').fadeOut(200);
|
||||
$('main').removeClass('main-main').removeClass('main').addClass('main');
|
||||
$('side').removeClass('main-side');
|
||||
$('.toc__flexbox').attr('data-position', 'absolute');
|
||||
if (tocElem) {
|
||||
fadeOut(tocElem, 200);
|
||||
}
|
||||
if (tocFlexboxElem) {
|
||||
tocFlexboxElem.setAttribute('data-position', 'absolute');
|
||||
}
|
||||
|
||||
if (mainElem) {
|
||||
mainElem.classList.remove('main-main');
|
||||
mainElem.classList.remove('main');
|
||||
mainElem.classList.add('main');
|
||||
}
|
||||
if (sideElem) {
|
||||
sideElem.classList.remove('main-side');
|
||||
}
|
||||
}
|
||||
});
|
||||
}) : null;
|
||||
}
|
||||
// =================================================================
|
||||
|
||||
// Add link button for every
|
||||
|
||||
// ======================== markdown table =========================
|
||||
var tables = document.querySelectorAll('.single__contents > table');
|
||||
for (let i = 0; i < tables.length; i++) {
|
||||
var table = tables[i];
|
||||
var wrapper = document.createElement('div');
|
||||
wrapper.className = 'table-wrapper';
|
||||
table.parentElement.replaceChild(wrapper, table);
|
||||
wrapper.appendChild(table);
|
||||
}
|
||||
// =================================================================
|
||||
|
||||
|
||||
// ==================== add links in all titles ====================
|
||||
var text, clip = new ClipboardJS('.anchor');
|
||||
var headers = $('.single__contents :header').not('h6').not('h5');
|
||||
headers.append(function (index, html) {
|
||||
var element = $(this);
|
||||
var singleContentsElem = document.querySelector('.single__contents');
|
||||
var headers = singleContentsElem.querySelectorAll("h1, h2, h3, h4");
|
||||
|
||||
headers ?
|
||||
headers.forEach(function (elem) {
|
||||
var url = encodeURI(document.location.origin + document.location.pathname);
|
||||
var link = url + "#" + element[0].id;
|
||||
return " <span class='anchor hide' data-clipboard-text='" + link + "' style='position: relative;'>" +
|
||||
"<span style='font-size: 1rem; position: absolute; right: -2rem; top: 50%; transform: translateY(-50%)'>🔗</span>" +
|
||||
"</span>"
|
||||
;
|
||||
});
|
||||
headers.on('mouseenter', function () {
|
||||
$(this).find('.anchor').attr('class', 'anchor');
|
||||
});
|
||||
headers.on('mouseleave', function () {
|
||||
$(this).find('.anchor').attr('class', 'anchor hide');
|
||||
});
|
||||
var link = url + "#" + elem.getAttribute('id');
|
||||
|
||||
var newElemOuter = document.createElement('span');
|
||||
newElemOuter.classList.add('anchor');
|
||||
newElemOuter.classList.add('hide');
|
||||
newElemOuter.setAttribute('data-clipboard-text', link);
|
||||
newElemOuter.style.position = 'relative';
|
||||
|
||||
$(".anchor").on('mouseleave', function (e) {
|
||||
$(this).attr('aria-label', null).removeClass('tooltipped tooltipped-s tooltipped-w');
|
||||
var newElemInner = document.createElement('span');
|
||||
newElemInner.style.fontSize = '1rem';
|
||||
newElemInner.style.position = 'absolute';
|
||||
newElemInner.style.right = '-2rem';
|
||||
newElemInner.style.top = '50%';
|
||||
newElemInner.style.transform = 'translateY(-50%)';
|
||||
newElemInner.innerText = "🔗";
|
||||
|
||||
newElemOuter.append(newElemInner);
|
||||
elem.append(newElemOuter);
|
||||
|
||||
elem.addEventListener('mouseenter', function() {
|
||||
this.querySelector('.anchor').classList.remove('hide');
|
||||
});
|
||||
elem.addEventListener('mouseleave', function () {
|
||||
this.querySelector('.anchor').classList.add('hide');
|
||||
});
|
||||
}) : null;
|
||||
|
||||
document.querySelectorAll('.anchor').forEach(function(elem) {
|
||||
elem.addEventListener('mouseleave', function() {
|
||||
elem.setAttribute('aria-label', null);
|
||||
elem.classList.remove('tooltipped');
|
||||
elem.classList.remove('tooltipped-s');
|
||||
elem.classList.remove('tooltipped-w');
|
||||
});
|
||||
});
|
||||
|
||||
clip.on('success', function (e) {
|
||||
e.clearSelection();
|
||||
$(e.trigger).attr('aria-label', 'Link copied to clipboard!').addClass('tooltipped tooltipped-s');
|
||||
});
|
||||
|
||||
$('.language-code').each(function (i, node) {
|
||||
$(node).append('<span class="copy-to-clipboard" title="Copy to clipboard"/>');
|
||||
e.trigger.setAttribute('aria-label', 'Link copied to clipboard!');
|
||||
e.trigger.classList.add('tooltipped');
|
||||
e.trigger.classList.add('tooltipped-s');
|
||||
});
|
||||
// =================================================================
|
||||
|
||||
// clipboard
|
||||
|
||||
// =========================== clipboard ===========================
|
||||
var clipInit = false;
|
||||
$('pre.chroma code, .language-code code').each(function () {
|
||||
var code = $(this),
|
||||
text = code.text();
|
||||
var preChromaElem = document.querySelectorAll('pre.chroma');
|
||||
var langCodeElem = document.querySelectorAll('.language-code');
|
||||
var makeClipboard = function(elem) {
|
||||
var code = elem,
|
||||
text = elem.textContent;
|
||||
|
||||
if (text.length > 30) {
|
||||
if (!clipInit) {
|
||||
var text, clip = new ClipboardJS('.copy-to-clipboard', {
|
||||
text: function (trigger) {
|
||||
console.log();
|
||||
if ($(trigger).prev().find('code').length > 1) {
|
||||
text = $(trigger).prev().find(`code[class^="language-"]`).text();
|
||||
var codeElem = prev(trigger).querySelectorAll('code');
|
||||
if (codeElem.length > 1) {
|
||||
text = prev(trigger).querySelector('code[class^="language-"]').textContent;
|
||||
} else {
|
||||
text = $(trigger).prev().find('code').text();
|
||||
text = prev(trigger).querySelector('code').textContent;
|
||||
}
|
||||
|
||||
|
||||
return text.replace(/^\$\s/gm, '');
|
||||
}
|
||||
});
|
||||
|
@ -207,16 +292,17 @@
|
|||
var inPre;
|
||||
clip.on('success', function (e) {
|
||||
e.clearSelection();
|
||||
inPre = $(e.trigger).parent().prop('tagName') == 'PRE';
|
||||
$(e.trigger).attr('aria-label', 'Copied to clipboard!').addClass('tooltipped tooltipped-w');
|
||||
inPre = prop(e.trigger.parentNode, 'tagName') == 'PRE';
|
||||
e.trigger.setAttribute('aria-label', 'Copied to clipboard!');
|
||||
e.trigger.classList.add('tooltipped');
|
||||
e.trigger.classList.add('tooltipped-w');
|
||||
});
|
||||
|
||||
clip.on('error', function (e) {
|
||||
inPre = $(e.trigger).parent().prop('tagName') == 'PRE';
|
||||
$(e.trigger).attr('aria-label', fallbackMessage(e.action)).addClass('tooltipped tooltipped-w');
|
||||
$(document).one('copy', function () {
|
||||
$(e.trigger).attr('aria-label', 'Copied to clipboard!').addClass('tooltipped tooltipped-w');
|
||||
});
|
||||
inPre = prop(e.trigger.parentNode, 'tagName') == 'PRE';
|
||||
e.trigger.setAttribute('aria-label', e.action.toString());
|
||||
e.trigger.classList.add('tooltipped');
|
||||
e.trigger.classList.add('tooltipped-w');
|
||||
});
|
||||
|
||||
clipInit = true;
|
||||
|
@ -224,71 +310,43 @@
|
|||
|
||||
var notAllowedClass = ['language-mermaid', 'language-viz', 'language-wave', 'language-chart', 'language-msc', 'language-flowchart'];
|
||||
var isNotAllowedIncluded = false;
|
||||
var curClassName = code.attr('class');
|
||||
var curClassName = code.getAttribute('class');
|
||||
|
||||
for (let str of notAllowedClass) {
|
||||
if (curClassName && curClassName.startsWith(str)) {
|
||||
isNotAllowedIncluded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!isNotAllowedIncluded) {
|
||||
if (curClassName) {
|
||||
code.closest('div.chroma').append('<span class="copy-to-clipboard" title="Copy to clipboard" />');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// gallery
|
||||
{{ $enablePhotoSwipe := ($.Param "enablePhotoSwipe") }}
|
||||
var enablePhotoSwipe = JSON.parse({{ $enablePhotoSwipe | jsonify }});
|
||||
|
||||
if (enablePhotoSwipe) {
|
||||
var pswpElement = $('.pswp')[0];
|
||||
var imgElements = $('.single__contents').find('img');
|
||||
var items = [];
|
||||
|
||||
imgElements.each(function (i, v) {
|
||||
$(this).click(function (e) {
|
||||
initGallery(i);
|
||||
});
|
||||
$(this).css('cursor', 'pointer');
|
||||
items.push({
|
||||
src: v['src'],
|
||||
w: 0,
|
||||
h: 0,
|
||||
title: filename(v['src']),
|
||||
});
|
||||
});
|
||||
|
||||
function filename(str) {
|
||||
var s = str.replace(/\\/g, '/');
|
||||
s = s.substring(s.lastIndexOf('/') + 1);
|
||||
return str ? s.replace(/[?#].+$/, '') : s.split('.')[0];
|
||||
}
|
||||
|
||||
function initGallery(index) {
|
||||
var options = { index: index };
|
||||
var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
|
||||
gallery.listen('imageLoadComplete', function (index, item) {
|
||||
if (item.h < 1 || item.w < 1) {
|
||||
let img = new Image();
|
||||
img.onload = () => {
|
||||
item.w = img.width;
|
||||
item.h = img.height;
|
||||
gallery.invalidateCurrItems();
|
||||
gallery.updateSize(true);
|
||||
}
|
||||
img.src = item.src;
|
||||
var newClipboardElem = document.createElement('span');
|
||||
newClipboardElem.setAttribute('class', 'copy-to-clipboard');
|
||||
newClipboardElem.setAttribute('title', 'Copy to clipboard');
|
||||
closest(code, 'div.chroma').append(newClipboardElem);
|
||||
}
|
||||
});
|
||||
gallery.init();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// mermaid
|
||||
preChromaElem ?
|
||||
preChromaElem.forEach(function(elem) {
|
||||
elem.querySelectorAll('code').forEach(function(codeElem) {
|
||||
makeClipboard(codeElem);
|
||||
});
|
||||
}) : null;
|
||||
|
||||
langCodeElem ?
|
||||
langCodeElem.forEach(function(elem) {
|
||||
elem.querySelectorAll('code').forEach(function (codeElem) {
|
||||
makeClipboard(codeElem);
|
||||
});
|
||||
}) : null;
|
||||
// =================================================================
|
||||
|
||||
|
||||
// ============================ mermaid ============================
|
||||
{{ $lib := .Params.libraries }}
|
||||
var lib = JSON.parse({{ $lib | jsonify }});
|
||||
|
||||
|
@ -302,17 +360,27 @@
|
|||
mermaid.initialize({ theme: 'default' });
|
||||
}
|
||||
|
||||
let mermaids = [];
|
||||
var mermaids = [];
|
||||
[].push.apply(mermaids, document.getElementsByClassName('language-mermaid'));
|
||||
for (i = 0; i < mermaids.length; i++) {
|
||||
$(mermaids[i]).unwrap('pre');
|
||||
$(mermaids[i]).replaceWith(function () {
|
||||
return $("<div />").append($(this).contents()).addClass('mermaid').css('padding', '34px 4px 6px');
|
||||
});
|
||||
}
|
||||
}
|
||||
mermaids.forEach(function(elem) {
|
||||
var elemParentNode = elem.parentNode;
|
||||
|
||||
// katex
|
||||
if (elemParentNode !== document.body) {
|
||||
elemParentNode.parentNode.insertBefore(elem, elemParentNode);
|
||||
elemParentNode.parentNode.removeChild(elemParentNode);
|
||||
}
|
||||
|
||||
var newElemWrapper = document.createElement('div');
|
||||
newElemWrapper.classList.add('mermaid');
|
||||
newElemWrapper.style.padding = '34px 4px 6px';
|
||||
newElemWrapper.innerHTML = elem.innerHTML;
|
||||
elem.replaceWith(newElemWrapper);
|
||||
});
|
||||
}
|
||||
// =================================================================
|
||||
|
||||
|
||||
// ============================= katex =============================
|
||||
if (lib && lib.includes('katex')) {
|
||||
var mathElements = document.getElementsByClassName('math');
|
||||
var options = [
|
||||
|
@ -323,8 +391,10 @@
|
|||
|
||||
renderMathInElement(document.querySelector('.single__contents'), options);
|
||||
}
|
||||
// =================================================================
|
||||
|
||||
// flowchart.js
|
||||
|
||||
// ========================= flowchart.js ==========================
|
||||
if (lib && lib.includes('flowchartjs')) {
|
||||
{{ $flowchartjs := .Site.Data.flowchartjs }}
|
||||
var options = JSON.parse({{ $flowchartjs | jsonify }});
|
||||
|
@ -346,8 +416,10 @@
|
|||
index +=1;
|
||||
});
|
||||
}
|
||||
// =================================================================
|
||||
|
||||
// mathjax
|
||||
|
||||
// ============================ mathjax ============================
|
||||
if (lib && lib.includes('mathjax')) {
|
||||
window.MathJax = {
|
||||
tex: {
|
||||
|
@ -361,8 +433,10 @@
|
|||
},
|
||||
};
|
||||
}
|
||||
// =================================================================
|
||||
|
||||
// js-sequence-diagram
|
||||
|
||||
// ====================== js-sequence-diagram ======================
|
||||
if (lib && lib.includes('msc')) {
|
||||
{{ $msc := .Site.Data.msc }}
|
||||
var options = JSON.parse({{ $msc | jsonify }});
|
||||
|
@ -381,8 +455,10 @@
|
|||
index += 1;
|
||||
});
|
||||
}
|
||||
// =================================================================
|
||||
|
||||
// chart.js
|
||||
|
||||
// =========================== chart.js ============================
|
||||
if (lib && lib.includes('chart')) {
|
||||
var borderColor = "#666";
|
||||
var bgColor = "#ddd";
|
||||
|
@ -417,8 +493,10 @@
|
|||
index += 1;
|
||||
});
|
||||
}
|
||||
// =================================================================
|
||||
|
||||
// wavedrom
|
||||
|
||||
// =========================== wavedrom ============================
|
||||
if (lib && lib.includes('wavedrom')) {
|
||||
var wavePrefix = "language-wave";
|
||||
var index = 0;
|
||||
|
@ -434,8 +512,10 @@
|
|||
index += 1;
|
||||
});
|
||||
}
|
||||
// =================================================================
|
||||
|
||||
// viz diagram
|
||||
|
||||
// ========================== viz diagram ==========================
|
||||
if (lib && lib.includes('viz')) {
|
||||
var vizPrefix = "language-viz-";
|
||||
Array.prototype.forEach.call(document.querySelectorAll("[class^=" + vizPrefix + "]"), function (x) {
|
||||
|
@ -455,5 +535,7 @@
|
|||
})
|
||||
});
|
||||
}
|
||||
// =================================================================
|
||||
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -1,15 +1,4 @@
|
|||
{{ $jquery := resources.Get "js/jquery.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $jquery.RelPermalink }}"></script>
|
||||
{{ $enquire := resources.Get "js/enquire.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $enquire.RelPermalink }}"></script>
|
||||
{{ $lazysizes := resources.Get "js/lazysizes.min.js" | resources.Fingerprint }}
|
||||
<script defer src="{{ $lazysizes.RelPermalink }}"></script>
|
||||
{{ $zzo := resources.Get "js/zzo.js" | resources.Minify | resources.Fingerprint }}
|
||||
<script defer src="{{ $zzo.RelPermalink }}"></script>
|
||||
|
||||
<script>
|
||||
window.onload = function() {
|
||||
// search
|
||||
runSearch();
|
||||
}
|
||||
</script>
|
|
@ -1,7 +1,7 @@
|
|||
<article class="summary-card">
|
||||
<header>
|
||||
<h5 class="title h5"><a href='{{ .Permalink }}'> {{ .Title }}</a> </h5>
|
||||
<h6 class="subtitle caption"><span title="{{ i18n "tooltip-written" }}">📅 {{ .Date.Format (i18n "summary-dateformat") }} </span> {{ if .GitInfo }} <span title="{{ i18n "tooltip-modified" }}"> · 📝 {{ .Lastmod.Format (i18n "summary-dateformat") }} </span> {{ end }} <span title="{{ i18n "tooltip-reading-time" }}"> · ☕{{ .ReadingTime }} {{ i18n "reading-time" }}</span></h6>
|
||||
<h6 class="subtitle caption"><span title="{{ i18n "tooltip-written" }}">📅{{ .Date.Format (i18n "summary-dateformat") }} </span> {{ if .GitInfo }} <span title="{{ i18n "tooltip-modified" }}"> · 📝 {{ .Lastmod.Format (i18n "summary-dateformat") }} </span> {{ end }} <span title="{{ i18n "tooltip-reading-time" }}"> · ☕{{ .ReadingTime }} {{ i18n "reading-time" }}</span>{{ with .Params.Author }}· <span title="{{ i18n "single-writtenBy" }}">{{if .Params.AuthorEmoji }}{{ .Params.AuthorEmoji }}{{ else }}✍️{{ end }} {{ . }}</span>{{ end }}</h6>
|
||||
</header>
|
||||
{{ $params := .Params }}
|
||||
<div class="summary-card__content">
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<div class="summary-classic__content">
|
||||
<header>
|
||||
<h5 class="title h5"><a href='{{ .Permalink }}'> {{ .Title }}</a> </h5>
|
||||
<h6 class="subtitle caption"><span title="{{ i18n "tooltip-written" }}">📅 {{ .Date.Format (i18n "summary-dateformat") }} </span> {{ if .GitInfo }} <span title="{{ i18n "tooltip-modified" }}"> · 📝 {{ .Lastmod.Format (i18n "summary-dateformat") }} </span> {{ end }} <span title="{{ i18n "tooltip-reading-time" }}"> · ☕{{ .ReadingTime }} {{ i18n "reading-time" }} </span></h6>
|
||||
<h6 class="subtitle caption"><span title="{{ i18n "tooltip-written" }}">📅 {{ .Date.Format (i18n "summary-dateformat") }} </span> {{ if .GitInfo }} <span title="{{ i18n "tooltip-modified" }}"> · 📝 {{ .Lastmod.Format (i18n "summary-dateformat") }} </span> {{ end }} <span title="{{ i18n "tooltip-reading-time" }}"> · ☕{{ .ReadingTime }} {{ i18n "reading-time" }} </span>{{ with .Params.Author }}· <span title="{{ i18n "single-writtenBy" }}">{{if $params.AuthorEmoji }}{{ $params.AuthorEmoji }}{{ else }}✍️{{ end }} {{ . }}</span>{{ end }}</h6>
|
||||
</header>
|
||||
<div>
|
||||
<div class="summary-classic__text p2">
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<div class="summary-compact__meta">
|
||||
<header>
|
||||
<h5 class="title h6"><a href='{{ .Permalink }}'> {{ .Title }}</a> </h5>
|
||||
<h6 class="subtitle caption"><span title="{{ i18n "tooltip-written" }}">📅 {{ .Date.Format (i18n "summary-dateformat") }} </span> {{ if .GitInfo }} <span title="{{ i18n "tooltip-modified" }}"> · 📝 {{ .Lastmod.Format (i18n "summary-dateformat") }} </span> {{ end }} <span title="{{ i18n "tooltip-reading-time" }}"> · ☕{{ .ReadingTime }} {{ i18n "reading-time" }}</span></h6>
|
||||
<h6 class="subtitle caption"><span title="{{ i18n "tooltip-written" }}">📅 {{ .Date.Format (i18n "summary-dateformat") }} </span> {{ if .GitInfo }} <span title="{{ i18n "tooltip-modified" }}"> · 📝 {{ .Lastmod.Format (i18n "summary-dateformat") }} </span> {{ end }} <span title="{{ i18n "tooltip-reading-time" }}"> · ☕{{ .ReadingTime }} {{ i18n "reading-time" }}</span>{{ with .Params.Author }}· <span title="{{ i18n "single-writtenBy" }}">{{if $params.AuthorEmoji }}{{ $params.AuthorEmoji }}{{ else }}✍️{{ end }} {{ . }}</span>{{ end }}</h6>
|
||||
</header>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 26 26" width="{{ .width }}" height="{{ .height }}"><path fill="currentColor" d="M 23.28125 11 L 10 10 L 10 6.851563 C 10 6.523438 9.839844 6.277344 9.519531 6.03125 C 9.199219 5.949219 8.878906 5.949219 8.640625 6.113281 C 5.359375 8.410156 2.238281 12.257813 2.160156 12.421875 C 2.082031 12.578125 2.007813 12.8125 2.003906 12.976563 C 2.003906 12.980469 2 12.988281 2 12.992188 C 2 13.15625 2.078125 13.402344 2.160156 13.484375 C 2.238281 13.648438 5.28125 17.507813 8.640625 19.804688 C 8.960938 19.96875 9.28125 20.050781 9.519531 19.886719 C 9.839844 19.722656 10 19.476563 10 19.148438 L 10 16 L 23.28125 15 C 23.679688 14.679688 24 13.875 24 12.992188 C 24 12.195313 23.761719 11.320313 23.28125 11 Z"/></svg>
|
After Width: | Height: | Size: 771 B |
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 26 26" width="{{ .width }}" height="{{ .height }}"><path fill="currentColor" d="M 2.71875 11.023438 L 16 10.023438 L 16 6.875 C 16 6.546875 16.160156 6.300781 16.480469 6.054688 C 16.800781 5.972656 17.121094 5.972656 17.359375 6.136719 C 20.640625 8.433594 23.761719 12.28125 23.839844 12.445313 C 23.917969 12.601563 23.992188 12.835938 23.996094 13 C 23.996094 13.003906 24 13.011719 24 13.015625 C 24 13.179688 23.921875 13.425781 23.839844 13.507813 C 23.761719 13.671875 20.71875 17.53125 17.359375 19.828125 C 17.039063 19.992188 16.71875 20.074219 16.480469 19.910156 C 16.160156 19.746094 16 19.5 16 19.171875 L 16 16.023438 L 2.71875 15.023438 C 2.320313 14.703125 2 13.898438 2 13.015625 C 2 12.21875 2.238281 11.34375 2.71875 11.023438 Z"/></svg>
|
After Width: | Height: | Size: 811 B |
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 26 26" width="{{ .width }}" height="{{ .height }}"><path fill="currentColor" d="M 21.734375 19.640625 L 19.636719 21.734375 C 19.253906 22.121094 18.628906 22.121094 18.242188 21.734375 L 13 16.496094 L 7.761719 21.734375 C 7.375 22.121094 6.746094 22.121094 6.363281 21.734375 L 4.265625 19.640625 C 3.878906 19.253906 3.878906 18.628906 4.265625 18.242188 L 9.503906 13 L 4.265625 7.761719 C 3.882813 7.371094 3.882813 6.742188 4.265625 6.363281 L 6.363281 4.265625 C 6.746094 3.878906 7.375 3.878906 7.761719 4.265625 L 13 9.507813 L 18.242188 4.265625 C 18.628906 3.878906 19.257813 3.878906 19.636719 4.265625 L 21.734375 6.359375 C 22.121094 6.746094 22.121094 7.375 21.738281 7.761719 L 16.496094 13 L 21.734375 18.242188 C 22.121094 18.628906 22.121094 19.253906 21.734375 19.640625 Z"/></svg>
|
After Width: | Height: | Size: 854 B |
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="{{ .width }}" height="{{ .height }}"><path fill="currentColor" d="M 5 3 C 3.9069372 3 3 3.9069372 3 5 L 3 8 A 1.0001 1.0001 0 1 0 5 8 L 5 5 L 8 5 A 1.0001 1.0001 0 1 0 8 3 L 5 3 z M 16 3 A 1.0001 1.0001 0 1 0 16 5 L 19 5 L 19 8 A 1.0001 1.0001 0 1 0 21 8 L 21 5 C 21 3.9069372 20.093063 3 19 3 L 16 3 z M 3.984375 14.986328 A 1.0001 1.0001 0 0 0 3 16 L 3 19 C 3 20.093063 3.9069372 21 5 21 L 8 21 A 1.0001 1.0001 0 1 0 8 19 L 5 19 L 5 16 A 1.0001 1.0001 0 0 0 3.984375 14.986328 z M 19.984375 14.986328 A 1.0001 1.0001 0 0 0 19 16 L 19 19 L 16 19 A 1.0001 1.0001 0 1 0 16 21 L 19 21 C 20.093063 21 21 20.093063 21 19 L 21 16 A 1.0001 1.0001 0 0 0 19.984375 14.986328 z"/></svg>
|
After Width: | Height: | Size: 744 B |
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" width="{{ .width }}" height="{{ .height }}"><path fill="currentColor" d="M 16.96875 4.972656 C 15.867188 4.988281 14.984375 5.894531 15 7 L 15 15 L 7 15 C 6.277344 14.988281 5.609375 15.367188 5.246094 15.992188 C 4.878906 16.613281 4.878906 17.386719 5.246094 18.007813 C 5.609375 18.632813 6.277344 19.011719 7 19 L 19 19 L 19 7 C 19.007813 6.460938 18.796875 5.941406 18.414063 5.558594 C 18.03125 5.175781 17.511719 4.964844 16.96875 4.972656 Z M 32.96875 4.972656 C 31.921875 4.988281 31.0625 5.8125 31.003906 6.859375 C 31 6.90625 31 6.953125 31 7 L 31 19 L 43 19 C 43.066406 19 43.132813 19 43.199219 18.992188 C 44.269531 18.894531 45.070313 17.972656 45.015625 16.902344 C 44.964844 15.828125 44.074219 14.988281 43 15 L 35 15 L 35 7 C 35.007813 6.460938 34.796875 5.941406 34.414063 5.558594 C 34.03125 5.175781 33.511719 4.964844 32.96875 4.972656 Z M 7 31 C 6.277344 30.988281 5.609375 31.367188 5.246094 31.992188 C 4.878906 32.613281 4.878906 33.386719 5.246094 34.007813 C 5.609375 34.632813 6.277344 35.011719 7 35 L 15 35 L 15 43 C 14.988281 43.722656 15.367188 44.390625 15.992188 44.753906 C 16.613281 45.121094 17.386719 45.121094 18.007813 44.753906 C 18.632813 44.390625 19.011719 43.722656 19 43 L 19 31 Z M 31 31 L 31 43 C 30.988281 43.722656 31.367188 44.390625 31.992188 44.753906 C 32.613281 45.121094 33.386719 45.121094 34.007813 44.753906 C 34.632813 44.390625 35.011719 43.722656 35 43 L 35 35 L 43 35 C 43.722656 35.011719 44.390625 34.632813 44.753906 34.007813 C 45.121094 33.386719 45.121094 32.613281 44.753906 31.992188 C 44.390625 31.367188 43.722656 30.988281 43 31 Z"/></svg>
|
After Width: | Height: | Size: 1.6 KiB |
|
@ -1,7 +1,7 @@
|
|||
<figure {{ with .Get "class" }}class="{{.}}" {{ end }}>
|
||||
{{ with .Get "link"}}<a href="{{.}}">{{ end }}
|
||||
{{ $base := (findRE "/[a-zA-Z0-9_]+/" .Site.BaseURL) }}
|
||||
<img data-src="{{ delimit $base "" }}{{ substr (.Get "src") 1 }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}"{{ end }} src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='24pt' height='24pt' viewBox='0 0 24 24' version='1.1'%3E%3Cg id='surface1035795'%3E%3Cpath style=' stroke:none;fill-rule:nonzero;fill:rgb(80%25,80%25,80%25);fill-opacity:1;' d='M 4 4 C 2.90625 4 2 4.90625 2 6 L 2 18 C 2 19.09375 2.90625 20 4 20 L 20 20 C 21.09375 20 22 19.09375 22 18 L 22 6 C 22 4.90625 21.09375 4 20 4 Z M 4 6 L 20 6 L 20 18 L 4 18 Z M 4 6 '/%3E%3C/g%3E%3C/svg%3E%0A" class="lazyload" width="{{ .Get "width" }}" height="{{ .Get "height" }}"/>
|
||||
{{ $base := (findRE "/[a-zA-Z0-9_]+/" .Site.BaseURL | default "/") }}
|
||||
<img data-src="{{ if eq $base "/" }}{{ .Get "src" }}{{ else }}{{ delimit $base "" }}{{ substr (.Get "src") 1 }}{{ end }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}"{{ end }} data-caption="{{ .Get "caption" }}" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='24pt' height='24pt' viewBox='0 0 24 24' version='1.1'%3E%3Cg id='surface1035795'%3E%3Cpath style=' stroke:none;fill-rule:nonzero;fill:rgb(80%25,80%25,80%25);fill-opacity:1;' d='M 4 4 C 2.90625 4 2 4.90625 2 6 L 2 18 C 2 19.09375 2.90625 20 4 20 L 20 20 C 21.09375 20 22 19.09375 22 18 L 22 6 C 22 4.90625 21.09375 4 20 4 Z M 4 6 L 20 6 L 20 18 L 4 18 Z M 4 6 '/%3E%3C/g%3E%3C/svg%3E%0A" class="lazyload" width="{{ .Get "width" }}" height="{{ .Get "height" }}"/>
|
||||
{{ if .Get "link"}}</a>{{ end }}
|
||||
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
|
||||
<figcaption>{{ if isset .Params "title" }}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "My Extension",
|
||||
"short_name": "My Extension",
|
||||
"version": "versionString",
|
||||
"default_locale": "en",
|
||||
"description": "A plain text description",
|
||||
|
@ -25,5 +26,9 @@
|
|||
],
|
||||
"background": {
|
||||
"persistent": false
|
||||
}
|
||||
},
|
||||
"start_url": "https://exampleSite.com/",
|
||||
"theme_color": "#fff",
|
||||
"background_color": "#fff",
|
||||
"display": "standalone"
|
||||
}
|
||||
|
|