r96237 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96236‎ | r96237 | r96238 >
Date:17:04, 4 September 2011
Author:krinkle
Status:deferred (Comments)
Tags:
Comment:
Add local generator function to account for revert of r93063 in r96236.
Modified paths:
  • /trunk/phase3/resources/mediawiki.page/mediawiki.page.ajaxCategories.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/mediawiki.page/mediawiki.page.ajaxCategories.js
@@ -35,6 +35,23 @@
3636 }
3737
3838 /**
 39+ * Generates a random id out of 62 alpha-numeric characters.
 40+ *
 41+ * @param {Number} Length of id (optional, defaults to 32)
 42+ * @return {String}
 43+ */
 44+ function generateRandomId( idLength ) {
 45+ idLength = typeof idLength === 'number' ? idLength : 32;
 46+ var seed = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',
 47+ id = '';
 48+ for ( var r, i = 0; i < idLength; i++ ) {
 49+ r = Math.floor( Math.random() * seed.length );
 50+ id += seed.substring( r, r + 1 );
 51+ }
 52+ return id;
 53+ }
 54+
 55+ /**
3956 * Helper function for $.fn.suggestions
4057 *
4158 * @context {jQuery}
@@ -872,7 +889,7 @@
873890 var token = data.edittoken,
874891 timestamp = data.revisions[0].timestamp,
875892 oldText = data.revisions[0]['*'],
876 - nowikiKey = mw.user.generateId(), // Unique ID for nowiki replacement
 893+ nowikiKey = generateRandomId(), // Unique ID for nowiki replacement
877894 nowikiFragments = []; // Nowiki fragments will be stored here during the changes
878895
879896 // Replace all nowiki parts with unique keys..

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r93063mw.user.js: Make sessionId publicdiebuche16:54, 25 July 2011
r96236Revert r93063 per r93063 CRkrinkle16:50, 4 September 2011

Comments

#Comment by Krinkle (talk | contribs)   20:58, 3 October 2011

AjaxCategories moved out of core. Marking deferred for now.

Status & tagging log