@@ -471,7 +471,6 @@ $(document).ready(function () {
471
471
$ ( '[data-toggle="tooltip"]' ) . tooltip ( )
472
472
// shortcuts
473
473
// allow on all tags
474
-
475
474
key . filter = function ( e ) { return true }
476
475
key ( 'ctrl+alt+e' , function ( e ) {
477
476
if ( blockSourceView ) return
@@ -505,14 +504,12 @@ $(window).on('error', function () {
505
504
// setNeedRefresh();
506
505
} )
507
506
508
- //
509
507
function checkParametr ( isLogin , permission ) {
510
508
if ( typeof isLogin !== 'boolean' || ! permission ) {
511
509
throw new Error ( 'one or more parametr is incorrect' )
512
510
} else return allowVisibleSource ( isLogin , permission )
513
511
}
514
512
515
- // replace url if user have not rights to veiw source code
516
513
function replaceUrl ( url ) {
517
514
const urlHasEditOrBoth = / \? e d i t | \? b o t h / ;
518
515
if ( urlHasEditOrBoth . test ( url ) ) {
@@ -521,7 +518,6 @@ function replaceUrl (url) {
521
518
}
522
519
}
523
520
524
- //denied access to view or both mode if user have not permission for that
525
521
function allowVisibleSource ( isLogin , permission ) {
526
522
switch ( permission ) {
527
523
case 'freely' :
@@ -550,30 +546,20 @@ function allowVisibleSource (isLogin, permission) {
550
546
}
551
547
}
552
548
553
- //set disable attr for UI
554
549
function disableControls ( ) {
555
550
ui . toolbar . edit . attr ( {
556
551
disabled : 'true' ,
557
- title : 'You have no rights to edit this note'
558
552
} )
559
553
ui . toolbar . both . attr ( {
560
554
disabled : 'true' ,
561
- title : 'You have no rights to edit this note'
562
555
} )
563
556
}
564
- //remove disable attr from UI
557
+
565
558
function enableControls ( ) {
566
559
ui . toolbar . edit . removeAttr ( 'disabled' )
567
560
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
- } )
574
561
}
575
562
576
- //checking is user log in
577
563
function userIsLogin ( userPersonalInfo ) {
578
564
if ( userPersonalInfo . hasOwnProperty ( 'login' ) ) {
579
565
if ( userPersonalInfo . login === true ) {
0 commit comments