r56423 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56422‎ | r56423 | r56424 >
Date:18:03, 16 September 2009
Author:catrope
Status:deferred
Tags:
Comment:
wmf-deployment-work: Merge r56226 (remove namespace dropdown in links
CGD) from trunk to shut up a JS error
Modified paths:
  • /branches/wmf-deployment-work/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js (modified) (history)

Diff [purge]

Index: branches/wmf-deployment-work/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js
@@ -759,7 +759,6 @@
760760 <div id="edittoolbar-link-dialog-tab-int"><form><fieldset><table><tr>\
761761 <td><label for="edittoolbar-link-int-target" rel="edittoolbar-tool-link-int-target"></label></td>\
762762 <td>\
763 - <select id="edittoolbar-link-int-target-ns" />\
764763 <input type="text" id="edittoolbar-link-int-target" />\
765764 <div id="edittoolbar-link-int-target-status" style="display: inline;"></div>\
766765 </td>\
@@ -788,24 +787,13 @@
789788 request.abort();
790789 }
791790
792 - var targetNSID = $j( '#edittoolbar-link-int-target-ns' ).val();
793 - if ( targetNSID < 0 ) {
794 - // Can't check existence for Special: or Media: titles
795 - updateWidget( 'exists' );
796 - return;
797 - }
798 -
799 - var targetNS = $j( '#edittoolbar-link-int-target-ns option:selected' ).text();
800 - if ( targetNS != '' )
801 - targetNS += ':';
802 - var targetTitle = $j( '#edittoolbar-link-int-target' ).val();
803 - var target = targetNS + targetTitle;
 791+ var target = $j( '#edittoolbar-link-int-target' ).val();
804792 var cache = $j( '#edittoolbar-link-int-target-status' ).data( 'existencecache' );
805793 if ( cache[target] ) {
806794 updateWidget( cache[target] );
807795 return;
808796 }
809 - if ( targetTitle == '' ) {
 797+ if ( target == '' ) {
810798 // Hide the widget when the textbox is empty
811799 $j( '#edittoolbar-link-int-target-status' ).children().hide();
812800 return;
@@ -851,8 +839,6 @@
852840 });
853841 // Build tabs
854842 $j( '#edittoolbar-link-tabs' ).tabs();
855 - // Set up the namespace selector
856 - $j( '#edittoolbar-link-int-target-ns' ).namespaceSelector();
857843 // Automatically copy the value of the internal link page title field to the link text field unless the user
858844 // has changed the link text field - this is a convience thing since most link texts are going to be the
859845 // the same as the page title
@@ -861,20 +847,12 @@
862848 if ( $j( '#edittoolbar-link-int-text' ).data( 'untouched' ) )
863849 // Defer this until $j(this).val() has been updated
864850 setTimeout( function() {
865 - var ns = $j( '#edittoolbar-link-int-target-ns option:selected' ).text();
866 - if ( ns != '' )
867 - ns += ':';
868 - $j( '#edittoolbar-link-int-text' ).val( ns + $j( '#edittoolbar-link-int-target' ).val() );
 851+ $j( '#edittoolbar-link-int-text' ).val( $j( '#edittoolbar-link-int-target' ).val() );
869852 }, 0 );
870853 });
871854 $j( '#edittoolbar-link-int-text' ).bind( 'change keypress paste cut', function() {
872855 $j(this).data( 'untouched', false );
873856 });
874 - // Make sure changes to the namespace selector also trigger value copying and AJAX stuff
875 - // This is ugly
876 - $j( '#edittoolbar-link-int-target-ns' ).change( function() {
877 - $j( '#edittoolbar-link-int-target' ).keydown().keypress().keyup();
878 - });
879857 // Set the initial value of the external link field to start out as a real URL
880858 $j( '#edittoolbar-link-ext-target' ).val( 'http://' );
881859 // Add images to the page existence widget, which will be shown mutually exclusively to communicate if the
@@ -935,44 +913,26 @@
936914 $j( '#edittoolbar-link-int-target' ).data( 'suggcache', {} ).suggestions( {
937915 fetch: function( query ) {
938916 var that = this;
939 - var ns = $j( '#edittoolbar-link-int-target-ns' ).val();
940917 var title = $j(this).val();
941 - if ( ns < 0 ) {
942 - // Can't search for Special: or Media: titles
943 - $j(this).suggestions( 'suggestions', [] );
944 - return;
945 - }
946918
947919 var cache = $j(this).data( 'suggcache' );
948 - if ( typeof cache[ns] != 'undefined' &&
949 - typeof cache[ns][title] != 'undefined' ) {
950 - $j(this).suggestions( 'suggestions', cache[ns][title] );
 920+ if ( typeof cache[title] != 'undefined' ) {
 921+ $j(this).suggestions( 'suggestions', cache[title] );
951922 return;
952923 }
953924
954925 var request = $j.ajax( {
955926 url: wgScriptPath + '/api.php',
956927 data: {
957 - 'action': 'query',
958 - 'list': 'allpages',
959 - 'apnamespace': ns,
960 - 'apprefix': title,
961 - 'aplimit': '10',
 928+ 'action': 'opensearch',
 929+ 'search': title,
 930+ 'namespace': 0,
 931+ 'suggest': '',
962932 'format': 'json'
963933 },
964934 dataType: 'json',
965935 success: function( data ) {
966 - var titles = [];
967 - for ( var i = 0; i < data.query.allpages.length; i++ ) {
968 - titles[i] = data.query.allpages[i].title;
969 - if ( ns != 0 )
970 - titles[i] = titles[i].substr(
971 - titles[i].indexOf( ':' ) + 1 );
972 - }
973 - if ( typeof cache[ns] == 'undefined' )
974 - cache[ns] = {};
975 - cache[ns][title] = titles;
976 - $j(that).suggestions( 'suggestions', titles );
 936+ $j(that).suggestions( 'suggestions', data[1] );
977937 }
978938 });
979939 $j(this).data( 'request', request );
@@ -1008,11 +968,7 @@
1009969 alert( gM( 'edittoolbar-tool-link-int-invalid' ) );
1010970 return;
1011971 }
1012 - var targetNS = $j( '#edittoolbar-link-int-target-ns option:selected' ).text();
1013 - if ( targetNS != '' )
1014 - targetNS += ':';
1015 - var targetTitle = $j( '#edittoolbar-link-int-target' ).val();
1016 - var target = targetNS + targetTitle;
 972+ var target = $j( '#edittoolbar-link-int-target' ).val();
1017973 var text = $j( '#edittoolbar-link-int-text' ).val();
1018974 whitespace = $j( '#edittoolbar-link-dialog-tab-int' ).data( 'whitespace' );
1019975 if ( target == text )
Property changes on: branches/wmf-deployment-work/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js
___________________________________________________________________
Name: svn:mergeinfo
1020976 + /branches/REL1_15/phase3/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js:51646
/trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js:56207,56209,56226,56296,56333,56355,56417
/trunk/phase3/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r56226EditToolbar: Remove namespace dropdown in link dialog for nowcatrope10:49, 12 September 2009

Status & tagging log