diff --git a/static/js/Wiki.js b/static/js/Wiki.js index dd281d2..3240793 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -808,16 +808,9 @@ Wiki.prototype.create_editor = function ( id, note_text, deleted_from_id, revisi '' + note_text; } - if ( !read_write && creation ) { - var short_creation = this.brief_revision( creation ); - if ( user_id ) - var by = ' by ' + user_id; - else - var by = ''; - - note_text = '

Posted' + by + ' on ' + short_creation + - ' | permalink

' + note_text; + if ( creation ) { + // FIXME: should be username, not user_id + note_text = this.make_byline( user_id, creation ) + note_text; } var startup = this.startup_notes[ id ]; @@ -1005,9 +998,18 @@ Wiki.prototype.update_link_with_suggestion = function ( editor, link, note ) { } Wiki.prototype.editor_focused = function ( editor, synchronous ) { - if ( editor ) + if ( editor ) { addElementClass( editor.iframe, "focused_note_frame" ); + if ( editor.document && editor.read_write ) { + var byline = getFirstElementByTagAndClassName( "p", "byline", editor.document ); + if ( byline ) { + removeElement( byline ); + editor.resize(); + } + } + } + if ( this.focused_editor && this.focused_editor != editor ) { this.clear_pulldowns(); removeElementClass( this.focused_editor.iframe, "focused_note_frame" ); @@ -1032,6 +1034,20 @@ Wiki.prototype.editor_focused = function ( editor, synchronous ) { } } +Wiki.prototype.make_byline = function ( username, creation ) { + if ( username ) + var by = ' by ' + username; + else + var by = ''; + + if ( creation ) + var timestamp = ' on ' + this.brief_revision( creation ); + else + var timestamp = ''; + + return '

Posted' + by + timestamp; +} + Wiki.prototype.editor_mouse_hovered = function ( editor, target ) { var pulldowns = getElementsByTagAndClassName( "div", "pulldown" );