Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/AmazingRise/hugo-theme-diary.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authoramazingrise <8315221+AmazingRise@users.noreply.github.com>2021-05-14 05:48:02 +0300
committeramazingrise <8315221+AmazingRise@users.noreply.github.com>2021-05-14 05:48:02 +0300
commit368250ef26613ab014bb78a2bbdea0f45cc8c4b7 (patch)
tree265685c350314c625a183fde9b26decf3cd8984a /static
parent3673a16986c4f71d8e7465d6c7fa512cae64173a (diff)
Remove components and some of jQuery codes.
Diffstat (limited to 'static')
-rw-r--r--static/js/journal.js28
-rw-r--r--static/js/toc-collapse.js4
-rw-r--r--static/js/toc.js90
3 files changed, 47 insertions, 75 deletions
diff --git a/static/js/journal.js b/static/js/journal.js
index fe6d4fe..e69de29 100644
--- a/static/js/journal.js
+++ b/static/js/journal.js
@@ -1,28 +0,0 @@
-new SmoothScroll('a#globalBackToTop');
-
-Vue.component('parent',{
- props:['name','type'],
- data: function () {
- return {
- isHidden: true
- }
- },
- template: `
- <div class="a-block" :class="type" v-on:click="isHidden = !isHidden">
- {{ name }}
- <div class="nav-link-subitem" v-if="!isHidden">
- <slot></slot>
- </div>
- </div>
- `
-});
-
-$().ready(function(){
- var elems = $("table");
- elems.each(function(idx){
- $(this).addClass('table-striped');
- $(this).addClass('table');
- $(this).addClass('table-responsive');
- $(this).addClass('table-hover');
- });
-}); \ No newline at end of file
diff --git a/static/js/toc-collapse.js b/static/js/toc-collapse.js
index fa51778..25212a4 100644
--- a/static/js/toc-collapse.js
+++ b/static/js/toc-collapse.js
@@ -35,7 +35,7 @@ var onNavClick = function (name) {
var elems = $(":header");
elems.each(function (idx) {
var id = $(this).attr('id');
- if (name == '#' + id + '-nav'){
+ if (name == '#' + id + '-nav') {
collapseOthers(idx);
return;
}
@@ -52,7 +52,7 @@ var collapseOthers = function (currentIndex) {
var elems = $(":header");
//console.log(currentIndex);
currentId = "#" + elems[currentIndex].id + "-nav";
-
+
$(currentId).parents(".collapse").each(function (idx) {
$(this).collapse("show");
});
diff --git a/static/js/toc.js b/static/js/toc.js
index 61fdc93..accf88d 100644
--- a/static/js/toc.js
+++ b/static/js/toc.js
@@ -1,55 +1,55 @@
var spy = function () {
- var elems = $(":header");
- if (elems.length == 0) {
- return;
- }
- var currentTop = $(window).scrollTop();
- var currentBottom = $(window).scrollTop() + $(window).height();
- var pageBottom = $('#EOF').offset().top;
+ var elems = $(":header");
+ if (elems.length == 0) {
+ return;
+ }
+ var currentTop = $(window).scrollTop();
+ var currentBottom = $(window).scrollTop() + $(window).height();
+ var pageBottom = $('#EOF').offset().top;
- var meetUnread = false
- var currentIndex = -1
- elems.each(function (idx) {
- var elemTop = $(this).offset().top;
- var id = $(this).attr('id');
- var navElem = $('#' + id + '-nav');
- if (currentTop + $(this).height() >= elemTop || currentBottom >= pageBottom) {
- navElem.addClass('toc-active');
- } else {
- if (meetUnread == false) {
- meetUnread = true
- currentIndex = idx - 1
- }
- navElem.removeClass('toc-active');
- }
- })
+ var meetUnread = false
+ var currentIndex = -1
+ elems.each(function (idx) {
+ var elemTop = $(this).offset().top;
+ var id = $(this).attr('id');
+ var navElem = $('#' + id + '-nav');
+ if (currentTop + $(this).height() >= elemTop || currentBottom >= pageBottom) {
+ navElem.addClass('toc-active');
+ } else {
+ if (meetUnread == false) {
+ meetUnread = true
+ currentIndex = idx - 1
+ }
+ navElem.removeClass('toc-active');
+ }
+ })
}
$().ready(function () {
- $(".collapse").each(function (idx) {
- $(this).collapse("show");
- });
- spy();
- $(window).bind('scroll', throttle(spy));
+ $(".collapse").each(function (idx) {
+ $(this).collapse("show");
+ });
+ spy();
+ $(window).bind('scroll', throttle(spy));
});
function throttle(func, timeout = 250) {
- let last;
- let timer;
-
- return function () {
- const context = this;
- const args = arguments;
- const now = +new Date();
-
- if (last && now < last + timeout) {
- clearTimeout(timer)
- timer = setTimeout(function () {
- last = now
- func.apply(context, args)
- }, timeout)
- } else {
+ let last;
+ let timer;
+
+ return function () {
+ const context = this;
+ const args = arguments;
+ const now = +new Date();
+
+ if (last && now < last + timeout) {
+ clearTimeout(timer)
+ timer = setTimeout(function () {
last = now
func.apply(context, args)
- }
+ }, timeout)
+ } else {
+ last = now
+ func.apply(context, args)
}
- } \ No newline at end of file
+ }
+} \ No newline at end of file