r91593 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91592‎ | r91593 | r91594 >
Date:20:05, 6 July 2011
Author:inez
Status:deferred
Tags:
Comment:
Make cursor blink every 500 ms for 500 ms
Modified paths:
  • /trunk/parsers/wikidom/lib/es/es.Surface.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/es/es.Surface.js
@@ -8,6 +8,7 @@
99 this.$ = $container;
1010 this.document = document;
1111 this.rendered = false;
 12+ this.cursorInitialized = false;
1213 this.location = null;
1314 this.render();
1415
@@ -18,9 +19,6 @@
1920 return surface.onMouseDown( e );
2021 }
2122 });
22 -
23 - this.$cursor = $( '<div class="editSurface-cursor"></div>' );
24 - this.$.after( this.$cursor );
2523 }
2624
2725 Surface.prototype.onMouseDown = function( e ) {
@@ -32,8 +30,8 @@
3331 return false;
3432 }
3533
36 - var position = new Position(e.pageX - $block.offset().left,
37 - e.pageY - $block.offset().top);
 34+ var position = new Position( e.pageX - $block.offset().left,
 35+ e.pageY - $block.offset().top );
3836 var offset = block.flow.getOffset( position );
3937 this.setCursor( new Location( block, offset ) );
4038 };
@@ -48,6 +46,17 @@
4947
5048 var position = this.location.block.getPosition( this.location.offset );
5149 var offset = this.location.block.$.offset();
 50+
 51+ if( !this.cursorInitialized ) {
 52+ this.$cursor = $( '<div class="editSurface-cursor"></div>' );
 53+ this.$.after( this.$cursor );
 54+
 55+ setInterval( function( surface ) {
 56+ surface.$cursor.css('display') == 'block' ? surface.$cursor.hide() : surface.$cursor.show();
 57+ }, 500, this );
 58+
 59+ this.cursorInitialized = true;
 60+ }
5261
5362 this.$cursor.css({
5463 'left': position.left + offset.left,

Status & tagging log