r99249 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99248‎ | r99249 | r99250 >
Date:20:48, 7 October 2011
Author:ashley
Status:deferred
Tags:
Comment:
CreateAPage: swap escape() to encodeURIComponent() and unescape() to decodeURIComponent, as per Dantman
Modified paths:
  • /trunk/extensions/CreateAPage/js/CreateAPage.js (modified) (history)

Diff [purge]

Index: trunk/extensions/CreateAPage/js/CreateAPage.js
@@ -60,9 +60,9 @@
6161 var category_text = document.getElementById( 'wpCategoryTextarea' );
6262
6363 if ( category_text.value === '' ) {
64 - category_text.value += unescape( category );
 64+ category_text.value += decodeURIComponent( category );
6565 } else {
66 - category_text.value += '|' + unescape( category );
 66+ category_text.value += '|' + decodeURIComponent( category );
6767 }
6868
6969 var this_button = document.getElementById( 'cloud' + num );
@@ -95,9 +95,9 @@
9696 var category = category_input.value;
9797 if ( category_input.value !== '' ) {
9898 if ( category_text.value === '' ) {
99 - category_text.value += unescape( category );
 99+ category_text.value += decodeURIComponent( category );
100100 } else {
101 - category_text.value += '|' + unescape( category );
 101+ category_text.value += '|' + decodeURIComponent( category );
102102 }
103103 category_input.value = '';
104104 var c_found = false;
@@ -140,10 +140,10 @@
141141
142142 remove: function( category, num ) { // previously cloudRemove
143143 var category_text = document.getElementById( 'wpCategoryTextarea' );
144 - var this_pos = category_text.value.indexOf( unescape( category ) );
 144+ var this_pos = category_text.value.indexOf( decodeURIComponent( category ) );
145145 if ( this_pos !== -1 ) {
146146 category_text.value = category_text.value.substr( 0, this_pos - 1 ) +
147 - category_text.value.substr( this_pos + unescape( category ).length );
 147+ category_text.value.substr( this_pos + decodeURIComponent( category ).length );
148148 }
149149 var this_button = document.getElementById( 'cloud' + num );
150150 this_button.onclick = function() {
@@ -618,7 +618,7 @@
619619
620620 onclickCategoryFn: function( cat, id ) {
621621 return function() {
622 - CreateAPageCategoryTagCloud.remove( escape( cat ), id );
 622+ CreateAPageCategoryTagCloud.remove( encodeURIComponent( cat ), id );
623623 return false;
624624 };
625625 },

Status & tagging log