Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php |
— | — | @@ -16,14 +16,14 @@ |
17 | 17 | array( 'src' => 'Modules/Preview/Preview.js', 'version' => 6 ), |
18 | 18 | array( 'src' => 'Modules/Publish/Publish.js', 'version' => 6 ), |
19 | 19 | array( 'src' => 'Modules/Toc/Toc.js', 'version' => 7 ), |
20 | | - array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 38 ), |
| 20 | + array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 39 ), |
21 | 21 | array( 'src' => 'Modules/TemplateEditor/TemplateEditor.js', 'version' => 4 ), |
22 | 22 | ), |
23 | 23 | 'combined' => array( |
24 | | - array( 'src' => 'WikiEditor.combined.js', 'version' => 40 ), |
| 24 | + array( 'src' => 'WikiEditor.combined.js', 'version' => 41 ), |
25 | 25 | ), |
26 | 26 | 'minified' => array( |
27 | | - array( 'src' => 'WikiEditor.combined.min.js', 'version' => 40 ), |
| 27 | + array( 'src' => 'WikiEditor.combined.min.js', 'version' => 41 ), |
28 | 28 | ), |
29 | 29 | ); |
30 | 30 | static $messages = array( |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js |
— | — | @@ -929,26 +929,27 @@ |
930 | 930 | } |
931 | 931 | return s.match( arguments.callee.regex ); |
932 | 932 | } |
| 933 | + // Updates the status indicator above the target link |
| 934 | + function updateWidget( status ) { |
| 935 | + $j( '#wikieditor-toolbar-link-int-target-status' ).children().hide(); |
| 936 | + $j( '#wikieditor-toolbar-link-int-target' ).parent() |
| 937 | + .removeClass( 'status-invalid status-external status-notexists status-exists status-loading' ); |
| 938 | + if ( status ) { |
| 939 | + $j( '#wikieditor-toolbar-link-int-target-status-' + status ).show(); |
| 940 | + $j( '#wikieditor-toolbar-link-int-target' ).parent().addClass( 'status-' + status ); |
| 941 | + } |
| 942 | + if ( status == 'invalid' ) { |
| 943 | + $j( '.ui-dialog:visible .ui-dialog-buttonpane button:first' ) |
| 944 | + .attr( 'disabled', true ) |
| 945 | + .addClass( 'disabled' ); |
| 946 | + } else { |
| 947 | + $j( '.ui-dialog:visible .ui-dialog-buttonpane button:first' ) |
| 948 | + .removeAttr('disabled') |
| 949 | + .removeClass('disabled'); |
| 950 | + } |
| 951 | + } |
933 | 952 | // Updates the UI to show if the page title being inputed by the user exists or not |
934 | 953 | function updateExistence() { |
935 | | - function updateWidget( status ) { |
936 | | - $j( '#wikieditor-toolbar-link-int-target-status' ).children().hide(); |
937 | | - $j( '#wikieditor-toolbar-link-int-target' ).parent() |
938 | | - .removeClass( 'status-invalid status-external status-notexists status-exists status-loading' ); |
939 | | - if ( status ) { |
940 | | - $j( '#wikieditor-toolbar-link-int-target-status-' + status ).show(); |
941 | | - $j( '#wikieditor-toolbar-link-int-target' ).parent().addClass( 'status-' + status ); |
942 | | - } |
943 | | - if ( status == 'invalid' ) { |
944 | | - $j( '.ui-dialog:visible .ui-dialog-buttonpane button:first' ) |
945 | | - .attr( 'disabled', true ) |
946 | | - .addClass( 'disabled' ); |
947 | | - } else { |
948 | | - $j( '.ui-dialog:visible .ui-dialog-buttonpane button:first' ) |
949 | | - .removeAttr('disabled') |
950 | | - .removeClass('disabled'); |
951 | | - } |
952 | | - } |
953 | 954 | // Abort previous request |
954 | 955 | var request = $j( '#wikieditor-toolbar-link-int-target-status' ).data( 'request' ); |
955 | 956 | if ( request ) { |
— | — | @@ -1008,6 +1009,12 @@ |
1009 | 1010 | } ) |
1010 | 1011 | ); |
1011 | 1012 | } |
| 1013 | + $j( '#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext' ).click( function() { |
| 1014 | + if( $j( '#wikieditor-toolbar-link-type-ext' ).is( ':checked' ) ) |
| 1015 | + updateWidget( 'external' ); |
| 1016 | + if( $j( '#wikieditor-toolbar-link-type-int' ).is( ':checked' ) ) |
| 1017 | + updateExistence(); |
| 1018 | + }); |
1012 | 1019 | // Set labels of tabs based on rel values |
1013 | 1020 | var u = mw.usability; |
1014 | 1021 | $j(this).find( '[rel]' ).each( function() { |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js |
— | — | @@ -27,9 +27,9 @@ |
28 | 28 | </div>\ |
29 | 29 | </fieldset>',init:function(){function isExternalLink(s){if(typeof arguments.callee.regex=='undefined'){arguments.callee.regex=new RegExp("(^("+wgUrlProtocols+"))|(^www\\.)|([^.]\\.[a-z]{2,}($|\\/))",'i');} |
30 | 30 | return s.match(arguments.callee.regex);} |
31 | | -function updateExistence(){function updateWidget(status){$j('#wikieditor-toolbar-link-int-target-status').children().hide();$j('#wikieditor-toolbar-link-int-target').parent().removeClass('status-invalid status-external status-notexists status-exists status-loading');if(status){$j('#wikieditor-toolbar-link-int-target-status-'+status).show();$j('#wikieditor-toolbar-link-int-target').parent().addClass('status-'+status);} |
| 31 | +function updateWidget(status){$j('#wikieditor-toolbar-link-int-target-status').children().hide();$j('#wikieditor-toolbar-link-int-target').parent().removeClass('status-invalid status-external status-notexists status-exists status-loading');if(status){$j('#wikieditor-toolbar-link-int-target-status-'+status).show();$j('#wikieditor-toolbar-link-int-target').parent().addClass('status-'+status);} |
32 | 32 | if(status=='invalid'){$j('.ui-dialog:visible .ui-dialog-buttonpane button:first').attr('disabled',true).addClass('disabled');}else{$j('.ui-dialog:visible .ui-dialog-buttonpane button:first').removeAttr('disabled').removeClass('disabled');}} |
33 | | -var request=$j('#wikieditor-toolbar-link-int-target-status').data('request');if(request){request.abort();} |
| 33 | +function updateExistence(){var request=$j('#wikieditor-toolbar-link-int-target-status').data('request');if(request){request.abort();} |
34 | 34 | var target=$j('#wikieditor-toolbar-link-int-target').val();var cache=$j('#wikieditor-toolbar-link-int-target-status').data('existencecache');if(cache[target]){updateWidget(cache[target]);return;} |
35 | 35 | if(target==''){updateWidget(false);return;} |
36 | 36 | if(isExternalLink(target)){updateWidget('external');return;} |
— | — | @@ -38,7 +38,9 @@ |
39 | 39 | status='notexists';else if(typeof page.invalid!='undefined') |
40 | 40 | status='invalid';} |
41 | 41 | cache[target]=status;updateWidget(status);}}));} |
42 | | -var u=mw.usability;$j(this).find('[rel]').each(function(){$j(this).text(u.getMsg($j(this).attr('rel')));});$j('#wikieditor-toolbar-link-int-target').data('tooltip',u.getMsg('wikieditor-toolbar-tool-link-int-target-tooltip'));$j('#wikieditor-toolbar-link-int-text').data('tooltip',u.getMsg('wikieditor-toolbar-tool-link-int-text-tooltip'));$j('#wikieditor-toolbar-link-int-target, #wikieditor-toolbar-link-int-text').each(function(){var tooltip=u.getMsg($j(this).attr('id')+'-tooltip');if($j(this).val()=='') |
| 42 | +$j('#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext').click(function(){if($j('#wikieditor-toolbar-link-type-ext').is(':checked')) |
| 43 | +updateWidget('external');if($j('#wikieditor-toolbar-link-type-int').is(':checked')) |
| 44 | +updateExistence();});var u=mw.usability;$j(this).find('[rel]').each(function(){$j(this).text(u.getMsg($j(this).attr('rel')));});$j('#wikieditor-toolbar-link-int-target').data('tooltip',u.getMsg('wikieditor-toolbar-tool-link-int-target-tooltip'));$j('#wikieditor-toolbar-link-int-text').data('tooltip',u.getMsg('wikieditor-toolbar-tool-link-int-text-tooltip'));$j('#wikieditor-toolbar-link-int-target, #wikieditor-toolbar-link-int-text').each(function(){var tooltip=u.getMsg($j(this).attr('id')+'-tooltip');if($j(this).val()=='') |
43 | 45 | $j(this).val($j(this).data('tooltip')).addClass('wikieditor-toolbar-dialog-hint');}).focus(function(){$j(this).removeClass('wikieditor-toolbar-dialog-hint');if($j(this).val()==$j(this).data('tooltip')) |
44 | 46 | $j(this).val('');}).bind('blur change',function(){if($j(this).val()=='') |
45 | 47 | $j(this).val($j(this).data('tooltip')).addClass('wikieditor-toolbar-dialog-hint');else |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.js |
— | — | @@ -880,26 +880,27 @@ |
881 | 881 | } |
882 | 882 | return s.match( arguments.callee.regex ); |
883 | 883 | } |
| 884 | + // Updates the status indicator above the target link |
| 885 | + function updateWidget( status ) { |
| 886 | + $j( '#wikieditor-toolbar-link-int-target-status' ).children().hide(); |
| 887 | + $j( '#wikieditor-toolbar-link-int-target' ).parent() |
| 888 | + .removeClass( 'status-invalid status-external status-notexists status-exists status-loading' ); |
| 889 | + if ( status ) { |
| 890 | + $j( '#wikieditor-toolbar-link-int-target-status-' + status ).show(); |
| 891 | + $j( '#wikieditor-toolbar-link-int-target' ).parent().addClass( 'status-' + status ); |
| 892 | + } |
| 893 | + if ( status == 'invalid' ) { |
| 894 | + $j( '.ui-dialog:visible .ui-dialog-buttonpane button:first' ) |
| 895 | + .attr( 'disabled', true ) |
| 896 | + .addClass( 'disabled' ); |
| 897 | + } else { |
| 898 | + $j( '.ui-dialog:visible .ui-dialog-buttonpane button:first' ) |
| 899 | + .removeAttr('disabled') |
| 900 | + .removeClass('disabled'); |
| 901 | + } |
| 902 | + } |
884 | 903 | // Updates the UI to show if the page title being inputed by the user exists or not |
885 | 904 | function updateExistence() { |
886 | | - function updateWidget( status ) { |
887 | | - $j( '#wikieditor-toolbar-link-int-target-status' ).children().hide(); |
888 | | - $j( '#wikieditor-toolbar-link-int-target' ).parent() |
889 | | - .removeClass( 'status-invalid status-external status-notexists status-exists status-loading' ); |
890 | | - if ( status ) { |
891 | | - $j( '#wikieditor-toolbar-link-int-target-status-' + status ).show(); |
892 | | - $j( '#wikieditor-toolbar-link-int-target' ).parent().addClass( 'status-' + status ); |
893 | | - } |
894 | | - if ( status == 'invalid' ) { |
895 | | - $j( '.ui-dialog:visible .ui-dialog-buttonpane button:first' ) |
896 | | - .attr( 'disabled', true ) |
897 | | - .addClass( 'disabled' ); |
898 | | - } else { |
899 | | - $j( '.ui-dialog:visible .ui-dialog-buttonpane button:first' ) |
900 | | - .removeAttr('disabled') |
901 | | - .removeClass('disabled'); |
902 | | - } |
903 | | - } |
904 | 905 | // Abort previous request |
905 | 906 | var request = $j( '#wikieditor-toolbar-link-int-target-status' ).data( 'request' ); |
906 | 907 | if ( request ) { |
— | — | @@ -959,6 +960,12 @@ |
960 | 961 | } ) |
961 | 962 | ); |
962 | 963 | } |
| 964 | + $j( '#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext' ).click( function() { |
| 965 | + if( $j( '#wikieditor-toolbar-link-type-ext' ).is( ':checked' ) ) |
| 966 | + updateWidget( 'external' ); |
| 967 | + if( $j( '#wikieditor-toolbar-link-type-int' ).is( ':checked' ) ) |
| 968 | + updateExistence(); |
| 969 | + }); |
963 | 970 | // Set labels of tabs based on rel values |
964 | 971 | var u = mw.usability; |
965 | 972 | $j(this).find( '[rel]' ).each( function() { |