From 3a4030fee55d6cd0f96d569adec71d22044d704a Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Tue, 29 Jul 2008 14:48:54 -0700 Subject: [PATCH] When scrolling to and then highlighting a note, do so serially instead of in parallel. Also made speed of scrolling to a note or message slightly faster. --- NEWS | 6 ++++++ static/js/Editor.js | 28 ++++++++++++++++++---------- static/js/Wiki.js | 2 +- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/NEWS b/NEWS index fc91e49..0688f3c 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +1.4.19: + * When scrolling to and then highlighting a note, do so serially instead of + in parallel. + * Made speed of scrolling to a note or message slightly faster. + * Removed big yellow "sign up for free" box from the sign up page itself. + 1.4.18: July 28, 2008: * Fixed a bug where clicking the link for an updated note in an RSS feed did not properly redirect to that note after login. diff --git a/static/js/Editor.js b/static/js/Editor.js index 3a9defb..609c208 100644 --- a/static/js/Editor.js +++ b/static/js/Editor.js @@ -214,22 +214,30 @@ Editor.prototype.highlight = function ( scroll ) { if ( scroll == undefined ) scroll = true; + var self = this; + + function do_highlight() { + if ( /Opera/.test( navigator.userAgent ) ) { // MochiKit's Highlight for iframes is broken in Opera + pulsate( self.iframe, options = { "pulses": 1, "duration": 0.5 } ); + } else if ( self.iframe.contentDocument ) { // browsers such as Firefox + Highlight( self.iframe, options = { "queue": { "scope": "highlight", "limit": 1 } } ); + } else { // browsers such as IE + if ( self.document && self.document.body ) + Highlight( self.document.body, options = { "queue": { "scope": "highlight", "limit": 1 } } ); + } + } + if ( scroll ) { // if the editor is already completely on-screen, then there's no need to scroll var viewport_position = getViewportPosition(); if ( getElementPosition( this.note_controls ).y < viewport_position.y || - getElementPosition( this.iframe ).y + getElementDimensions( this.iframe ).h > viewport_position.y + getViewportDimensions().h ) - new ScrollTo( this.note_controls ); + getElementPosition( this.iframe ).y + getElementDimensions( this.iframe ).h > viewport_position.y + getViewportDimensions().h ) { + new ScrollTo( this.note_controls, { "afterFinish": do_highlight, "duration": 0.5 } ); + return; + } } - if ( /Opera/.test( navigator.userAgent ) ) { // MochiKit's Highlight for iframes is broken in Opera - pulsate( this.iframe, options = { "pulses": 1, "duration": 0.5 } ); - } else if ( this.iframe.contentDocument ) { // browsers such as Firefox - Highlight( this.iframe, options = { "queue": { "scope": "highlight", "limit": 1 } } ); - } else { // browsers such as IE - if ( this.document && this.document.body ) - Highlight( this.document.body, options = { "queue": { "scope": "highlight", "limit": 1 } } ); - } + do_highlight(); } Editor.prototype.exec_command = function ( command, parameter ) { diff --git a/static/js/Wiki.js b/static/js/Wiki.js index 965a6cc..5f63117 100644 --- a/static/js/Wiki.js +++ b/static/js/Wiki.js @@ -2287,7 +2287,7 @@ Wiki.prototype.scroll_to = function ( node ) { var viewport_position = getViewportPosition(); if ( getElementPosition( node ).y < viewport_position.y || getElementPosition( node ).y + getElementDimensions( node ).h > viewport_position.y + getViewportDimensions().h ) - new ScrollTo( node ); + new ScrollTo( node, { "duration": 0.5 } ); } Wiki.prototype.clear_messages = function () {