add eslint and stuff
This commit is contained in:
+2
-2
@@ -1,11 +1,11 @@
|
||||
// toggle collapse when clicked outside link, without drag
|
||||
$(document)
|
||||
.on('mousedown', '.block-collapse', function(e) {
|
||||
.on('mousedown', '.block-collapse', function (e) {
|
||||
let $bc = $(e.target).closest('.block-collapse')
|
||||
$bc.data('mx', e.screenX)
|
||||
$bc.data('my', e.screenY)
|
||||
})
|
||||
.on('mouseup', '.block-collapse', function(e) {
|
||||
.on('mouseup', '.block-collapse', function (e) {
|
||||
if (e.target.nodeName === 'A') return
|
||||
let $bc = $(e.target).closest('.block-collapse')
|
||||
|
||||
|
||||
+23
-23
@@ -1,35 +1,35 @@
|
||||
$(function () {
|
||||
// theme switcher without reloading
|
||||
|
||||
let themeStyle = $('#theme-style');
|
||||
const lightURL = themeStyle.data('light-url');
|
||||
const darkURL = themeStyle.data('dark-url');
|
||||
const navbar = $('.page-navbar');
|
||||
const logo = $('#navbar-logo');
|
||||
let themeStyle = $('#theme-style')
|
||||
const lightURL = themeStyle.data('light-url')
|
||||
const darkURL = themeStyle.data('dark-url')
|
||||
const navbar = $('.page-navbar')
|
||||
const logo = $('#navbar-logo')
|
||||
|
||||
window.toggleDarkMode = function () {
|
||||
let newStyle = document.createElement('link');
|
||||
newStyle.rel = 'stylesheet';
|
||||
let newStyle = document.createElement('link')
|
||||
newStyle.rel = 'stylesheet'
|
||||
if (themeStyle.attr('href') === lightURL) {
|
||||
newStyle.href = darkURL;
|
||||
navbar.removeClass('navbar-light');
|
||||
navbar.addClass('navbar-dark');
|
||||
logo.attr('src', logo.data('src-dark'));
|
||||
newStyle.href = darkURL
|
||||
navbar.removeClass('navbar-light')
|
||||
navbar.addClass('navbar-dark')
|
||||
logo.attr('src', logo.data('src-dark'))
|
||||
|
||||
document.cookie = "dark_mode=1";
|
||||
document.cookie = 'dark_mode=1'
|
||||
} else {
|
||||
newStyle.href = lightURL;
|
||||
navbar.removeClass('navbar-dark');
|
||||
navbar.addClass('navbar-light');
|
||||
logo.attr('src', logo.data('src-light'));
|
||||
newStyle.href = lightURL
|
||||
navbar.removeClass('navbar-dark')
|
||||
navbar.addClass('navbar-light')
|
||||
logo.attr('src', logo.data('src-light'))
|
||||
|
||||
document.cookie = "dark_mode=0;expires=" + new Date().toUTCString();
|
||||
document.cookie = 'dark_mode=0;expires=' + new Date().toUTCString()
|
||||
}
|
||||
|
||||
// remove old css after new css has loaded to prevent FOUC
|
||||
let oldThemeStyle = themeStyle;
|
||||
themeStyle = $(newStyle);
|
||||
themeStyle.on('load', () => oldThemeStyle.remove());
|
||||
$(document.head).append(themeStyle);
|
||||
};
|
||||
});
|
||||
let oldThemeStyle = themeStyle
|
||||
themeStyle = $(newStyle)
|
||||
themeStyle.on('load', () => oldThemeStyle.remove())
|
||||
$(document.head).append(themeStyle)
|
||||
}
|
||||
})
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
$(function() {
|
||||
$(function () {
|
||||
// auto hide flash alerts
|
||||
let $notifs = $('div.alert').not('.alert-important').addClass('fadeout')
|
||||
setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user