r59837 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59836‎ | r59837 | r59838 >
Date:18:46, 8 December 2009
Author:catrope
Status:ok
Tags:
Comment:
UsabilityInitiative: Revert part of r59799 renaming getSelection to textSelection for no good reason and without updating callers
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -70,7 +70,7 @@
7171 array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ),
7272 array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 6 ),
7373 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 21 ),
74 - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 28 ),
 74+ array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 29 ),
7575 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 1 ),
7676 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 35 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 9 ),
@@ -79,10 +79,10 @@
8080 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 0 ),
8181 ),
8282 'combined' => array(
83 - array( 'src' => 'js/plugins.combined.js', 'version' => 97 ),
 83+ array( 'src' => 'js/plugins.combined.js', 'version' => 98 ),
8484 ),
8585 'minified' => array(
86 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 97 ),
 86+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 98 ),
8787 ),
8888 ),
8989 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -375,7 +375,7 @@
376376 * Gets the currently selected text in the content
377377 * DO NOT CALL THESE DIRECTLY, use .textSelection( 'functionname', options ) instead
378378 */
379 - 'textSelection': function() {
 379+ 'getSelection': function() {
380380 var retval;
381381 if ( context.$iframe[0].contentWindow.getSelection ) {
382382 retval = context.$iframe[0].contentWindow.getSelection();
@@ -390,7 +390,7 @@
391391 return retval;
392392 },
393393 /**
394 - * Inserts text at the beginning and end of a text selection, optionally inserting text at the caret when
 394+ * Inserts text at the begining and end of a text selection, optionally inserting text at the caret when
395395 * selection is empty.
396396 * DO NOT CALL THESE DIRECTLY, use .textSelection( 'functionname', options ) instead
397397 */
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -1562,11 +1562,11 @@
15631563 context.fn = {
15641564 'trigger': function( name, event ) {
15651565 // Event is an optional argument, but from here on out, at least the type field should be dependable
1566 - if ( event == undefined ) {
 1566+ if ( typeof event == 'undefined' ) {
15671567 event = { 'type': 'custom' };
15681568 }
15691569 // Ensure there's a place for extra information to live
1570 - if ( event.data == undefined ) {
 1570+ if ( typeof event.data == 'undefined' ) {
15711571 event.data = {};
15721572 }
15731573 // Allow filtering to occur
@@ -1685,7 +1685,7 @@
16861686 * Gets the currently selected text in the content
16871687 * DO NOT CALL THESE DIRECTLY, use .textSelection( 'functionname', options ) instead
16881688 */
1689 - 'textSelection': function() {
 1689+ 'getSelection': function() {
16901690 var retval;
16911691 if ( context.$iframe[0].contentWindow.getSelection ) {
16921692 retval = context.$iframe[0].contentWindow.getSelection();
@@ -1700,7 +1700,7 @@
17011701 return retval;
17021702 },
17031703 /**
1704 - * Inserts text at the beginning and end of a text selection, optionally inserting text at the caret when
 1704+ * Inserts text at the begining and end of a text selection, optionally inserting text at the caret when
17051705 * selection is empty.
17061706 * DO NOT CALL THESE DIRECTLY, use .textSelection( 'functionname', options ) instead
17071707 */
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -93,14 +93,14 @@
9494 context.evt={'change':function(event){switch(event.type){case'keypress':if(true){event.data.scope='division';}else{event.data.scope='character';}
9595 break;case'mousedown':if(true){event.data.scope='division';}else{return false;}
9696 break;default:event.data.scope='division';break;}
97 -return true;}};context.fn={'trigger':function(name,event){if(event==undefined){event={'type':'custom'};}
98 -if(event.data==undefined){event.data={};}
 97+return true;}};context.fn={'trigger':function(name,event){if(typeof event=='undefined'){event={'type':'custom'};}
 98+if(typeof event.data=='undefined'){event.data={};}
9999 if(name in context.evt){if(!context.evt[name](event)){return false;}}
100100 for(module in $.wikiEditor.modules){if('evt'in $.wikiEditor.modules[module]&&name in $.wikiEditor.modules[module].evt){$.wikiEditor.modules[module].evt[name](context,event);}}},'addButton':function(options){context.$controls.show();context.$buttons.show();return $('<button />').text($.wikiEditor.autoMsg(options,'caption')).click(options.action).appendTo(context.$buttons);},'addView':function(options){function addTab(options){context.$controls.show();context.$tabs.show();return $('<div></div>').attr('rel','wikiEditor-ui-view-'+options.name).addClass(context.view==options.name?'current':null).append($('<a></a>').attr('href','#').click(function(event){context.$ui.find('.wikiEditor-ui-view').hide();context.$ui.find('.'+$(this).parent().attr('rel')).show();context.$tabs.find('div').removeClass('current');$(this).parent().addClass('current');$(this).blur();if('init'in options&&typeof options.init=='function'){options.init(context);}
101101 event.preventDefault();return false;}).text($.wikiEditor.autoMsg(options,'title'))).appendTo(context.$tabs);}
102102 if(!context.$tabs.children().size()){addTab({'name':'wikitext','titleMsg':'wikieditor-wikitext-tab'});}
103103 addTab(options);return $('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-'+options.name).hide().appendTo(context.$ui);},'setup':function(){var contentHTML=$('<div />').text(context.$textarea.val()).html();context.$iframe[0].contentWindow.document.open();context.$iframe[0].contentWindow.document.write('<html><head><title>wikiEditor</title><script>var context = window.parent.jQuery.wikiEditor.instances['+context.instance+'].data( "wikiEditor-context" ); window.parent.jQuery( document ).bind( "keydown keypress keyup mousedown mouseup cut paste", function( event ) { context.fn.trigger( "change", event ) } );</script></head><body style="margin:0;padding:0;width:100%;height:100%;white-space:pre-wrap;font-family:monospace">'+contentHTML+'</body></html>');context.$iframe[0].contentWindow.document.close();context.$iframe[0].contentWindow.document.designMode='on';context.$content=$(context.$iframe[0].contentWindow.document.body);if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');}
104 -context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();},'isSetup':function(){return context.$content!=undefined&&context.$content[0].innerHTML!=undefined;},'getContents':function(){return $('<div />').html(context.$content.html().replace(/\<br\>/g,"\n")).text();},'setContents':function(options){context.$content.text(options.contents);return context.$textarea;},'textSelection':function(){var retval;if(context.$iframe[0].contentWindow.getSelection){retval=context.$iframe[0].contentWindow.getSelection();}else if(context.$iframe[0].contentWindow.document.selection){retval=context.$iframe[0].contentWindow.document.selection.createRange();}
 104+context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();},'isSetup':function(){return context.$content!=undefined&&context.$content[0].innerHTML!=undefined;},'getContents':function(){return $('<div />').html(context.$content.html().replace(/\<br\>/g,"\n")).text();},'setContents':function(options){context.$content.text(options.contents);return context.$textarea;},'getSelection':function(){var retval;if(context.$iframe[0].contentWindow.getSelection){retval=context.$iframe[0].contentWindow.getSelection();}else if(context.$iframe[0].contentWindow.document.selection){retval=context.$iframe[0].contentWindow.document.selection.createRange();}
105105 if(retval.text){retval=retval.text;}else if(retval.toString){retval=retval.toString();}
106106 return retval;},'encapsulateSelection':function(options){var selText=$(this).textSelection('getSelection');var selectAfter=false;var pre=options.pre,post=options.post;if(!selText){selText=options.peri;selectAfter=true;}else if(options.replace){selText=options.peri;}else if(selText.charAt(selText.length-1)==' '){selText=selText.substring(0,selText.length-1);post+=' ';}
107107 var range=context.$iframe[0].contentWindow.getSelection().getRangeAt(0);if(options.ownline){if(range.startOffset!=0)

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r59799* updated js2 stopgap stubs to reflect new function name...dale19:56, 7 December 2009

Status & tagging log