r101603 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101602‎ | r101603 | r101604 >
Date:09:33, 2 November 2011
Author:neilk
Status:ok
Tags:
Comment:
validate wikitext only if idle for 2 seconds
Modified paths:
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardLicenseInput.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardLicenseInput.js
@@ -219,14 +219,21 @@
220220 * @return {jQuery} wrapped textarea
221221 */
222222 createCustomWikiTextInterface: function( $input ) {
223 - var _this = this;
 223+ var _this = this,
 224+ keydownTimeout;
224225
225226 var nameId = $input.attr( 'id' ) + '_custom';
226227 var $textarea = $j( '<textarea></textarea>' )
227228 .attr( { id: nameId, name: nameId } )
228229 .growTextArea()
229230 .focus( function() { _this.setInput( $input, true ); } )
230 - .keydown( function() { _this.$selector.trigger( 'changeLicenses' ); } )
 231+ .keydown( function() {
 232+ window.clearTimeout( keydownTimeout );
 233+ keydownTimeout = window.setTimeout(
 234+ function() { _this.$selector.trigger( 'changeLicenses' ); },
 235+ 2000
 236+ );
 237+ } )
231238 .css( {
232239 'width': '100%',
233240 'font-family': 'monospace'
@@ -479,8 +486,10 @@
480487 var templates = [];
481488 accumTemplates( ast, templates );
482489
 490+ // TODO config
483491 var topCat = new mw.Title( 'License tags', 'category' );
484492
 493+ // TODO caching
485494 var found = false;
486495 function recurseCategories( desiredCatTitle, title, depthToContinue ) {
487496 if ( depthToContinue === 0 ) {

Status & tagging log