Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -63,7 +63,7 @@ |
64 | 64 | array( 'src' => 'js/plugins/jquery.delayedBind.js', 'version' => 1 ), |
65 | 65 | array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ), |
66 | 66 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 4 ), |
67 | | - array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 14 ), |
| 67 | + array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 15 ), |
68 | 68 | array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 9 ), |
69 | 69 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 11 ), |
70 | 70 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 4 ), |
— | — | @@ -73,10 +73,10 @@ |
74 | 74 | array( 'src' => 'js/js2/jquery-ui-1.7.2.js', 'version' => '1.7.2y' ), |
75 | 75 | ), |
76 | 76 | 'combined' => array( |
77 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 38 ), |
| 77 | + array( 'src' => 'js/plugins.combined.js', 'version' => 39 ), |
78 | 78 | ), |
79 | 79 | 'minified' => array( |
80 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 38 ), |
| 80 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 39 ), |
81 | 81 | ), |
82 | 82 | ), |
83 | 83 | ); |
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js |
— | — | @@ -1310,14 +1310,18 @@ |
1311 | 1311 | // Execute the action associated with the first button |
1312 | 1312 | // when the user presses Enter |
1313 | 1313 | $j(this).closest( '.ui-dialog' ).keypress( function( e ) { |
1314 | | - if ( ( e.keyCode || e.which ) == 13 ) |
| 1314 | + if ( ( e.keyCode || e.which ) == 13 ) { |
1315 | 1315 | $j(this).find( 'button:first' ).click(); |
| 1316 | + e.preventDefault(); |
| 1317 | + } |
1316 | 1318 | }); |
1317 | 1319 | } |
1318 | 1320 | var dialog = $j(this).closest( '.ui-dialog' ); |
1319 | 1321 | $j(this).data( 'context' ).$textarea.bind( 'keypress.srdialog', function( e ) { |
1320 | | - if ( ( e.keyCode || e.which ) == 13 ) |
| 1322 | + if ( ( e.keyCode || e.which ) == 13 ) { |
1321 | 1323 | dialog.find( 'button:first' ).click(); |
| 1324 | + e.preventDefault(); |
| 1325 | + } |
1322 | 1326 | }); |
1323 | 1327 | } |
1324 | 1328 | } |
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 = 49; |
| 23 | +$wgEditToolbarStyleVersion = 50; |
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 |
— | — | @@ -203,8 +203,16 @@ |
204 | 204 | end = start; |
205 | 205 | return this.each( function() { |
206 | 206 | if ( this.selectionStart || this.selectionStart == '0' ) { |
207 | | - this.selectionStart = start; |
208 | | - this.selectionEnd = end; |
| 207 | + // Opera 9.0 doesn't allow setting selectionStart past |
| 208 | + // selectionEnd; any attempts to do that will be ignored |
| 209 | + // Make sure to set them in the right order |
| 210 | + if ( start > this.selectionEnd ) { |
| 211 | + this.selectionEnd = end; |
| 212 | + this.selectionStart = start; |
| 213 | + } else { |
| 214 | + this.selectionStart = start; |
| 215 | + this.selectionEnd = end; |
| 216 | + } |
209 | 217 | } else if ( document.body.createTextRange ) { |
210 | 218 | var selection = document.body.createTextRange(); |
211 | 219 | selection.moveToElementText( this ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -1027,8 +1027,16 @@ |
1028 | 1028 | end = start; |
1029 | 1029 | return this.each( function() { |
1030 | 1030 | if ( this.selectionStart || this.selectionStart == '0' ) { |
1031 | | - this.selectionStart = start; |
1032 | | - this.selectionEnd = end; |
| 1031 | + // Opera 9.0 doesn't allow setting selectionStart past |
| 1032 | + // selectionEnd; any attempts to do that will be ignored |
| 1033 | + // Make sure to set them in the right order |
| 1034 | + if ( start > this.selectionEnd ) { |
| 1035 | + this.selectionEnd = end; |
| 1036 | + this.selectionStart = start; |
| 1037 | + } else { |
| 1038 | + this.selectionStart = start; |
| 1039 | + this.selectionEnd = end; |
| 1040 | + } |
1033 | 1041 | } else if ( document.body.createTextRange ) { |
1034 | 1042 | var selection = document.body.createTextRange(); |
1035 | 1043 | selection.moveToElementText( this ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -69,7 +69,7 @@ |
70 | 70 | if(postRange.text==postText){rawPostText+="\r\n";}else{postFinished=true;}}}}while((!postFinished||!periFinished||!postFinished));caretPos=rawPreText.replace(/\r\n/g,"\n").length;}else if(e.selectionStart||e.selectionStart=='0'){caretPos=e.selectionStart;} |
71 | 71 | return caretPos;} |
72 | 72 | return getCaret(this.get(0));},setSelection:function(start,end){if(typeof end=='undefined') |
73 | | -end=start;return this.each(function(){if(this.selectionStart||this.selectionStart=='0'){this.selectionStart=start;this.selectionEnd=end;}else if(document.body.createTextRange){var selection=document.body.createTextRange();selection.moveToElementText(this);var length=selection.text.length;selection.moveStart('character',start);selection.moveEnd('character',-length+end);selection.select();}});},scrollToCaretPosition:function(force){function getLineLength(e){return Math.floor(e.scrollWidth/($.os.name=='linux'?7:8));} |
| 73 | +end=start;return this.each(function(){if(this.selectionStart||this.selectionStart=='0'){if(start>this.selectionEnd){this.selectionEnd=end;this.selectionStart=start;}else{this.selectionStart=start;this.selectionEnd=end;}}else if(document.body.createTextRange){var selection=document.body.createTextRange();selection.moveToElementText(this);var length=selection.text.length;selection.moveStart('character',start);selection.moveEnd('character',-length+end);selection.select();}});},scrollToCaretPosition:function(force){function getLineLength(e){return Math.floor(e.scrollWidth/($.os.name=='linux'?7:8));} |
74 | 74 | function getCaretScrollPosition(e){var text=e.value.replace(/\r/g,"");var caret=$(e).getCaretPosition();var lineLength=getLineLength(e);var row=0;var charInLine=0;var lastSpaceInLine=0;for(i=0;i<caret;i++){charInLine++;if(text.charAt(i)==" "){lastSpaceInLine=charInLine;}else if(text.charAt(i)=="\n"){lastSpaceInLine=0;charInLine=0;row++;} |
75 | 75 | if(charInLine>lineLength){if(lastSpaceInLine>0){charInLine=charInLine-lastSpaceInLine;lastSpaceInLine=0;row++;}}} |
76 | 76 | var nextSpace=0;for(j=caret;j<caret+lineLength;j++){if(text.charAt(j)==" "||text.charAt(j)=="\n"||caret==text.length){nextSpace=j;break;}} |