Skip to content

Commit b309457

Browse files
committed
clean code
Signed-off-by: JamesHow1ett <mopis101@gmail.com>
1 parent 4e414db commit b309457

File tree

2 files changed

+1
-16
lines changed

2 files changed

+1
-16
lines changed

lib/config/environment.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ module.exports = {
2929
allowAnonymousEdits: toBooleanConfig(process.env.CMD_ALLOW_ANONYMOUS_EDITS),
3030
allowAnonymousViews: toBooleanConfig(process.env.CMD_ALLOW_ANONYMOUS_VIEWS),
3131
allowFreeURL: toBooleanConfig(process.env.CMD_ALLOW_FREEURL),
32-
//my feature is below
3332
allowVisibleSource: toBooleanConfig(process.env.CMD_VISIBLE_SOURCE),
3433
forbiddenNoteIDs: toArrayConfig(process.env.CMD_FORBIDDEN_NOTE_IDS),
3534
defaultPermission: process.env.CMD_DEFAULT_PERMISSION,

public/js/index.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,6 @@ $(document).ready(function () {
471471
$('[data-toggle="tooltip"]').tooltip()
472472
// shortcuts
473473
// allow on all tags
474-
475474
key.filter = function (e) { return true }
476475
key('ctrl+alt+e', function (e) {
477476
if (blockSourceView) return
@@ -505,14 +504,12 @@ $(window).on('error', function () {
505504
// setNeedRefresh();
506505
})
507506

508-
//
509507
function checkParametr (isLogin, permission) {
510508
if (typeof isLogin !== 'boolean' || !permission) {
511509
throw new Error('one or more parametr is incorrect')
512510
} else return allowVisibleSource(isLogin, permission)
513511
}
514512

515-
// replace url if user have not rights to veiw source code
516513
function replaceUrl (url) {
517514
const urlHasEditOrBoth = /\?edit|\?both/;
518515
if (urlHasEditOrBoth.test(url)) {
@@ -521,7 +518,6 @@ function replaceUrl (url) {
521518
}
522519
}
523520

524-
//denied access to view or both mode if user have not permission for that
525521
function allowVisibleSource (isLogin, permission) {
526522
switch(permission) {
527523
case 'freely':
@@ -550,30 +546,20 @@ function allowVisibleSource (isLogin, permission) {
550546
}
551547
}
552548

553-
//set disable attr for UI
554549
function disableControls () {
555550
ui.toolbar.edit.attr({
556551
disabled: 'true',
557-
title: 'You have no rights to edit this note'
558552
})
559553
ui.toolbar.both.attr({
560554
disabled: 'true',
561-
title: 'You have no rights to edit this note'
562555
})
563556
}
564-
//remove disable attr from UI
557+
565558
function enableControls () {
566559
ui.toolbar.edit.removeAttr('disabled')
567560
ui.toolbar.both.removeAttr('disabled')
568-
ui.toolbar.edit.attr({
569-
title: 'Edit (Ctrl+Alt+E)'
570-
})
571-
ui.toolbar.both.attr({
572-
title: 'Both (Ctrl+Alt+B)'
573-
})
574561
}
575562

576-
//checking is user log in
577563
function userIsLogin (userPersonalInfo) {
578564
if (userPersonalInfo.hasOwnProperty('login')) {
579565
if (userPersonalInfo.login === true) {

0 commit comments

Comments
 (0)