+
+ {%- if page.image.alt -%}
{{ page.image.alt }}
- {% endif %}
+ {%- endif -%}
{% endif %}
diff --git a/_sass/addon/commons.scss b/_sass/addon/commons.scss
index e7692fe2851..6ea733daca3 100644
--- a/_sass/addon/commons.scss
+++ b/_sass/addon/commons.scss
@@ -83,6 +83,47 @@ a {
img {
max-width: 100%;
height: auto;
+
+ &[data-src] {
+ &.lazyloaded {
+ z-index: 1;
+ -webkit-animation: fade-in 0.4s ease-in;
+ animation: fade-in 0.4s ease-in;
+ }
+
+ &[data-lqip="true"] {
+ &.lazyload,
+ &.lazyloading {
+ -webkit-filter: blur(20px);
+ filter: blur(20px);
+ }
+ }
+
+ &:not([data-lqip="true"]) {
+ &.lazyload,
+ &.lazyloading {
+ background: var(--img-bg);
+ }
+ }
+
+ &.shadow {
+ -webkit-filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.08));
+ filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.08));
+ box-shadow: none !important; /* cover the Bootstrap 4.6.1 styles */
+ }
+
+ @extend %img-caption;
+ }
+
+ @-webkit-keyframes fade-in {
+ from { opacity: 0; }
+ to { opacity: 1; }
+ }
+
+ @keyframes fade-in {
+ from { opacity: 0; }
+ to { opacity: 1; }
+ }
}
blockquote {
@@ -183,49 +224,6 @@ i { /* fontawesome icons */
}
}
-img[data-src] {
- @at-root #main #{&} {
- margin: 0.5rem 0;
- }
-
- &[data-lqip="true"] {
- &.lazyload,
- &.lazyloading {
- filter: blur(20px);
- }
- }
-
- &:not([data-lqip="true"]) {
- &.lazyload,
- &.lazyloading {
- opacity: 0;
- }
-
- &.lazyloaded {
- opacity: 1;
- transition: opacity 0.5s;
- }
- }
-
- &.left {
- float: left;
- margin: 0.75rem 1rem 1rem 0;
- }
-
- &.right {
- float: right;
- margin: 0.75rem 0 1rem 1rem;
- }
-
- &.shadow {
- -webkit-filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.08));
- filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.08));
- box-shadow: none !important; /* cover the Bootstrap 4.6.1 styles */
- }
-
- @extend %img-caption;
-}
-
/* --- Panels --- */
.access {
@@ -406,26 +404,14 @@ img[data-src] {
margin-bottom: 1.5rem;
}
- img[data-src]:not(.normal):not(.left):not(.right) {
- @include align-center;
- }
-
- a {
- &.img-link {
- @extend %no-cursor;
- }
-
- /* created by `_includes/img-extra.html` */
- &.popup {
- cursor: zoom-in;
- }
-
- &:hover {
- code {
- @extend %link-hover;
+ p {
+ > img[data-src],
+ > a.popup {
+ &:not(.normal):not(.left):not(.right) {
+ @include align-center;
}
}
- } /* a */
+ }
}
.pageviews .fa-spinner {
@@ -457,6 +443,14 @@ img[data-src] {
overflow-wrap: break-word;
a {
+ &.popup {
+ @extend %no-cursor;
+ @extend %img-caption;
+ @include mt-mb(0.5rem);
+
+ cursor: zoom-in;
+ }
+
&:not(.img-link) {
@extend %link-underline;
@@ -464,10 +458,6 @@ img[data-src] {
@extend %link-hover;
}
}
-
- &.img-link {
- @extend %img-caption;
- }
}
ol,
@@ -553,6 +543,39 @@ img[data-src] {
}
}
+.img-link {
+ color: transparent;
+ display: inline-flex;
+
+ @extend %img-rounded;
+}
+
+.shimmer {
+ overflow: hidden;
+ position: relative;
+ background: var(--img-bg);
+
+ &::before {
+ content: "";
+ position: absolute;
+ background: var(--shimmer-bg);
+ height: 100%;
+ width: 100%;
+ -webkit-animation: shimmer 1s infinite;
+ animation: shimmer 1s infinite;
+ }
+
+ @-webkit-keyframes shimmer {
+ 0% { -webkit-transform: translateX(-100%); transform: translateX(-100%); }
+ 100% { -webkit-transform: translateX(100%); transform: translateX(100%); }
+ }
+
+ @keyframes shimmer {
+ 0% { -webkit-transform: translateX(-100%); transform: translateX(-100%); }
+ 100% { -webkit-transform: translateX(100%); transform: translateX(100%); }
+ }
+}
+
/* --- buttons --- */
.btn-lang {
border: 1px solid !important;
@@ -622,6 +645,16 @@ img[data-src] {
transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}
+.left {
+ float: left;
+ margin: 0.75rem 1rem 1rem 0 !important;
+}
+
+.right {
+ float: right;
+ margin: 0.75rem 0 1rem 1rem !important;
+}
+
/* --- Overriding --- */
/* magnific-popup */
diff --git a/_sass/addon/module.scss b/_sass/addon/module.scss
index 1f980022996..a00e2dc19a7 100644
--- a/_sass/addon/module.scss
+++ b/_sass/addon/module.scss
@@ -90,6 +90,10 @@
font-style: normal;
}
+%img-rounded {
+ border-radius: 10px;
+}
+
%img-caption {
+ em {
display: block;
@@ -114,6 +118,11 @@
text-decoration: none;
}
+@mixin mt-mb($value) {
+ margin-top: $value;
+ margin-bottom: $value;
+}
+
@mixin ml-mr($value) {
margin-left: $value;
margin-right: $value;
diff --git a/_sass/colors/dark-typography.scss b/_sass/colors/dark-typography.scss
index 9c60b930086..f834f846122 100644
--- a/_sass/colors/dark-typography.scss
+++ b/_sass/colors/dark-typography.scss
@@ -26,6 +26,14 @@
--label-color: rgb(108, 117, 125);
--checkbox-color: rgb(118, 120, 121);
--checkbox-checked-color: var(--link-color);
+ --img-bg: radial-gradient(circle, rgb(22, 22, 24) 0%, rgb(32, 32, 32) 100%);
+ --shimmer-bg:
+ linear-gradient(
+ 90deg,
+ rgba(255, 255, 255, 0) 0%,
+ rgba(58, 55, 55, 0.4) 50%,
+ rgba(255, 255, 255, 0) 100%
+ );
/* Sidebar */
--sidebar-bg: radial-gradient(circle, #242424 0%, #1d1f27 100%);
@@ -65,7 +73,6 @@
--card-bg: rgb(39, 40, 43);
--card-border-color: rgb(53, 53, 60);
--card-box-shadow: var(--main-bg);
- --preview-img-bg: radial-gradient(circle, rgb(22, 22, 24) 0%, rgb(32, 32, 32) 100%);
--kbd-wrap-color: #6a6a6a;
--kbd-text-color: #d3d3d3;
--kbd-bg-color: #242424;
diff --git a/_sass/colors/light-typography.scss b/_sass/colors/light-typography.scss
index 5e653f95cf2..940d7b50c17 100644
--- a/_sass/colors/light-typography.scss
+++ b/_sass/colors/light-typography.scss
@@ -24,6 +24,14 @@
--btn-box-shadow: #eaeaea;
--checkbox-color: #c5c5c5;
--checkbox-checked-color: #07a8f7;
+ --img-bg: radial-gradient(circle, rgb(255, 255, 255) 0%, rgb(249, 249, 249) 100%);
+ --shimmer-bg:
+ linear-gradient(
+ 90deg,
+ rgba(250, 250, 250, 0) 0%,
+ rgba(232, 230, 230, 1) 50%,
+ rgba(250, 250, 250, 0) 100%
+ );
/* Sidebar */
--sidebar-bg: #eeeeee;
@@ -64,7 +72,6 @@
--tb-odd-bg: #fbfcfd;
--tb-border-color: #eaeaea;
--dash-color: silver;
- --preview-img-bg: radial-gradient(circle, rgb(255, 255, 255) 0%, rgb(249, 249, 249) 100%);
--kbd-wrap-color: #bdbdbd;
--kbd-text-color: var(--text-color);
--kbd-bg-color: white;
diff --git a/_sass/layout/post.scss b/_sass/layout/post.scss
index e1b7dab5df9..146caba26bc 100644
--- a/_sass/layout/post.scss
+++ b/_sass/layout/post.scss
@@ -26,12 +26,23 @@
color: var(--text-color);
}
-img.preview-img {
+%preview-margin {
margin: 0;
- border-radius: 6px;
+}
+
+.preview-img {
+ @include align-center;
+ @extend %preview-margin;
&:not(.no-bg) {
- background: var(--preview-img-bg);
+ img.lazyloaded {
+ background: var(--img-bg);
+ }
+ }
+
+ img {
+ @extend %preview-margin;
+ @extend %img-rounded;
}
}
diff --git a/assets/js/dist/page.min.js b/assets/js/dist/page.min.js
index cd907220068..59cd096876d 100644
--- a/assets/js/dist/page.min.js
+++ b/assets/js/dist/page.min.js
@@ -3,4 +3,4 @@
* © 2019 Cotes Chung
* MIT Licensed
*/
-$(function(){$(window).scroll(()=>{50<$(this).scrollTop()&&"none"===$("#sidebar-trigger").css("display")?$("#back-to-top").fadeIn():$("#back-to-top").fadeOut()}),$("#back-to-top").click(()=>($("body,html").animate({scrollTop:0},800),!1))}),$(function(){$(".mode-toggle").click(t=>{t=$(t.target);(t.prop("tagName")==="button".toUpperCase()?t:t.parent()).blur(),flipMode()})});const ScrollHelper=function(){const t=$("body"),e="data-topbar-visible",o=$("#topbar-wrapper").outerHeight();let r=0,a=!1,l=!1;return{hideTopbar:()=>t.attr(e,!1),showTopbar:()=>t.attr(e,!0),addScrollUpTask:()=>{r+=1,a=a||!0},popScrollUpTask:()=>--r,hasScrollUpTask:()=>0