10 changed files with 919 additions and 53 deletions
@ -0,0 +1,11 @@ |
|||
{ |
|||
"extends": "standard", |
|||
"globals": { |
|||
"$": false, |
|||
"Vue": false, |
|||
"_": false |
|||
}, |
|||
"rules": { |
|||
"camelcase": ["off", { "properties": "never" }] |
|||
} |
|||
} |
File diff suppressed because it is too large
@ -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,27 +1,27 @@ |
|||
window.Vue = require('vue'); |
|||
window.Vue = require('vue') |
|||
|
|||
const ColumnEditorCtor = Vue.component('column-editor', require('./components/ColumnEditor.vue')); |
|||
const RowsEditorCtor = Vue.component('rows-editor', require('./components/RowsEditor.vue')); |
|||
const IconCtor = Vue.component('v-icon', require('./components/Icon.vue')); |
|||
const ColumnEditorCtor = Vue.component('column-editor', require('./components/ColumnEditor.vue')) |
|||
const RowsEditorCtor = Vue.component('rows-editor', require('./components/RowsEditor.vue')) |
|||
const IconCtor = Vue.component('v-icon', require('./components/Icon.vue')) |
|||
|
|||
// const app = new Vue({
|
|||
// el: '#app'
|
|||
// });
|
|||
|
|||
window.app = { |
|||
ColumnEditor: function(selector, data) { |
|||
ColumnEditor: function (selector, data) { |
|||
new ColumnEditorCtor({ |
|||
propsData: data |
|||
}).$mount(selector); |
|||
}).$mount(selector) |
|||
}, |
|||
RowsEditor: function(selector, data) { |
|||
RowsEditor: function (selector, data) { |
|||
new RowsEditorCtor({ |
|||
propsData: data |
|||
}).$mount(selector); |
|||
}).$mount(selector) |
|||
}, |
|||
Icon: function(selector, data) { |
|||
Icon: function (selector, data) { |
|||
new IconCtor({ |
|||
propsData: data |
|||
}).$mount(selector); |
|||
}).$mount(selector) |
|||
} |
|||
} |
|||
|
Loading…
Reference in new issue