perf: optimizing DOM naming
This commit is contained in:
parent
31444f2458
commit
83c6af4438
|
@ -2,8 +2,8 @@
|
||||||
<span class="scroll-progress-bar"></span>
|
<span class="scroll-progress-bar"></span>
|
||||||
|
|
||||||
<% if (theme.pjax.enable === true) { %>
|
<% if (theme.pjax.enable === true) { %>
|
||||||
<span class="loading-progress-bar"></span>
|
<span class="pjax-progress-bar"></span>
|
||||||
<span class="loading-progress-icon">
|
<span class="pjax-progress-icon">
|
||||||
<i class="fas fa-circle-notch fa-spin"></i>
|
<i class="fas fa-circle-notch fa-spin"></i>
|
||||||
</span>
|
</span>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
|
@ -16,6 +16,11 @@ html, body {
|
||||||
font-size: $default-font-size;
|
font-size: $default-font-size;
|
||||||
line-height: $default-font-line-height;
|
line-height: $default-font-line-height;
|
||||||
|
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
width: 8px;
|
||||||
|
height: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
+keep-tablet() {
|
+keep-tablet() {
|
||||||
font-size: $default-font-size * 0.96;
|
font-size: $default-font-size * 0.96;
|
||||||
line-height: $default-font-line-height * 0.96;
|
line-height: $default-font-line-height * 0.96;
|
||||||
|
@ -39,7 +44,7 @@ html, body {
|
||||||
}
|
}
|
||||||
|
|
||||||
&::-webkit-scrollbar-thumb {
|
&::-webkit-scrollbar-thumb {
|
||||||
background: var(--scroll-bar-color);
|
background: var(--scrollbar-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
&::-webkit-scrollbar-track {
|
&::-webkit-scrollbar-track {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// ========================================================================================
|
// ========================================================================================
|
||||||
$header-height = 76px; // header height
|
$header-height = 76px; // header height
|
||||||
$header-shrink-height = $header-height * 0.72; // header shrink height
|
$header-shrink-height = $header-height * 0.72; // header shrink height
|
||||||
$scroll-progress-bar-height = 2.8px; // scroll progress bar height
|
$scroll-progress-bar-height = 2px; // scroll progress bar height
|
||||||
$main-content-width = 80%; // main content width (PC)
|
$main-content-width = 80%; // main content width (PC)
|
||||||
$main-content-width-tablet = 86%; // main content width (tablet)
|
$main-content-width-tablet = 86%; // main content width (tablet)
|
||||||
$main-content-width-mobile = 90%; // main content width (mobile)
|
$main-content-width-mobile = 90%; // main content width (mobile)
|
||||||
|
@ -71,12 +71,12 @@ $border-color = darken($background-color, 30%);
|
||||||
$selection-color = lighten($primary-color, 10%);
|
$selection-color = lighten($primary-color, 10%);
|
||||||
$shadow-color = rgba(0, 0, 0, 0.2);
|
$shadow-color = rgba(0, 0, 0, 0.2);
|
||||||
$shadow-hover-color = rgba(0, 0, 0, 0.28);
|
$shadow-hover-color = rgba(0, 0, 0, 0.28);
|
||||||
$scroll-bar-color = lighten($default-text-color, 20%);
|
$scrollbar-color = lighten($default-text-color, 20%);
|
||||||
$scroll-bar-bg-color = darken($background-color, 10%);
|
$scroll-bar-bg-color = darken($background-color, 10%);
|
||||||
$link-color = darken($default-text-color, 10%);
|
$link-color = darken($default-text-color, 10%);
|
||||||
$copyright-info-color = #CC0033;
|
$copyright-info-color = #CC0033;
|
||||||
$avatar-background-color = #0066CC;
|
$avatar-background-color = #0066CC;
|
||||||
$loading-progress-bar-color = linear-gradient(45deg, #ef0e18, #ff5f00, #eea40b, #1fe708, #00d6d6, #016bd7, #f300f3);
|
$pjax-progress-bar-color = linear-gradient(45deg, #ef0e18, #ff5f00, #eea40b, #1fe708, #00d6d6, #016bd7, #f300f3);
|
||||||
|
|
||||||
|
|
||||||
// ========================================================================================
|
// ========================================================================================
|
||||||
|
@ -94,12 +94,12 @@ $dark-border-color = lighten($dark-background-color, 20%);
|
||||||
$dark-selection-color = $selection-color;
|
$dark-selection-color = $selection-color;
|
||||||
$dark-shadow-color = rgba(128, 128, 128, 0.2);
|
$dark-shadow-color = rgba(128, 128, 128, 0.2);
|
||||||
$dark-shadow-hover-color = rgba(128, 128, 128, 0.28);
|
$dark-shadow-hover-color = rgba(128, 128, 128, 0.28);
|
||||||
$dark-scroll-bar-color = darken($dark-background-color, 30%);
|
$dark-scrollbar-color = darken($dark-background-color, 30%);
|
||||||
$dark-scroll-bar-bg-color = lighten($dark-background-color, 10%);
|
$dark-scroll-bar-bg-color = lighten($dark-background-color, 10%);
|
||||||
$dark-link-color = lighten($dark-default-text-color, 10%);
|
$dark-link-color = lighten($dark-default-text-color, 10%);
|
||||||
$dark-copyright-info-color = darken($copyright-info-color, 20%);
|
$dark-copyright-info-color = darken($copyright-info-color, 20%);
|
||||||
$dark-avatar-background-color = darken($avatar-background-color, 10%);
|
$dark-avatar-background-color = darken($avatar-background-color, 10%);
|
||||||
$dark-loading-progress-bar-color = linear-gradient(45deg, #ea404a, #ea722f, #e9a71f, #67e559, #18ecec, #1b85f1, #ee1dee);
|
$dark-pjax-progress-bar-color = linear-gradient(45deg, #ea404a, #ea722f, #e9a71f, #67e559, #18ecec, #1b85f1, #ee1dee);
|
||||||
|
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
|
@ -127,12 +127,12 @@ root-color(mode) {
|
||||||
--selection-color: mode == 'light' ? $selection-color : $dark-selection-color;
|
--selection-color: mode == 'light' ? $selection-color : $dark-selection-color;
|
||||||
--shadow-color: mode == 'light' ? $shadow-color : $dark-shadow-color;
|
--shadow-color: mode == 'light' ? $shadow-color : $dark-shadow-color;
|
||||||
--shadow-hover-color: mode == 'light' ? $shadow-hover-color : $dark-shadow-hover-color;
|
--shadow-hover-color: mode == 'light' ? $shadow-hover-color : $dark-shadow-hover-color;
|
||||||
--scroll-bar-color: mode == 'light' ? $scroll-bar-color : $dark-scroll-bar-color;
|
--scrollbar-color: mode == 'light' ? $scrollbar-color : $dark-scrollbar-color;
|
||||||
--scroll-bar-bg-color: mode == 'light' ? $scroll-bar-bg-color : $dark-scroll-bar-bg-color;
|
--scroll-bar-bg-color: mode == 'light' ? $scroll-bar-bg-color : $dark-scroll-bar-bg-color;
|
||||||
--link-color: mode == 'light' ? $link-color : $dark-link-color;
|
--link-color: mode == 'light' ? $link-color : $dark-link-color;
|
||||||
--copyright-info-color: mode == 'light' ? $copyright-info-color : $dark-copyright-info-color;
|
--copyright-info-color: mode == 'light' ? $copyright-info-color : $dark-copyright-info-color;
|
||||||
--avatar-background-color: mode == 'light' ? $avatar-background-color : $dark-avatar-background-color;
|
--avatar-background-color: mode == 'light' ? $avatar-background-color : $dark-avatar-background-color;
|
||||||
--loading-progress-bar-color : mode == 'light' ? $loading-progress-bar-color : $dark-loading-progress-bar-color;
|
--pjax-progress-bar-color : mode == 'light' ? $pjax-progress-bar-color : $dark-pjax-progress-bar-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,13 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: $z-index-9;
|
z-index: $z-index-9;
|
||||||
|
|
||||||
.loading-progress-bar {
|
.pjax-progress-bar {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
height: 1.8px;
|
height: 2px;
|
||||||
width: 0;
|
width: 0;
|
||||||
background: var(--loading-progress-bar-color);
|
background: var(--pjax-progress-bar-color);
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
z-index: $z-index-8;
|
z-index: $z-index-8;
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.loading-progress-icon {
|
.pjax-progress-icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
|
|
|
@ -7,8 +7,8 @@ KEEP.initUtils = () => {
|
||||||
pageTop_dom: document.querySelector('.page-main-content-top'),
|
pageTop_dom: document.querySelector('.page-main-content-top'),
|
||||||
firstScreen_dom: document.querySelector('.first-screen-container'),
|
firstScreen_dom: document.querySelector('.first-screen-container'),
|
||||||
scrollProgressBar_dom: document.querySelector('.scroll-progress-bar'),
|
scrollProgressBar_dom: document.querySelector('.scroll-progress-bar'),
|
||||||
loadingProgressBar_dom: document.querySelector('.loading-progress-bar'),
|
pjaxProgressBar_dom: document.querySelector('.pjax-progress-bar'),
|
||||||
loadingProgressCircle_dom: document.querySelector('.loading-progress-icon'),
|
pjaxProgressIcon_dom: document.querySelector('.pjax-progress-icon'),
|
||||||
|
|
||||||
innerHeight: window.innerHeight,
|
innerHeight: window.innerHeight,
|
||||||
loadingProgressBarTimer: null,
|
loadingProgressBarTimer: null,
|
||||||
|
@ -240,31 +240,31 @@ KEEP.initUtils = () => {
|
||||||
// loading progress bar start
|
// loading progress bar start
|
||||||
loadingProgressBarStart() {
|
loadingProgressBarStart() {
|
||||||
this.loadingProgressBarTimer && clearInterval(this.loadingProgressBarTimer);
|
this.loadingProgressBarTimer && clearInterval(this.loadingProgressBarTimer);
|
||||||
this.loadingProgressBar_dom.style.width = '0';
|
this.pjaxProgressBar_dom.style.width = '0';
|
||||||
this.scrollProgressBar_dom.classList.add('hide');
|
this.scrollProgressBar_dom.classList.add('hide');
|
||||||
this.loadingProgressCircle_dom.classList.add('show');
|
this.pjaxProgressIcon_dom.classList.add('show');
|
||||||
|
|
||||||
let width = 5;
|
let width = 5;
|
||||||
const maxWidth = 99;
|
const maxWidth = 99;
|
||||||
|
|
||||||
this.loadingProgressBar_dom.classList.add('show');
|
this.pjaxProgressBar_dom.classList.add('show');
|
||||||
this.loadingProgressBar_dom.style.width = width + '%';
|
this.pjaxProgressBar_dom.style.width = width + '%';
|
||||||
|
|
||||||
this.loadingProgressBarTimer = setInterval(() => {
|
this.loadingProgressBarTimer = setInterval(() => {
|
||||||
width += 5;
|
width += 5;
|
||||||
if (width > maxWidth) width = maxWidth;
|
if (width > maxWidth) width = maxWidth;
|
||||||
this.loadingProgressBar_dom.style.width = width + '%';
|
this.pjaxProgressBar_dom.style.width = width + '%';
|
||||||
}, 100);
|
}, 100);
|
||||||
},
|
},
|
||||||
|
|
||||||
// loading progress bar end
|
// loading progress bar end
|
||||||
loadingProgressBarEnd() {
|
loadingProgressBarEnd() {
|
||||||
this.loadingProgressBarTimer && clearInterval(this.loadingProgressBarTimer);
|
this.loadingProgressBarTimer && clearInterval(this.loadingProgressBarTimer);
|
||||||
this.loadingProgressBar_dom.style.width = '100%';
|
this.pjaxProgressBar_dom.style.width = '100%';
|
||||||
|
|
||||||
const tempTimeout = setTimeout(() => {
|
const tempTimeout = setTimeout(() => {
|
||||||
this.loadingProgressBar_dom.classList.remove('show');
|
this.pjaxProgressBar_dom.classList.remove('show');
|
||||||
this.loadingProgressCircle_dom.classList.remove('show');
|
this.pjaxProgressIcon_dom.classList.remove('show');
|
||||||
this.scrollProgressBar_dom.classList.remove('hide');
|
this.scrollProgressBar_dom.classList.remove('hide');
|
||||||
clearTimeout(tempTimeout);
|
clearTimeout(tempTimeout);
|
||||||
}, 200);
|
}, 200);
|
||||||
|
|
Loading…
Reference in New Issue