if($action=="edit") {
if($section!="") {
- $secs=preg_split("/(^=+.*?=+)/m",
+ $secs=preg_split("/(^=+.*?=+|^<h[1-6].*?>.*?<\/h[1-6].*?>)/mi",
$this->mContent, -1,
PREG_SPLIT_DELIM_CAPTURE);
if($section==0) {
// of the article
if ($section != "") {
$oldtext=$this->getContent();
- $secs=preg_split("/(^=+.*?=+)/m",$oldtext,-1,PREG_SPLIT_DELIM_CAPTURE);
+ $secs=preg_split("/(^=+.*?=+|^<h[1-6].*?>.*?<\/h[1-6].*?>)/mi",$oldtext,-1,PREG_SPLIT_DELIM_CAPTURE);
$secs[$section*2]=$text."\n\n"; // replace with edited
if($section) { $secs[$section*2-1]=""; } // erase old headline
$text=join("",$secs);
}
function tocTable($toc) {
-
-/* does not auto-expand, use table for now
- return "
- <div><div style=\"border-width:1px;background-color:#f3f3ff;border-color:#8888aa;border-style:solid;padding:1em;padding-bottom:1em;\">
- <b>".wfMsg("toc")."</b><P>
- $toc</div></div>";
-*/
+ // note to CSS fanatics: putting this in a div does not works -- div won't auto-expand
return
- "<table border=\"0\" bgcolor=\"#8888aa\" cellpadding=\"0\" cellspacing=\"1\"><tr><td>\n" .
- "<table border=\"0\" bgcolor=\"#f3f3ff\" CELLPADDING=5><tr><td>\n".
+ "<table border=\"0\" align=\"center\" id=\"toc\"><tr><td align=\"center\">\n".
"<b>".wfMsg("toc")."</b>" .
" <script type='text/javascript'>showTocToggle(\"" . wfMsg("showtoc") . "\",\"" . wfMsg("hidetoc") . "\")</script>" .
- "</td></tr><tr id='tocinside'><td>\n".
- $toc."</td></tr></table></td></tr></table><P>\n";
+ "</td></tr><tr id='tocinside'><td align=\"left\">\n".
+ $toc."</td></tr></table><P>\n";
}
function editSectionLink($section) {
document.preferences.wpHourDiff.value = fetchTimezone();
}
-var tocShow, tocHide;
function showTocToggle(show,hide) {
if(document.getElementById) {
- document.writeln('<small>[<a href="javascript:toggleToc()" id="toctoggle">' +
- hide + '/' + show + '</a>]</small>');
- tocShow = show;
- tocHide = hide;
+ document.writeln('<small>[<a href="javascript:toggleToc()" class="internal">' +
+ '<span id="showlink" style="display:none;">' + show + '</span>' +
+ '<span id="hidelink">' + hide + '</span>'
+ + '</a>]</small>');
}
}
function toggleToc() {
var toc = document.getElementById('tocinside');
- var tog = document.getElementById('toctoggle');
+ var showlink=document.getElementById('showlink');
+ var hidelink=document.getElementById('hidelink');
if(toc.style.display == 'none') {
- toc.style.display = tocWas;
- // tog.innerHtml = tocHide;
+ toc.style.display = tocWas;
+ hidelink.style.display='';
+ showlink.style.display='none';
+
} else {
tocWas = toc.style.display;
toc.style.display = 'none';
- // tog.innerHtml = tocShow;
+ hidelink.style.display='none';
+ showlink.style.display='';
+
}
}
}
#quickbar { width: 140px; padding: 4px; visibility: visible; z-index: 99; }
#topbar { padding: 4px; }
+#toc { border:1px solid #8888aa; background-color:#f3f3ff;padding:5px;font-size:90%; }
.bodytext { }
a.interwiki, a.external { color: #3366BB; }
a.printable { text-decoration: underline; }