summaryrefslogtreecommitdiff
path: root/public/js
diff options
context:
space:
mode:
Diffstat (limited to 'public/js')
-rw-r--r--public/js/extra.js6
-rw-r--r--public/js/index.js15
-rw-r--r--public/js/lib/appState.js3
-rw-r--r--public/js/lib/editor/index.js6
-rw-r--r--public/js/lib/editor/ui-elements.js1
-rw-r--r--[-rwxr-xr-x]public/js/reveal-markdown.js0
6 files changed, 26 insertions, 5 deletions
diff --git a/public/js/extra.js b/public/js/extra.js
index 13b8924c..75aa29af 100644
--- a/public/js/extra.js
+++ b/public/js/extra.js
@@ -156,7 +156,11 @@ export function renderTags (view) {
}
function slugifyWithUTF8 (text) {
- let newText = S(text.toLowerCase()).trim().stripTags().dasherize().s
+ // remove html tags and trim spaces
+ let newText = S(text).trim().stripTags().s
+ // replace all spaces in between to dashes
+ newText = newText.replace(/\s+/g, '-')
+ // slugify string to make it valid for attribute
newText = newText.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, '')
return newText
}
diff --git a/public/js/index.js b/public/js/index.js
index b336af90..5ff716fd 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -1633,6 +1633,10 @@ ui.toolbar.view.click(function () {
ui.toolbar.both.click(function () {
changeMode(modeType.both)
})
+
+ui.toolbar.night.click(function () {
+ toggleNightMode()
+})
// permission
// freely
ui.infobar.permission.freely.click(function () {
@@ -1666,6 +1670,17 @@ $('.ui-delete-modal-confirm').click(function () {
socket.emit('delete')
})
+function toggleNightMode () {
+ var $body = $('body')
+ var isActive = ui.toolbar.night.hasClass('active')
+ if (isActive) {
+ $body.removeClass('night')
+ appState.nightMode = false
+ } else {
+ $body.addClass('night')
+ appState.nightMode = true
+ }
+}
function emitPermission (_permission) {
if (_permission !== permission) {
socket.emit('permission', _permission)
diff --git a/public/js/lib/appState.js b/public/js/lib/appState.js
index fb8030e1..87aaf737 100644
--- a/public/js/lib/appState.js
+++ b/public/js/lib/appState.js
@@ -2,7 +2,8 @@ import modeType from './modeType'
let state = {
syncscroll: true,
- currentMode: modeType.view
+ currentMode: modeType.view,
+ nightMode: false
}
export default state
diff --git a/public/js/lib/editor/index.js b/public/js/lib/editor/index.js
index 33c1e0d4..003b32b7 100644
--- a/public/js/lib/editor/index.js
+++ b/public/js/lib/editor/index.js
@@ -171,13 +171,13 @@ export default class Editor {
this.statusLength.text('Length ' + docLength)
if (docLength > (config.docmaxlength * 0.95)) {
this.statusLength.css('color', 'red')
- this.statusLength.attr('title', 'Your almost reach note max length limit.')
+ this.statusLength.attr('title', 'You have almost reached the limit for this document.')
} else if (docLength > (config.docmaxlength * 0.8)) {
this.statusLength.css('color', 'orange')
- this.statusLength.attr('title', 'You nearly fill the note, consider to make more pieces.')
+ this.statusLength.attr('title', 'This document is nearly full, consider splitting it or creating a new one.')
} else {
this.statusLength.css('color', 'white')
- this.statusLength.attr('title', 'You could write up to ' + config.docmaxlength + ' characters in this note.')
+ this.statusLength.attr('title', 'You can write up to ' + config.docmaxlength + ' characters in this document.')
}
}
diff --git a/public/js/lib/editor/ui-elements.js b/public/js/lib/editor/ui-elements.js
index 0d330d77..88a1e3ca 100644
--- a/public/js/lib/editor/ui-elements.js
+++ b/public/js/lib/editor/ui-elements.js
@@ -37,6 +37,7 @@ export const getUIElements = () => ({
edit: $('.ui-edit'),
view: $('.ui-view'),
both: $('.ui-both'),
+ night: $('.ui-night'),
uploadImage: $('.ui-upload-image')
},
infobar: {
diff --git a/public/js/reveal-markdown.js b/public/js/reveal-markdown.js
index d15b5ebd..d15b5ebd 100755..100644
--- a/public/js/reveal-markdown.js
+++ b/public/js/reveal-markdown.js