@@ -443,29 +443,29 @@ $(document).ready(function () {
443443 clearMap ( )
444444 }
445445 checkEditorStyle ( )
446- /* we need this only on touch devices */
446+ /* we need this only on touch devices */
447447 if ( window . isTouchDevice ) {
448- /* cache dom references */
448+ /* cache dom references */
449449 var $body = jQuery ( 'body' )
450450
451- /* bind events */
451+ /* bind events */
452452 $ ( document )
453- . on ( 'focus' , 'textarea, input' , function ( ) {
454- $body . addClass ( 'fixfixed' )
455- } )
456- . on ( 'blur' , 'textarea, input' , function ( ) {
457- $body . removeClass ( 'fixfixed' )
458- } )
453+ . on ( 'focus' , 'textarea, input' , function ( ) {
454+ $body . addClass ( 'fixfixed' )
455+ } )
456+ . on ( 'blur' , 'textarea, input' , function ( ) {
457+ $body . removeClass ( 'fixfixed' )
458+ } )
459459 }
460- // showup
460+ // showup
461461 $ ( ) . showUp ( '.navbar' , {
462462 upClass : 'navbar-hide' ,
463463 downClass : 'navbar-show'
464464 } )
465- // tooltip
465+ // tooltip
466466 $ ( '[data-toggle="tooltip"]' ) . tooltip ( )
467- // shortcuts
468- // allow on all tags
467+ // shortcuts
468+ // allow on all tags
469469 key . filter = function ( e ) { return true }
470470 key ( 'ctrl+alt+e' , function ( e ) {
471471 changeMode ( modeType . edit )
@@ -476,7 +476,7 @@ $(document).ready(function () {
476476 key ( 'ctrl+alt+b' , function ( e ) {
477477 changeMode ( modeType . both )
478478 } )
479- // toggle-dropdown
479+ // toggle-dropdown
480480 $ ( document ) . on ( 'click' , '.toggle-dropdown .dropdown-menu' , function ( e ) {
481481 e . stopPropagation ( )
482482 } )
@@ -491,10 +491,10 @@ $(window).resize(function () {
491491} )
492492// when page unload
493493$ ( window ) . on ( 'unload' , function ( ) {
494- // updateHistoryInner();
494+ // updateHistoryInner();
495495} )
496496$ ( window ) . on ( 'error' , function ( ) {
497- // setNeedRefresh();
497+ // setNeedRefresh();
498498} )
499499
500500setupSyncAreas ( ui . area . codemirrorScroll , ui . area . view , ui . area . markdown )
@@ -516,7 +516,7 @@ function windowResizeInner (callback) {
516516 checkEditorStyle ( )
517517 checkTocStyle ( )
518518 checkCursorMenu ( )
519- // refresh editor
519+ // refresh editor
520520 if ( window . loaded ) {
521521 if ( editor . getOption ( 'scrollbarStyle' ) === 'native' ) {
522522 setTimeout ( function ( ) {
@@ -526,13 +526,13 @@ function windowResizeInner (callback) {
526526 if ( callback && typeof callback === 'function' ) { callback ( ) }
527527 } , 1 )
528528 } else {
529- // force it load all docs at once to prevent scroll knob blink
529+ // force it load all docs at once to prevent scroll knob blink
530530 editor . setOption ( 'viewportMargin' , Infinity )
531531 setTimeout ( function ( ) {
532532 clearMap ( )
533533 autoSyncscroll ( )
534534 editor . setOption ( 'viewportMargin' , viewportMargin )
535- // add or update user cursors
535+ // add or update user cursors
536536 for ( var i = 0 ; i < window . onlineUsers . length ; i ++ ) {
537537 if ( window . onlineUsers [ i ] . id !== window . personalInfo . id ) { buildCursor ( window . onlineUsers [ i ] ) }
538538 }
@@ -581,9 +581,9 @@ function checkEditorStyle () {
581581 ui . area . codemirrorScroll . css ( 'height' , '' )
582582 ui . area . codemirrorScroll . css ( 'min-height' , desireHeight + 'px' )
583583 }
584- // workaround editor will have wrong doc height when editor height changed
584+ // workaround editor will have wrong doc height when editor height changed
585585 editor . setSize ( null , ui . area . edit . height ( ) )
586- // make editor resizable
586+ // make editor resizable
587587 if ( ! ui . area . resize . handle . length ) {
588588 ui . area . edit . resizable ( {
589589 handles : 'e' ,
@@ -662,8 +662,8 @@ var checkEditorScrollbar = _.debounce(function () {
662662} , 50 )
663663
664664function checkEditorScrollbarInner ( ) {
665- // workaround simple scroll bar knob
666- // will get wrong position when editor height changed
665+ // workaround simple scroll bar knob
666+ // will get wrong position when editor height changed
667667 var scrollInfo = editor . getScrollInfo ( )
668668 editor . scrollTo ( null , scrollInfo . top - 1 )
669669 editor . scrollTo ( null , scrollInfo . top )
@@ -687,7 +687,7 @@ function checkTocStyle () {
687687 } else {
688688 newbool = false
689689 }
690- // toc scrollspy
690+ // toc scrollspy
691691 ui . toc . toc . removeClass ( 'scrollspy-body, scrollspy-view' )
692692 ui . toc . affix . removeClass ( 'scrollspy-body, scrollspy-view' )
693693 if ( window . currentMode === modeType . both ) {
@@ -1895,10 +1895,6 @@ function initMarkAndCheckGutter (mark, author, timestamp) {
18951895 }
18961896 return mark
18971897}
1898- var gutterStylePrefix = 'border-left: 3px solid '
1899- var gutterStylePostfix = '; height: ' + defaultTextHeight + 'px; margin-left: 3px;'
1900- var textMarkderStylePrefix = 'background-image: linear-gradient(to top, '
1901- var textMarkderStylePostfix = ' 1px, transparent 1px);'
19021898var addStyleRule = ( function ( ) {
19031899 var added = { }
19041900 var styleElement = document . createElement ( 'style' )
@@ -2015,11 +2011,11 @@ function updateAuthorshipInner () {
20152011 for ( let i = 0 ; i < addTextMarkers . length ; i ++ ) {
20162012 let textMarker = addTextMarkers [ i ]
20172013 let author = authors [ textMarker . userid ]
2018- var rgbcolor = hex2rgb ( author . color )
2019- var colorString = ' rgba(' + rgbcolor . red + ',' + rgbcolor . green + ',' + rgbcolor . blue + ' ,0.7)'
2020- var styleString = textMarkderStylePrefix + colorString + textMarkderStylePostfix
2021- let className = ' authorship-inline-' + author . color . substr ( 1 )
2022- var rule = '.' + className + '{' + styleString + '}'
2014+ const rgbcolor = hex2rgb ( author . color )
2015+ const colorString = ` rgba(${ rgbcolor . red } , ${ rgbcolor . green } , ${ rgbcolor . blue } ,0.7)`
2016+ const styleString = `background-image: linear-gradient(to top, ${ colorString } 1px, transparent 1px);`
2017+ let className = ` authorship-inline-${ author . color . substr ( 1 ) } `
2018+ const rule = `. ${ className } { ${ styleString } }`
20232019 addStyleRule ( rule )
20242020 editor . markText ( textMarker . pos [ 0 ] , textMarker . pos [ 1 ] , {
20252021 className : 'authorship-inline ' + className ,
@@ -2033,12 +2029,12 @@ function iterateLine (line) {
20332029 var author = currMark ? authors [ currMark . gutter . userid ] : null
20342030 if ( currMark && author ) {
20352031 let className = 'authorship-gutter-' + author . color . substr ( 1 )
2036- var gutters = line . gutterMarkers
2032+ const gutters = line . gutterMarkers
20372033 if ( ! gutters || ! gutters [ 'authorship-gutters' ] ||
2038- ! gutters [ 'authorship-gutters' ] . className ||
2039- ! gutters [ 'authorship-gutters' ] . className . indexOf ( className ) < 0 ) {
2040- var styleString = gutterStylePrefix + author . color + gutterStylePostfix
2041- var rule = '.' + className + '{' + styleString + '}'
2034+ ! gutters [ 'authorship-gutters' ] . className ||
2035+ ! gutters [ 'authorship-gutters' ] . className . indexOf ( className ) < 0 ) {
2036+ const styleString = `border-left: 3px solid ${ author . color } ; height: ${ defaultTextHeight } px; margin-left: 3px;`
2037+ const rule = `. ${ className } { ${ styleString } }`
20422038 addStyleRule ( rule )
20432039 var gutter = $ ( '<div>' , {
20442040 class : 'authorship-gutter ' + className ,
@@ -2069,14 +2065,14 @@ editorInstance.on('update', function () {
20692065 placement : 'bottom' ,
20702066 delay : { 'show' : 500 , 'hide' : 100 }
20712067 } )
2072- // clear tooltip which described element has been removed
2068+ // clear tooltip which described element has been removed
20732069 $ ( '[id^="tooltip"]' ) . each ( function ( index , element ) {
20742070 var $ele = $ ( element )
20752071 if ( $ ( '[aria-describedby="' + $ele . attr ( 'id' ) + '"]' ) . length <= 0 ) $ele . remove ( )
20762072 } )
20772073} )
20782074socket . on ( 'check' , function ( data ) {
2079- // console.log(data);
2075+ // console.log(data);
20802076 updateInfo ( data )
20812077} )
20822078socket . on ( 'permission' , function ( data ) {
@@ -2096,7 +2092,7 @@ socket.on('refresh', function (data) {
20962092 if ( nocontent ) {
20972093 if ( window . visibleXS ) { window . currentMode = modeType . edit } else { window . currentMode = modeType . both }
20982094 }
2099- // parse mode from url
2095+ // parse mode from url
21002096 if ( window . location . search . length > 0 ) {
21012097 var urlMode = modeType [ window . location . search . substr ( 1 ) ]
21022098 if ( urlMode ) window . currentMode = urlMode
@@ -2112,9 +2108,9 @@ socket.on('refresh', function (data) {
21122108 emitUserStatus ( ) // send first user status
21132109 updateOnlineStatus ( ) // update first online status
21142110 setTimeout ( function ( ) {
2115- // work around editor not refresh or doc not fully loaded
2111+ // work around editor not refresh or doc not fully loaded
21162112 windowResizeInner ( )
2117- // work around might not scroll to hash
2113+ // work around might not scroll to hash
21182114 scrollToHash ( )
21192115 } , 1 )
21202116 }
@@ -2148,17 +2144,17 @@ socket.on('doc', function (obj) {
21482144 ui . spinner . hide ( )
21492145 ui . content . fadeIn ( )
21502146 } else {
2151- // if current doc is equal to the doc before disconnect
2147+ // if current doc is equal to the doc before disconnect
21522148 if ( setDoc && bodyMismatch ) editor . clearHistory ( )
21532149 else if ( window . lastInfo . history ) editor . setHistory ( window . lastInfo . history )
21542150 window . lastInfo . history = null
21552151 }
21562152
21572153 if ( ! cmClient ) {
21582154 cmClient = window . cmClient = new EditorClient (
2159- obj . revision , obj . clients ,
2160- new SocketIOAdapter ( socket ) , new CodeMirrorAdapter ( editor )
2161- )
2155+ obj . revision , obj . clients ,
2156+ new SocketIOAdapter ( socket ) , new CodeMirrorAdapter ( editor )
2157+ )
21622158 synchronized_ = cmClient . state
21632159 } else if ( setDoc ) {
21642160 if ( bodyMismatch ) {
@@ -2263,11 +2259,11 @@ socket.on('cursor blur', function (data) {
22632259var options = {
22642260 valueNames : [ 'id' , 'name' ] ,
22652261 item : '<li class="ui-user-item">' +
2266- '<span class="id" style="display:none;"></span>' +
2267- '<a href="#">' +
2268- '<span class="pull-left"><i class="ui-user-icon"></i></span><span class="ui-user-name name"></span><span class="pull-right"><i class="fa fa-circle ui-user-status"></i></span>' +
2269- '</a>' +
2270- '</li>'
2262+ '<span class="id" style="display:none;"></span>' +
2263+ '<a href="#">' +
2264+ '<span class="pull-left"><i class="ui-user-icon"></i></span><span class="ui-user-name name"></span><span class="pull-right"><i class="fa fa-circle ui-user-status"></i></span>' +
2265+ '</a>' +
2266+ '</li>'
22712267}
22722268var onlineUserList = new List ( 'online-user-list' , options )
22732269var shortOnlineUserList = new List ( 'short-online-user-list' , options )
0 commit comments