style: 4 space indents to the JS files

This commit is contained in:
Cotes Chung 2022-10-25 19:26:44 +08:00
parent 1fd665bf49
commit 339293d0d7
No known key found for this signature in database
GPG key ID: 0D9E54843167A808
21 changed files with 913 additions and 912 deletions

View file

@ -2,10 +2,13 @@ root = true
[*]
charset = utf-8
# 2 space indentation
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
# Unix-style newlines with a newline ending every file
end_of_line = lf
insert_final_newline = true
[*.js]
indent_size = 4

View file

@ -1,5 +1,5 @@
/*
Reference: https://bootsnipp.com/snippets/featured/link-to-top-page
/**
* Reference: https://bootsnipp.com/snippets/featured/link-to-top-page
*/
$(function() {
$(window).scroll(() => {

View file

@ -1,4 +1,4 @@
/*
/**
* Listener for theme mode toggle
*/
$(function () {

View file

@ -18,7 +18,9 @@ const ScrollHelper = (function () {
addScrollUpTask: () => {
scrollUpCount += 1;
if (!topbarLocked) { topbarLocked = true; }
if (!topbarLocked) {
topbarLocked = true;
}
},
popScrollUpTask: () => scrollUpCount -= 1,
hasScrollUpTask: () => scrollUpCount > 0,

View file

@ -1,4 +1,4 @@
/*
/**
* This script make #search-result-wrapper switch to unloaded or shown automatically.
*/

View file

@ -3,7 +3,6 @@
*/
$(function () {
const sidebarUtil = (function () {
const ATTR_DISPLAY = "sidebar-display";
let isExpanded = false;
@ -26,5 +25,4 @@ $(function() {
$("#sidebar-trigger").click(sidebarUtil.toggle);
$("#mask").click(sidebarUtil.toggle);
});

View file

@ -1,4 +1,4 @@
/*
/**
* Hide Header on scroll down
*/
@ -86,5 +86,4 @@ $(function() {
didScroll = false;
}
}, 250);
});

View file

@ -1,4 +1,4 @@
/*
/**
* Top bar title auto change while scrolling up/down in mobile screens.
*/

View file

@ -1,4 +1,4 @@
/*
/**
* Tab 'Categories' expand/close effect.
*/

View file

@ -1,4 +1,4 @@
/*
/**
* Clipboard functions
*
* Dependencies:

View file

@ -4,7 +4,6 @@
*/
$(function () {
const IMG_SCOPE = '#main > div.row:first-child > div:first-child';
if ($(`${IMG_SCOPE} img`).length <= 0) {

View file

@ -1,4 +1,4 @@
/*
/**
* Count page views form GA or local cache file.
*
* Dependencies:

View file

@ -1,4 +1,4 @@
/*
/**
Safari doesn't support CSS `scroll-behavior: smooth`,
so here is a compatible solution for all browser to smooth scrolling

View file

@ -5,7 +5,6 @@ layout: compress
---
const resource = [
/* --- CSS --- */
'{{ "/assets/css/style.css" | relative_url }}',
@ -16,6 +15,7 @@ const resource = [
/* --- HTML --- */
'{{ "/index.html" | relative_url }}',
'{{ "/404.html" | relative_url }}',
{% for tab in site.tabs %}
'{{ tab.url | relative_url }}',
{% endfor %}
@ -25,7 +25,6 @@ const resource = [
{% for file in cache_list %}
'{{ file.path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%}
{% endfor %}
];
/* The request url with below domain will be cached */

View file

@ -32,8 +32,7 @@ if ('serviceWorker' in navigator) {
}
$notification.toast('hide');
});
}
);
});
let refreshing = false;
@ -45,3 +44,4 @@ if ('serviceWorker' in navigator) {
}
});
}

View file

@ -87,3 +87,4 @@ self.addEventListener('fetch', event => {
})
);
});