@@ -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- //
509507function 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
516513function replaceUrl ( url ) {
517514 const urlHasEditOrBoth = / \? e d i t | \? b o t h / ;
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
525521function 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
554549function 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+
565558function 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
577563function userIsLogin ( userPersonalInfo ) {
578564 if ( userPersonalInfo . hasOwnProperty ( 'login' ) ) {
579565 if ( userPersonalInfo . login === true ) {
0 commit comments