[Home]WikiPatches/AvoidTablesInColorDiff

UseModWiki | WikiPatches | RecentChanges | Preferences

It can be achieve the same result without using tables, with divs, if you claim only background-color (such as this case).

(There are another tables, that they can be avoid in the script, I guess).

Design is more "fluid" with divs.

sub ColorDiff {
...
  if ($color ne '') {
    - $colorHtml = " bgcolor=$color";
    + $colorHtml = "$color";
  }
  if ($type) {
    - $classHtml = ' class=wikidiffnew';
    + $classHtml = 'class=wikidiffnew';
  } else {
    - $classHtml = ' class=wikidiffold';
    + $classHtml = 'class=wikidiffold';
  }
  - return "<table width=\"95\%\"$colorHtml$classHtml><tr><td>\n" . $diff
         . "</td></tr></table>\n";
  + return "<div $classHtml style=background-color:$colorHtml;>\n" . $diff
         . "</div>\n";
}
The old 95% was, not neccesary, imho.

--JuanmaMP


UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited August 29, 2009 2:21 pm by JuanmaMP (diff)
Search: