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 charset = utf-8
# 2 space indentation
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
trim_trailing_whitespace = true trim_trailing_whitespace = true
# Unix-style newlines with a newline ending every file # Unix-style newlines with a newline ending every file
end_of_line = lf end_of_line = lf
insert_final_newline = true 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() { $(function() {
$(window).scroll(() => { $(window).scroll(() => {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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