Index: branches/wmf-deployment-work/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js |
— | — | @@ -759,7 +759,6 @@ |
760 | 760 | <div id="edittoolbar-link-dialog-tab-int"><form><fieldset><table><tr>\ |
761 | 761 | <td><label for="edittoolbar-link-int-target" rel="edittoolbar-tool-link-int-target"></label></td>\ |
762 | 762 | <td>\ |
763 | | - <select id="edittoolbar-link-int-target-ns" />\ |
764 | 763 | <input type="text" id="edittoolbar-link-int-target" />\ |
765 | 764 | <div id="edittoolbar-link-int-target-status" style="display: inline;"></div>\ |
766 | 765 | </td>\ |
— | — | @@ -788,24 +787,13 @@ |
789 | 788 | request.abort(); |
790 | 789 | } |
791 | 790 | |
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(); |
804 | 792 | var cache = $j( '#edittoolbar-link-int-target-status' ).data( 'existencecache' ); |
805 | 793 | if ( cache[target] ) { |
806 | 794 | updateWidget( cache[target] ); |
807 | 795 | return; |
808 | 796 | } |
809 | | - if ( targetTitle == '' ) { |
| 797 | + if ( target == '' ) { |
810 | 798 | // Hide the widget when the textbox is empty |
811 | 799 | $j( '#edittoolbar-link-int-target-status' ).children().hide(); |
812 | 800 | return; |
— | — | @@ -851,8 +839,6 @@ |
852 | 840 | }); |
853 | 841 | // Build tabs |
854 | 842 | $j( '#edittoolbar-link-tabs' ).tabs(); |
855 | | - // Set up the namespace selector |
856 | | - $j( '#edittoolbar-link-int-target-ns' ).namespaceSelector(); |
857 | 843 | // Automatically copy the value of the internal link page title field to the link text field unless the user |
858 | 844 | // has changed the link text field - this is a convience thing since most link texts are going to be the |
859 | 845 | // the same as the page title |
— | — | @@ -861,20 +847,12 @@ |
862 | 848 | if ( $j( '#edittoolbar-link-int-text' ).data( 'untouched' ) ) |
863 | 849 | // Defer this until $j(this).val() has been updated |
864 | 850 | 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() ); |
869 | 852 | }, 0 ); |
870 | 853 | }); |
871 | 854 | $j( '#edittoolbar-link-int-text' ).bind( 'change keypress paste cut', function() { |
872 | 855 | $j(this).data( 'untouched', false ); |
873 | 856 | }); |
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 | | - }); |
879 | 857 | // Set the initial value of the external link field to start out as a real URL |
880 | 858 | $j( '#edittoolbar-link-ext-target' ).val( 'http://' ); |
881 | 859 | // Add images to the page existence widget, which will be shown mutually exclusively to communicate if the |
— | — | @@ -935,44 +913,26 @@ |
936 | 914 | $j( '#edittoolbar-link-int-target' ).data( 'suggcache', {} ).suggestions( { |
937 | 915 | fetch: function( query ) { |
938 | 916 | var that = this; |
939 | | - var ns = $j( '#edittoolbar-link-int-target-ns' ).val(); |
940 | 917 | 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 | | - } |
946 | 918 | |
947 | 919 | 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] ); |
951 | 922 | return; |
952 | 923 | } |
953 | 924 | |
954 | 925 | var request = $j.ajax( { |
955 | 926 | url: wgScriptPath + '/api.php', |
956 | 927 | 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': '', |
962 | 932 | 'format': 'json' |
963 | 933 | }, |
964 | 934 | dataType: 'json', |
965 | 935 | 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] ); |
977 | 937 | } |
978 | 938 | }); |
979 | 939 | $j(this).data( 'request', request ); |
— | — | @@ -1008,11 +968,7 @@ |
1009 | 969 | alert( gM( 'edittoolbar-tool-link-int-invalid' ) ); |
1010 | 970 | return; |
1011 | 971 | } |
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(); |
1017 | 973 | var text = $j( '#edittoolbar-link-int-text' ).val(); |
1018 | 974 | whitespace = $j( '#edittoolbar-link-dialog-tab-int' ).data( 'whitespace' ); |
1019 | 975 | if ( target == text ) |
Property changes on: branches/wmf-deployment-work/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js |
___________________________________________________________________ |
Name: svn:mergeinfo |
1020 | 976 | + /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 |