r99209 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99208‎ | r99209 | r99210 >
Date:13:08, 7 October 2011
Author:inez
Status:deferred
Tags:
Comment:
Implement methods showCursor and hideCursor in SurfaceView - and make cursor blink
Modified paths:
  • /trunk/parsers/wikidom/lib/synth/views/es.SurfaceView.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/synth/views/es.SurfaceView.js
@@ -217,11 +217,7 @@
218218 position = this.documentView.getRenderedPosition( contentOffset );
219219
220220 if ( position !== null ) {
221 - this.$cursor.css( {
222 - 'left': position.left,
223 - 'top': position.top,
224 - 'height': position.bottom - position.top
225 - } ).show();
 221+ this.showCursor( position );
226222 }
227223
228224 /*
@@ -279,4 +275,31 @@
280276
281277 es.SurfaceView.prototype.setInputContent = function( content ) {
282278 // TODO: Set the value of this.$input
 279+};
 280+
 281+es.SurfaceView.prototype.showCursor = function( position ) {
 282+ if ( position ) {
 283+ this.$cursor.css( {
 284+ 'left': position.left,
 285+ 'top': position.top,
 286+ 'height': position.bottom - position.top
 287+ } ).show();
 288+ } else {
 289+ this.$cursor.show();
 290+ }
 291+
 292+ if ( this.blinkInterval ) {
 293+ clearInterval( this.blinkInterval );
 294+ }
 295+ this.blinkInterval = setInterval( function( surface ) {
 296+ surface.$cursor.css( 'display' ) == 'block'
 297+ ? surface.$cursor.hide() : surface.$cursor.show();
 298+ }, 500, this );
 299+};
 300+
 301+es.SurfaceView.prototype.hideCursor = function( position ) {
 302+ if( this.blinkInterval ) {
 303+ clearInterval( this.blinkInterval );
 304+ }
 305+ this.$cursor.hide();
283306 };
\ No newline at end of file

Status & tagging log