r51735 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51734‎ | r51735 | r51736 >
Date:10:30, 11 June 2009
Author:catrope
Status:deferred
Tags:
Comment:
* EditToolbar: Fix attribute handling by wrapping characters in a <div /> and slapping attributes on that
* Discriminate between attributes and styles correctly
* Fix RTL issues caused by float: left; local JS needs to be updated to use {'class': 'rtl'} instead of {'direction': 'rtl'}
Modified paths:
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.php
@@ -18,7 +18,7 @@
1919 /* Configuration */
2020
2121 // Bump the version number every time you change any of the .css/.js files
22 -$wgEditToolbarStyleVersion = 2;
 22+$wgEditToolbarStyleVersion = 3;
2323
2424 // Set this to true to simply override the stock toolbar for everyone
2525 $wgEditToolbarGlobalEnable = false;
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.css
@@ -156,7 +156,7 @@
157157 div#edittoolbar-section-help div.page > table td.description {
158158 width: 20%;
159159 }
160 -div#edittoolbar-section-characters div.page > a {
 160+div#edittoolbar-section-characters div.page > div > a {
161161 border: solid 1px #DDDDDD;
162162 padding: 5px;
163163 padding-left: 8px;
@@ -169,12 +169,16 @@
170170 color: black;
171171 text-decoration: none;
172172 }
173 -div#edittoolbar-section-characters div.page > a:hover {
 173+div#edittoolbar-section-characters div.page > div.rtl > a {
 174+ direction: rtl;
 175+ float: right;
 176+}
 177+div#edittoolbar-section-characters div.page > div > a:hover {
174178 background-color: white;
175179 text-decoration: none;
176180 border-color: #a8d7f9;
177181 }
178 -div#edittoolbar-section-characters div.page > div.character {
 182+div#edittoolbar-section-characters div.page > div > div.character {
179183 }
180184 div#edittoolbar div.tabs > div.tab {
181185 float: left;
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js
@@ -260,6 +260,10 @@
261261 break;
262262 case 'characters':
263263 // Appends special character adders
 264+ var charsDiv = $( '<div />' )
 265+ .attr( section.pages[page].attributes )
 266+ .css( section.pages[page].styles )
 267+ .appendTo( pageDiv );
264268 for ( character in section.pages[page].characters ) {
265269 switch( section.pages[page].characters[character].type ) {
266270 case 'break':
@@ -275,10 +279,9 @@
276280 'tool' : section.pages[page].characters[character],
277281 'textbox': textbox
278282 };
279 - pageDiv.append(
 283+ charsDiv.append(
280284 $( '<a />' )
281 - .attr( section.pages[page].characters[character].attributes )
282 - .attr( { 'href': '#' } )
 285+ .attr( 'href', '#' )
283286 .text( section.pages[page].characters[character].text )
284287 .data( 'context', context)
285288 .click( action )
@@ -340,17 +343,25 @@
341344 parseCharinsert: function( charinsert ) {
342345 var retval = {};
343346 for( page in charinsert ) {
344 - var characters = [], attributes = {};
 347+ var characters = [], attributes = {}, styles = {};
345348 var i = 0;
346349 for( line in charinsert[page] ) {
347350 if( !( charinsert[page][line] instanceof Array ) ) {
348 - attributes = charinsert[page][line];
 351+ for( attr in charinsert[page][line] ) {
 352+ switch( attr ) {
 353+ case 'class':
 354+ case 'lang':
 355+ attributes[attr] = charinsert[page][line][attr];
 356+ break;
 357+ default:
 358+ styles[attr] = charinsert[page][line][attr];
 359+ }
 360+ }
349361 continue;
350362 }
351363 for( character in charinsert[page][line] ) {
352364 var tool = {
353365 type: 'link',
354 - attributes: attributes,
355366 text: '',
356367 action: {
357368 type: 'encapsulate',
@@ -376,6 +387,8 @@
377388 retval[page] = {
378389 label: page,
379390 layout: 'characters',
 391+ attributes: attributes,
 392+ styles: styles,
380393 characters: characters
381394 };
382395 }

Status & tagging log