Index: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/images/wikiEditor/dialogs/insert-link-external-rtl.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/images/wikiEditor/dialogs/insert-link-external-rtl.png |
___________________________________________________________________ |
Added: svn:mime-type |
1 | 1 | + image/png |
Index: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/ClickTracking/ClickTracking.i18n.php |
— | — | @@ -1436,6 +1436,26 @@ |
1437 | 1437 | 'ct-update-table' => 'Таабылы саҥардыы', |
1438 | 1438 | ); |
1439 | 1439 | |
| 1440 | +/** Sinhala (සිංහල) |
| 1441 | + * @author චතුනි අලහප්පෙරුම |
| 1442 | + */ |
| 1443 | +$messages['si'] = array( |
| 1444 | + 'ct-start-date' => 'ඇරඹුම් දිනය (YYYYMMDD)', |
| 1445 | + 'ct-end-date' => 'අවසන් දිනය (YYYYMMDD)', |
| 1446 | + 'ct-increment-by' => 'එක් එක් දත්ත ලක්ෂ්යය නිරූපණය කරන දින සංඛ්යාව', |
| 1447 | + 'ct-change-graph' => 'ප්රස්තාරය වෙනස් කරන්න', |
| 1448 | + 'ct-beginner' => 'නවකයා', |
| 1449 | + 'ct-intermediate' => 'අතරමැදි', |
| 1450 | + 'ct-expert' => 'ප්රවීණයා', |
| 1451 | + 'ct-date-range' => 'දත්ත පරාසය', |
| 1452 | + 'ct-editing' => 'වත්මන සංස්කරණය කෙරෙමින්:', |
| 1453 | + 'ct-anon-users' => 'නිර්නාමික පරිශීලකයන්', |
| 1454 | + 'ct-user-contribs' => 'මුළු පරිශීලක දායකත්වයන්', |
| 1455 | + 'ct-user-span' => 'කාලපරාසය තුලදී පරිහීලක දායකත්වයන්', |
| 1456 | + 'ct-and' => 'සහ', |
| 1457 | + 'ct-update-table' => 'වගුව යාවත්කාල කරන්න', |
| 1458 | +); |
| 1459 | + |
1440 | 1460 | /** Slovak (Slovenčina) |
1441 | 1461 | * @author Helix84 |
1442 | 1462 | */ |
Index: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/css/wikiEditor.dialogs.css |
— | — | @@ -160,7 +160,32 @@ |
161 | 161 | } |
162 | 162 | #wikieditor-toolbar-tool-link-int-target-label { |
163 | 163 | float: left; |
| 164 | + line-height: 1.7em; |
164 | 165 | } |
| 166 | +#wikieditor-toolbar-link-int-target-status-loading { |
| 167 | + line-height: 1.7em; |
| 168 | +} |
| 169 | +#wikieditor-toolbar-link-int-target-status-exists, |
| 170 | +#wikieditor-toolbar-link-int-target-status-notexists, |
| 171 | +#wikieditor-toolbar-link-int-target-status-invalid, |
| 172 | +#wikieditor-toolbar-link-int-target-status-external { |
| 173 | + padding-left: 30px; |
| 174 | + background-position: 0 50%; |
| 175 | + background-repeat: no-repeat; |
| 176 | +} |
| 177 | +#wikieditor-toolbar-link-int-target-status-exists { |
| 178 | + background-image: url( ../images/wikiEditor/dialogs/insert-link-exists.png ); |
| 179 | +} |
| 180 | +#wikieditor-toolbar-link-int-target-status-notexists { |
| 181 | + background-image: url( ../images/wikiEditor/dialogs/insert-link-notexists.png ); |
| 182 | +} |
| 183 | +#wikieditor-toolbar-link-int-target-status-invalid { |
| 184 | + background-image: url( ../images/wikiEditor/dialogs/insert-link-invalid.png ); |
| 185 | +} |
| 186 | +#wikieditor-toolbar-link-int-target-status-external { |
| 187 | + background-image: url( ../images/wikiEditor/dialogs/insert-link-external.png ); |
| 188 | +} |
| 189 | + |
165 | 190 | /* RTL Changes */ |
166 | 191 | body.rtl .wikiEditor-toolbar-dialog .ui-dialog-buttonpane button { |
167 | 192 | float: left; |
— | — | @@ -184,6 +209,17 @@ |
185 | 210 | margin-right: 0; |
186 | 211 | margin-left: 2em; |
187 | 212 | } |
| 213 | +body.rtl #wikieditor-toolbar-link-int-target-status-exists, |
| 214 | +body.rtl #wikieditor-toolbar-link-int-target-status-notexists, |
| 215 | +body.rtl #wikieditor-toolbar-link-int-target-status-invalid, |
| 216 | +body.rtl #wikieditor-toolbar-link-int-target-status-external { |
| 217 | + padding-left: 0; |
| 218 | + padding-right: 30px; |
| 219 | + background-position: 100% 50%; |
| 220 | +} |
| 221 | +body.rtl #wikieditor-toolbar-link-int-target-status-external { |
| 222 | + background-image: url( ../images/wikiEditor/dialogs/insert-link-external-rtl.png ); |
| 223 | +} |
188 | 224 | /* Self Clearing Floats */ |
189 | 225 | .wikieditor-toolbar-table-dimension-fields:after, |
190 | 226 | .wikieditor-toolbar-dialog-wrapper:after { |
Index: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/css/combined.css |
— | — | @@ -387,7 +387,32 @@ |
388 | 388 | } |
389 | 389 | #wikieditor-toolbar-tool-link-int-target-label { |
390 | 390 | float: left; |
| 391 | + line-height: 1.7em; |
391 | 392 | } |
| 393 | +#wikieditor-toolbar-link-int-target-status-loading { |
| 394 | + line-height: 1.7em; |
| 395 | +} |
| 396 | +#wikieditor-toolbar-link-int-target-status-exists, |
| 397 | +#wikieditor-toolbar-link-int-target-status-notexists, |
| 398 | +#wikieditor-toolbar-link-int-target-status-invalid, |
| 399 | +#wikieditor-toolbar-link-int-target-status-external { |
| 400 | + padding-left: 30px; |
| 401 | + background-position: 0 50%; |
| 402 | + background-repeat: no-repeat; |
| 403 | +} |
| 404 | +#wikieditor-toolbar-link-int-target-status-exists { |
| 405 | + background-image: url( ../images/wikiEditor/dialogs/insert-link-exists.png ); |
| 406 | +} |
| 407 | +#wikieditor-toolbar-link-int-target-status-notexists { |
| 408 | + background-image: url( ../images/wikiEditor/dialogs/insert-link-notexists.png ); |
| 409 | +} |
| 410 | +#wikieditor-toolbar-link-int-target-status-invalid { |
| 411 | + background-image: url( ../images/wikiEditor/dialogs/insert-link-invalid.png ); |
| 412 | +} |
| 413 | +#wikieditor-toolbar-link-int-target-status-external { |
| 414 | + background-image: url( ../images/wikiEditor/dialogs/insert-link-external.png ); |
| 415 | +} |
| 416 | + |
392 | 417 | /* RTL Changes */ |
393 | 418 | body.rtl .wikiEditor-toolbar-dialog .ui-dialog-buttonpane button { |
394 | 419 | float: left; |
— | — | @@ -411,6 +436,17 @@ |
412 | 437 | margin-right: 0; |
413 | 438 | margin-left: 2em; |
414 | 439 | } |
| 440 | +body.rtl #wikieditor-toolbar-link-int-target-status-exists, |
| 441 | +body.rtl #wikieditor-toolbar-link-int-target-status-notexists, |
| 442 | +body.rtl #wikieditor-toolbar-link-int-target-status-invalid, |
| 443 | +body.rtl #wikieditor-toolbar-link-int-target-status-external { |
| 444 | + padding-left: 0; |
| 445 | + padding-right: 30px; |
| 446 | + background-position: 100% 50%; |
| 447 | +} |
| 448 | +body.rtl #wikieditor-toolbar-link-int-target-status-external { |
| 449 | + background-image: url( ../images/wikiEditor/dialogs/insert-link-external-rtl.png ); |
| 450 | +} |
415 | 451 | /* Self Clearing Floats */ |
416 | 452 | .wikieditor-toolbar-table-dimension-fields:after, |
417 | 453 | .wikieditor-toolbar-dialog-wrapper:after { |
Index: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/css/combined.min.css |
— | — | @@ -366,7 +366,31 @@ |
367 | 367 | } |
368 | 368 | #wikieditor-toolbar-tool-link-int-target-label{ |
369 | 369 | float:left; |
| 370 | +line-height:1.7em; |
370 | 371 | } |
| 372 | +#wikieditor-toolbar-link-int-target-status-loading{ |
| 373 | +line-height:1.7em; |
| 374 | +} |
| 375 | +#wikieditor-toolbar-link-int-target-status-exists, |
| 376 | +#wikieditor-toolbar-link-int-target-status-notexists, |
| 377 | +#wikieditor-toolbar-link-int-target-status-invalid, |
| 378 | +#wikieditor-toolbar-link-int-target-status-external{ |
| 379 | +padding-left:30px; |
| 380 | +background-position:0 50%; |
| 381 | +background-repeat:no-repeat; |
| 382 | +} |
| 383 | +#wikieditor-toolbar-link-int-target-status-exists{ |
| 384 | +background-image:url( ../images/wikiEditor/dialogs/insert-link-exists.png ); |
| 385 | +} |
| 386 | +#wikieditor-toolbar-link-int-target-status-notexists{ |
| 387 | +background-image:url( ../images/wikiEditor/dialogs/insert-link-notexists.png ); |
| 388 | +} |
| 389 | +#wikieditor-toolbar-link-int-target-status-invalid{ |
| 390 | +background-image:url( ../images/wikiEditor/dialogs/insert-link-invalid.png ); |
| 391 | +} |
| 392 | +#wikieditor-toolbar-link-int-target-status-external{ |
| 393 | +background-image:url( ../images/wikiEditor/dialogs/insert-link-external.png ); |
| 394 | +} |
371 | 395 | body.rtl .wikiEditor-toolbar-dialog .ui-dialog-buttonpane button{ |
372 | 396 | float:left; |
373 | 397 | margin:0.5em 0.4em 0.5em 0 !important; |
— | — | @@ -389,6 +413,17 @@ |
390 | 414 | margin-right:0; |
391 | 415 | margin-left:2em; |
392 | 416 | } |
| 417 | +body.rtl #wikieditor-toolbar-link-int-target-status-exists, |
| 418 | +body.rtl #wikieditor-toolbar-link-int-target-status-notexists, |
| 419 | +body.rtl #wikieditor-toolbar-link-int-target-status-invalid, |
| 420 | +body.rtl #wikieditor-toolbar-link-int-target-status-external{ |
| 421 | +padding-left:0; |
| 422 | +padding-right:30px; |
| 423 | +background-position:100% 50%; |
| 424 | +} |
| 425 | +body.rtl #wikieditor-toolbar-link-int-target-status-external{ |
| 426 | +background-image:url( ../images/wikiEditor/dialogs/insert-link-external-rtl.png ); |
| 427 | +} |
393 | 428 | .wikieditor-toolbar-table-dimension-fields:after, |
394 | 429 | .wikieditor-toolbar-dialog-wrapper:after{ |
395 | 430 | visibility:hidden; |
Index: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/OptIn/OptIn.i18n.php |
— | — | @@ -3591,6 +3591,16 @@ |
3592 | 3592 | 'optin-title-justoptedout' => 'Mersì per avè pruaa la Beta', |
3593 | 3593 | 'optin-intro' => "'L pruget d'üsabilità de Wikipedia l'è adree a laurà fort per mejurà la Wikipedia. |
3594 | 3594 | A vöret pruvà la nostra beta?", |
| 3595 | + 'optin-success-in' => 'Te see adree a pruvà la Beta. |
| 3596 | +Te pö piantà lì quand te vör fasend \'click\' sura al ligamm "{{int:optin-leave}}" in coo a la pagina.', |
| 3597 | + 'optin-accept-short' => 'Pröva!', |
| 3598 | + 'optin-accept-long' => 'Pröva la Beta', |
| 3599 | + 'optin-accept-long-anon' => 'Vegn denter e pröva la Beta', |
| 3600 | + 'optin-deny-short' => 'No, mersì', |
| 3601 | + 'optin-deny-long' => 'Va indree a la pagina de prima', |
| 3602 | + 'optin-submit-out' => 'Va föra da Beta', |
| 3603 | + 'optin-survey-yes' => 'Sì', |
| 3604 | + 'optin-survey-no' => 'Nò', |
3595 | 3605 | ); |
3596 | 3606 | |
3597 | 3607 | /** Lithuanian (Lietuvių) |
Index: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/WikiEditor/WikiEditor.combined.js |
— | — | @@ -1031,21 +1031,28 @@ |
1032 | 1032 | var tooltip = u.getMsg( $j( this ).attr( 'id' ) + '-tooltip' ); |
1033 | 1033 | if ( $j( this ).val() == '' ) |
1034 | 1034 | $j( this ) |
1035 | | - .val( $j( this ).data( 'tooltip' ) ) |
1036 | | - .addClass( 'wikieditor-toolbar-dialog-hint' ); |
| 1035 | + .addClass( 'wikieditor-toolbar-dialog-hint' ) |
| 1036 | + .val( $j( this ).data( 'tooltip' ) ); |
1037 | 1037 | } ) |
1038 | 1038 | .focus( function() { |
1039 | | - $j( this ).removeClass( 'wikieditor-toolbar-dialog-hint' ); |
1040 | | - if( $j( this ).val() == $j( this ).data( 'tooltip' ) ) |
1041 | | - $j( this ).val( '' ); |
| 1039 | + if( $j( this ).val() == $j( this ).data( 'tooltip' ) ) { |
| 1040 | + $j( this ) |
| 1041 | + .val( '' ) |
| 1042 | + .removeClass( 'wikieditor-toolbar-dialog-hint' ); |
| 1043 | + } |
1042 | 1044 | }) |
1043 | | - .bind( 'blur change', function() { |
1044 | | - if ( $j( this ).val() == '' ) |
| 1045 | + .bind( 'change', function() { |
| 1046 | + if ( $j( this ).val() != $j( this ).data( 'tooltip' ) ) { |
1045 | 1047 | $j( this ) |
1046 | | - .val( $j( this ).data( 'tooltip' ) ) |
1047 | | - .addClass( 'wikieditor-toolbar-dialog-hint' ); |
1048 | | - else |
1049 | | - $j( this ).removeClass( 'wikieditor-toolbar-dialog-hint' ); |
| 1048 | + .removeClass( 'wikieditor-toolbar-dialog-hint' ); |
| 1049 | + } |
| 1050 | + }) |
| 1051 | + .bind( 'blur', function() { |
| 1052 | + if ( $j( this ).val() == '' ) { |
| 1053 | + $j( this ) |
| 1054 | + .addClass( 'wikieditor-toolbar-dialog-hint' ) |
| 1055 | + .val( $j( this ).data( 'tooltip' ) ); |
| 1056 | + } |
1050 | 1057 | }); |
1051 | 1058 | |
1052 | 1059 | // Automatically copy the value of the internal link page title field to the link text field unless the user |
— | — | @@ -1062,9 +1069,17 @@ |
1063 | 1070 | $j( '#wikieditor-toolbar-link-type-int' ).attr( 'checked', 'checked' ); |
1064 | 1071 | |
1065 | 1072 | if ( $j( '#wikieditor-toolbar-link-int-text' ).data( 'untouched' ) ) |
1066 | | - $j( '#wikieditor-toolbar-link-int-text' ) |
1067 | | - .val( $j( '#wikieditor-toolbar-link-int-target' ).val() ) |
1068 | | - .change(); |
| 1073 | + if ( $j( '#wikieditor-toolbar-link-int-target' ).val() == |
| 1074 | + $j( '#wikieditor-toolbar-link-int-target' ).data( 'tooltip' ) ) { |
| 1075 | + $j( '#wikieditor-toolbar-link-int-text' ) |
| 1076 | + .addClass( 'wikieditor-toolbar-dialog-hint' ) |
| 1077 | + .val( $j( '#wikieditor-toolbar-link-int-text' ).data( 'tooltip' ) ) |
| 1078 | + .change(); |
| 1079 | + } else { |
| 1080 | + $j( '#wikieditor-toolbar-link-int-text' ) |
| 1081 | + .val( $j( '#wikieditor-toolbar-link-int-target' ).val() ) |
| 1082 | + .change(); |
| 1083 | + } |
1069 | 1084 | }, 0 ); |
1070 | 1085 | }); |
1071 | 1086 | $j( '#wikieditor-toolbar-link-int-text' ).bind( 'change keydown paste cut', function() { |
— | — | @@ -1085,26 +1100,18 @@ |
1086 | 1101 | $j( '#wikieditor-toolbar-link-int-target-status' ) |
1087 | 1102 | .append( $j( '<div />' ) |
1088 | 1103 | .attr( 'id', 'wikieditor-toolbar-link-int-target-status-exists' ) |
1089 | | - .append( $j( '<img />' ).attr( 'src', |
1090 | | - $j.wikiEditor.imgPath + 'dialogs/' + 'insert-link-exists.png' ) ) |
1091 | 1104 | .append( existsMsg ) |
1092 | 1105 | ) |
1093 | 1106 | .append( $j( '<div />' ) |
1094 | 1107 | .attr( 'id', 'wikieditor-toolbar-link-int-target-status-notexists' ) |
1095 | | - .append( $j( '<img />' ).attr( 'src', |
1096 | | - $j.wikiEditor.imgPath + 'dialogs/' + 'insert-link-notexists.png' ) ) |
1097 | 1108 | .append( notexistsMsg ) |
1098 | 1109 | ) |
1099 | 1110 | .append( $j( '<div />' ) |
1100 | 1111 | .attr( 'id', 'wikieditor-toolbar-link-int-target-status-invalid' ) |
1101 | | - .append( $j( '<img />' ).attr( 'src', |
1102 | | - $j.wikiEditor.imgPath + 'dialogs/' + 'insert-link-invalid.png' ) ) |
1103 | 1112 | .append( invalidMsg ) |
1104 | 1113 | ) |
1105 | 1114 | .append( $j( '<div />' ) |
1106 | 1115 | .attr( 'id', 'wikieditor-toolbar-link-int-target-status-external' ) |
1107 | | - .append( $j( '<img />' ).attr( 'src', |
1108 | | - $j.wikiEditor.imgPath + 'dialogs/' + 'insert-link-external.png' ) ) |
1109 | 1116 | .append( externalMsg ) |
1110 | 1117 | ) |
1111 | 1118 | .append( $j( '<div />' ) |
— | — | @@ -1201,6 +1208,11 @@ |
1202 | 1209 | var whitespace = $j( '#wikieditor-toolbar-link-dialog' ).data( 'whitespace' ); |
1203 | 1210 | var target = $j( '#wikieditor-toolbar-link-int-target' ).val(); |
1204 | 1211 | var text = $j( '#wikieditor-toolbar-link-int-text' ).val(); |
| 1212 | + // check if the tooltips were passed as target or text |
| 1213 | + if ( target == $j( '#wikieditor-toolbar-link-int-target' ).data( 'tooltip' ) ) |
| 1214 | + target = ""; |
| 1215 | + if ( text == $j( '#wikieditor-toolbar-link-int-text' ).data( 'tooltip' ) ) |
| 1216 | + text = ""; |
1205 | 1217 | var u = mw.usability; |
1206 | 1218 | if ( target == '' ) { |
1207 | 1219 | alert( u.getMsg( 'wikieditor-toolbar-tool-link-empty' ) ); |
Index: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/WikiEditor/WikiEditor.combined.min.js |
— | — | @@ -42,14 +42,11 @@ |
43 | 43 | $j('#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext').click(function(){if($j('#wikieditor-toolbar-link-type-ext').is(':checked')) |
44 | 44 | updateWidget('external');if($j('#wikieditor-toolbar-link-type-int').is(':checked')) |
45 | 45 | 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).val($j(this).data('tooltip')).addClass('wikieditor-toolbar-dialog-hint');}).focus(function(){$j(this).removeClass('wikieditor-toolbar-dialog-hint');if($j(this).val()==$j(this).data('tooltip')) |
47 | | -$j(this).val('');}).bind('blur change',function(){if($j(this).val()=='') |
48 | | -$j(this).val($j(this).data('tooltip')).addClass('wikieditor-toolbar-dialog-hint');else |
49 | | -$j(this).removeClass('wikieditor-toolbar-dialog-hint');});$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'));}).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())) |
50 | 47 | $j('#wikieditor-toolbar-link-type-ext').attr('checked','checked');else |
51 | 48 | $j('#wikieditor-toolbar-link-type-int').attr('checked','checked');if($j('#wikieditor-toolbar-link-int-text').data('untouched')) |
52 | | -$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) |
53 | | -$j(that).data('untouched',false);},0);});var existsMsg=u.getMsg('wikieditor-toolbar-tool-link-int-target-status-exists');var notexistsMsg=u.getMsg('wikieditor-toolbar-tool-link-int-target-status-notexists');var invalidMsg=u.getMsg('wikieditor-toolbar-tool-link-int-target-status-invalid');var externalMsg=u.getMsg('wikieditor-toolbar-tool-link-int-target-status-external');var loadingMsg=u.getMsg('wikieditor-toolbar-tool-link-int-target-status-loading');$j('#wikieditor-toolbar-link-int-target-status').append($j('<div />').attr('id','wikieditor-toolbar-link-int-target-status-exists').append($j('<img />').attr('src',$j.wikiEditor.imgPath+'dialogs/'+'insert-link-exists.png')).append(existsMsg)).append($j('<div />').attr('id','wikieditor-toolbar-link-int-target-status-notexists').append($j('<img />').attr('src',$j.wikiEditor.imgPath+'dialogs/'+'insert-link-notexists.png')).append(notexistsMsg)).append($j('<div />').attr('id','wikieditor-toolbar-link-int-target-status-invalid').append($j('<img />').attr('src',$j.wikiEditor.imgPath+'dialogs/'+'insert-link-invalid.png')).append(invalidMsg)).append($j('<div />').attr('id','wikieditor-toolbar-link-int-target-status-external').append($j('<img />').attr('src',$j.wikiEditor.imgPath+'dialogs/'+'insert-link-external.png')).append(externalMsg)).append($j('<div />').attr('id','wikieditor-toolbar-link-int-target-status-loading').append($j('<img />').attr({'src':$j.wikiEditor.imgPath+'dialogs/'+'loading.gif','alt':loadingMsg,'title':loadingMsg}))).data('existencecache',{}).children().hide();$j('#wikieditor-toolbar-link-int-target').bind('keyup paste cut',function(){if(typeof $j(this).data('timerID')!='undefined'){clearTimeout($j(this).data('timerID'));} |
| 49 | +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) |
| 50 | +$j(that).data('untouched',false);},0);});var existsMsg=u.getMsg('wikieditor-toolbar-tool-link-int-target-status-exists');var notexistsMsg=u.getMsg('wikieditor-toolbar-tool-link-int-target-status-notexists');var invalidMsg=u.getMsg('wikieditor-toolbar-tool-link-int-target-status-invalid');var externalMsg=u.getMsg('wikieditor-toolbar-tool-link-int-target-status-external');var loadingMsg=u.getMsg('wikieditor-toolbar-tool-link-int-target-status-loading');$j('#wikieditor-toolbar-link-int-target-status').append($j('<div />').attr('id','wikieditor-toolbar-link-int-target-status-exists').append(existsMsg)).append($j('<div />').attr('id','wikieditor-toolbar-link-int-target-status-notexists').append(notexistsMsg)).append($j('<div />').attr('id','wikieditor-toolbar-link-int-target-status-invalid').append(invalidMsg)).append($j('<div />').attr('id','wikieditor-toolbar-link-int-target-status-external').append(externalMsg)).append($j('<div />').attr('id','wikieditor-toolbar-link-int-target-status-loading').append($j('<img />').attr({'src':$j.wikiEditor.imgPath+'dialogs/'+'loading.gif','alt':loadingMsg,'title':loadingMsg}))).data('existencecache',{}).children().hide();$j('#wikieditor-toolbar-link-int-target').bind('keyup paste cut',function(){if(typeof $j(this).data('timerID')!='undefined'){clearTimeout($j(this).data('timerID'));} |
54 | 51 | var timerID=setTimeout(updateExistence,120);$j(this).data('timerID',timerID);}).change(function(){if(typeof $j(this).data('timerID')!='undefined'){clearTimeout($j(this).data('timerID'));} |
55 | 52 | updateExistence();});$j('#wikieditor-toolbar-link-int-target').data('suggcache',{}).suggestions({fetch:function(query){var that=this;var title=$j(this).val();if(isExternalLink(title)||title.indexOf('|')!=-1||title==''){$j(this).suggestions('suggestions',[]);return;} |
56 | 53 | var cache=$j(this).data('suggcache');if(typeof cache[title]!='undefined'){$j(this).suggestions('suggestions',cache[title]);return;} |
— | — | @@ -57,7 +54,9 @@ |
58 | 55 | 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>');} |
59 | 56 | function escapeExternalTarget(s){return s.replace(/ /g,'%20').replace(/\[/g,'%5B').replace(/]/g,'%5D');} |
60 | 57 | function escapeExternalText(s){return s.replace(/(]+)/g,'<nowiki>$1</nowiki>');} |
61 | | -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();var u=mw.usability;if(target==''){alert(u.getMsg('wikieditor-toolbar-tool-link-empty'));return;} |
| 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')) |
| 60 | +text="";var u=mw.usability;if(target==''){alert(u.getMsg('wikieditor-toolbar-tool-link-empty'));return;} |
62 | 61 | if($j.trim(text)==''){text='';} |
63 | 62 | 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;} |
64 | 63 | if(target==text) |
Index: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/WikiEditor/Modules/Toolbar/Toolbar.i18n.php |
— | — | @@ -11265,7 +11265,7 @@ |
11266 | 11266 | 'wikieditor-toolbar-tool-link-title' => "'Nzerisce 'nu collegamende", |
11267 | 11267 | 'wikieditor-toolbar-tool-link-int' => "A 'na vôsce/pàgene de Uicchi", |
11268 | 11268 | 'wikieditor-toolbar-tool-link-int-target' => "Titele d'a vôsce:", |
11269 | | - 'wikieditor-toolbar-tool-link-int-target-tooltip' => "Mitte 'u titele d'a pàgene", |
| 11269 | + 'wikieditor-toolbar-tool-link-int-target-tooltip' => "Titele d'a pàgene o URL", |
11270 | 11270 | 'wikieditor-toolbar-tool-link-int-text' => "Teste d'u collegamende:", |
11271 | 11271 | 'wikieditor-toolbar-tool-link-int-text-tooltip' => "Mitte 'u teste ca avessa essere fatte vedè", |
11272 | 11272 | 'wikieditor-toolbar-tool-link-ext' => "A 'na pàgena web fore da Uicchipèdie", |
— | — | @@ -11888,7 +11888,9 @@ |
11889 | 11889 | 'wikieditor-toolbar-tool-link-title' => 'සබැඳුමක් ඇතුල් කිරීම', |
11890 | 11890 | 'wikieditor-toolbar-tool-link-int' => 'විකි පිටුවක් වෙත', |
11891 | 11891 | 'wikieditor-toolbar-tool-link-int-target' => 'පිටු මාතෘකාව:', |
| 11892 | + 'wikieditor-toolbar-tool-link-int-target-tooltip' => 'පිටු මාතෘකාව හෝ අන්තර්ජාල ලිපිනය', |
11892 | 11893 | 'wikieditor-toolbar-tool-link-int-text' => 'සබැඳුම් පෙළ:', |
| 11894 | + 'wikieditor-toolbar-tool-link-int-text-tooltip' => 'ප්රදර්ශනය කල යුතු පෙළ', |
11893 | 11895 | 'wikieditor-toolbar-tool-link-ext' => 'බාහිර වෙබ් පිටුවක් වෙත', |
11894 | 11896 | 'wikieditor-toolbar-tool-link-ext-target' => ' URL සබැඳුම:', |
11895 | 11897 | 'wikieditor-toolbar-tool-link-ext-text' => 'සබැඳුම් පෙළ:', |
Index: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/WikiEditor/Modules/Toolbar/Toolbar.js |
— | — | @@ -982,21 +982,28 @@ |
983 | 983 | var tooltip = u.getMsg( $j( this ).attr( 'id' ) + '-tooltip' ); |
984 | 984 | if ( $j( this ).val() == '' ) |
985 | 985 | $j( this ) |
986 | | - .val( $j( this ).data( 'tooltip' ) ) |
987 | | - .addClass( 'wikieditor-toolbar-dialog-hint' ); |
| 986 | + .addClass( 'wikieditor-toolbar-dialog-hint' ) |
| 987 | + .val( $j( this ).data( 'tooltip' ) ); |
988 | 988 | } ) |
989 | 989 | .focus( function() { |
990 | | - $j( this ).removeClass( 'wikieditor-toolbar-dialog-hint' ); |
991 | | - if( $j( this ).val() == $j( this ).data( 'tooltip' ) ) |
992 | | - $j( this ).val( '' ); |
| 990 | + if( $j( this ).val() == $j( this ).data( 'tooltip' ) ) { |
| 991 | + $j( this ) |
| 992 | + .val( '' ) |
| 993 | + .removeClass( 'wikieditor-toolbar-dialog-hint' ); |
| 994 | + } |
993 | 995 | }) |
994 | | - .bind( 'blur change', function() { |
995 | | - if ( $j( this ).val() == '' ) |
| 996 | + .bind( 'change', function() { |
| 997 | + if ( $j( this ).val() != $j( this ).data( 'tooltip' ) ) { |
996 | 998 | $j( this ) |
997 | | - .val( $j( this ).data( 'tooltip' ) ) |
998 | | - .addClass( 'wikieditor-toolbar-dialog-hint' ); |
999 | | - else |
1000 | | - $j( this ).removeClass( 'wikieditor-toolbar-dialog-hint' ); |
| 999 | + .removeClass( 'wikieditor-toolbar-dialog-hint' ); |
| 1000 | + } |
| 1001 | + }) |
| 1002 | + .bind( 'blur', function() { |
| 1003 | + if ( $j( this ).val() == '' ) { |
| 1004 | + $j( this ) |
| 1005 | + .addClass( 'wikieditor-toolbar-dialog-hint' ) |
| 1006 | + .val( $j( this ).data( 'tooltip' ) ); |
| 1007 | + } |
1001 | 1008 | }); |
1002 | 1009 | |
1003 | 1010 | // Automatically copy the value of the internal link page title field to the link text field unless the user |
— | — | @@ -1013,9 +1020,17 @@ |
1014 | 1021 | $j( '#wikieditor-toolbar-link-type-int' ).attr( 'checked', 'checked' ); |
1015 | 1022 | |
1016 | 1023 | if ( $j( '#wikieditor-toolbar-link-int-text' ).data( 'untouched' ) ) |
1017 | | - $j( '#wikieditor-toolbar-link-int-text' ) |
1018 | | - .val( $j( '#wikieditor-toolbar-link-int-target' ).val() ) |
1019 | | - .change(); |
| 1024 | + if ( $j( '#wikieditor-toolbar-link-int-target' ).val() == |
| 1025 | + $j( '#wikieditor-toolbar-link-int-target' ).data( 'tooltip' ) ) { |
| 1026 | + $j( '#wikieditor-toolbar-link-int-text' ) |
| 1027 | + .addClass( 'wikieditor-toolbar-dialog-hint' ) |
| 1028 | + .val( $j( '#wikieditor-toolbar-link-int-text' ).data( 'tooltip' ) ) |
| 1029 | + .change(); |
| 1030 | + } else { |
| 1031 | + $j( '#wikieditor-toolbar-link-int-text' ) |
| 1032 | + .val( $j( '#wikieditor-toolbar-link-int-target' ).val() ) |
| 1033 | + .change(); |
| 1034 | + } |
1020 | 1035 | }, 0 ); |
1021 | 1036 | }); |
1022 | 1037 | $j( '#wikieditor-toolbar-link-int-text' ).bind( 'change keydown paste cut', function() { |
— | — | @@ -1036,26 +1051,18 @@ |
1037 | 1052 | $j( '#wikieditor-toolbar-link-int-target-status' ) |
1038 | 1053 | .append( $j( '<div />' ) |
1039 | 1054 | .attr( 'id', 'wikieditor-toolbar-link-int-target-status-exists' ) |
1040 | | - .append( $j( '<img />' ).attr( 'src', |
1041 | | - $j.wikiEditor.imgPath + 'dialogs/' + 'insert-link-exists.png' ) ) |
1042 | 1055 | .append( existsMsg ) |
1043 | 1056 | ) |
1044 | 1057 | .append( $j( '<div />' ) |
1045 | 1058 | .attr( 'id', 'wikieditor-toolbar-link-int-target-status-notexists' ) |
1046 | | - .append( $j( '<img />' ).attr( 'src', |
1047 | | - $j.wikiEditor.imgPath + 'dialogs/' + 'insert-link-notexists.png' ) ) |
1048 | 1059 | .append( notexistsMsg ) |
1049 | 1060 | ) |
1050 | 1061 | .append( $j( '<div />' ) |
1051 | 1062 | .attr( 'id', 'wikieditor-toolbar-link-int-target-status-invalid' ) |
1052 | | - .append( $j( '<img />' ).attr( 'src', |
1053 | | - $j.wikiEditor.imgPath + 'dialogs/' + 'insert-link-invalid.png' ) ) |
1054 | 1063 | .append( invalidMsg ) |
1055 | 1064 | ) |
1056 | 1065 | .append( $j( '<div />' ) |
1057 | 1066 | .attr( 'id', 'wikieditor-toolbar-link-int-target-status-external' ) |
1058 | | - .append( $j( '<img />' ).attr( 'src', |
1059 | | - $j.wikiEditor.imgPath + 'dialogs/' + 'insert-link-external.png' ) ) |
1060 | 1067 | .append( externalMsg ) |
1061 | 1068 | ) |
1062 | 1069 | .append( $j( '<div />' ) |
— | — | @@ -1152,6 +1159,11 @@ |
1153 | 1160 | var whitespace = $j( '#wikieditor-toolbar-link-dialog' ).data( 'whitespace' ); |
1154 | 1161 | var target = $j( '#wikieditor-toolbar-link-int-target' ).val(); |
1155 | 1162 | var text = $j( '#wikieditor-toolbar-link-int-text' ).val(); |
| 1163 | + // check if the tooltips were passed as target or text |
| 1164 | + if ( target == $j( '#wikieditor-toolbar-link-int-target' ).data( 'tooltip' ) ) |
| 1165 | + target = ""; |
| 1166 | + if ( text == $j( '#wikieditor-toolbar-link-int-text' ).data( 'tooltip' ) ) |
| 1167 | + text = ""; |
1156 | 1168 | var u = mw.usability; |
1157 | 1169 | if ( target == '' ) { |
1158 | 1170 | alert( u.getMsg( 'wikieditor-toolbar-tool-link-empty' ) ); |
Index: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/WikiEditor/WikiEditor.hooks.php |
— | — | @@ -16,14 +16,14 @@ |
17 | 17 | array( 'src' => 'Modules/Preview/Preview.js', 'version' => 6 ), |
18 | 18 | array( 'src' => 'Modules/Publish/Publish.js', 'version' => 6 ), |
19 | 19 | array( 'src' => 'Modules/Toc/Toc.js', 'version' => 7 ), |
20 | | - array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 44 ), |
| 20 | + array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 46 ), |
21 | 21 | array( 'src' => 'Modules/TemplateEditor/TemplateEditor.js', 'version' => 4 ), |
22 | 22 | ), |
23 | 23 | 'combined' => array( |
24 | | - array( 'src' => 'WikiEditor.combined.js', 'version' => 46 ), |
| 24 | + array( 'src' => 'WikiEditor.combined.js', 'version' => 48 ), |
25 | 25 | ), |
26 | 26 | 'minified' => array( |
27 | | - array( 'src' => 'WikiEditor.combined.min.js', 'version' => 46 ), |
| 27 | + array( 'src' => 'WikiEditor.combined.min.js', 'version' => 48 ), |
28 | 28 | ), |
29 | 29 | ); |
30 | 30 | static $messages = array( |
Index: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins.combined.min.js |
— | — | @@ -448,9 +448,10 @@ |
449 | 449 | if(context.history.length+context.historyPosition>=0&&context.historyPosition<0){context.$content.html(context.history[context.history.length+context.historyPosition].html);}else{context.historyPosition=Math.max(-context.history.length,Math.min(context.historyPosition,-1));} |
450 | 450 | return false;} |
451 | 451 | break;} |
452 | | -return true;},'change':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldHTML!=newHTML){context.fn.purgeOffsets();context.oldHTML=newHTML;event.data.scope='realchange';context.historyPosition=-1;} |
| 452 | +return true;},'change':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldHTML!=newHTML){context.fn.purgeOffsets();context.oldHTML=newHTML;event.data.scope='realchange';} |
453 | 453 | switch(event.which){case 8:break;} |
454 | | -return true;},'delayedChange':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldDelayedHTML!=newHTML){context.fn.purgeOffsets();context.oldDelayedHTML=newHTML;event.data.scope='realchange';context.history.push({'html':newHTML});while(context.history.length>10){context.history.shift();}} |
| 454 | +return true;},'delayedChange':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldDelayedHTML!=newHTML){context.fn.purgeOffsets();context.oldDelayedHTML=newHTML;event.data.scope='realchange';if(newHTML!==context.history[context.history.length+context.historyPosition].html){context.historyPosition=-1;} |
| 455 | +context.history.push({'html':newHTML});while(context.history.length>10){context.history.shift();}} |
455 | 456 | return true;}};context.fn={'trigger':function(name,event){if(typeof event=='undefined'){event={'type':'custom'};} |
456 | 457 | if(typeof event.data=='undefined'){event.data={};} |
457 | 458 | if(name in context.evt){if(!context.evt[name](event)){return false;}} |
— | — | @@ -459,7 +460,9 @@ |
460 | 461 | event.preventDefault();return false;}).text($.wikiEditor.autoMsg(options,'title'))).appendTo(context.$tabs);} |
461 | 462 | if(!context.$tabs.children().size()){addTab({'name':'wikitext','titleMsg':'wikieditor-wikitext-tab'});} |
462 | 463 | addTab(options);return $('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-'+options.name).hide().appendTo(context.$ui);},'htmlToText':function(html){if(html in context.htmlToTextMap){return context.htmlToTextMap[html];} |
463 | | -var origHTML=html;html=html.replace(/\r?\n/g,"").replace(/ /g," ").replace(/\<br[^\>]*\>/gi,"\n").replace(/\<\/p\>\<p\>/gi,"\n").replace(/\<\/p\>(\n*)\<p\>/gi,"$1\n");var leading=html.match(/^\s*/)[0];var trailing=html.match(/\s*$/)[0];html=html.substr(leading.length,html.length-leading.length-trailing.length);var $pre=$('<pre>'+html+'</pre>');$pre.find('.wikiEditor-noinclude').each(function(){$(this).remove();});$pre.find('.wikiEditor-tab').each(function(){$(this).text("\t");});$pre.find('br').each(function(){$(this).replaceWith("\n");});$pre.find('p').each(function(){var text=$(this).text();var t=new context.fn.rawTraverser(this.firstChild,0,this,$pre.get(0)).prev();while(t&&t.node.nodeName!='#text'&&t.node.nodeName!='BR'&&t.node.nodeName!='P'){t=t.prev();} |
| 464 | +var origHTML=html;html=html.replace(/\r?\n/g,"").replace(/ /g," ").replace(/\<br[^\>]*\>\<\/p\>/gi,'</p>') |
| 465 | +if($.browser.firefox){html=html.replace(/\<p[^\>]*\>\<\/p\>(\<p[^\>]*\>\<\/p\>)*/gi,'$1');} |
| 466 | +html=html.replace(/\<\/p\>\s*\<p[^\>]*\>/gi,"\n").replace(/\<br[^\>]*\>/gi,"\n").replace(/\<\/p\>(\n*)\<p[^\>]*\>/gi,"$1\n");var leading=html.match(/^\s*/)[0];var trailing=html.match(/\s*$/)[0];html=html.substr(leading.length,html.length-leading.length-trailing.length);var $pre=$('<pre>'+html+'</pre>');$pre.find('.wikiEditor-noinclude').each(function(){$(this).remove();});$pre.find('.wikiEditor-tab').each(function(){$(this).text("\t");});$pre.find('br').each(function(){$(this).replaceWith("\n");});$pre.find('p').each(function(){var text=$(this).text();var t=new context.fn.rawTraverser(this.firstChild,0,this,$pre.get(0)).prev();while(t&&t.node.nodeName!='#text'&&t.node.nodeName!='BR'&&t.node.nodeName!='P'){t=t.prev();} |
464 | 467 | if(t){text="\n"+text;} |
465 | 468 | t=new context.fn.rawTraverser(this.lastChild,0,this,$pre.get(0)).next();while(t&&t.node.nodeName!='#text'&&t.node.nodeName!='BR'&&t.node.nodeName!='P'){t=t.next();} |
466 | 469 | if(t&&!t.inP&&t.node.nodeName=='#text'&&t.node.nodeValue.charAt(0)!='\n'&&t.node.nodeValue.charAt(0)!='\r'){text+="\n";} |
— | — | @@ -493,8 +496,10 @@ |
494 | 497 | return context.$textarea;},'scrollToCaretPosition':function(options){},'scrollToTop':function($element,force){var html=context.$content.closest('html'),body=context.$content.closest('body'),parentHtml=$('html'),parentBody=$('body');var y=$element.offset().top;if(!$.browser.msie&&!$element.is('body')){y=parentHtml.scrollTop()>0?y+html.scrollTop()-parentHtml.scrollTop():y;y=parentBody.scrollTop()>0?y+body.scrollTop()-parentBody.scrollTop():y;} |
495 | 498 | var topBound=html.scrollTop()>body.scrollTop()?html.scrollTop():body.scrollTop(),bottomBound=topBound+context.$iframe.height();if(force||y<topBound||y>bottomBound){html.scrollTop(y);body.scrollTop(y);} |
496 | 499 | $element.trigger('scrollToTop');},'beforeSelection':function(classname,strict){if(typeof classname=='undefined'){classname='';} |
497 | | -var e,offset;if(context.$iframe[0].contentWindow.getSelection){var selection=context.$iframe[0].contentWindow.getSelection();if(selection.baseNode!==null){e=selection.getRangeAt(0).startContainer;offset=selection.getRangeAt(0).startOffset;}else{return $([]);}}else if(context.$iframe[0].contentWindow.document.selection){var range=context.$iframe[0].contentWindow.document.selection.createRange();var range2=context.$iframe[0].contentWindow.document.body.createTextRange();try{range2.setEndPoint('EndToStart',range);}catch(ex){return $([]);} |
498 | | -var seekPos=context.fn.htmlToText(range2.htmlText).length;var offset=context.fn.getOffset(seekPos);e=offset?offset.node:null;offset=offset?offset.offset:null;if(!e){return $([]);}} |
| 500 | +var e=null,offset=null;if(context.$iframe[0].contentWindow.getSelection){var selection=context.$iframe[0].contentWindow.getSelection();if(selection.baseNode!==null){e=selection.getRangeAt(0).startContainer;offset=selection.getRangeAt(0).startOffset;}else{return null;} |
| 501 | +var body=context.$iframe[0].contentWindow.document.body;if($.browser.opera&&e==body&&offset==1){return null;}} |
| 502 | +if(!e&&context.$iframe[0].contentWindow.document.selection){var range=context.$iframe[0].contentWindow.document.selection.createRange();var range2=context.$iframe[0].contentWindow.document.body.createTextRange();try{range2.setEndPoint('EndToStart',range);}catch(ex){return null;} |
| 503 | +var seekPos=context.fn.htmlToText(range2.htmlText).length;var offset=context.fn.getOffset(seekPos);e=offset?offset.node:null;offset=offset?offset.offset:null;if(!e){return null;}} |
499 | 504 | if(e.nodeName!='#text'){var newE=e.firstChild;for(var i=0;i<offset-1&&newE;i++){newE=newE.nextSibling;} |
500 | 505 | while(newE&&newE.lastChild){newE=newE.lastChild;} |
501 | 506 | e=newE||e;} |
— | — | @@ -587,9 +592,10 @@ |
588 | 593 | if(endIndex!=-1){markers.push({start:tokenArray[beginIndex].offset,end:tokenArray[endIndex].offset,type:'template',anchor:'wrap',afterWrap:$.wikiEditor.modules.templateEditor.fn.stylize,beforeUnwrap:function(node){$(node).data('display').remove();},onSkip:function(){},getAnchor:function(ca1,ca2){return $(ca1.parentNode).is('div.wikiEditor-template-text')&&$(ca1.parentNode.previousSibling).is('ul.wikiEditor-template-modes')&&ca1.parentNode.nextSibling==null?ca1.parentNode:null;}});}else{tokenArray[beginIndex].label='TEMPLATE_FALSE_BEGIN';tokenIndex=beginIndex;}}}}},exp:[{'regex':/{{/,'label':"TEMPLATE_BEGIN"},{'regex':/}}/,'label':"TEMPLATE_END",'markAfter':true}],cfg:{},fn:{create:function(context,config){context.modules.templateEditor={};},stylize:function(wrappedTemplate){$(wrappedTemplate).each(function(){if(typeof $(this).data('model')!='undefined'){return;} |
589 | 594 | var model=new $.wikiEditor.modules.templateEditor.fn.model($(this).text());if(!model.isCollapsible()){return;} |
590 | 595 | var $template=$(this).wrap('<div class="wikiEditor-template"></div>').addClass('wikiEditor-template-text wikiEditor-nodisplay').parent().addClass('wikiEditor-template-collapsed').data('model',model);$('<span />').addClass('wikiEditor-template-name wikiEditor-noinclude').text(model.getName()).mousedown(function(){createDialog($template);}).prependTo($template);var $options=$('<ul />').addClass('wikiEditor-template-modes wikiEditor-noinclude').append($('<li />').addClass('wikiEditor-template-action-wikiText').append($('<img />').attr('src',$.wikiEditor.imgPath+'templateEditor/'+'wiki-text.png')).mousedown(toggleWikiTextEditor)).insertAfter($template.find('.wikiEditor-template-name'));function toggleWikiTextEditor(){var $template=$(this).closest('.wikiEditor-template');$template.toggleClass('wikiEditor-template-expanded').toggleClass('wikiEditor-template-collapsed');var $wikitext=$template.children('.wikiEditor-template-text');$wikitext.toggleClass('wikiEditor-nodisplay');if($template.hasClass('wikiEditor-template-collapsed')){var model=new $.wikiEditor.modules.templateEditor.fn.model($template.children('.wikiEditor-template-text').text());$template.data('model',model);$template.children('.wikiEditor-template-name').text(model.getName());} |
591 | | -return false;};function expandTemplate($displayDiv){$displayDiv.removeClass('wikiEditor-template-collapsed');$displayDiv.addClass('wikiEditor-template-expanded');$displayDiv.unbind('mousedown');$keyValueTable=$('<table />').appendTo($displayDiv);$header_row=$('<tr />').appendTo($keyValueTable);$('<th />').attr('colspan','2').text(model.getName()).appendTo($header_row);for(param in model.getAllParamNames()){$keyVal_row=$('<tr />').appendTo($keyValueTable);$('<td />').text(param).appendTo($keyVal_row);$('<td />').text(model.getValue(param)).appendTo($keyVal_row);}};function collapseTemplate($displayDiv){$displayDiv.addClass('wikiEditor-template-collapsed');$displayDiv.removeClass('wikiEditor-template-expanded');$displayDiv.text(model.getName());};function createDialog($templateDiv){var templateModel=$templateDiv.data('model');console.log(templateModel.getText());var $dialog=$("<div></div>");var $title=$("<div>"+templateModel.getName()+"</div>").addClass('wikiEditor-template-dialog-title');var $table=$("<table></table>").addClass('wikiEditor-template-dialog-table').appendTo($dialog);var allInitialParams=templateModel.getAllInitialParams();for(var paramIndex in allInitialParams){var param=allInitialParams[paramIndex];if(typeof param.name=='undefined'){continue;} |
| 596 | +else{$wikitext.text($template.data('model').getText());} |
| 597 | +return false;};function expandTemplate($displayDiv){$displayDiv.removeClass('wikiEditor-template-collapsed');$displayDiv.addClass('wikiEditor-template-expanded');$displayDiv.unbind('mousedown');$keyValueTable=$('<table />').appendTo($displayDiv);$header_row=$('<tr />').appendTo($keyValueTable);$('<th />').attr('colspan','2').text(model.getName()).appendTo($header_row);for(param in model.getAllParamNames()){$keyVal_row=$('<tr />').appendTo($keyValueTable);$('<td />').text(param).appendTo($keyVal_row);$('<td />').text(model.getValue(param)).appendTo($keyVal_row);}};function collapseTemplate($displayDiv){$displayDiv.addClass('wikiEditor-template-collapsed');$displayDiv.removeClass('wikiEditor-template-expanded');$displayDiv.text(model.getName());};function createDialog($templateDiv){var $wikitext=$templateDiv.children('.wikiEditor-template-text');var templateModel=new $.wikiEditor.modules.templateEditor.fn.model($wikitext.text());$templateDiv.data('model',templateModel);var $dialog=$("<div></div>");var $title=$("<div>"+templateModel.getName()+"</div>").addClass('wikiEditor-template-dialog-title');var $table=$("<table></table>").addClass('wikiEditor-template-dialog-table').appendTo($dialog);var allInitialParams=templateModel.getAllInitialParams();for(var paramIndex in allInitialParams){var param=allInitialParams[paramIndex];if(typeof param.name=='undefined'){continue;} |
592 | 598 | var $paramRow=$("<tr></tr>").addClass('wikiEditor-template-dialog-row');var $paramName=$("<td></td>").addClass('wikiEditor-template-dialog-name').text(param.name);var $paramVal=$("<td></td>").addClass('wikiEditor-template-dialog-value');var $paramInput=$("<input></input>").data('name',param.name).val(templateModel.getValue(param.name));$paramVal.append($paramInput);$paramRow.append($paramName).append($paramVal);$table.append($paramRow);} |
593 | | -$("<button></button>").click(function(){$('.wikiEditor-template-dialog-value input').each(function(){templateModel.setValue($(this).data('name'),$(this).val());});$dialog.dialog('close');}).text("OK").appendTo($dialog);$dialog.dialog();return false;};function toggleWikiText(){var $template=$(this).closest('.wikiEditor-template');$template.toggleClass('wikiEditor-template-collapsed').toggleClass('wikiEditor-template-expanded').children('.wikiEditor-template-text, .wikiEditor-template-name, .wikiEditor-template-modes').toggleClass('wikiEditor-nodisplay');if($template.hasClass('wikiEditor-template-collapsed')){var model=new $.wikiEditor.modules.templateEditor.fn.model($template.children('.wikiEditor-template-text').text());$template.data('model',model);$template.children('.wikiEditor-template-name').text(model.getName());} |
| 599 | +$("<button></button>").click(function(){$('.wikiEditor-template-dialog-value input').each(function(){templateModel.setValue($(this).data('name'),$(this).val());});$wikitext.text(templateModel.getText());$dialog.dialog('close');}).text("OK").appendTo($dialog);$dialog.dialog();return false;};function toggleWikiText(){var $template=$(this).closest('.wikiEditor-template');$template.toggleClass('wikiEditor-template-collapsed').toggleClass('wikiEditor-template-expanded').children('.wikiEditor-template-text, .wikiEditor-template-name, .wikiEditor-template-modes').toggleClass('wikiEditor-nodisplay');if($template.hasClass('wikiEditor-template-collapsed')){var model=new $.wikiEditor.modules.templateEditor.fn.model($template.children('.wikiEditor-template-text').text());$template.data('model',model);$template.children('.wikiEditor-template-name').text(model.getName());} |
594 | 600 | else{$template.children('.wikiEditor-template-text').children('.wikiEditor-template-inner-text').text($template.data('model').getText().replace(/\{\{/,'').replace(/\}\}$/,''));} |
595 | 601 | return false;} |
596 | 602 | function noEdit(){return false;}});},getTemplateInfo:function(templateName){var templateInfo='';return $(templateInfo);},model:function(wikitext){var collapsible=true;function Param(name,value,number,nameIndex,equalsIndex,valueIndex){this.name=name;this.value=value;this.number=number;this.nameIndex=nameIndex;this.equalsIndex=equalsIndex;this.valueIndex=valueIndex;} |
— | — | @@ -633,7 +639,8 @@ |
634 | 640 | context.$wikitext.css({'position':'','height':''});context.$ui.find('.wikiEditor-ui-right').css({'marginRight':'','position':'','left':'','right':'','float':'','top':'','height':''});context.$ui.find('.wikiEditor-ui-left').css({'width':'','position':'','left':'','float':'','right':''});} |
635 | 641 | $.wikiEditor.modules.toc.fn.redraw(context,width);},disable:function(context){if(context.modules.toc.$toc.data('collapsed')){context.$ui.find('.wikiEditor-ui-toc-expandControl').hide();}else{if(context.modules.toc.$toc.data('positionMode')=='goofy'){$.wikiEditor.modules.toc.fn.switchLayout(context);} |
636 | 642 | context.$ui.find('.wikiEditor-ui-right').hide();context.$ui.find('.wikiEditor-ui-left').css('marginRight','').children().css('marginRight','');} |
637 | | -context.modules.toc.$toc.data('positionMode','disabled');},enable:function(context){context.modules.toc.$toc.data('positionMode','regular');if(context.modules.toc.$toc.data('collapsed')){context.$ui.find('.wikiEditor-ui-toc-expandControl').show();}else{context.$ui.find('.wikiEditor-ui-right').show();$.wikiEditor.modules.toc.fn.redraw(context,$.wikiEditor.modules.toc.cfg.minimumWidth);context.modules.toc.$toc.find('div').autoEllipsis({'position':'right','tooltip':true,'restoreText':true});}},unhighlight:function(context){if(context){context.modules.toc.$toc.find('div').removeClass('current');}},update:function(context){$.wikiEditor.modules.toc.fn.unhighlight(context);var div=context.fn.beforeSelection('wikiEditor-toc-header');var section=div.data('section')||0;if(context.data.outline.length>0){var sectionLink=context.modules.toc.$toc.find('div.section-'+section);sectionLink.addClass('current');var relTop=sectionLink.offset().top-context.modules.toc.$toc.offset().top;var scrollTop=context.modules.toc.$toc.scrollTop();var divHeight=context.modules.toc.$toc.height();var sectionHeight=sectionLink.height();if(relTop<0) |
| 643 | +context.modules.toc.$toc.data('positionMode','disabled');},enable:function(context){context.modules.toc.$toc.data('positionMode','regular');if(context.modules.toc.$toc.data('collapsed')){context.$ui.find('.wikiEditor-ui-toc-expandControl').show();}else{context.$ui.find('.wikiEditor-ui-right').show();$.wikiEditor.modules.toc.fn.redraw(context,$.wikiEditor.modules.toc.cfg.minimumWidth);context.modules.toc.$toc.find('div').autoEllipsis({'position':'right','tooltip':true,'restoreText':true});}},unhighlight:function(context){if(context){context.modules.toc.$toc.find('div').removeClass('current');}},update:function(context){var div=context.fn.beforeSelection('wikiEditor-toc-header');if(div===null){return;} |
| 644 | +$.wikiEditor.modules.toc.fn.unhighlight(context);var section=div.data('section')||0;if(context.data.outline.length>0){var sectionLink=context.modules.toc.$toc.find('div.section-'+section);sectionLink.addClass('current');var relTop=sectionLink.offset().top-context.modules.toc.$toc.offset().top;var scrollTop=context.modules.toc.$toc.scrollTop();var divHeight=context.modules.toc.$toc.height();var sectionHeight=sectionLink.height();if(relTop<0) |
638 | 645 | context.modules.toc.$toc.scrollTop(scrollTop+relTop);else if(relTop+sectionHeight>divHeight) |
639 | 646 | context.modules.toc.$toc.scrollTop(scrollTop+relTop+sectionHeight-divHeight);}},collapse:function(event){var $this=$(this),context=$this.data('context');if(context.modules.toc.$toc.data('positionMode')=='goofy'){$.wikiEditor.modules.toc.fn.switchLayout(context);} |
640 | 647 | var pT=$this.parent().position().top-1;context.modules.toc.$toc.data('collapsed',true);context.$ui.find('.wikiEditor-ui-left').animate({'marginRight':'-1px'},'fast',function(){$(this).css('marginRight',0);}).children().animate({'marginRight':'1px'},'fast',function(){$(this).css('marginRight',0);});context.$ui.find('.wikiEditor-ui-right').css({'marginTop':'1px','position':'absolute','left':$.wikiEditor.modules.toc.cfg.rtl?0:'auto','right':$.wikiEditor.modules.toc.cfg.rtl?'auto':0,'top':pT}).fadeOut('fast',function(){$(this).hide().css({'marginTop':'0','width':'1px'});context.$ui.find('.wikiEditor-ui-toc-expandControl').fadeIn('fast');context.fn.trigger('tocCollapse');context.fn.trigger('resize');});$.cookie('wikiEditor-'+context.instance+'-toc-width',0);return false;},expand:function(event){var $this=$(this),context=$this.data('context'),openWidth=parseFloat(context.modules.toc.$toc.data('openWidth')),availableSpace=context.$wikitext.width()-parseFloat($.wikiEditor.modules.toc.cfg.textMinimumWidth);if(availableSpace<$.wikiEditor.modules.toc.cfg.textMinmumWidth)return false;context.modules.toc.$toc.data('collapsed',false);if(availableSpace<openWidth)openWidth=availableSpace;context.$ui.find('.wikiEditor-ui-toc-expandControl').hide();context.$ui.find('.wikiEditor-ui-left').animate({'marginRight':(parseFloat(openWidth)*-1)},'fast').children().animate({'marginRight':openWidth},'fast');context.$ui.find('.wikiEditor-ui-right').show().css('marginTop','1px').animate({'width':openWidth},'fast',function(){context.$content.trigger('mouseup');$(this).css({'marginTop':'0','position':'relative','right':'auto','left':'auto','top':'auto'});context.fn.trigger('tocExpand');context.fn.trigger('resize');});$.cookie('wikiEditor-'+context.instance+'-toc-width',context.modules.toc.$toc.data('openWidth'));return false;},build:function(context){function buildStructure(outline,offset,level){if(offset==undefined)offset=0;if(level==undefined)level=1;var sections=[];for(var i=offset;i<outline.length;i++){if(outline[i].nLevel==level){var sub=buildStructure(outline,i+1,level+1);if(sub.length){outline[i].sections=sub;} |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins/jquery.textSelection.js |
___________________________________________________________________ |
Modified: svn:mergeinfo |
641 | 648 | Merged /trunk/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js:r61960-61992 |
Index: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins/jquery.wikiEditor.templateEditor.js |
— | — | @@ -138,6 +138,9 @@ |
139 | 139 | $template.data( 'model' , model ); |
140 | 140 | $template.children( '.wikiEditor-template-name' ).text( model.getName() ); |
141 | 141 | } |
| 142 | + else{ //we just expanded this |
| 143 | + $wikitext.text($template.data('model').getText()); |
| 144 | + } |
142 | 145 | |
143 | 146 | return false; |
144 | 147 | }; |
— | — | @@ -180,8 +183,10 @@ |
181 | 184 | |
182 | 185 | |
183 | 186 | function createDialog( $templateDiv ){ |
184 | | - var templateModel = $templateDiv.data('model'); |
185 | | - console.log(templateModel.getText()); |
| 187 | + var $wikitext = $templateDiv.children('.wikiEditor-template-text'); |
| 188 | + //TODO: check if template model has been changed |
| 189 | + var templateModel = new $.wikiEditor.modules.templateEditor.fn.model( $wikitext.text() ); |
| 190 | + $templateDiv.data('model', templateModel); |
186 | 191 | var $dialog = $("<div></div>"); |
187 | 192 | var $title = $("<div>" + templateModel.getName() + "</div>").addClass('wikiEditor-template-dialog-title'); |
188 | 193 | var $table = $("<table></table>") |
— | — | @@ -210,6 +215,9 @@ |
211 | 216 | $('.wikiEditor-template-dialog-value input').each( function(){ |
212 | 217 | templateModel.setValue( $(this).data('name'), $(this).val() ); |
213 | 218 | }); |
| 219 | + //keep text consistent |
| 220 | + $wikitext.text( templateModel.getText() ); |
| 221 | + |
214 | 222 | $dialog.dialog('close'); |
215 | 223 | |
216 | 224 | }).text("OK").appendTo($dialog); |
Index: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins/jquery.wikiEditor.toc.js |
— | — | @@ -257,9 +257,13 @@ |
258 | 258 | * @param {Object} context |
259 | 259 | */ |
260 | 260 | update: function( context ) { |
| 261 | + var div = context.fn.beforeSelection( 'wikiEditor-toc-header' ); |
| 262 | + if ( div === null ) { |
| 263 | + // beforeSelection couldn't figure it out, keep the old highlight state |
| 264 | + return; |
| 265 | + } |
| 266 | + |
261 | 267 | $.wikiEditor.modules.toc.fn.unhighlight( context ); |
262 | | - |
263 | | - var div = context.fn.beforeSelection( 'wikiEditor-toc-header' ); |
264 | 268 | var section = div.data( 'section' ) || 0; |
265 | 269 | if ( context.data.outline.length > 0 ) { |
266 | 270 | var sectionLink = context.modules.toc.$toc.find( 'div.section-' + section ); |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins/jquery.cookie.js |
___________________________________________________________________ |
Modified: svn:mergeinfo |
267 | 271 | Merged /trunk/extensions/UsabilityInitiative/js/plugins/jquery.cookie.js:r61960-61992 |
Index: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins/jquery.wikiEditor.js |
— | — | @@ -311,7 +311,6 @@ |
312 | 312 | context.fn.purgeOffsets(); |
313 | 313 | context.oldHTML = newHTML; |
314 | 314 | event.data.scope = 'realchange'; |
315 | | - context.historyPosition = -1; |
316 | 315 | } |
317 | 316 | // Are we deleting a <p> with one keystroke? if so, either remove preceding <br> or merge <p>s |
318 | 317 | switch ( event.which ) { |
— | — | @@ -330,6 +329,10 @@ |
331 | 330 | event.data.scope = 'realchange'; |
332 | 331 | // Save in the history |
333 | 332 | //console.log( 'save-state' ); |
| 333 | + // Only reset the historyPosition and begin moving forward if this change is not the result of undo |
| 334 | + if ( newHTML !== context.history[context.history.length + context.historyPosition].html ) { |
| 335 | + context.historyPosition = -1; |
| 336 | + } |
334 | 337 | context.history.push( { 'html': newHTML } ); |
335 | 338 | // Keep the history under control |
336 | 339 | while ( context.history.length > 10 ) { |
— | — | @@ -440,11 +443,17 @@ |
441 | 444 | // IE does overzealous whitespace collapsing for $( '<pre />' ).html( html ); |
442 | 445 | // We also do <br> and easy cases for <p> conversion here, complicated cases are handled later |
443 | 446 | html = html |
444 | | - .replace( /\r?\n/g, "" ) // IE7 inserts newlines before block elements |
445 | | - .replace( / /g, " " ) // We inserted these to prevent IE from collapsing spaces |
446 | | - .replace( /\<br[^\>]*\>/gi, "\n" ) // <br> conversion |
447 | | - .replace( /\<\/p\>\<p\>/gi, "\n" ) // Easy case for <p> conversion |
448 | | - .replace( /\<\/p\>(\n*)\<p\>/gi, "$1\n" ); |
| 447 | + .replace( /\r?\n/g, "" ) // IE7 inserts newlines before block elements |
| 448 | + .replace( / /g, " " ) // We inserted these to prevent IE from collapsing spaces |
| 449 | + .replace( /\<br[^\>]*\>\<\/p\>/gi, '</p>' ) // Remove trailing <br> from <p> |
| 450 | + // Firefox ends up with one too many empty paragraphs, so this reduced consective strings of them by 1 |
| 451 | + if ( $.browser.firefox ) { |
| 452 | + html = html.replace( /\<p[^\>]*\>\<\/p\>(\<p[^\>]*\>\<\/p\>)*/gi, '$1' ); |
| 453 | + } |
| 454 | + html = html |
| 455 | + .replace( /\<\/p\>\s*\<p[^\>]*\>/gi, "\n" ) // Easy case for <p> conversion |
| 456 | + .replace( /\<br[^\>]*\>/gi, "\n" ) // <br> conversion |
| 457 | + .replace( /\<\/p\>(\n*)\<p[^\>]*\>/gi, "$1\n" ); |
449 | 458 | // Save leading and trailing whitespace now and restore it later. IE eats it all, and even Firefox |
450 | 459 | // won't leave everything alone |
451 | 460 | var leading = html.match( /^\s*/ )[0]; |
— | — | @@ -824,13 +833,13 @@ |
825 | 834 | * Get the first element before the selection that's in a certain class |
826 | 835 | * @param classname Class to match. Defaults to '', meaning any class |
827 | 836 | * @param strict If true, the element the selection starts in cannot match (default: false) |
828 | | - * @return jQuery object |
| 837 | + * @return jQuery object or null if unknown |
829 | 838 | */ |
830 | 839 | 'beforeSelection': function( classname, strict ) { |
831 | 840 | if ( typeof classname == 'undefined' ) { |
832 | 841 | classname = ''; |
833 | 842 | } |
834 | | - var e, offset; |
| 843 | + var e = null, offset = null; |
835 | 844 | if ( context.$iframe[0].contentWindow.getSelection ) { |
836 | 845 | // Firefox and Opera |
837 | 846 | var selection = context.$iframe[0].contentWindow.getSelection(); |
— | — | @@ -841,9 +850,17 @@ |
842 | 851 | e = selection.getRangeAt( 0 ).startContainer; |
843 | 852 | offset = selection.getRangeAt( 0 ).startOffset; |
844 | 853 | } else { |
845 | | - return $( [] ); |
| 854 | + return null; |
846 | 855 | } |
847 | | - } else if ( context.$iframe[0].contentWindow.document.selection ) { |
| 856 | + |
| 857 | + // When the cursor is on an empty line, Opera gives us a bogus range object with |
| 858 | + // startContainer=endContainer=body and startOffset=endOffset=1 |
| 859 | + var body = context.$iframe[0].contentWindow.document.body; |
| 860 | + if ( $.browser.opera && e == body && offset == 1 ) { |
| 861 | + return null; |
| 862 | + } |
| 863 | + } |
| 864 | + if ( !e && context.$iframe[0].contentWindow.document.selection ) { |
848 | 865 | // IE |
849 | 866 | // Because there's nothing like range.startContainer in IE, we need to do a DOM traversal |
850 | 867 | // to find the element the start of the selection is in |
— | — | @@ -855,14 +872,14 @@ |
856 | 873 | try { |
857 | 874 | range2.setEndPoint( 'EndToStart', range ); |
858 | 875 | } catch ( ex ) { |
859 | | - return $( [] ); |
| 876 | + return null; |
860 | 877 | } |
861 | 878 | var seekPos = context.fn.htmlToText( range2.htmlText ).length; |
862 | 879 | var offset = context.fn.getOffset( seekPos ); |
863 | 880 | e = offset ? offset.node : null; |
864 | 881 | offset = offset ? offset.offset : null; |
865 | 882 | if ( !e ) { |
866 | | - return $( [] ); |
| 883 | + return null; |
867 | 884 | } |
868 | 885 | } |
869 | 886 | if ( e.nodeName != '#text' ) { |
Index: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/js/plugins.combined.js |
— | — | @@ -6744,7 +6744,6 @@ |
6745 | 6745 | context.fn.purgeOffsets(); |
6746 | 6746 | context.oldHTML = newHTML; |
6747 | 6747 | event.data.scope = 'realchange'; |
6748 | | - context.historyPosition = -1; |
6749 | 6748 | } |
6750 | 6749 | // Are we deleting a <p> with one keystroke? if so, either remove preceding <br> or merge <p>s |
6751 | 6750 | switch ( event.which ) { |
— | — | @@ -6763,6 +6762,10 @@ |
6764 | 6763 | event.data.scope = 'realchange'; |
6765 | 6764 | // Save in the history |
6766 | 6765 | //console.log( 'save-state' ); |
| 6766 | + // Only reset the historyPosition and begin moving forward if this change is not the result of undo |
| 6767 | + if ( newHTML !== context.history[context.history.length + context.historyPosition].html ) { |
| 6768 | + context.historyPosition = -1; |
| 6769 | + } |
6767 | 6770 | context.history.push( { 'html': newHTML } ); |
6768 | 6771 | // Keep the history under control |
6769 | 6772 | while ( context.history.length > 10 ) { |
— | — | @@ -6873,11 +6876,17 @@ |
6874 | 6877 | // IE does overzealous whitespace collapsing for $( '<pre />' ).html( html ); |
6875 | 6878 | // We also do <br> and easy cases for <p> conversion here, complicated cases are handled later |
6876 | 6879 | html = html |
6877 | | - .replace( /\r?\n/g, "" ) // IE7 inserts newlines before block elements |
6878 | | - .replace( / /g, " " ) // We inserted these to prevent IE from collapsing spaces |
6879 | | - .replace( /\<br[^\>]*\>/gi, "\n" ) // <br> conversion |
6880 | | - .replace( /\<\/p\>\<p\>/gi, "\n" ) // Easy case for <p> conversion |
6881 | | - .replace( /\<\/p\>(\n*)\<p\>/gi, "$1\n" ); |
| 6880 | + .replace( /\r?\n/g, "" ) // IE7 inserts newlines before block elements |
| 6881 | + .replace( / /g, " " ) // We inserted these to prevent IE from collapsing spaces |
| 6882 | + .replace( /\<br[^\>]*\>\<\/p\>/gi, '</p>' ) // Remove trailing <br> from <p> |
| 6883 | + // Firefox ends up with one too many empty paragraphs, so this reduced consective strings of them by 1 |
| 6884 | + if ( $.browser.firefox ) { |
| 6885 | + html = html.replace( /\<p[^\>]*\>\<\/p\>(\<p[^\>]*\>\<\/p\>)*/gi, '$1' ); |
| 6886 | + } |
| 6887 | + html = html |
| 6888 | + .replace( /\<\/p\>\s*\<p[^\>]*\>/gi, "\n" ) // Easy case for <p> conversion |
| 6889 | + .replace( /\<br[^\>]*\>/gi, "\n" ) // <br> conversion |
| 6890 | + .replace( /\<\/p\>(\n*)\<p[^\>]*\>/gi, "$1\n" ); |
6882 | 6891 | // Save leading and trailing whitespace now and restore it later. IE eats it all, and even Firefox |
6883 | 6892 | // won't leave everything alone |
6884 | 6893 | var leading = html.match( /^\s*/ )[0]; |
— | — | @@ -7257,13 +7266,13 @@ |
7258 | 7267 | * Get the first element before the selection that's in a certain class |
7259 | 7268 | * @param classname Class to match. Defaults to '', meaning any class |
7260 | 7269 | * @param strict If true, the element the selection starts in cannot match (default: false) |
7261 | | - * @return jQuery object |
| 7270 | + * @return jQuery object or null if unknown |
7262 | 7271 | */ |
7263 | 7272 | 'beforeSelection': function( classname, strict ) { |
7264 | 7273 | if ( typeof classname == 'undefined' ) { |
7265 | 7274 | classname = ''; |
7266 | 7275 | } |
7267 | | - var e, offset; |
| 7276 | + var e = null, offset = null; |
7268 | 7277 | if ( context.$iframe[0].contentWindow.getSelection ) { |
7269 | 7278 | // Firefox and Opera |
7270 | 7279 | var selection = context.$iframe[0].contentWindow.getSelection(); |
— | — | @@ -7274,9 +7283,17 @@ |
7275 | 7284 | e = selection.getRangeAt( 0 ).startContainer; |
7276 | 7285 | offset = selection.getRangeAt( 0 ).startOffset; |
7277 | 7286 | } else { |
7278 | | - return $( [] ); |
| 7287 | + return null; |
7279 | 7288 | } |
7280 | | - } else if ( context.$iframe[0].contentWindow.document.selection ) { |
| 7289 | + |
| 7290 | + // When the cursor is on an empty line, Opera gives us a bogus range object with |
| 7291 | + // startContainer=endContainer=body and startOffset=endOffset=1 |
| 7292 | + var body = context.$iframe[0].contentWindow.document.body; |
| 7293 | + if ( $.browser.opera && e == body && offset == 1 ) { |
| 7294 | + return null; |
| 7295 | + } |
| 7296 | + } |
| 7297 | + if ( !e && context.$iframe[0].contentWindow.document.selection ) { |
7281 | 7298 | // IE |
7282 | 7299 | // Because there's nothing like range.startContainer in IE, we need to do a DOM traversal |
7283 | 7300 | // to find the element the start of the selection is in |
— | — | @@ -7288,14 +7305,14 @@ |
7289 | 7306 | try { |
7290 | 7307 | range2.setEndPoint( 'EndToStart', range ); |
7291 | 7308 | } catch ( ex ) { |
7292 | | - return $( [] ); |
| 7309 | + return null; |
7293 | 7310 | } |
7294 | 7311 | var seekPos = context.fn.htmlToText( range2.htmlText ).length; |
7295 | 7312 | var offset = context.fn.getOffset( seekPos ); |
7296 | 7313 | e = offset ? offset.node : null; |
7297 | 7314 | offset = offset ? offset.offset : null; |
7298 | 7315 | if ( !e ) { |
7299 | | - return $( [] ); |
| 7316 | + return null; |
7300 | 7317 | } |
7301 | 7318 | } |
7302 | 7319 | if ( e.nodeName != '#text' ) { |
— | — | @@ -8589,6 +8606,9 @@ |
8590 | 8607 | $template.data( 'model' , model ); |
8591 | 8608 | $template.children( '.wikiEditor-template-name' ).text( model.getName() ); |
8592 | 8609 | } |
| 8610 | + else{ //we just expanded this |
| 8611 | + $wikitext.text($template.data('model').getText()); |
| 8612 | + } |
8593 | 8613 | |
8594 | 8614 | return false; |
8595 | 8615 | }; |
— | — | @@ -8631,8 +8651,10 @@ |
8632 | 8652 | |
8633 | 8653 | |
8634 | 8654 | function createDialog( $templateDiv ){ |
8635 | | - var templateModel = $templateDiv.data('model'); |
8636 | | - console.log(templateModel.getText()); |
| 8655 | + var $wikitext = $templateDiv.children('.wikiEditor-template-text'); |
| 8656 | + //TODO: check if template model has been changed |
| 8657 | + var templateModel = new $.wikiEditor.modules.templateEditor.fn.model( $wikitext.text() ); |
| 8658 | + $templateDiv.data('model', templateModel); |
8637 | 8659 | var $dialog = $("<div></div>"); |
8638 | 8660 | var $title = $("<div>" + templateModel.getName() + "</div>").addClass('wikiEditor-template-dialog-title'); |
8639 | 8661 | var $table = $("<table></table>") |
— | — | @@ -8661,6 +8683,9 @@ |
8662 | 8684 | $('.wikiEditor-template-dialog-value input').each( function(){ |
8663 | 8685 | templateModel.setValue( $(this).data('name'), $(this).val() ); |
8664 | 8686 | }); |
| 8687 | + //keep text consistent |
| 8688 | + $wikitext.text( templateModel.getText() ); |
| 8689 | + |
8665 | 8690 | $dialog.dialog('close'); |
8666 | 8691 | |
8667 | 8692 | }).text("OK").appendTo($dialog); |
— | — | @@ -9340,9 +9365,13 @@ |
9341 | 9366 | * @param {Object} context |
9342 | 9367 | */ |
9343 | 9368 | update: function( context ) { |
| 9369 | + var div = context.fn.beforeSelection( 'wikiEditor-toc-header' ); |
| 9370 | + if ( div === null ) { |
| 9371 | + // beforeSelection couldn't figure it out, keep the old highlight state |
| 9372 | + return; |
| 9373 | + } |
| 9374 | + |
9344 | 9375 | $.wikiEditor.modules.toc.fn.unhighlight( context ); |
9345 | | - |
9346 | | - var div = context.fn.beforeSelection( 'wikiEditor-toc-header' ); |
9347 | 9376 | var section = div.data( 'section' ) || 0; |
9348 | 9377 | if ( context.data.outline.length > 0 ) { |
9349 | 9378 | var sectionLink = context.modules.toc.$toc.find( 'div.section-' + section ); |
Index: branches/wmf-deployment/extensions/UsabilityInitiative_alpha/UsabilityInitiative.hooks.php |
— | — | @@ -22,18 +22,18 @@ |
23 | 23 | array( 'src' => 'css/vector.collapsibleNav.css', 'version' => 7 ), |
24 | 24 | array( 'src' => 'css/vector.footerCleanup.css', 'version' => 1 ), |
25 | 25 | array( 'src' => 'css/wikiEditor.css', 'version' => 9 ), |
26 | | - array( 'src' => 'css/wikiEditor.dialogs.css', 'version' => 17 ), |
| 26 | + array( 'src' => 'css/wikiEditor.dialogs.css', 'version' => 19 ), |
27 | 27 | array( 'src' => 'css/wikiEditor.preview.css', 'version' => 1 ), |
28 | 28 | array( 'src' => 'css/wikiEditor.toc.css', 'version' => 28 ), |
29 | 29 | array( 'src' => 'css/wikiEditor.toolbar.css', 'version' => 10 ), |
30 | 30 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ), |
31 | 31 | ), |
32 | 32 | 'combined' => array( |
33 | | - array( 'src' => 'css/combined.css', 'version' => 61 ), |
| 33 | + array( 'src' => 'css/combined.css', 'version' => 63 ), |
34 | 34 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ), |
35 | 35 | ), |
36 | 36 | 'minified' => array( |
37 | | - array( 'src' => 'css/combined.min.css', 'version' => 61 ), |
| 37 | + array( 'src' => 'css/combined.min.css', 'version' => 63 ), |
38 | 38 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ), |
39 | 39 | ), |
40 | 40 | ) |
— | — | @@ -72,20 +72,20 @@ |
73 | 73 | array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ), |
74 | 74 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 7 ), |
75 | 75 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 27 ), |
76 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 100 ), |
| 76 | + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 105 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 29 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 47 ), |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 12 ), |
80 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 78 ), |
| 80 | + array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 79 ), |
81 | 81 | array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 10 ), |
82 | 82 | array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 17 ), |
83 | 83 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 2 ), |
84 | 84 | ), |
85 | 85 | 'combined' => array( |
86 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 217 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 222 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 217 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 222 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative_alpha |
___________________________________________________________________ |
Modified: svn:mergeinfo |
93 | 93 | Merged /trunk/extensions/UsabilityInitiative:r61960-61992 |