💄 Add new tool buttons in page side.

This commit is contained in:
凡梦星尘 2022-09-25 21:40:36 +08:00
parent 523c12f0ec
commit 4037ea0d68
16 changed files with 1191 additions and 46 deletions

View File

@ -12,7 +12,7 @@
z-index: $zindex-5; z-index: $zindex-5;
} }
@import 'back-to-top'; @import 'tool-buttons';
@import 'reading-progress'; @import 'reading-progress';
@import 'post'; @import 'post';

View File

@ -1,3 +1,3 @@
.mermaid { .post-block .post-body .mermaid {
background: var(--highlight-foreground); background: var(--highlight-foreground);
} }

View File

@ -1,6 +1,49 @@
.tool-buttons {
@include sidebar-toggle();
background: var(--body-bg-color);
bottom: 55px;
z-index: 100;
filter: alpha(opacity=0);
font-size: 12px;
.button {
display: block;
margin-bottom: 5px;
width: 36px;
height: 36px;
border-radius: 5px;
background-color: $tool-btn-bg;
color: $tool-btn-color;
text-align: center;
font-size: $font-size-larger;
line-height: 35px;
padding: 0;
outline: 0;
border: none;
text-transform: none;
cursor: pointer;
opacity: $tool-btn-opacity;
touch-action: manipulation;
&:hover {
color: $tool-btn-hover-fore-color;
opacity: $tool-btn-opacity-hover;
}
}
.goto-comments {
display: none;
}
.goto-comments-on {
display: block;
}
}
@if $back2top_enable { @if $back2top_enable {
.back-to-top { .back-to-top {
font-size: $b2t-font-size; font-size: $font-size-smaller;
@if not $back2top_scrollpercent { @if not $back2top_scrollpercent {
span { span {

View File

@ -29,6 +29,16 @@
font-size: $font-size-smallest; font-size: $font-size-smallest;
} }
.google-translate {
display: flex;
justify-content: center;
i {
font-size: $font-size-larger;
margin: auto 0;
}
}
@if $footer_vendors_enable { @if $footer_vendors_enable {
.vendors-list { .vendors-list {
a { a {

View File

@ -283,6 +283,13 @@ $site-state-item-name-color : inherit;
// Components // Components
// -------------------------------------------------- // --------------------------------------------------
// Tool buttons
$tool-btn-bg : $black-deep;
$tool-btn-color : white;
$tool-btn-hover-fore-color : $orange;
$tool-btn-opacity : .8;
$tool-btn-opacity-hover : 1;
// Back to top // Back to top
$b2t-opacity : .8; $b2t-opacity : .8;
$b2t-opacity-hover : 1; $b2t-opacity-hover : 1;

892
assets/css/gt.scss Normal file
View File

@ -0,0 +1,892 @@
:root {
--gt-blue: #2640b2;
--gt-border: #d1d5db;
}
@keyframes "goog-te-spinner-rotator" {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(270deg);
}
}
@keyframes "goog-te-spinner-dash" {
0% {
stroke-dashoffset: 187;
}
50% {
stroke-dashoffset: 46.75;
transform: rotate(135deg);
}
100% {
stroke-dashoffset: 187;
transform: rotate(450deg);
}
}
.goog-te-banner-frame {
left: 0px;
top: 0px;
height: 39px;
width: 100%;
z-index: 10000001;
position: fixed;
border: none;
border-bottom: 1px solid #6b90da;
margin: 0;
box-shadow: 0 0 8px 1px #999999;
_position: absolute;
}
.goog-te-menu-frame {
z-index: 10000002;
position: fixed;
box-shadow: 0.5rem 0.875rem 2.375rem rgba(39, 44, 49, 0.06), 0.0625rem 0.1875rem 0.5rem rgba(39, 44, 49, 0.03);
_position: absolute;
}
.goog-te-ftab-frame {
z-index: 10000000;
border: none;
margin: 0;
}
.goog-te-gadget {
font-family: arial;
font-size: 11px;
color: #666;
white-space: nowrap;
display: inline-flex;
img {
vertical-align: middle;
border: none;
display: inline-block;
}
.goog-te-combo {
margin: 4px 0;
}
div:first-child {
margin: 0 10px;
}
}
.goog-te-gadget-simple {
background-color: #fff;
border-left: 1px solid #d5d5d5;
border-top: 1px solid #9b9b9b;
border-bottom: 1px solid #e8e8e8;
border-right: 1px solid #d5d5d5;
font-size: 10pt;
display: inline-block;
padding-top: 1px;
padding-bottom: 2px;
cursor: pointer;
zoom: 1;
*display: inline;
.goog-te-menu-value {
color: #000;
span {
text-decoration: none;
}
}
}
.goog-te-gadget-icon {
margin-left: 2px;
margin-right: 2px;
width: 19px;
height: 19px;
border: none;
vertical-align: middle;
}
.goog-te-combo {
margin-left: 4px;
margin-right: 4px;
vertical-align: baseline;
*vertical-align: middle;
font-family: arial;
font-size: 10pt;
}
.goog-logo-link {
font-size: 12px;
font-weight: bold;
color: #444;
text-decoration: none;
margin: 0 5px;
border-bottom: 0;
&:link {
font-size: 12px;
font-weight: bold;
color: #444;
text-decoration: none;
}
&:visited {
font-size: 12px;
font-weight: bold;
color: #444;
text-decoration: none;
}
&:hover {
font-size: 12px;
font-weight: bold;
color: #444;
text-decoration: none;
}
&:active {
font-size: 12px;
font-weight: bold;
color: #444;
text-decoration: none;
}
}
.goog-te-banner {
.goog-logo-link {
display: block;
margin: 0px 10px;
padding-top: 2px;
padding-left: 4px;
}
* {
font-family: arial;
font-size: 10pt;
}
margin: 0;
background-color: #fff;
overflow: hidden;
img {
border: none;
}
table {
tbody {
tr {
td {
&:nth-child(2) {
display: none;
}
}
}
}
}
}
.goog-close-link {
display: block;
margin: 0px 10px;
}
.goog-te-ftab {
* {
font-family: arial;
font-size: 10pt;
}
margin: 0px;
background-color: #fff;
white-space: nowrap;
}
.goog-te-menu {
* {
font-family: arial;
font-size: 10pt;
}
background-color: #ffffff;
text-decoration: none;
border: 2px solid #c3d9ff;
overflow-y: scroll;
overflow-x: hidden;
position: absolute;
left: 0;
top: 0;
}
.goog-te-menu2 {
* {
font-family: arial;
font-size: 10pt;
}
background-color: #ffffff;
text-decoration: none;
overflow: hidden;
padding: 4px;
border: 1px solid var(--gt-border);
border-radius: 4px;
}
.goog-te-balloon {
* {
font-family: arial;
font-size: 10pt;
}
background-color: #ffffff;
overflow: hidden;
padding: 8px;
border: none;
border-radius: 10px;
img {
border: none;
}
}
.goog-te-banner-content {
color: #000;
img {
vertical-align: middle;
}
}
.goog-te-banner-info {
color: #666;
vertical-align: top;
margin-top: 0px;
font-size: 7pt;
}
.goog-te-banner-margin {
width: 8px;
}
.goog-te-button {
div {
border: 1px solid var(--gt-border);
height: 20px;
}
button {
background: transparent;
border: none;
cursor: pointer;
height: 20px;
overflow: hidden;
margin: 0;
vertical-align: top;
white-space: nowrap;
&:active {
background: none repeat scroll 0 0 #cccccc;
}
}
}
.goog-te-ftab-link {
text-decoration: none;
font-weight: bold;
font-size: 10pt;
border: 1px outset #888;
padding: 6px 10px;
white-space: nowrap;
position: absolute;
left: 0px;
top: 0px;
img {
margin-left: 2px;
margin-right: 2px;
width: 19px;
height: 19px;
border: none;
vertical-align: middle;
}
span {
text-decoration: underline;
margin-left: 2px;
margin-right: 2px;
vertical-align: middle;
}
}
.goog-float-top {
.goog-te-ftab-link {
padding: 2px 2px;
border-top-width: 0px;
}
}
.goog-float-bottom {
.goog-te-ftab-link {
padding: 2px 2px;
border-bottom-width: 0px;
}
}
.goog-te-menu-value {
text-decoration: none;
color: var(--gt-blue);
white-space: nowrap;
margin-left: 4px;
margin-right: 4px;
span {
text-decoration: underline;
&::after {
content: "";
}
}
img {
margin-left: 2px;
margin-right: 2px;
display: none;
}
}
.goog-te-menu-item {
padding: 3px;
text-decoration: none;
color: var(--gt-blue);
background: #ffffff;
&:link {
color: var(--gt-blue);
background: #ffffff;
}
&:visited {
color: #551a8b;
}
&:hover {
background: #c3d9ff;
}
&:active {
color: var(--gt-blue);
}
}
.goog-te-menu2-colpad {
width: 16px;
}
.goog-te-menu2-separator {
margin: 6px 0;
height: 1px;
background-color: var(--gt-border);
overflow: hidden;
}
.goog-te-menu2-item {
div {
padding: 4px;
color: var(--gt-blue);
background: #ffffff;
}
.indicator {
display: none;
}
text-decoration: none;
&:link {
div {
color: var(--gt-blue);
background: #ffffff;
}
}
&:visited {
div {
color: var(--gt-blue);
background: #ffffff;
}
}
&:active {
div {
color: var(--gt-blue);
background: #ffffff;
}
}
&:hover {
div {
color: #ffffff;
background: #3366cc;
border-radius: 2px;
}
}
}
.goog-te-menu2-item-selected {
div {
padding: 4px;
color: #000;
font-weight: bold;
}
.indicator {
display: auto;
}
.text {
padding-left: 4px;
padding-right: 4px;
}
text-decoration: none;
&:link {
div {
color: #000;
font-weight: bold;
}
}
&:visited {
div {
color: #000;
font-weight: bold;
}
}
&:hover {
div {
color: #000;
font-weight: bold;
}
}
&:active {
div {
color: #000;
font-weight: bold;
}
}
}
.goog-te-balloon-frame {
background-color: #ffffff;
border: 1px solid #6b90da;
box-shadow: 0.5rem 0.875rem 2.375rem rgba(39, 44, 49, 0.06), 0.0625rem 0.1875rem 0.5rem rgba(39, 44, 49, 0.03);
border-radius: 8px;
}
.goog-te-balloon-text {
margin-top: 6px;
}
.goog-te-balloon-zippy {
margin-top: 6px;
white-space: nowrap;
* {
vertical-align: middle;
}
.minus {
background-image: url(//www.google.com/images/zippy_minus_sm.gif);
}
.plus {
background-image: url(//www.google.com/images/zippy_plus_sm.gif);
}
span {
color: #00c;
text-decoration: underline;
cursor: pointer;
margin: 0 4px;
}
}
.goog-te-balloon-form {
margin: 6px 0 0 0;
form {
margin: 0;
textarea {
margin-bottom: 4px;
width: 100%;
}
}
}
.goog-te-balloon-footer {
margin: 6px 0 4px 0;
}
.goog-te-spinner-pos {
z-index: 1000;
position: fixed;
transition-delay: 0.6s;
left: -1000px;
top: -1000px;
}
.goog-te-spinner-animation {
background: #ccc;
display: flex;
align-items: center;
justify-content: center;
width: 104px;
height: 104px;
border-radius: 50px;
background: #fff url(//www.gstatic.com/images/branding/product/2x/translate_24dp.png) 50% 50% no-repeat;
transition: all 0.6s ease-in-out;
transform: scale(0.4);
opacity: 0;
}
.goog-te-spinner-animation-show {
transform: scale(0.5);
opacity: 1;
}
.goog-te-spinner {
margin: 2px 0 0 2px;
animation: goog-te-spinner-rotator 1.4s linear infinite;
}
.goog-te-spinner-path {
stroke-dasharray: 187;
stroke-dashoffset: 0;
stroke: #4285f4;
transform-origin: center;
animation: goog-te-spinner-dash 1.4s ease-in-out infinite;
}
#goog-gt-tt {
color: #222;
background-color: #ffffff;
border: 1px solid #eee;
box-shadow: 0 4px 16px rgba(0,0,0,.2);
display: none;
font-family: arial;
font-size: 10pt;
width: 420px;
padding: 12px;
position: absolute;
z-index: 10000;
.original-text {
clear: both;
font-size: 10pt;
position: relative;
text-align: justify;
width: 100%;
}
.title {
color: #999;
font-family: arial,sans-serif;
margin: 4px 0;
text-align: left;
}
.close-button {
display: none;
}
.logo {
float: left;
margin: 0px;
}
.activity-links {
display: inline-block;
}
.started-activity-container {
display: none;
width: 100%;
}
.activity-root {
margin-top: 20px;
}
.left {
float: left;
}
.right {
float: right;
}
.bottom {
min-height: 15px;
position: relative;
height: 1%;
}
.status-message {
background: linear-gradient(top,#29910d 0%,#20af0e 100%);
background: #29910d;
border-radius: 4px;
box-shadow: inset 0px 2px 2px #1e6609;
color: white;
font-size: 9pt;
font-weight: bolder;
margin-top: 12px;
padding: 6px;
text-shadow: 1px 1px 1px #1e6609;
}
.activity-link {
color: #1155cc;
cursor: pointer;
font-family: arial;
font-size: 11px;
margin-right: 15px;
text-decoration: none;
}
textarea {
font-family: arial;
resize: vertical;
width: 100%;
margin-bottom: 10px;
border-radius: 1px;
border: 1px solid #d9d9d9;
border-top: 1px solid silver;
font-size: 13px;
height: auto;
overflow-y: auto;
padding: 1px;
&:focus {
box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
border: 1px solid #4d90fe;
outline: none;
}
}
.activity-cancel {
margin-right: 10px;
}
.translate-form {
min-height: 25px;
vertical-align: middle;
padding-top: 8px;
.activity-form {
margin-bottom: 5px;
margin-bottom: 0px;
input {
display: inline-block;
min-width: 54px;
*min-width: 70px;
border: 1px solid #dcdcdc;
border: 1px solid rgba(0,0,0,0.1);
text-align: center;
color: #444;
font-size: 11px;
font-weight: bold;
height: 27px;
outline: 0;
padding: 0 8px;
vertical-align: middle;
line-height: 27px;
margin: 0 16px 0 0;
box-shadow: 0 1px 2px rgba(0,0,0,.1);
border-radius: 2px;
transition: all 0.218s;
background-color: #f5f5f5;
background-image: linear-gradient(top,#f5f5f5,#f1f1f1);
-webkit-user-select: none;
-moz-user-select: none;
cursor: default;
&:hover {
border: 1px solid #c6c6c6;
color: #222;
transition: all 0.0s;
background-color: #f8f8f8;
background-image: linear-gradient(top,#f8f8f8,#f1f1f1);
border-color: #3079ed;
}
&:active {
border: 1px solid #c6c6c6;
color: #333;
background-color: #f6f6f6;
background-image: linear-gradient(top,#f6f6f6,#f1f1f1);
border-color: #3079ed;
}
&:focus {
#goog-gt-tt {
.translate-form {
.activity-form {
input.focus {
#goog-gt-tt {
.translate-form {
.activity-form {
input {
&:active {
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5);
}
}
}
}
}
}
}
}
}
&:active {
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5);
}
outline: none;
border: 1px solid #4d90fe;
z-index: 4 !important;
border-color: #3079ed;
}
&.focus {
&:active {
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5);
}
}
}
input.focus {
outline: none;
border: 1px solid #4d90fe;
z-index: 4 !important;
border-color: #3079ed;
}
input.selected {
background-color: #eeeeee;
background-image: linear-gradient(top,#eeeeee,#e0e0e0);
box-shadow: inset 0px 1px 2px rgba(0,0,0,0.1);
border: 1px solid #ccc;
color: #333;
}
input.activity-submit {
color: white;
border-color: #3079ed;
background-color: #4d90fe;
background-image: linear-gradient(top,#4d90fe,#4787ed);
&:hover {
#goog-gt-tt {
.translate-form {
.activity-form {
input.activity-submit {
&:focus {
border-color: #3079ed;
background-color: #357ae8;
background-image: linear-gradient(top,#4d90fe,#357ae8);
}
}
}
}
}
box-shadow: inset 0 0 0 1px #fff,0px 1px 1px rgba(0,0,0,0.1);
border-color: #3079ed;
}
&:focus {
border-color: #3079ed;
}
&:active {
border-color: #3079ed;
}
}
input.activity-submit.focus {
#goog-gt-tt {
.translate-form {
.activity-form {
input.activity-submit {
&:active {
border-color: #3079ed;
background-color: #357ae8;
background-image: linear-gradient(top,#4d90fe,#357ae8);
}
}
}
}
}
border-color: #3079ed;
}
}
}
.gray {
color: #999;
font-family: arial,sans-serif;
}
.alt-helper-text {
color: #999;
font-size: 11px;
font-family: arial,sans-serif;
margin: 15px 0px 5px 0px;
}
.alt-error-text {
color: #800;
display: none;
font-size: 9pt;
}
.alt-menu.goog-menu {
background: #ffffff;
border: 1px solid #dddddd;
box-shadow: 0px 2px 4px #99a;
min-width: 0;
outline: none;
padding: 0;
position: absolute;
z-index: 2000;
}
.alt-menu {
.goog-menuitem {
cursor: pointer;
padding: 2px 5px 5px;
margin-right: 0px;
border-style: none;
h1 {
font-size: 100%;
font-weight: bold;
margin: 4px 0px;
}
strong {
color: #345aad;
}
}
div.goog-menuitem {
&:hover {
background: #ddd;
}
}
}
.goog-submenu-arrow {
text-align: right;
position: absolute;
right: 0;
left: auto;
}
.goog-menuitem-rtl {
.goog-submenu-arrow {
text-align: left;
position: absolute;
left: 0;
right: auto;
}
}
.gt-hl-text {
background-color: #f1ea00;
border-radius: 4px;
box-shadow: rgba(0,0,0,.5) 3px 3px 4px;
box-sizing: border-box;
color: #f1ea00;
cursor: pointer;
margin: -2px -2px -2px -3px;
padding: 2px 2px 2px 3px;
position: relative;
}
.trans-target-highlight {
background-color: #f1ea00;
border-radius: 4px;
box-shadow: rgba(0,0,0,.5) 3px 3px 4px;
box-sizing: border-box;
color: #f1ea00;
cursor: pointer;
margin: -2px -2px -2px -3px;
padding: 2px 2px 2px 3px;
position: relative;
color: #222;
}
.gt-hl-layer {
color: white;
position: absolute !important;
}
.trans-target {
background-color: #c9d7f1;
border-radius: 4px 4px 0px 0px;
box-shadow: rgba(0,0,0,.5) 3px 3px 4px;
box-sizing: border-box;
cursor: pointer;
margin: -2px -2px -2px -3px;
padding: 2px 2px 3px 3px;
position: relative;
.trans-target-highlight {
background-color: #c9d7f1;
border-radius: 4px 4px 0px 0px;
box-shadow: rgba(0,0,0,.5) 3px 3px 4px;
box-sizing: border-box;
cursor: pointer;
margin: -2px -2px -2px -3px;
padding: 2px 2px 3px 3px;
position: relative;
}
}
.trans-edit {
background-color: transparent;
border: 1px solid #4d90fe;
border-radius: 0em;
margin: -2px;
padding: 1px;
}
.gt-trans-highlight-l {
border-left: 2px solid red;
margin-left: -2px;
}
.gt-trans-highlight-r {
border-right: 2px solid red;
margin-right: -2px;
}
#alt-input {
padding: 2px;
}
#alt-input-text {
font-size: 11px;
padding: 2px 2px 3px;
margin: 0;
background-color: #fff;
color: #333;
border: 1px solid #d9d9d9;
border-top: 1px solid #c0c0c0;
display: inline-block;
vertical-align: top;
height: 21px;
box-sizing: border-box;
&:hover {
border: 1px solid #b9b9b9;
border-top: 1px solid #a0a0a0;
box-shadow: inset 0px 1px 2px rgba(0,0,0,0.1);
}
&:focus {
box-shadow: inset 0px 1px 2px rgba(0,0,0,0.3);
outline: none;
border: 1px solid #4d90fe;
}
}
#alt-input-submit {
font-size: 11px;
padding: 2px 6px 3px;
margin: 0 0 0 2px;
height: 21px;
}
}
div#goog-gt-tt {
padding: 10px 14px;
}
.gt-hl-layer {
clear: both;
font-size: 10pt;
position: relative;
text-align: justify;
width: 100%;
}
.goog-text-highlight {
background-color: #c9d7f1;
box-shadow: 2px 2px 4px #9999aa;
box-sizing: border-box;
position: relative;
}

View File

@ -45,6 +45,7 @@ NexT.boot.refresh = function() {
if(NexT.CONFIG.page.comments) { if(NexT.CONFIG.page.comments) {
NexT.utils.initCommontesDispaly(); NexT.utils.initCommontesDispaly();
NexT.utils.registerCommonSwitch(); NexT.utils.registerCommonSwitch();
NexT.utils.domAddClass('#goto-comments', 'goto-comments-on');
} else { } else {
NexT.utils.hideCommontes(); NexT.utils.hideCommontes();
} }

View File

@ -0,0 +1,173 @@
(function () {
var gtConstEvalStartTime = new Date();
var h = this || self,
l = /^[\w+/_-]+[=]{0,2}$/,
m = null;
function n(a) {
return (a = a.querySelector && a.querySelector("script[nonce]")) && (a = a.nonce || a.getAttribute("nonce")) &&
l.test(a) ? a : ""
}
function p(a, b) {
function c() {}
c.prototype = b.prototype;
a.i = b.prototype;
a.prototype = new c;
a.prototype.constructor = a;
a.h = function (g, f, k) {
for (var e = Array(arguments.length - 2), d = 2; d < arguments.length; d++) e[d - 2] = arguments[d];
return b.prototype[f].apply(g, e)
}
}
function q(a) {
return a
};
function r(a) {
if (Error.captureStackTrace) Error.captureStackTrace(this, r);
else {
var b = Error().stack;
b && (this.stack = b)
}
a && (this.message = String(a))
}
p(r, Error);
r.prototype.name = "CustomError";
function u(a, b) {
a = a.split("%s");
for (var c = "", g = a.length - 1, f = 0; f < g; f++) c += a[f] + (f < b.length ? b[f] : "%s");
r.call(this, c + a[g])
}
p(u, r);
u.prototype.name = "AssertionError";
function v(a, b) {
throw new u("Failure" + (a ? ": " + a : ""), Array.prototype.slice.call(arguments, 1));
};
var w;
function x(a, b) {
this.g = b === y ? a : ""
}
x.prototype.toString = function () {
return this.g + ""
};
var y = {};
function z(a) {
var b = document.getElementsByTagName("head")[0];
b || (b = document.body.parentNode.appendChild(document.createElement("head")));
b.appendChild(a)
}
function _loadJs(a) {
var b = document;
var c = "SCRIPT";
"application/xhtml+xml" === b.contentType && (c = c.toLowerCase());
c = b.createElement(c);
c.type = "text/javascript";
c.charset = "UTF-8";
if (void 0 === w) {
b = null;
var g = h.trustedTypes;
if (g && g.createPolicy) {
try {
b = g.createPolicy("goog#html", {
createHTML: q,
createScript: q,
createScriptURL: q
})
} catch (t) {
h.console && h.console.error(t.message)
}
w = b
} else w = b
}
a = (b = w) ? b.createScriptURL(a) : a;
a = new x(a, y);
a: {
try {
var f = c && c.ownerDocument,
k = f && (f.defaultView || f.parentWindow);
k = k || h;
if (k.Element && k.Location) {
var e = k;
break a
}
} catch (t) {}
e = null
}
if (e && "undefined" != typeof e.HTMLScriptElement && (!c || !(c instanceof e.HTMLScriptElement) && (c instanceof e
.Location || c instanceof e.Element))) {
e = typeof c;
if ("object" == e && null != c || "function" == e) try {
var d = c.constructor.displayName || c.constructor.name || Object.prototype.toString.call(c)
} catch (t) {
d = "<object could not be stringified>"
} else d = void 0 === c ? "undefined" : null === c ? "null" : typeof c;
v("Argument is not a %s (or a non-Element, non-Location mock); got: %s",
"HTMLScriptElement", d)
}
a instanceof x && a.constructor === x ? d = a.g : (d = typeof a, v(
"expected object of type TrustedResourceUrl, got '" + a + "' of type " + ("object" != d ? d : a ?
Array.isArray(a) ? "array" : d : "null")), d = "type_error:TrustedResourceUrl");
c.src = d;
(d = c.ownerDocument && c.ownerDocument.defaultView) && d != h ? d = n(d.document) : (null === m && (m = n(
h.document)), d = m);
d && c.setAttribute("nonce", d);
z(c)
}
function _loadCss(a) {
var b = document.createElement("link");
b.type = "text/css";
b.rel = "stylesheet";
b.charset = "UTF-8";
b.href = a;
z(b)
}
function _isNS(a) {
a = a.split(".");
for (var b = window, c = 0; c < a.length; ++c)
if (!(b = b[a[c]])) return !1;
return !0
}
function _setupNS(a) {
a = a.split(".");
for (var b = window, c = 0; c < a.length; ++c) b.hasOwnProperty ? b.hasOwnProperty(a[c]) ? b = b[a[c]] : b =
b[a[c]] = {} : b = b[a[c]] || (b[a[c]] = {});
return b
}
window.addEventListener && "undefined" == typeof document.readyState && window.addEventListener(
"DOMContentLoaded",
function () {
document.readyState = "complete"
}, !1);
if (_isNS('google.translate.Element')) {
return
}(function () {
var c = _setupNS('google.translate._const');
c._cest = gtConstEvalStartTime;
gtConstEvalStartTime = undefined;
c._cl = navigator.language || navigator.userLanguage;
c._cuc = 'googleTranslateElementInit';
c._cac = '';
c._cam = '';
c._ctkk = '449649.3822363247';
var h = 'translate.googleapis.com';
var s = (true ? 'https' : window.location.protocol == 'https:' ? 'https' : 'http') + '://';
var b = s + h;
c._pah = h;
c._pas = s;
// c._pbi = b + '/translate_static/img/te_bk.gif';
c._pbi = '';
c._pci = b + '/translate_static/img/te_ctrl3.gif';
c._pli = b + '/translate_static/img/loading.gif';
c._plla = h + '/translate_a/l';
c._pmi = b + '/translate_static/img/mini_google.png';
c._ps = window.translateelement_styles;
c._puh = 'translate.google.cn';
_loadCss(c._ps);
_loadJs(b + `/translate_static/js/element/main_${navigator.language || navigator.userLanguage}.js`);
})();
})();
function googleTranslateElementInit(){
new google.translate.TranslateElement({
includedLanguages: 'zh-CN,zh-TW,en,ru',
autoDisplay:false
},'google_translate_element');
}

View File

@ -23,6 +23,15 @@ HTMLElement.prototype.wrap = function(wrapper) {
NexT.utils = { NexT.utils = {
domAddClass: function(selector, cls) {
const doms = document.querySelectorAll(selector);
if (doms) {
doms.forEach(dom => {
dom.classList.add(cls);
});
}
},
calSiteInfo: function() { calSiteInfo: function() {
const runtimeCount = document.getElementById('runTimes'); const runtimeCount = document.getElementById('runTimes');
if (runtimeCount) { if (runtimeCount) {
@ -276,8 +285,10 @@ NexT.utils = {
const contentHeight = document.body.scrollHeight - window.innerHeight; const contentHeight = document.body.scrollHeight - window.innerHeight;
const scrollPercent = contentHeight > 0 ? Math.min(100 * window.scrollY / contentHeight, 100) : 0; const scrollPercent = contentHeight > 0 ? Math.min(100 * window.scrollY / contentHeight, 100) : 0;
if (backToTop) { if (backToTop) {
backToTop.classList.toggle('back-to-top-on', Math.round(scrollPercent) >= 5); const scrollPercentRound = Math.round(scrollPercent)
backToTop.querySelector('span').innerText = Math.round(scrollPercent) + '%'; const isShow = scrollPercentRound >= 5;
backToTop.classList.toggle('back-to-top-on', isShow);
backToTop.querySelector('span').innerText = scrollPercentRound + '%';
} }
if (readingProgressBar) { if (readingProgressBar) {
readingProgressBar.style.setProperty('--progress', scrollPercent.toFixed(2) + '%'); readingProgressBar.style.setProperty('--progress', scrollPercent.toFixed(2) + '%');

View File

@ -45,8 +45,6 @@ RSSLable:
other: "RSS Subscribe" other: "RSS Subscribe"
CCLinkTitle: CCLinkTitle:
other: "Creative Commons" other: "Creative Commons"
BackTopLabel:
other: "Top"
TagsCounterTitle: TagsCounterTitle:
zero: No tags zero: No tags
@ -169,3 +167,9 @@ DateSuffix:
hour: " Hour Ago" hour: " Hour Ago"
min: " Min Ago" min: " Min Ago"
just: "Just" just: "Just"
ToolBtns:
comment: "Go to Comment"
theme: "Change Theme"
lang: "Multilingual translation"
backTop: "Back to Top"

View File

@ -46,8 +46,6 @@ RSSLable:
other: RSS 订阅 other: RSS 订阅
CCLinkTitle: CCLinkTitle:
other: 共享知识 other: 共享知识
BackTopLabel:
other: 返回顶部
TagsCounterTitle: TagsCounterTitle:
zero: 暂无标签 zero: 暂无标签
@ -170,3 +168,9 @@ DateSuffix:
hour: " 小时前" hour: " 小时前"
min: " 分钟前" min: " 分钟前"
just: "刚刚" just: "刚刚"
ToolBtns:
comment: "直达评论"
theme: "深浅模式切换"
lang: "多语言翻译"
backTop: "返回顶部"

View File

@ -3,6 +3,7 @@
{{- define "main_inner_class" }}flinks posts-expand{{- end }} {{- define "main_inner_class" }}flinks posts-expand{{- end }}
{{ define "main" }} {{ define "main" }}
<div class="flinks-block"> <div class="flinks-block">
<h1 class="flinks-block-title">{{ .Title }}</h1> <h1 class="flinks-block-title">{{ .Title }}</h1>
<div class="flinks-lists"> <div class="flinks-lists">
@ -30,5 +31,4 @@
<div class="flinks-page-desc">{{ .Content }}</div> <div class="flinks-page-desc">{{ .Content }}</div>
</div> </div>
{{ end }} {{ end }}

View File

@ -5,7 +5,7 @@
{{- $fc := .active }} {{- $fc := .active }}
{{- $sc := "" }} {{- $sc := "" }}
{{- $sn := "" }} {{- $sn := "" }}
<div class="post-comments"> <div id="comments" class="post-comments">
<div class="comment-head"> <div class="comment-head">
<div class="comment-headline"> <div class="comment-headline">
<i class="fas fa-comments fa-fw"></i> <i class="fas fa-comments fa-fw"></i>

View File

@ -1,4 +1,10 @@
{{- $ft := .Site.Params.footer }} {{- $ft := .Site.Params.footer }}
{{ if $ft.translate }}
<div class="google-translate">
<i class="fa fa-language"></i>
<div id="google_translate_element"></div>
</div>
{{ end }}
<div class="copyright"> <div class="copyright">
&copy; &copy;
<span itemprop="copyrightYear"> <span itemprop="copyrightYear">
@ -18,36 +24,6 @@
</span> </span>
<span class="author" itemprop="copyrightHolder">{{ $ft.copyright | default .Site.Params.author }}</span> <span class="author" itemprop="copyrightHolder">{{ $ft.copyright | default .Site.Params.author }}</span>
</div> </div>
{{/* TODO
<!--
{{- if config.symbols_count_time.total_symbols or config.symbols_count_time.total_time }}
<div class="wordcount">
{{- if config.symbols_count_time.total_symbols }}
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-chart-line"></i>
</span>
{{- if .Site.Params.symbols_count_time.item_text_total }}
<span>{{ __('symbols_count_time.count_total') + __('symbol.colon') }}</span>
{{- end }}
<span title="{{ __('symbols_count_time.count_total') }}">{{ symbolsCountTotal(site) }}</span>
</span>
{{- end }}
{{- if config.symbols_count_time.total_time }}
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-coffee"></i>
</span>
{{- if .Site.Params.symbols_count_time.item_text_total }}
<span>{{ __('symbols_count_time.time_total') }} &asymp;</span>
{{- end }}
<span title="{{ __('symbols_count_time.time_total') }}">{{ symbolsTimeTotal(site, config.symbols_count_time.awl, config.symbols_count_time.wpm, __('symbols_count_time.time_minutes')) }}</span>
</span>
{{- end }}
</div>
{{- end }}
-->
*/}}
{{- with .Site.Params.busuanzi }} {{- with .Site.Params.busuanzi }}
{{- if .enable }} {{- if .enable }}
<div class="busuanzi-count"> <div class="busuanzi-count">

View File

@ -61,8 +61,19 @@
{{- $search := resources.Get "js/third-party/search/algolia.js" }} {{- $search := resources.Get "js/third-party/search/algolia.js" }}
{{- $nextjs = $nextjs | append $search }} {{- $nextjs = $nextjs | append $search }}
{{ end }} {{ end }}
{{ if .Site.Params.footer.translate }}
{{- $gt := resources.Get "js/third-party/others/google-translate.js" }}
{{- $nextjs = $nextjs | append $gt }}
{{ $gtCss := resources.Get "css/gt.scss" }}
{{ $style := $gtCss | resources.ToCSS | minify }}
<script type="text/javascript">
window.translateelement_styles = "{{- $style.RelPermalink -}}";
</script>
{{ end }}
{{- $nextjs = $nextjs | resources.Concat "js/main.js"}} {{- $nextjs = $nextjs | resources.Concat "js/main.js"}}
{{ if hugo.IsProduction }} {{ if hugo.IsProduction }}
{{- $nextjs = $nextjs | minify | fingerprint }} {{- $nextjs = $nextjs | minify | fingerprint }}
{{ end }} {{ end }}
<script type="text/javascript" src="{{ $nextjs.RelPermalink }}" defer></script> <script type="text/javascript" src="{{ $nextjs.RelPermalink }}" defer></script>

View File

@ -1,9 +1,22 @@
<div class="tool-buttons" >
<a id="goto-comments" class="button goto-comments" href="#comments" title="{{ T "ToolBtns.comment" }}">
<i class="fas fa-comments"></i>
</a>
<div class="button" title="{{ T "ToolBtns.theme" }}">
<i class="fas fa-adjust"></i>
</div>
{{ if .Site.Params.footer.translate }}
<a class="button" href="#google_translate_element" title="{{ T "ToolBtns.lang" }}">
<i class="fas fa-globe"></i>
</a>
{{ end }}
{{- if and .Site.Params.backTop.enable (not .Site.Params.backTop.sidebar) }} {{- if and .Site.Params.backTop.enable (not .Site.Params.backTop.sidebar) }}
<div class="back-to-top" role="button" aria-label="{{ T "BackTopLabel" }}"> <div class="back-to-top" role="button" title="{{ T "ToolBtns.backTop" }}">
<i class="fa fa-arrow-up"></i> <i class="fa fa-arrow-up"></i>
<span>0%</span> <span>0%</span>
</div> </div>
{{- end }} {{- end }}
</div>
{{- if .Site.Params.readingProgress.enable }} {{- if .Site.Params.readingProgress.enable }}
<div class="reading-progress-bar"></div> <div class="reading-progress-bar"></div>