r56226 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56225‎ | r56226 | r56227 >
Date:10:49, 12 September 2009
Author:catrope
Status:ok
Tags:
Comment:
EditToolbar: Remove namespace dropdown in link dialog for now
Modified paths:
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js
@@ -710,7 +710,6 @@
711711 <div id="edittoolbar-link-dialog-tab-int"><form><fieldset><table><tr>\
712712 <td><label for="edittoolbar-link-int-target" rel="edittoolbar-tool-link-int-target"></label></td>\
713713 <td>\
714 - <select id="edittoolbar-link-int-target-ns" />\
715714 <input type="text" id="edittoolbar-link-int-target" />\
716715 <div id="edittoolbar-link-int-target-status" style="display: inline;"></div>\
717716 </td>\
@@ -739,24 +738,13 @@
740739 request.abort();
741740 }
742741
743 - var targetNSID = $j( '#edittoolbar-link-int-target-ns' ).val();
744 - if ( targetNSID < 0 ) {
745 - // Can't check existence for Special: or Media: titles
746 - updateWidget( 'exists' );
747 - return;
748 - }
749 -
750 - var targetNS = $j( '#edittoolbar-link-int-target-ns option:selected' ).text();
751 - if ( targetNS != '' )
752 - targetNS += ':';
753 - var targetTitle = $j( '#edittoolbar-link-int-target' ).val();
754 - var target = targetNS + targetTitle;
 742+ var target = $j( '#edittoolbar-link-int-target' ).val();
755743 var cache = $j( '#edittoolbar-link-int-target-status' ).data( 'existencecache' );
756744 if ( cache[target] ) {
757745 updateWidget( cache[target] );
758746 return;
759747 }
760 - if ( targetTitle == '' ) {
 748+ if ( target == '' ) {
761749 // Hide the widget when the textbox is empty
762750 $j( '#edittoolbar-link-int-target-status' ).children().hide();
763751 return;
@@ -802,8 +790,6 @@
803791 });
804792 // Build tabs
805793 $j( '#edittoolbar-link-tabs' ).tabs();
806 - // Set up the namespace selector
807 - $j( '#edittoolbar-link-int-target-ns' ).namespaceSelector();
808794 // Automatically copy the value of the internal link page title field to the link text field unless the user
809795 // has changed the link text field - this is a convience thing since most link texts are going to be the
810796 // the same as the page title
@@ -812,20 +798,12 @@
813799 if ( $j( '#edittoolbar-link-int-text' ).data( 'untouched' ) )
814800 // Defer this until $j(this).val() has been updated
815801 setTimeout( function() {
816 - var ns = $j( '#edittoolbar-link-int-target-ns option:selected' ).text();
817 - if ( ns != '' )
818 - ns += ':';
819 - $j( '#edittoolbar-link-int-text' ).val( ns + $j( '#edittoolbar-link-int-target' ).val() );
 802+ $j( '#edittoolbar-link-int-text' ).val( $j( '#edittoolbar-link-int-target' ).val() );
820803 }, 0 );
821804 });
822805 $j( '#edittoolbar-link-int-text' ).bind( 'change keypress paste cut', function() {
823806 $j(this).data( 'untouched', false );
824807 });
825 - // Make sure changes to the namespace selector also trigger value copying and AJAX stuff
826 - // This is ugly
827 - $j( '#edittoolbar-link-int-target-ns' ).change( function() {
828 - $j( '#edittoolbar-link-int-target' ).keydown().keypress().keyup();
829 - });
830808 // Set the initial value of the external link field to start out as a real URL
831809 $j( '#edittoolbar-link-ext-target' ).val( 'http://' );
832810 // Add images to the page existence widget, which will be shown mutually exclusively to communicate if the
@@ -886,44 +864,26 @@
887865 $j( '#edittoolbar-link-int-target' ).data( 'suggcache', {} ).suggestions( {
888866 fetch: function( query ) {
889867 var that = this;
890 - var ns = $j( '#edittoolbar-link-int-target-ns' ).val();
891868 var title = $j(this).val();
892 - if ( ns < 0 ) {
893 - // Can't search for Special: or Media: titles
894 - $j(this).suggestions( 'suggestions', [] );
895 - return;
896 - }
897869
898870 var cache = $j(this).data( 'suggcache' );
899 - if ( typeof cache[ns] != 'undefined' &&
900 - typeof cache[ns][title] != 'undefined' ) {
901 - $j(this).suggestions( 'suggestions', cache[ns][title] );
 871+ if ( typeof cache[title] != 'undefined' ) {
 872+ $j(this).suggestions( 'suggestions', cache[title] );
902873 return;
903874 }
904875
905876 var request = $j.ajax( {
906877 url: wgScriptPath + '/api.php',
907878 data: {
908 - 'action': 'query',
909 - 'list': 'allpages',
910 - 'apnamespace': ns,
911 - 'apprefix': title,
912 - 'aplimit': '10',
 879+ 'action': 'opensearch',
 880+ 'search': title,
 881+ 'namespace': 0,
 882+ 'suggest': '',
913883 'format': 'json'
914884 },
915885 dataType: 'json',
916886 success: function( data ) {
917 - var titles = [];
918 - for ( var i = 0; i < data.query.allpages.length; i++ ) {
919 - titles[i] = data.query.allpages[i].title;
920 - if ( ns != 0 )
921 - titles[i] = titles[i].substr(
922 - titles[i].indexOf( ':' ) + 1 );
923 - }
924 - if ( typeof cache[ns] == 'undefined' )
925 - cache[ns] = {};
926 - cache[ns][title] = titles;
927 - $j(that).suggestions( 'suggestions', titles );
 887+ $j(that).suggestions( 'suggestions', data[1] );
928888 }
929889 });
930890 $j(this).data( 'request', request );
@@ -958,11 +918,7 @@
959919 alert( gM( 'edittoolbar-tool-link-int-invalid' ) );
960920 return;
961921 }
962 - var targetNS = $j( '#edittoolbar-link-int-target-ns option:selected' ).text();
963 - if ( targetNS != '' )
964 - targetNS += ':';
965 - var targetTitle = $j( '#edittoolbar-link-int-target' ).val();
966 - var target = targetNS + targetTitle;
 922+ var target = $j( '#edittoolbar-link-int-target' ).val();
967923 var text = $j( '#edittoolbar-link-int-text' ).val();
968924 whitespace = $j( '#edittoolbar-link-dialog-tab-int' ).data( 'whitespace' );
969925 if ( target == text )

Follow-up revisions

RevisionCommit summaryAuthorDate
r56423wmf-deployment-work: Merge r56226 (remove namespace dropdown in links...catrope18:03, 16 September 2009

Status & tagging log