Skip to content
Snippets Groups Projects
Commit 5a3c1347 authored by Adrian Lang's avatar Adrian Lang
Browse files

Better section highlighting

darcs-hash:20091021151244-28332-825d669945b62dd71009e632db07fbbe1d7bd7f7.gz
parent 3c177c11
No related branches found
No related tags found
No related merge requests found
......@@ -557,7 +557,7 @@ addInitEvent(function(){
* @author Andreas Gohr <andi@splitbrain.org>
*/
addInitEvent(function(){
var highlightorfinish = new RegExp('DIV|H[123]');
var break_classes = new RegExp('secedit|toc|page');
var btns = getElementsByClass('btn_secedit',document,'form');
for(var i=0; i<btns.length; i++){
addEvent(btns[i],'mouseover',function(e){
......@@ -565,19 +565,19 @@ addInitEvent(function(){
if(tgt.form) tgt = tgt.form;
tgt = tgt.parentNode.previousSibling;
if(tgt.nodeName != "DIV") tgt = tgt.previousSibling;
while(tgt.nodeName == 'DIV') {
while(!break_classes.test(tgt.className)) {
tgt.className += ' section_highlight';
do {
tgt = (tgt.previousSibling != null) ? tgt.previousSibling : tgt.parentNode;
} while (!highlightorfinish.test(tgt.nodeName));
if (tgt.tagName == 'H1') break;
tgt = (tgt.previousSibling != null) ? tgt.previousSibling : tgt.parentNode;
}
});
addEvent(btns[i],'mouseout',function(e){
var secs = getElementsByClass('section_highlight',document,'div');
var secs = getElementsByClass('section_highlight');
for(var j=0; j<secs.length; j++){
secs[j].className = secs[j].className.replace(/ section_highlight/,'');
secs[j].className = secs[j].className.replace(/section_highlight/,'');
}
var secs = getElementsByClass('section_highlight');
});
}
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment