Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -68,17 +68,17 @@ |
69 | 69 | array( 'src' => 'js/plugins/jquery.delayedBind.js', 'version' => 1 ), |
70 | 70 | array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ), |
71 | 71 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 6 ), |
72 | | - array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 16 ), |
| 72 | + array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 17 ), |
73 | 73 | array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 12 ), |
74 | 74 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 18 ), |
75 | 75 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 8 ), |
76 | 76 | array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 25 ), |
77 | 77 | ), |
78 | 78 | 'combined' => array( |
79 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 57 ), |
| 79 | + array( 'src' => 'js/plugins.combined.js', 'version' => 58 ), |
80 | 80 | ), |
81 | 81 | 'minified' => array( |
82 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 57 ), |
| 82 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 58 ), |
83 | 83 | ), |
84 | 84 | ), |
85 | 85 | ); |
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js |
— | — | @@ -1138,10 +1138,9 @@ |
1139 | 1139 | '^' + RegExp.escape( wgServer + wgArticlePath ) |
1140 | 1140 | .replace( /\\\$1/g, '(.*)' ) + '$' |
1141 | 1141 | ) ); |
1142 | | - |
1143 | | - $j( '#edittoolbar-link-int-target' ).focus(); |
1144 | 1142 | // Pre-fill the text fields based on the current selection |
1145 | 1143 | var selection = $j(this).data( 'context' ).$textarea.getSelection(); |
| 1144 | + $j( '#edittoolbar-link-int-target' ).focus(); |
1146 | 1145 | $j( '#edittoolbar-link-dialog' ).data( 'whitespace', [ '', '' ] ); |
1147 | 1146 | if ( selection != '' ) { |
1148 | 1147 | var target, text, type; |
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.min.js |
— | — | @@ -58,7 +58,7 @@ |
59 | 59 | insertText=escTarget;else if(text=='') |
60 | 60 | insertText='['+escTarget+']';else |
61 | 61 | insertText='['+escTarget+' '+escText+']';} |
62 | | -insertText=whitespace[0]+insertText+whitespace[1];$j.wikiEditor.modules.toolbar.fn.doAction($j(this).data('context'),{type:'replace',options:{pre:insertText}},$j(this));$j('#edittoolbar-link-int-target, #edittoolbar-link-int-text').val('');$j('#edittoolbar-link-type-int, #edittoolbar-link-type-ext').attr('checked','');$j(this).dialog('close');},'edittoolbar-tool-link-cancel':function(){$j(this).dialog('close');}},open:function(){$j(this).data('articlePathRegex',new RegExp('^'+RegExp.escape(wgServer+wgArticlePath).replace(/\\\$1/g,'(.*)')+'$'));$j('#edittoolbar-link-int-target').focus();var selection=$j(this).data('context').$textarea.getSelection();$j('#edittoolbar-link-dialog').data('whitespace',['','']);if(selection!=''){var target,text,type;var matches;if((matches=selection.match(/^(\s*)\[\[([^\]\|]+)(\|([^\]\|]*))?\]\](\s*)$/))){target=matches[2];text=(matches[4]?matches[4]:matches[2]);type='int';$j('#edittoolbar-link-dialog').data('whitespace',[matches[1],matches[5]]);}else if((matches=selection.match(/^(\s*)\[([^\] ]+)( ([^\]]+))?\](\s*)$/))){target=matches[2];text=(matches[4]?matches[4]:'');type='ext';$j('#edittoolbar-link-dialog').data('whitespace',[matches[1],matches[5]]);}else{target=text=selection;} |
| 62 | +insertText=whitespace[0]+insertText+whitespace[1];$j.wikiEditor.modules.toolbar.fn.doAction($j(this).data('context'),{type:'replace',options:{pre:insertText}},$j(this));$j('#edittoolbar-link-int-target, #edittoolbar-link-int-text').val('');$j('#edittoolbar-link-type-int, #edittoolbar-link-type-ext').attr('checked','');$j(this).dialog('close');},'edittoolbar-tool-link-cancel':function(){$j(this).dialog('close');}},open:function(){$j(this).data('articlePathRegex',new RegExp('^'+RegExp.escape(wgServer+wgArticlePath).replace(/\\\$1/g,'(.*)')+'$'));var selection=$j(this).data('context').$textarea.getSelection();$j('#edittoolbar-link-int-target').focus();$j('#edittoolbar-link-dialog').data('whitespace',['','']);if(selection!=''){var target,text,type;var matches;if((matches=selection.match(/^(\s*)\[\[([^\]\|]+)(\|([^\]\|]*))?\]\](\s*)$/))){target=matches[2];text=(matches[4]?matches[4]:matches[2]);type='int';$j('#edittoolbar-link-dialog').data('whitespace',[matches[1],matches[5]]);}else if((matches=selection.match(/^(\s*)\[([^\] ]+)( ([^\]]+))?\](\s*)$/))){target=matches[2];text=(matches[4]?matches[4]:'');type='ext';$j('#edittoolbar-link-dialog').data('whitespace',[matches[1],matches[5]]);}else{target=text=selection;} |
63 | 63 | if(typeof text!='undefined') |
64 | 64 | $j('#edittoolbar-link-int-text').val(text).change();if(typeof target!='undefined') |
65 | 65 | $j('#edittoolbar-link-int-target').val(target).change();if(typeof type!='undefined') |
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 = 68; |
| 23 | +$wgEditToolbarStyleVersion = 69; |
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/jquery.textSelection.js |
— | — | @@ -3,12 +3,17 @@ |
4 | 4 | */ |
5 | 5 | ( function( $ ) { $.fn.extend( { |
6 | 6 | |
| 7 | +/** |
| 8 | + * Get the currently selected text in this textarea. Will focus the textarea |
| 9 | + * in some browsers (IE/Opera) |
| 10 | + */ |
7 | 11 | getSelection: function() { |
8 | 12 | var e = this.jquery ? this[0] : this; |
9 | 13 | var retval = ''; |
10 | 14 | if ( e.style.display == 'none' ) { |
11 | 15 | // Do nothing |
12 | 16 | } else if ( document.selection && document.selection.createRange ) { |
| 17 | + e.focus(); |
13 | 18 | var range = document.selection.createRange(); |
14 | 19 | retval = range.text; |
15 | 20 | } else if ( e.selectionStart || e.selectionStart == '0' ) { |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -924,12 +924,17 @@ |
925 | 925 | */ |
926 | 926 | ( function( $ ) { $.fn.extend( { |
927 | 927 | |
| 928 | +/** |
| 929 | + * Get the currently selected text in this textarea. Will focus the textarea |
| 930 | + * in some browsers (IE/Opera) |
| 931 | + */ |
928 | 932 | getSelection: function() { |
929 | 933 | var e = this.jquery ? this[0] : this; |
930 | 934 | var retval = ''; |
931 | 935 | if ( e.style.display == 'none' ) { |
932 | 936 | // Do nothing |
933 | 937 | } else if ( document.selection && document.selection.createRange ) { |
| 938 | + e.focus(); |
934 | 939 | var range = document.selection.createRange(); |
935 | 940 | retval = range.text; |
936 | 941 | } else if ( e.selectionStart || e.selectionStart == '0' ) { |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -51,7 +51,7 @@ |
52 | 52 | context.data.$container.hide();if(typeof context.config.special.select=='function'){context.config.special.select.call($special,context.data.$textbox);} |
53 | 53 | 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;switch(context.data.keypressed){case 40:e.preventDefault();e.stopImmediatePropagation();break;case 38:case 27:case 13:if(context.data.$container.is(':visible')){e.preventDefault();e.stopImmediatePropagation();}}}).keypress(function(e){context.data.keypressedCount++;$.suggestions.keypress(e,context,context.data.keypressed);}).keyup(function(e){if(context.data.keypressedCount==0){$.suggestions.keypress(e,context,context.data.keypressed);}}).blur(function(){if(context.data.mouseDownOn.size()>0){return;} |
54 | 54 | context.data.$container.hide();$.suggestions.cancel(context);});} |
55 | | -$(this).data('suggestions-context',context);});return returnValue!==null?returnValue:$(this);};})(jQuery);(function($){$.fn.extend({getSelection:function(){var e=this.jquery?this[0]:this;var retval='';if(e.style.display=='none'){}else if(document.selection&&document.selection.createRange){var range=document.selection.createRange();retval=range.text;}else if(e.selectionStart||e.selectionStart=='0'){retval=e.value.substring(e.selectionStart,e.selectionEnd);} |
| 55 | +$(this).data('suggestions-context',context);});return returnValue!==null?returnValue:$(this);};})(jQuery);(function($){$.fn.extend({getSelection:function(){var e=this.jquery?this[0]:this;var retval='';if(e.style.display=='none'){}else if(document.selection&&document.selection.createRange){e.focus();var range=document.selection.createRange();retval=range.text;}else if(e.selectionStart||e.selectionStart=='0'){retval=e.value.substring(e.selectionStart,e.selectionEnd);} |
56 | 56 | return retval;},encapsulateSelection:function(pre,peri,post,ownline,replace){return this.each(function(){function checkSelectedText(){if(!selText){selText=peri;isSample=true;}else if(replace){selText=peri;}else if(selText.charAt(selText.length-1)==' '){selText=selText.substring(0,selText.length-1);post+=' ';}} |
57 | 57 | var selText=$(this).getSelection();var isSample=false;if(this.style.display=='none'){}else if(this.selectionStart||this.selectionStart=='0'){$(this).focus();var startPos=this.selectionStart;var endPos=this.selectionEnd;checkSelectedText();if(ownline){if(startPos!=0&&this.value.charAt(startPos-1)!="\n"){pre="\n"+pre;} |
58 | 58 | if(this.value.charAt(endPos)!="\n"){post+="\n";}} |