r62001 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62000‎ | r62001 | r62002 >
Date:23:45, 4 February 2010
Author:adam
Status:ok
Tags:
Comment:
Followup to r61980, specifically intended to help Roan sleep better at night knowing users can enter the default text as a link if they want to
Modified paths:
  • /trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php
@@ -16,14 +16,14 @@
1717 array( 'src' => 'Modules/Preview/Preview.js', 'version' => 6 ),
1818 array( 'src' => 'Modules/Publish/Publish.js', 'version' => 6 ),
1919 array( 'src' => 'Modules/Toc/Toc.js', 'version' => 7 ),
20 - array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 46 ),
 20+ array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 47 ),
2121 array( 'src' => 'Modules/TemplateEditor/TemplateEditor.js', 'version' => 4 ),
2222 ),
2323 'combined' => array(
24 - array( 'src' => 'WikiEditor.combined.js', 'version' => 48 ),
 24+ array( 'src' => 'WikiEditor.combined.js', 'version' => 49 ),
2525 ),
2626 'minified' => array(
27 - array( 'src' => 'WikiEditor.combined.min.js', 'version' => 48 ),
 27+ array( 'src' => 'WikiEditor.combined.min.js', 'version' => 49 ),
2828 ),
2929 );
3030 static $messages = array(
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js
@@ -1032,26 +1032,30 @@
10331033 if ( $j( this ).val() == '' )
10341034 $j( this )
10351035 .addClass( 'wikieditor-toolbar-dialog-hint' )
1036 - .val( $j( this ).data( 'tooltip' ) );
 1036+ .val( $j( this ).data( 'tooltip' ) )
 1037+ .data( 'tooltip-mode', true );
10371038 } )
10381039 .focus( function() {
10391040 if( $j( this ).val() == $j( this ).data( 'tooltip' ) ) {
10401041 $j( this )
10411042 .val( '' )
1042 - .removeClass( 'wikieditor-toolbar-dialog-hint' );
 1043+ .removeClass( 'wikieditor-toolbar-dialog-hint' )
 1044+ .data( 'tooltip-mode', false );
10431045 }
10441046 })
10451047 .bind( 'change', function() {
10461048 if ( $j( this ).val() != $j( this ).data( 'tooltip' ) ) {
10471049 $j( this )
1048 - .removeClass( 'wikieditor-toolbar-dialog-hint' );
 1050+ .removeClass( 'wikieditor-toolbar-dialog-hint' )
 1051+ .data( 'tooltip-mode', false );
10491052 }
10501053 })
10511054 .bind( 'blur', function() {
10521055 if ( $j( this ).val() == '' ) {
10531056 $j( this )
10541057 .addClass( 'wikieditor-toolbar-dialog-hint' )
1055 - .val( $j( this ).data( 'tooltip' ) );
 1058+ .val( $j( this ).data( 'tooltip' ) )
 1059+ .data( 'tooltip-mode', true );
10561060 }
10571061 });
10581062
@@ -1209,9 +1213,9 @@
12101214 var target = $j( '#wikieditor-toolbar-link-int-target' ).val();
12111215 var text = $j( '#wikieditor-toolbar-link-int-text' ).val();
12121216 // check if the tooltips were passed as target or text
1213 - if ( target == $j( '#wikieditor-toolbar-link-int-target' ).data( 'tooltip' ) )
 1217+ if ( $j( '#wikieditor-toolbar-link-int-target' ).data( 'tooltip-mode' ) )
12141218 target = "";
1215 - if ( text == $j( '#wikieditor-toolbar-link-int-text' ).data( 'tooltip' ) )
 1219+ if ( $j( '#wikieditor-toolbar-link-int-text' ).data( 'tooltip-mode' ) )
12161220 text = "";
12171221 var u = mw.usability;
12181222 if ( target == '' ) {
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js
@@ -42,7 +42,7 @@
4343 $j('#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext').click(function(){if($j('#wikieditor-toolbar-link-type-ext').is(':checked'))
4444 updateWidget('external');if($j('#wikieditor-toolbar-link-type-int').is(':checked'))
4545 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()=='')
46 -$j(this).addClass('wikieditor-toolbar-dialog-hint').val($j(this).data('tooltip'));}).focus(function(){if($j(this).val()==$j(this).data('tooltip')){$j(this).val('').removeClass('wikieditor-toolbar-dialog-hint');}}).bind('change',function(){if($j(this).val()!=$j(this).data('tooltip')){$j(this).removeClass('wikieditor-toolbar-dialog-hint');}}).bind('blur',function(){if($j(this).val()==''){$j(this).addClass('wikieditor-toolbar-dialog-hint').val($j(this).data('tooltip'));}});$j('#wikieditor-toolbar-link-int-target').bind('change keydown paste cut',function(){setTimeout(function(){if(isExternalLink($j('#wikieditor-toolbar-link-int-target').val()))
 46+$j(this).addClass('wikieditor-toolbar-dialog-hint').val($j(this).data('tooltip')).data('tooltip-mode',true);}).focus(function(){if($j(this).val()==$j(this).data('tooltip')){$j(this).val('').removeClass('wikieditor-toolbar-dialog-hint').data('tooltip-mode',false);}}).bind('change',function(){if($j(this).val()!=$j(this).data('tooltip')){$j(this).removeClass('wikieditor-toolbar-dialog-hint').data('tooltip-mode',false);}}).bind('blur',function(){if($j(this).val()==''){$j(this).addClass('wikieditor-toolbar-dialog-hint').val($j(this).data('tooltip')).data('tooltip-mode',true);}});$j('#wikieditor-toolbar-link-int-target').bind('change keydown paste cut',function(){setTimeout(function(){if(isExternalLink($j('#wikieditor-toolbar-link-int-target').val()))
4747 $j('#wikieditor-toolbar-link-type-ext').attr('checked','checked');else
4848 $j('#wikieditor-toolbar-link-type-int').attr('checked','checked');if($j('#wikieditor-toolbar-link-int-text').data('untouched'))
4949 if($j('#wikieditor-toolbar-link-int-target').val()==$j('#wikieditor-toolbar-link-int-target').data('tooltip')){$j('#wikieditor-toolbar-link-int-text').addClass('wikieditor-toolbar-dialog-hint').val($j('#wikieditor-toolbar-link-int-text').data('tooltip')).change();}else{$j('#wikieditor-toolbar-link-int-text').val($j('#wikieditor-toolbar-link-int-target').val()).change();}},0);});$j('#wikieditor-toolbar-link-int-text').bind('change keydown paste cut',function(){var oldVal=$j(this).val();var that=this;setTimeout(function(){if($j(that).val()!=oldVal)
@@ -54,8 +54,8 @@
5555 request.abort();}});},dialog:{width:500,dialogClass:'wikiEditor-toolbar-dialog',buttons:{'wikieditor-toolbar-tool-link-insert':function(){function escapeInternalText(s){return s.replace(/(]{2,})/g,'<nowiki>$1</nowiki>');}
5656 function escapeExternalTarget(s){return s.replace(/ /g,'%20').replace(/\[/g,'%5B').replace(/]/g,'%5D');}
5757 function escapeExternalText(s){return s.replace(/(]+)/g,'<nowiki>$1</nowiki>');}
58 -var insertText='';var whitespace=$j('#wikieditor-toolbar-link-dialog').data('whitespace');var target=$j('#wikieditor-toolbar-link-int-target').val();var text=$j('#wikieditor-toolbar-link-int-text').val();if(target==$j('#wikieditor-toolbar-link-int-target').data('tooltip'))
59 -target="";if(text==$j('#wikieditor-toolbar-link-int-text').data('tooltip'))
 58+var insertText='';var whitespace=$j('#wikieditor-toolbar-link-dialog').data('whitespace');var target=$j('#wikieditor-toolbar-link-int-target').val();var text=$j('#wikieditor-toolbar-link-int-text').val();if($j('#wikieditor-toolbar-link-int-target').data('tooltip-mode'))
 59+target="";if($j('#wikieditor-toolbar-link-int-text').data('tooltip-mode'))
6060 text="";var u=mw.usability;if(target==''){alert(u.getMsg('wikieditor-toolbar-tool-link-empty'));return;}
6161 if($j.trim(text)==''){text='';}
6262 if($j('#wikieditor-toolbar-link-type-int').is(':checked')){if($j('#wikieditor-toolbar-link-int-target-status-invalid').is(':visible')){alert(u.getMsg('wikieditor-toolbar-tool-link-int-invalid'));return;}
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.js
@@ -983,26 +983,30 @@
984984 if ( $j( this ).val() == '' )
985985 $j( this )
986986 .addClass( 'wikieditor-toolbar-dialog-hint' )
987 - .val( $j( this ).data( 'tooltip' ) );
 987+ .val( $j( this ).data( 'tooltip' ) )
 988+ .data( 'tooltip-mode', true );
988989 } )
989990 .focus( function() {
990991 if( $j( this ).val() == $j( this ).data( 'tooltip' ) ) {
991992 $j( this )
992993 .val( '' )
993 - .removeClass( 'wikieditor-toolbar-dialog-hint' );
 994+ .removeClass( 'wikieditor-toolbar-dialog-hint' )
 995+ .data( 'tooltip-mode', false );
994996 }
995997 })
996998 .bind( 'change', function() {
997999 if ( $j( this ).val() != $j( this ).data( 'tooltip' ) ) {
9981000 $j( this )
999 - .removeClass( 'wikieditor-toolbar-dialog-hint' );
 1001+ .removeClass( 'wikieditor-toolbar-dialog-hint' )
 1002+ .data( 'tooltip-mode', false );
10001003 }
10011004 })
10021005 .bind( 'blur', function() {
10031006 if ( $j( this ).val() == '' ) {
10041007 $j( this )
10051008 .addClass( 'wikieditor-toolbar-dialog-hint' )
1006 - .val( $j( this ).data( 'tooltip' ) );
 1009+ .val( $j( this ).data( 'tooltip' ) )
 1010+ .data( 'tooltip-mode', true );
10071011 }
10081012 });
10091013
@@ -1160,9 +1164,9 @@
11611165 var target = $j( '#wikieditor-toolbar-link-int-target' ).val();
11621166 var text = $j( '#wikieditor-toolbar-link-int-text' ).val();
11631167 // check if the tooltips were passed as target or text
1164 - if ( target == $j( '#wikieditor-toolbar-link-int-target' ).data( 'tooltip' ) )
 1168+ if ( $j( '#wikieditor-toolbar-link-int-target' ).data( 'tooltip-mode' ) )
11651169 target = "";
1166 - if ( text == $j( '#wikieditor-toolbar-link-int-text' ).data( 'tooltip' ) )
 1170+ if ( $j( '#wikieditor-toolbar-link-int-text' ).data( 'tooltip-mode' ) )
11671171 text = "";
11681172 var u = mw.usability;
11691173 if ( target == '' ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r61980Insert Link Dialog: Improvements to tooltip handling. No longer will insert t...adam17:49, 4 February 2010

Status & tagging log