Converted all client code to Standard JS compliant
This commit is contained in:
parent
414dc386d6
commit
547f3065d3
11
.editorconfig
Normal file
11
.editorconfig
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.{jade,pug}]
|
||||||
|
trim_trailing_whitespace = false
|
174
.eslintrc.json
Normal file
174
.eslintrc.json
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
{
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 8,
|
||||||
|
"ecmaFeatures": {
|
||||||
|
"experimentalObjectRestSpread": true,
|
||||||
|
"jsx": true
|
||||||
|
},
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
|
||||||
|
"env": {
|
||||||
|
"es6": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
|
||||||
|
"plugins": [
|
||||||
|
"standard",
|
||||||
|
"promise"
|
||||||
|
],
|
||||||
|
|
||||||
|
"globals": {
|
||||||
|
"document": false,
|
||||||
|
"navigator": false,
|
||||||
|
"window": false,
|
||||||
|
"app": true,
|
||||||
|
"appconfig": true,
|
||||||
|
"appdata": true,
|
||||||
|
"db": true,
|
||||||
|
"entries": true,
|
||||||
|
"git": true,
|
||||||
|
"lang": true,
|
||||||
|
"lcdata": true,
|
||||||
|
"mark": true,
|
||||||
|
"rights": true,
|
||||||
|
"upl": true,
|
||||||
|
"winston": true,
|
||||||
|
"ws": true,
|
||||||
|
"Mongoose": true,
|
||||||
|
"CORE_PATH": true,
|
||||||
|
"ROOTPATH": true,
|
||||||
|
"IS_DEBUG": true,
|
||||||
|
"PROCNAME": true,
|
||||||
|
"WSInternalKey": true
|
||||||
|
},
|
||||||
|
|
||||||
|
"rules": {
|
||||||
|
"accessor-pairs": 2,
|
||||||
|
"arrow-spacing": [2, { "before": true, "after": true }],
|
||||||
|
"block-spacing": [2, "always"],
|
||||||
|
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
|
||||||
|
"camelcase": [2, { "properties": "never" }],
|
||||||
|
"comma-dangle": [2, "never"],
|
||||||
|
"comma-spacing": [2, { "before": false, "after": true }],
|
||||||
|
"comma-style": [2, "last"],
|
||||||
|
"constructor-super": 2,
|
||||||
|
"curly": [2, "multi-line"],
|
||||||
|
"dot-location": [2, "property"],
|
||||||
|
"eol-last": 2,
|
||||||
|
"eqeqeq": [2, "always", {"null": "ignore"}],
|
||||||
|
"func-call-spacing": [2, "never"],
|
||||||
|
"handle-callback-err": [2, "^(err|error)$" ],
|
||||||
|
"indent": [2, 2, { "SwitchCase": 1 }],
|
||||||
|
"key-spacing": [2, { "beforeColon": false, "afterColon": true }],
|
||||||
|
"keyword-spacing": [2, { "before": true, "after": true }],
|
||||||
|
"new-cap": [2, { "newIsCap": true, "capIsNew": false }],
|
||||||
|
"new-parens": 2,
|
||||||
|
"no-array-constructor": 2,
|
||||||
|
"no-caller": 2,
|
||||||
|
"no-class-assign": 2,
|
||||||
|
"no-cond-assign": 2,
|
||||||
|
"no-const-assign": 2,
|
||||||
|
"no-constant-condition": [2, { "checkLoops": false }],
|
||||||
|
"no-control-regex": 2,
|
||||||
|
"no-debugger": 2,
|
||||||
|
"no-delete-var": 2,
|
||||||
|
"no-dupe-args": 2,
|
||||||
|
"no-dupe-class-members": 2,
|
||||||
|
"no-dupe-keys": 2,
|
||||||
|
"no-duplicate-case": 2,
|
||||||
|
"no-duplicate-imports": 2,
|
||||||
|
"no-empty-character-class": 2,
|
||||||
|
"no-empty-pattern": 2,
|
||||||
|
"no-eval": 2,
|
||||||
|
"no-ex-assign": 2,
|
||||||
|
"no-extend-native": 2,
|
||||||
|
"no-extra-bind": 2,
|
||||||
|
"no-extra-boolean-cast": 2,
|
||||||
|
"no-extra-parens": [2, "functions"],
|
||||||
|
"no-fallthrough": 2,
|
||||||
|
"no-floating-decimal": 2,
|
||||||
|
"no-func-assign": 2,
|
||||||
|
"no-global-assign": 2,
|
||||||
|
"no-implied-eval": 2,
|
||||||
|
"no-inner-declarations": [2, "functions"],
|
||||||
|
"no-invalid-regexp": 2,
|
||||||
|
"no-irregular-whitespace": 2,
|
||||||
|
"no-iterator": 2,
|
||||||
|
"no-label-var": 2,
|
||||||
|
"no-labels": [2, { "allowLoop": false, "allowSwitch": false }],
|
||||||
|
"no-lone-blocks": 2,
|
||||||
|
"no-mixed-spaces-and-tabs": 2,
|
||||||
|
"no-multi-spaces": 2,
|
||||||
|
"no-multi-str": 2,
|
||||||
|
"no-multiple-empty-lines": [2, { "max": 1 }],
|
||||||
|
"no-negated-in-lhs": 2,
|
||||||
|
"no-new": 2,
|
||||||
|
"no-new-func": 2,
|
||||||
|
"no-new-object": 2,
|
||||||
|
"no-new-require": 2,
|
||||||
|
"no-new-symbol": 2,
|
||||||
|
"no-new-wrappers": 2,
|
||||||
|
"no-obj-calls": 2,
|
||||||
|
"no-octal": 2,
|
||||||
|
"no-octal-escape": 2,
|
||||||
|
"no-path-concat": 2,
|
||||||
|
"no-proto": 2,
|
||||||
|
"no-redeclare": 2,
|
||||||
|
"no-regex-spaces": 2,
|
||||||
|
"no-return-assign": [2, "except-parens"],
|
||||||
|
"no-self-assign": 2,
|
||||||
|
"no-self-compare": 2,
|
||||||
|
"no-sequences": 2,
|
||||||
|
"no-shadow-restricted-names": 2,
|
||||||
|
"no-sparse-arrays": 2,
|
||||||
|
"no-tabs": 2,
|
||||||
|
"no-template-curly-in-string": 2,
|
||||||
|
"no-this-before-super": 2,
|
||||||
|
"no-throw-literal": 2,
|
||||||
|
"no-trailing-spaces": 2,
|
||||||
|
"no-undef": 2,
|
||||||
|
"no-undef-init": 2,
|
||||||
|
"no-unexpected-multiline": 2,
|
||||||
|
"no-unmodified-loop-condition": 2,
|
||||||
|
"no-unneeded-ternary": [2, { "defaultAssignment": false }],
|
||||||
|
"no-unreachable": 2,
|
||||||
|
"no-unsafe-finally": 2,
|
||||||
|
"no-unsafe-negation": 2,
|
||||||
|
"no-unused-vars": [2, { "vars": "all", "args": "none" }],
|
||||||
|
"no-useless-call": 2,
|
||||||
|
"no-useless-computed-key": 2,
|
||||||
|
"no-useless-constructor": 2,
|
||||||
|
"no-useless-escape": 2,
|
||||||
|
"no-useless-rename": 2,
|
||||||
|
"no-whitespace-before-property": 2,
|
||||||
|
"no-with": 2,
|
||||||
|
"object-property-newline": [2, { "allowMultiplePropertiesPerLine": true }],
|
||||||
|
"one-var": [2, { "initialized": "never" }],
|
||||||
|
"operator-linebreak": [2, "after", { "overrides": { "?": "before", ":": "before" } }],
|
||||||
|
"padded-blocks": [2, "never"],
|
||||||
|
"quotes": [2, "single", { "avoidEscape": true, "allowTemplateLiterals": true }],
|
||||||
|
"rest-spread-spacing": [2, "never"],
|
||||||
|
"semi": [2, "never"],
|
||||||
|
"semi-spacing": [2, { "before": false, "after": true }],
|
||||||
|
"space-before-blocks": [2, "always"],
|
||||||
|
"space-before-function-paren": [2, "always"],
|
||||||
|
"space-in-parens": [2, "never"],
|
||||||
|
"space-infix-ops": 2,
|
||||||
|
"space-unary-ops": [2, { "words": true, "nonwords": false }],
|
||||||
|
"spaced-comment": [2, "always", { "line": { "markers": ["*package", "!", ","] }, "block": { "balanced": true, "markers": ["*package", "!", ","], "exceptions": ["*"] } }],
|
||||||
|
"template-curly-spacing": [2, "never"],
|
||||||
|
"unicode-bom": [2, "never"],
|
||||||
|
"use-isnan": 2,
|
||||||
|
"valid-typeof": 2,
|
||||||
|
"wrap-iife": [2, "any", { "functionPrototypeMethods": true }],
|
||||||
|
"yield-star-spacing": [2, "both"],
|
||||||
|
"yoda": [2, "never"],
|
||||||
|
|
||||||
|
"standard/object-curly-even-spacing": [2, "either"],
|
||||||
|
"standard/array-bracket-even-spacing": [2, "either"],
|
||||||
|
"standard/computed-property-even-spacing": [2, "even"],
|
||||||
|
|
||||||
|
"promise/param-names": 2
|
||||||
|
}
|
||||||
|
}
|
16
.pug-lintrc.json
Normal file
16
.pug-lintrc.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"disallowDuplicateAttributes": true,
|
||||||
|
"disallowIdAttributeWithStaticValue": true,
|
||||||
|
"disallowMultipleLineBreaks": true,
|
||||||
|
"requireClassLiteralsBeforeAttributes": true,
|
||||||
|
"requireIdLiteralsBeforeAttributes": true,
|
||||||
|
"requireLineFeedAtFileEnd": true,
|
||||||
|
"requireLowerCaseAttributes": true,
|
||||||
|
"requireLowerCaseTags": true,
|
||||||
|
"requireSpaceAfterCodeOperator": true,
|
||||||
|
"requireStrictEqualityOperators": true,
|
||||||
|
"validateAttributeQuoteMarks": true,
|
||||||
|
"validateAttributeSeparator": ", ",
|
||||||
|
"validateDivTags": true,
|
||||||
|
"validateIndentation": 2
|
||||||
|
}
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -1,3 +1,4 @@
|
|||||||
{
|
{
|
||||||
"eslint.enable": false
|
"eslint.enable": true,
|
||||||
|
"puglint.enable": true
|
||||||
}
|
}
|
@ -5,9 +5,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Added
|
### Added
|
||||||
- Change log
|
- Change log
|
||||||
|
- Added .editorconfig, .eslintrc.json and .pug-lintrc.json for code linting
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixed issue with social accounts with empty name
|
- Fixed issue with social accounts with empty name
|
||||||
|
- Fixed standard error page styling
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Updated dependencies + snyk policy
|
- Updated dependencies + snyk policy
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,5 +1,8 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
|
/* global jQuery, _, io, Sticky, alertsData, Alerts */
|
||||||
|
/* eslint-disable spaced-comment */
|
||||||
|
|
||||||
jQuery(document).ready(function ($) {
|
jQuery(document).ready(function ($) {
|
||||||
// ====================================
|
// ====================================
|
||||||
// Scroll
|
// Scroll
|
||||||
@ -10,7 +13,7 @@ jQuery(document).ready(function ($) {
|
|||||||
offset: -70
|
offset: -70
|
||||||
})
|
})
|
||||||
|
|
||||||
var sticky = new Sticky('.stickyscroll')
|
var sticky = new Sticky('.stickyscroll') // eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
// ====================================
|
// ====================================
|
||||||
// Notifications
|
// Notifications
|
||||||
@ -36,22 +39,24 @@ jQuery(document).ready(function ($) {
|
|||||||
// Establish WebSocket connection
|
// Establish WebSocket connection
|
||||||
// ====================================
|
// ====================================
|
||||||
|
|
||||||
var socket = io(window.location.origin)
|
var socket = io(window.location.origin) // eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
// =include components/search.js
|
//=include components/search.js
|
||||||
|
|
||||||
// ====================================
|
// ====================================
|
||||||
// Pages logic
|
// Pages logic
|
||||||
// ====================================
|
// ====================================
|
||||||
|
|
||||||
// =include pages/view.js
|
//=include pages/view.js
|
||||||
// =include pages/create.js
|
//=include pages/create.js
|
||||||
// =include pages/edit.js
|
//=include pages/edit.js
|
||||||
// =include pages/source.js
|
//=include pages/source.js
|
||||||
// =include pages/admin.js
|
//=include pages/admin.js
|
||||||
})
|
})
|
||||||
|
|
||||||
// =include helpers/form.js
|
//=include helpers/form.js
|
||||||
// =include helpers/pages.js
|
//=include helpers/pages.js
|
||||||
|
|
||||||
// =include components/alerts.js
|
//=include components/alerts.js
|
||||||
|
|
||||||
|
/* eslint-enable spaced-comment */
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
|
/* global Vue, _ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alerts
|
* Alerts
|
||||||
*/
|
*/
|
||||||
class Alerts {
|
class Alerts { // eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* global $, Vue, ace, mde, _ */
|
||||||
|
|
||||||
let modelist = ace.require('ace/ext/modelist')
|
let modelist = ace.require('ace/ext/modelist')
|
||||||
let codeEditor = null
|
let codeEditor = null
|
||||||
@ -57,7 +58,7 @@ let vueCodeBlock = new Vue({
|
|||||||
}, 300)
|
}, 300)
|
||||||
},
|
},
|
||||||
cancel: (ev) => {
|
cancel: (ev) => {
|
||||||
mdeModalOpenState = false
|
mdeModalOpenState = false // eslint-disable-line no-undef
|
||||||
$('#modal-editor-codeblock').removeClass('is-active')
|
$('#modal-editor-codeblock').removeClass('is-active')
|
||||||
vueCodeBlock.initContent = ''
|
vueCodeBlock.initContent = ''
|
||||||
},
|
},
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* global $, Vue, _, alerts, mde, socket */
|
||||||
|
|
||||||
let vueFile = new Vue({
|
let vueFile = new Vue({
|
||||||
el: '#modal-editor-file',
|
el: '#modal-editor-file',
|
||||||
@ -23,12 +24,12 @@ let vueFile = new Vue({
|
|||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
open: () => {
|
open: () => {
|
||||||
mdeModalOpenState = true
|
mdeModalOpenState = true // eslint-disable-line no-undef
|
||||||
$('#modal-editor-file').addClass('is-active')
|
$('#modal-editor-file').addClass('is-active')
|
||||||
vueFile.refreshFolders()
|
vueFile.refreshFolders()
|
||||||
},
|
},
|
||||||
cancel: (ev) => {
|
cancel: (ev) => {
|
||||||
mdeModalOpenState = false
|
mdeModalOpenState = false // eslint-disable-line no-undef
|
||||||
$('#modal-editor-file').removeClass('is-active')
|
$('#modal-editor-file').removeClass('is-active')
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ let vueFile = new Vue({
|
|||||||
vueFile.newFolderShow = false
|
vueFile.newFolderShow = false
|
||||||
},
|
},
|
||||||
newFolderCreate: (ev) => {
|
newFolderCreate: (ev) => {
|
||||||
let regFolderName = new RegExp('^[a-z0-9][a-z0-9\-]*[a-z0-9]$')
|
let regFolderName = new RegExp('^[a-z0-9][a-z0-9-]*[a-z0-9]$')
|
||||||
vueFile.newFolderName = _.kebabCase(_.trim(vueFile.newFolderName))
|
vueFile.newFolderName = _.kebabCase(_.trim(vueFile.newFolderName))
|
||||||
|
|
||||||
if (_.isEmpty(vueFile.newFolderName) || !regFolderName.test(vueFile.newFolderName)) {
|
if (_.isEmpty(vueFile.newFolderName) || !regFolderName.test(vueFile.newFolderName)) {
|
||||||
@ -95,7 +96,7 @@ let vueFile = new Vue({
|
|||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
|
|
||||||
renameFile: () => {
|
renameFile: () => {
|
||||||
let c = _.find(vueFile.files, ['_id', vueFile.renameFileId ])
|
let c = _.find(vueFile.files, [ '_id', vueFile.renameFileId ])
|
||||||
vueFile.renameFileFilename = c.basename || ''
|
vueFile.renameFileFilename = c.basename || ''
|
||||||
vueFile.renameFileShow = true
|
vueFile.renameFileShow = true
|
||||||
_.delay(() => {
|
_.delay(() => {
|
||||||
@ -148,7 +149,7 @@ let vueFile = new Vue({
|
|||||||
|
|
||||||
deleteFileWarn: (show) => {
|
deleteFileWarn: (show) => {
|
||||||
if (show) {
|
if (show) {
|
||||||
let c = _.find(vueFile.files, ['_id', vueFile.deleteFileId ])
|
let c = _.find(vueFile.files, [ '_id', vueFile.deleteFileId ])
|
||||||
vueFile.deleteFileFilename = c.filename || 'this file'
|
vueFile.deleteFileFilename = c.filename || 'this file'
|
||||||
}
|
}
|
||||||
vueFile.deleteFileShow = show
|
vueFile.deleteFileShow = show
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* global $, Vue, mde, _, alerts, socket */
|
||||||
|
|
||||||
let vueImage = new Vue({
|
let vueImage = new Vue({
|
||||||
el: '#modal-editor-image',
|
el: '#modal-editor-image',
|
||||||
@ -26,12 +27,12 @@ let vueImage = new Vue({
|
|||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
open: () => {
|
open: () => {
|
||||||
mdeModalOpenState = true
|
mdeModalOpenState = true // eslint-disable-line no-undef
|
||||||
$('#modal-editor-image').addClass('is-active')
|
$('#modal-editor-image').addClass('is-active')
|
||||||
vueImage.refreshFolders()
|
vueImage.refreshFolders()
|
||||||
},
|
},
|
||||||
cancel: (ev) => {
|
cancel: (ev) => {
|
||||||
mdeModalOpenState = false
|
mdeModalOpenState = false // eslint-disable-line no-undef
|
||||||
$('#modal-editor-image').removeClass('is-active')
|
$('#modal-editor-image').removeClass('is-active')
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -82,7 +83,7 @@ let vueImage = new Vue({
|
|||||||
vueImage.newFolderShow = false
|
vueImage.newFolderShow = false
|
||||||
},
|
},
|
||||||
newFolderCreate: (ev) => {
|
newFolderCreate: (ev) => {
|
||||||
let regFolderName = new RegExp('^[a-z0-9][a-z0-9\-]*[a-z0-9]$')
|
let regFolderName = new RegExp('^[a-z0-9][a-z0-9-]*[a-z0-9]$')
|
||||||
vueImage.newFolderName = _.kebabCase(_.trim(vueImage.newFolderName))
|
vueImage.newFolderName = _.kebabCase(_.trim(vueImage.newFolderName))
|
||||||
|
|
||||||
if (_.isEmpty(vueImage.newFolderName) || !regFolderName.test(vueImage.newFolderName)) {
|
if (_.isEmpty(vueImage.newFolderName) || !regFolderName.test(vueImage.newFolderName)) {
|
||||||
@ -138,7 +139,7 @@ let vueImage = new Vue({
|
|||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
|
|
||||||
renameImage: () => {
|
renameImage: () => {
|
||||||
let c = _.find(vueImage.images, ['_id', vueImage.renameImageId ])
|
let c = _.find(vueImage.images, [ '_id', vueImage.renameImageId ])
|
||||||
vueImage.renameImageFilename = c.basename || ''
|
vueImage.renameImageFilename = c.basename || ''
|
||||||
vueImage.renameImageShow = true
|
vueImage.renameImageShow = true
|
||||||
_.delay(() => {
|
_.delay(() => {
|
||||||
@ -191,7 +192,7 @@ let vueImage = new Vue({
|
|||||||
|
|
||||||
deleteImageWarn: (show) => {
|
deleteImageWarn: (show) => {
|
||||||
if (show) {
|
if (show) {
|
||||||
let c = _.find(vueImage.images, ['_id', vueImage.deleteImageId ])
|
let c = _.find(vueImage.images, [ '_id', vueImage.deleteImageId ])
|
||||||
vueImage.deleteImageFilename = c.filename || 'this image'
|
vueImage.deleteImageFilename = c.filename || 'this image'
|
||||||
}
|
}
|
||||||
vueImage.deleteImageShow = show
|
vueImage.deleteImageShow = show
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
/* global $, Vue, mde, _ */
|
||||||
|
|
||||||
const videoRules = {
|
const videoRules = {
|
||||||
'youtube': new RegExp(/(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/)|(?:(?:watch)?\?v(?:i)?=|\&v(?:i)?=))([^#\&\?]*).*/, 'i'),
|
'youtube': new RegExp(/(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/)|(?:(?:watch)?\?v(?:i)?=|&v(?:i)?=))([^#&?]*).*/, 'i'),
|
||||||
'vimeo': new RegExp(/vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^\/]*)\/videos\/|album\/(?:\d+)\/video\/|)(\d+)(?:$|\/|\?)/, 'i'),
|
'vimeo': new RegExp(/vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^/]*)\/videos\/|album\/(?:\d+)\/video\/|)(\d+)(?:$|\/|\?)/, 'i'),
|
||||||
'dailymotion': new RegExp(/(?:dailymotion\.com(?:\/embed)?(?:\/video|\/hub)|dai\.ly)\/([0-9a-z]+)(?:[\-_0-9a-zA-Z]+(?:#video=)?([a-z0-9]+)?)?/, 'i')
|
'dailymotion': new RegExp(/(?:dailymotion\.com(?:\/embed)?(?:\/video|\/hub)|dai\.ly)\/([0-9a-z]+)(?:[-_0-9a-zA-Z]+(?:#video=)?([a-z0-9]+)?)?/, 'i')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vue Video instance
|
// Vue Video instance
|
||||||
@ -18,7 +19,7 @@ let vueVideo = new Vue({
|
|||||||
$('#modal-editor-video input').focus()
|
$('#modal-editor-video input').focus()
|
||||||
},
|
},
|
||||||
cancel: (ev) => {
|
cancel: (ev) => {
|
||||||
mdeModalOpenState = false
|
mdeModalOpenState = false // eslint-disable-line no-undef
|
||||||
$('#modal-editor-video').removeClass('is-active')
|
$('#modal-editor-video').removeClass('is-active')
|
||||||
vueVideo.link = ''
|
vueVideo.link = ''
|
||||||
},
|
},
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
'use strict'
|
||||||
|
|
||||||
|
/* global $, Vue, _, filesize, SimpleMDE, alerts, vueImage, vueFile, vueVideo, vueCodeBlock */
|
||||||
|
|
||||||
// ====================================
|
// ====================================
|
||||||
// Markdown Editor
|
// Markdown Editor
|
||||||
@ -5,16 +8,18 @@
|
|||||||
|
|
||||||
if ($('#mk-editor').length === 1) {
|
if ($('#mk-editor').length === 1) {
|
||||||
let mdeModalOpenState = false
|
let mdeModalOpenState = false
|
||||||
let mdeCurrentEditor = null
|
let mdeCurrentEditor = null // eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
Vue.filter('filesize', (v) => {
|
Vue.filter('filesize', (v) => {
|
||||||
return _.toUpper(filesize(v))
|
return _.toUpper(filesize(v))
|
||||||
})
|
})
|
||||||
|
|
||||||
// =include editor-image.js
|
/* eslint-disable spaced-comment */
|
||||||
// =include editor-file.js
|
//=include editor-image.js
|
||||||
// =include editor-video.js
|
//=include editor-file.js
|
||||||
// =include editor-codeblock.js
|
//=include editor-video.js
|
||||||
|
//=include editor-codeblock.js
|
||||||
|
/* eslint-enable spaced-comment */
|
||||||
|
|
||||||
var mde = new SimpleMDE({
|
var mde = new SimpleMDE({
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
@ -23,7 +28,8 @@ if ($('#mk-editor').length === 1) {
|
|||||||
placeholder: 'Enter Markdown formatted content here...',
|
placeholder: 'Enter Markdown formatted content here...',
|
||||||
spellChecker: false,
|
spellChecker: false,
|
||||||
status: false,
|
status: false,
|
||||||
toolbar: [{
|
toolbar: [
|
||||||
|
{
|
||||||
name: 'bold',
|
name: 'bold',
|
||||||
action: SimpleMDE.toggleBold,
|
action: SimpleMDE.toggleBold,
|
||||||
className: 'icon-bold',
|
className: 'icon-bold',
|
||||||
@ -186,7 +192,7 @@ if ($('#mk-editor').length === 1) {
|
|||||||
method: 'PUT'
|
method: 'PUT'
|
||||||
}).then((rData, rStatus, rXHR) => {
|
}).then((rData, rStatus, rXHR) => {
|
||||||
if (rData.ok) {
|
if (rData.ok) {
|
||||||
window.location.assign('/' + pageEntryPath)
|
window.location.assign('/' + pageEntryPath) // eslint-disable-line no-undef
|
||||||
} else {
|
} else {
|
||||||
alerts.pushError('Something went wrong', rData.error)
|
alerts.pushError('Something went wrong', rData.error)
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
|
/* global $, Vue, _, socket */
|
||||||
|
|
||||||
if ($('#search-input').length) {
|
if ($('#search-input').length) {
|
||||||
$('#search-input').focus()
|
$('#search-input').focus()
|
||||||
|
|
||||||
@ -39,9 +41,9 @@ if ($('#search-input').length) {
|
|||||||
},
|
},
|
||||||
searchmoveidx: (val, oldVal) => {
|
searchmoveidx: (val, oldVal) => {
|
||||||
if (val > 0) {
|
if (val > 0) {
|
||||||
vueHeader.searchmovekey = (vueHeader.searchmovearr[val - 1]) ?
|
vueHeader.searchmovekey = (vueHeader.searchmovearr[val - 1])
|
||||||
'res.' + vueHeader.searchmovearr[val - 1]._id :
|
? 'res.' + vueHeader.searchmovearr[val - 1]._id
|
||||||
'sug.' + vueHeader.searchmovearr[val - 1]
|
: 'sug.' + vueHeader.searchmovearr[val - 1]
|
||||||
} else {
|
} else {
|
||||||
vueHeader.searchmovekey = ''
|
vueHeader.searchmovekey = ''
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
function setInputSelection (input, startPos, endPos) {
|
function setInputSelection (input, startPos, endPos) {
|
||||||
input.focus()
|
input.focus()
|
||||||
@ -14,3 +15,5 @@ function setInputSelection (input, startPos, endPos) {
|
|||||||
range.select()
|
range.select()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* eslint-enable no-unused-vars */
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* global _ */
|
||||||
|
/* eslint-disable no-unused-vars */
|
||||||
|
|
||||||
function makeSafePath (rawPath) {
|
function makeSafePath (rawPath) {
|
||||||
let rawParts = _.split(_.trim(rawPath), '/')
|
let rawParts = _.split(_.trim(rawPath), '/')
|
||||||
@ -7,3 +9,5 @@ function makeSafePath (rawPath) {
|
|||||||
|
|
||||||
return _.join(_.filter(rawParts, (r) => { return !_.isEmpty(r) }), '/')
|
return _.join(_.filter(rawParts, (r) => { return !_.isEmpty(r) }), '/')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* eslint-enable no-unused-vars */
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
|
/* global jQuery */
|
||||||
|
|
||||||
jQuery(document).ready(function ($) {
|
jQuery(document).ready(function ($) {
|
||||||
$('#login-user').focus()
|
$('#login-user').focus()
|
||||||
})
|
})
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* global $, Vue */
|
||||||
|
|
||||||
// Vue Create User instance
|
// Vue Create User instance
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* global $, Vue */
|
||||||
|
|
||||||
// Vue Delete User instance
|
// Vue Delete User instance
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* global $, _, currentBasePath */
|
||||||
|
|
||||||
// -> Create New Document
|
// -> Create New Document
|
||||||
|
|
||||||
@ -6,7 +7,7 @@ let suggestedCreatePath = currentBasePath + '/new-page'
|
|||||||
$('.btn-create-prompt').on('click', (ev) => {
|
$('.btn-create-prompt').on('click', (ev) => {
|
||||||
$('#txt-create-prompt').val(suggestedCreatePath)
|
$('#txt-create-prompt').val(suggestedCreatePath)
|
||||||
$('#modal-create-prompt').toggleClass('is-active')
|
$('#modal-create-prompt').toggleClass('is-active')
|
||||||
setInputSelection($('#txt-create-prompt').get(0), currentBasePath.length + 1, suggestedCreatePath.length)
|
setInputSelection($('#txt-create-prompt').get(0), currentBasePath.length + 1, suggestedCreatePath.length) // eslint-disable-line no-undef
|
||||||
$('#txt-create-prompt').removeClass('is-danger').next().addClass('is-hidden')
|
$('#txt-create-prompt').removeClass('is-danger').next().addClass('is-hidden')
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -17,7 +18,7 @@ $('#txt-create-prompt').on('keypress', (ev) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
$('.btn-create-go').on('click', (ev) => {
|
$('.btn-create-go').on('click', (ev) => {
|
||||||
let newDocPath = makeSafePath($('#txt-create-prompt').val())
|
let newDocPath = makeSafePath($('#txt-create-prompt').val()) // eslint-disable-line no-undef
|
||||||
if (_.isEmpty(newDocPath)) {
|
if (_.isEmpty(newDocPath)) {
|
||||||
$('#txt-create-prompt').addClass('is-danger').next().removeClass('is-hidden')
|
$('#txt-create-prompt').addClass('is-danger').next().removeClass('is-hidden')
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* global $, _, alerts, currentBasePath */
|
||||||
|
|
||||||
// -> Move Existing Document
|
// -> Move Existing Document
|
||||||
|
|
||||||
@ -10,7 +11,7 @@ let moveInitialDocument = _.lastIndexOf(currentBasePath, '/') + 1
|
|||||||
$('.btn-move-prompt').on('click', (ev) => {
|
$('.btn-move-prompt').on('click', (ev) => {
|
||||||
$('#txt-move-prompt').val(currentBasePath)
|
$('#txt-move-prompt').val(currentBasePath)
|
||||||
$('#modal-move-prompt').toggleClass('is-active')
|
$('#modal-move-prompt').toggleClass('is-active')
|
||||||
setInputSelection($('#txt-move-prompt').get(0), moveInitialDocument, currentBasePath.length)
|
setInputSelection($('#txt-move-prompt').get(0), moveInitialDocument, currentBasePath.length) // eslint-disable-line no-undef
|
||||||
$('#txt-move-prompt').removeClass('is-danger').next().addClass('is-hidden')
|
$('#txt-move-prompt').removeClass('is-danger').next().addClass('is-hidden')
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -21,7 +22,7 @@ $('#txt-move-prompt').on('keypress', (ev) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
$('.btn-move-go').on('click', (ev) => {
|
$('.btn-move-go').on('click', (ev) => {
|
||||||
let newDocPath = makeSafePath($('#txt-move-prompt').val())
|
let newDocPath = makeSafePath($('#txt-move-prompt').val()) // eslint-disable-line no-undef
|
||||||
if (_.isEmpty(newDocPath) || newDocPath === currentBasePath || newDocPath === 'home') {
|
if (_.isEmpty(newDocPath) || newDocPath === currentBasePath || newDocPath === 'home') {
|
||||||
$('#txt-move-prompt').addClass('is-danger').next().removeClass('is-hidden')
|
$('#txt-move-prompt').addClass('is-danger').next().removeClass('is-hidden')
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* global $, Vue, alerts, _, usrData, usrDataName */
|
||||||
|
|
||||||
if ($('#page-type-admin-profile').length) {
|
if ($('#page-type-admin-profile').length) {
|
||||||
let vueProfile = new Vue({
|
let vueProfile = new Vue({
|
||||||
@ -29,7 +30,9 @@ if ($('#page-type-admin-profile').length) {
|
|||||||
})
|
})
|
||||||
} else if ($('#page-type-admin-users').length) {
|
} else if ($('#page-type-admin-users').length) {
|
||||||
|
|
||||||
// =include ../modals/admin-users-create.js
|
/* eslint-disable spaced-comment */
|
||||||
|
//=include ../modals/admin-users-create.js
|
||||||
|
/* eslint-enable spaced-comment */
|
||||||
|
|
||||||
} else if ($('#page-type-admin-users-edit').length) {
|
} else if ($('#page-type-admin-users-edit').length) {
|
||||||
let vueEditUser = new Vue({
|
let vueEditUser = new Vue({
|
||||||
@ -92,5 +95,7 @@ if ($('#page-type-admin-profile').length) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// =include ../modals/admin-users-delete.js
|
/* eslint-disable spaced-comment */
|
||||||
|
//=include ../modals/admin-users-delete.js
|
||||||
|
/* eslint-enable spaced-comment */
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
/* global $ */
|
||||||
|
|
||||||
if ($('#page-type-create').length) {
|
if ($('#page-type-create').length) {
|
||||||
let pageEntryPath = $('#page-type-create').data('entrypath')
|
let pageEntryPath = $('#page-type-create').data('entrypath') // eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
// -> Discard
|
// -> Discard
|
||||||
|
|
||||||
@ -8,5 +9,7 @@ if ($('#page-type-create').length) {
|
|||||||
$('#modal-create-discard').toggleClass('is-active')
|
$('#modal-create-discard').toggleClass('is-active')
|
||||||
})
|
})
|
||||||
|
|
||||||
// =include ../components/editor.js
|
/* eslint-disable spaced-comment */
|
||||||
|
//=include ../components/editor.js
|
||||||
|
/* eslint-enable spaced-comment */
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
/* global $ */
|
||||||
|
|
||||||
if ($('#page-type-edit').length) {
|
if ($('#page-type-edit').length) {
|
||||||
let pageEntryPath = $('#page-type-edit').data('entrypath')
|
let pageEntryPath = $('#page-type-edit').data('entrypath') // eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
// -> Discard
|
// -> Discard
|
||||||
|
|
||||||
@ -8,5 +9,7 @@ if ($('#page-type-edit').length) {
|
|||||||
$('#modal-edit-discard').toggleClass('is-active')
|
$('#modal-edit-discard').toggleClass('is-active')
|
||||||
})
|
})
|
||||||
|
|
||||||
// =include ../components/editor.js
|
/* eslint-disable spaced-comment */
|
||||||
|
//=include ../components/editor.js
|
||||||
|
/* eslint-enable spaced-comment */
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* global $, ace */
|
||||||
|
|
||||||
if ($('#page-type-source').length) {
|
if ($('#page-type-source').length) {
|
||||||
var scEditor = ace.edit('source-display')
|
var scEditor = ace.edit('source-display')
|
||||||
@ -9,8 +10,10 @@ if ($('#page-type-source').length) {
|
|||||||
scEditor.setReadOnly(true)
|
scEditor.setReadOnly(true)
|
||||||
scEditor.renderer.updateFull()
|
scEditor.renderer.updateFull()
|
||||||
|
|
||||||
let currentBasePath = ($('#page-type-source').data('entrypath') !== 'home') ? $('#page-type-source').data('entrypath') : ''
|
let currentBasePath = ($('#page-type-source').data('entrypath') !== 'home') ? $('#page-type-source').data('entrypath') : '' // eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
// =include ../modals/create.js
|
/* eslint-disable spaced-comment */
|
||||||
// =include ../modals/move.js
|
//=include ../modals/create.js
|
||||||
|
//=include ../modals/move.js
|
||||||
|
/* eslint-enable spaced-comment */
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
|
/* global $ */
|
||||||
|
|
||||||
if ($('#page-type-view').length) {
|
if ($('#page-type-view').length) {
|
||||||
let currentBasePath = ($('#page-type-view').data('entrypath') !== 'home') ? $('#page-type-view').data('entrypath') : ''
|
let currentBasePath = ($('#page-type-view').data('entrypath') !== 'home') ? $('#page-type-view').data('entrypath') : '' // eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
// =include ../modals/create.js
|
/* eslint-disable spaced-comment */
|
||||||
// =include ../modals/move.js
|
//=include ../modals/create.js
|
||||||
|
//=include ../modals/move.js
|
||||||
|
/* eslint-enable spaced-comment */
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node server",
|
"start": "node server",
|
||||||
"dev": "gulp dev",
|
"dev": "gulp dev",
|
||||||
"test": "snyk test && istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec ./tests/index.js && cat ./coverage/lcov.info | ./node_modules/.bin/codacy-coverage && rm -rf ./coverage",
|
"test": "snyk test && standard && pug-lint ./views",
|
||||||
"snyk-protect": "snyk protect",
|
"snyk-protect": "snyk protect",
|
||||||
"__prepublish": "npm run snyk-protect"
|
"__prepublish": "npm run snyk-protect"
|
||||||
},
|
},
|
||||||
@ -101,6 +101,9 @@
|
|||||||
"chai": "^3.5.0",
|
"chai": "^3.5.0",
|
||||||
"chai-as-promised": "^6.0.0",
|
"chai-as-promised": "^6.0.0",
|
||||||
"codacy-coverage": "^2.0.0",
|
"codacy-coverage": "^2.0.0",
|
||||||
|
"eslint": "^3.15.0",
|
||||||
|
"eslint-plugin-promise": "^3.4.1",
|
||||||
|
"eslint-plugin-standard": "^2.0.1",
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
"gulp-babel": "^6.1.2",
|
"gulp-babel": "^6.1.2",
|
||||||
"gulp-clean-css": "^3.0.0",
|
"gulp-clean-css": "^3.0.0",
|
||||||
@ -123,6 +126,7 @@
|
|||||||
"mocha": "^3.2.0",
|
"mocha": "^3.2.0",
|
||||||
"mocha-lcov-reporter": "^1.2.0",
|
"mocha-lcov-reporter": "^1.2.0",
|
||||||
"nodemon": "^1.11.0",
|
"nodemon": "^1.11.0",
|
||||||
|
"pug-lint": "^2.4.0",
|
||||||
"run-sequence": "^1.2.2",
|
"run-sequence": "^1.2.2",
|
||||||
"snyk": "^1.24.6",
|
"snyk": "^1.24.6",
|
||||||
"sticky-js": "^1.1.9",
|
"sticky-js": "^1.1.9",
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"folders":
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"file_exclude_patterns":
|
|
||||||
[
|
|
||||||
"wiki.sublime-project"
|
|
||||||
],
|
|
||||||
"path": "."
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user