Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -61,7 +61,7 @@ |
62 | 62 | array( 'src' => 'js/plugins/jquery.browser.js', 'version' => 3 ), |
63 | 63 | array( 'src' => 'js/plugins/jquery.cookie.js', 'version' => 3 ), |
64 | 64 | array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ), |
65 | | - array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 1 ), |
| 65 | + array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 2 ), |
66 | 66 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 9 ), |
67 | 67 | array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 4 ), |
68 | 68 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 11 ), |
— | — | @@ -70,10 +70,10 @@ |
71 | 71 | array( 'src' => 'js/js2/jquery-ui-1.7.2.js', 'version' => '1.7.2x' ), |
72 | 72 | ), |
73 | 73 | 'combined' => array( |
74 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 18 ), |
| 74 | + array( 'src' => 'js/plugins.combined.js', 'version' => 19 ), |
75 | 75 | ), |
76 | 76 | 'minified' => array( |
77 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 18 ), |
| 77 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 19 ), |
78 | 78 | ), |
79 | 79 | ), |
80 | 80 | ); |
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.hooks.php |
— | — | @@ -50,6 +50,7 @@ |
51 | 51 | 'edittoolbar-tool-link-int-target-status-invalid', |
52 | 52 | 'edittoolbar-tool-link-int-target-status-loading', |
53 | 53 | 'edittoolbar-tool-link-int-invalid', |
| 54 | + 'edittoolbar-tool-link-ext-invalid', |
54 | 55 | 'edittoolbar-tool-file', |
55 | 56 | 'edittoolbar-tool-file-pre', |
56 | 57 | 'edittoolbar-tool-file-example', |
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js |
— | — | @@ -912,14 +912,15 @@ |
913 | 913 | var whitespace = [ '', '' ]; |
914 | 914 | switch ( $j( '#edittoolbar-link-tabs' ).tabs( 'option', 'selected' ) ) { |
915 | 915 | case 0: // Internal link |
| 916 | + var target = $j( '#edittoolbar-link-int-target' ).val(); |
| 917 | + var text = $j( '#edittoolbar-link-int-text' ).val(); |
916 | 918 | // FIXME: Exactly how fragile is this? |
917 | | - if ( $j( '#edittoolbar-link-int-target-status-invalid' ).is( ':visible' ) ) { |
| 919 | + if ( $j( '#edittoolbar-link-int-target-status-invalid' ).is( ':visible' ) || |
| 920 | + target == '' ) { |
918 | 921 | // Refuse to add links to invalid titles |
919 | 922 | alert( gM( 'edittoolbar-tool-link-int-invalid' ) ); |
920 | 923 | return; |
921 | 924 | } |
922 | | - var target = $j( '#edittoolbar-link-int-target' ).val(); |
923 | | - var text = $j( '#edittoolbar-link-int-text' ).val(); |
924 | 925 | whitespace = $j( '#edittoolbar-link-dialog-tab-int' ).data( 'whitespace' ); |
925 | 926 | if ( target == text ) |
926 | 927 | insertText = '[[' + target + ']]'; |
— | — | @@ -932,6 +933,12 @@ |
933 | 934 | var escTarget = escapeExternalTarget( target ); |
934 | 935 | var escText = escapeExternalText( text ); |
935 | 936 | whitespace = $j( '#edittoolbar-link-dialog-tab-ext' ).data( 'whitespace' ); |
| 937 | + if ( target == '' || target == 'http://' ) { |
| 938 | + // Refuse to add links to invalid URLs |
| 939 | + // TODO: More elaborate regex here? |
| 940 | + alert( gM( 'edittoolbar-tool-link-ext-invalid' ) ); |
| 941 | + return; |
| 942 | + } |
936 | 943 | if ( escTarget == escText ) |
937 | 944 | insertText = escTarget; |
938 | 945 | else if ( text == '' ) |
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.i18n.php |
— | — | @@ -36,6 +36,7 @@ |
37 | 37 | 'edittoolbar-tool-link-int-target-status-invalid' => 'Invalid title', |
38 | 38 | 'edittoolbar-tool-link-int-target-status-loading' => 'Checking page existence...', |
39 | 39 | 'edittoolbar-tool-link-int-invalid' => 'The title you specified is invalid.', |
| 40 | + 'edittoolbar-tool-link-ext-invalid' => 'The URL you specified is invalid.', |
40 | 41 | 'edittoolbar-tool-file' => 'Embedded file', |
41 | 42 | 'edittoolbar-tool-file-pre' => '$1{{ns:file}}:', |
42 | 43 | 'edittoolbar-tool-file-example' => 'Example.jpg', |
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.php |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | /* Configuration */ |
21 | 21 | |
22 | 22 | // Bump the version number every time you change any of the .css/.js files |
23 | | -$wgEditToolbarStyleVersion = 29; |
| 23 | +$wgEditToolbarStyleVersion = 30; |
24 | 24 | |
25 | 25 | // Set this to true to simply override the stock toolbar for everyone |
26 | 26 | $wgEditToolbarGlobalEnable = false; |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -484,6 +484,10 @@ |
485 | 485 | $.suggestions.restore( context ); |
486 | 486 | } else { |
487 | 487 | context.data.$textbox.val( result.data( 'text' ) ); |
| 488 | + |
| 489 | + // .val() doesn't call any event handlers, so |
| 490 | + // let the world know what happened |
| 491 | + context.data.$textbox.change(); |
488 | 492 | } |
489 | 493 | } |
490 | 494 | $.suggestions.special( context ); |
— | — | @@ -613,7 +617,7 @@ |
614 | 618 | if ( $result.get( 0 ) != $other.get( 0 ) ) { |
615 | 619 | return; |
616 | 620 | } |
617 | | - highlight( $result, true ); |
| 621 | + $.suggestions.highlight( context, $result, true ); |
618 | 622 | context.data.$container.hide(); |
619 | 623 | if ( typeof context.config.result.select == 'function' ) { |
620 | 624 | context.config.result.select.call( $result, context.data.$textbox ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -31,13 +31,13 @@ |
32 | 32 | result=context.data.$container.find('.suggestions-results div:first');else{result=selected.next();if(result.size()==0) |
33 | 33 | result=selected;}} |
34 | 34 | selected.removeClass('suggestions-result-current');result.addClass('suggestions-result-current');} |
35 | | -if(updateTextbox){if(result.size()==0){$.suggestions.restore(context);}else{context.data.$textbox.val(result.data('text'));}} |
| 35 | +if(updateTextbox){if(result.size()==0){$.suggestions.restore(context);}else{context.data.$textbox.val(result.data('text'));context.data.$textbox.change();}} |
36 | 36 | $.suggestions.special(context);},keypress:function(context,key){switch(key){case 40:if(context.data.$container.is(':visible')){$.suggestions.highlight(context,'next',true);}else{$.suggestions.update(context,false);} |
37 | 37 | context.data.$textbox.trigger('change');break;case 38:if(context.data.$container.is(':visible')){$.suggestions.highlight(context,'prev',true);} |
38 | 38 | context.data.$textbox.trigger('change');break;case 27:context.data.$container.hide();$.suggestions.restore(context);$.suggestions.cancel(context);context.data.$textbox.trigger('change');break;case 13:context.data.$container.hide();break;default:$.suggestions.update(context,true);break;}}};$.fn.suggestions=function(){var returnValue=null;var args=arguments;$(this).each(function(){var context=$(this).data('suggestions-context');if(typeof context=='undefined'){context={config:{'fetch':function(){},'cancel':function(){},'special':{},'result':{},'$region':$(this),'suggestions':[],'maxRows':7,'delay':1200,'submitOnClick':false}};} |
39 | 39 | if(args.length>0){if(typeof args[0]=='object'){for(key in args[0]){$.suggestions.configure(context,key,args[0][key]);}}else if(typeof args[0]=='string'){if(args.length>1){$.suggestions.configure(context,args[0],args[1]);}else if(returnValue==null){returnValue=(args[0]in context.config?undefined:context.config[args[0]]);}}} |
40 | 40 | if(typeof context.data=='undefined'){context.data={'timerID':null,'prevText':null,'visibleResults':0,'mouseDownOn':$([]),'$textbox':$(this)};context.data.$container=$('<div />').css({'top':Math.round(context.data.$textbox.offset().top+context.data.$textbox.outerHeight()),'left':Math.round(context.data.$textbox.offset().left),'width':context.data.$textbox.outerWidth(),'display':'none'}).mouseover(function(e){$.suggestions.highlight(context,$(e.target).closest('.suggestions-results div'),false);}).addClass('suggestions').append($('<div />').addClass('suggestions-results').mousedown(function(e){context.data.mouseDownOn=$(e.target).closest('.suggestions-results div');}).mouseup(function(e){var $result=$(e.target).closest('.suggestions-results div');var $other=context.data.mouseDownOn;context.data.mouseDownOn=$([]);if($result.get(0)!=$other.get(0)){return;} |
41 | | -highlight($result,true);context.data.$container.hide();if(typeof context.config.result.select=='function'){context.config.result.select.call($result,context.data.$textbox);} |
| 41 | +$.suggestions.highlight(context,$result,true);context.data.$container.hide();if(typeof context.config.result.select=='function'){context.config.result.select.call($result,context.data.$textbox);} |
42 | 42 | context.data.$textbox.focus();})).append($('<div />').addClass('suggestions-special').mousedown(function(e){context.data.mouseDownOn=$(e.target).closest('.suggestions-special');}).mouseup(function(e){var $special=$(e.target).closest('.suggestions-special');var $other=context.data.mouseDownOn;context.data.mouseDownOn=$([]);if($special.get(0)!=$other.get(0)){return;} |
43 | 43 | context.data.$container.hide();if(typeof context.config.special.select=='function'){context.config.special.select.call($special,context.data.$textbox);} |
44 | 44 | context.data.$textbox.focus();})).appendTo($('body'));$(this).attr('autocomplete','off').keydown(function(e){context.data.keypressed=(e.keyCode==undefined)?e.which:e.keyCode;context.data.keypressedCount=0;}).keypress(function(){context.data.keypressedCount++;$.suggestions.keypress(context,context.data.keypressed);}).keyup(function(){if(context.data.keypressedCount==0){$.suggestions.keypress(context,context.data.keypressed);}}).blur(function(){if(context.data.mouseDownOn.size()>0){return;} |