add eslint and stuff

pull/27/head
Ondřej Hruška 6 years ago
parent 3f74e15115
commit 7121cfaabd
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 11
      .eslintrc
  2. 870
      package-lock.json
  3. 6
      package.json
  4. 2
      resources/assets/js/base-setup.js
  5. 7
      resources/assets/js/lib/url-slug.js
  6. 4
      resources/assets/js/modules/block-collapse.js
  7. 46
      resources/assets/js/modules/dark-mode.js
  8. 2
      resources/assets/js/modules/flash-messages.js
  9. 4
      resources/assets/js/udash.js
  10. 20
      resources/assets/js/vue-init.js

@ -0,0 +1,11 @@
{
"extends": "standard",
"globals": {
"$": false,
"Vue": false,
"_": false
},
"rules": {
"camelcase": ["off", { "properties": "never" }]
}
}

870
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -14,6 +14,12 @@
"axios": "^0.18",
"bootstrap": "^4.0.0",
"cross-env": "^5.1",
"eslint": "^5.3.0",
"eslint-config-standard": "^11.0.0",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-node": "^7.0.1",
"eslint-plugin-promise": "^3.8.0",
"eslint-plugin-standard": "^3.1.0",
"jquery": "^3.2",
"laravel-mix": "^2.0",
"lodash": "^4.17.10",

@ -1,4 +1,4 @@
window._ = require('./udash');
window._ = require('./udash')
window.Popper = require('popper.js').default
/**

@ -1,6 +1,6 @@
// Source & more langs: https://gist.github.com/sgmurphy/3095196
/* eslint-disable object-property-newline */
const char_map = {
// Latin
'À': 'A', 'Á': 'A', 'Â': 'A', 'Ã': 'A', 'Ä': 'A', 'Å': 'A', 'Æ': 'AE', 'Ç': 'C',
@ -27,8 +27,9 @@ const char_map = {
'Ą': 'A', 'Ć': 'C', 'Ę': 'e', 'Ł': 'L', 'Ń': 'N', 'Ś': 'S', 'Ź': 'Z',
'Ż': 'Z',
'ą': 'a', 'ć': 'c', 'ę': 'e', 'ł': 'l', 'ń': 'n', 'ś': 's', 'ź': 'z',
'ż': 'z',
'ż': 'z'
}
/* eslint-enable object-property-newline */
const alnum = new RegExp('[^a-z0-9]+', 'ig')
@ -99,4 +100,4 @@ function url_slug (s, opt) {
return opt.lowercase ? s.toLowerCase() : s
}
module.exports = url_slug;
module.exports = url_slug

@ -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')

@ -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,4 +1,4 @@
$(function() {
$(function () {
// auto hide flash alerts
let $notifs = $('div.alert').not('.alert-important').addClass('fadeout')
setTimeout(() => {

@ -6,7 +6,7 @@ export { default as merge } from 'lodash/merge'
export { default as unset } from 'lodash/unset'
export { default as isEmpty } from 'lodash/isEmpty'
function isDefined(x) {
return typeof(x) !== 'undefined';
function isDefined (x) {
return typeof x !== 'undefined'
}
export { isDefined }

@ -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…
Cancel
Save