style: images in figure will be centered when {{figure src="center" ... }} is used

This commit is contained in:
olOwOlo 2017-11-01 22:25:41 +08:00
parent 758f15746a
commit 8cd3af6331
No known key found for this signature in database
GPG key ID: 456394B6E7A15EA6
5 changed files with 33 additions and 28 deletions

View file

@ -100,10 +100,15 @@
content: ':'; content: ':';
} }
figure figcaption h4 { figure {
&.center {
text-align: center;
}
figcaption h4 {
color: #b5b5b5; color: #b5b5b5;
font-size: 0.9rem; font-size: 0.9rem;
text-align: center; }
} }
.task-list { .task-list {

View file

@ -1,9 +1,9 @@
'use strict' 'use strict'
var Even = {} const Even = {}
Even.backToTop = function () { Even.backToTop = function () {
var $backToTop = $('#back-to-top') const $backToTop = $('#back-to-top')
$(window).scroll(function () { $(window).scroll(function () {
if ($(window).scrollTop() > 100) { if ($(window).scrollTop() > 100) {
@ -19,9 +19,9 @@ Even.backToTop = function () {
} }
Even.mobileNavbar = function () { Even.mobileNavbar = function () {
var $mobileNav = $('#mobile-navbar') const $mobileNav = $('#mobile-navbar')
var $mobileNavIcon = $('.mobile-navbar-icon') const $mobileNavIcon = $('.mobile-navbar-icon')
var slideout = new Slideout({ const slideout = new Slideout({
'panel': document.getElementById('mobile-panel'), 'panel': document.getElementById('mobile-panel'),
'menu': document.getElementById('mobile-menu'), 'menu': document.getElementById('mobile-menu'),
'padding': 180, 'padding': 180,
@ -49,15 +49,15 @@ Even.mobileNavbar = function () {
} }
Even._initToc = function () { Even._initToc = function () {
var SPACING = 20 const SPACING = 20
var $toc = $('.post-toc') const $toc = $('.post-toc')
var $footer = $('.post-footer') const $footer = $('.post-footer')
if ($toc.length) { if ($toc.length) {
var minScrollTop = $toc.offset().top - SPACING const minScrollTop = $toc.offset().top - SPACING
var maxScrollTop = $footer.offset().top - $toc.height() - SPACING const maxScrollTop = $footer.offset().top - $toc.height() - SPACING
var tocState = { const tocState = {
start: { start: {
'position': 'absolute', 'position': 'absolute',
'top': minScrollTop 'top': minScrollTop
@ -73,7 +73,7 @@ Even._initToc = function () {
} }
$(window).scroll(function () { $(window).scroll(function () {
var scrollTop = $(window).scrollTop() const scrollTop = $(window).scrollTop()
if (scrollTop < minScrollTop) { if (scrollTop < minScrollTop) {
$toc.css(tocState.start) $toc.css(tocState.start)
@ -85,21 +85,21 @@ Even._initToc = function () {
}) })
} }
var HEADERFIX = 30 const HEADERFIX = 30
var $toclink = $('.toc-link') const $toclink = $('.toc-link')
var $headerlink = $('.headerlink') const $headerlink = $('.headerlink')
var headerlinkTop = $.map($headerlink, function (link) { const headerlinkTop = $.map($headerlink, function (link) {
return $(link).offset().top return $(link).offset().top
}) })
$(window).scroll(function () { $(window).scroll(function () {
var scrollTop = $(window).scrollTop() const scrollTop = $(window).scrollTop()
for (var i = 0; i < $toclink.length; i++) { for (let i = 0; i < $toclink.length; i++) {
var isLastOne = i + 1 === $toclink.length const isLastOne = i + 1 === $toclink.length
var currentTop = headerlinkTop[i] - HEADERFIX const currentTop = headerlinkTop[i] - HEADERFIX
var nextTop = isLastOne ? Infinity : headerlinkTop[i + 1] - HEADERFIX const nextTop = isLastOne ? Infinity : headerlinkTop[i + 1] - HEADERFIX
if (currentTop < scrollTop && scrollTop <= nextTop) { if (currentTop < scrollTop && scrollTop <= nextTop) {
$($toclink[i]).addClass('active') $($toclink[i]).addClass('active')

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long