MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
weird spacing fixes
(Testing some improvements for the current translation system)
(weird spacing fixes)
Line 262: Line 262:
if(apply)
if(apply)
{
{
for(j=0;j<firstUL.getElementsByTagName('li').lengt h;j++)
for(j=0;j<firstUL.getElementsByTagName('li').length;j++)
{
{
if(new RegExp('\\b'+currentClass+'\\b').test(firstUL.getE lementsByTagName('li')[j].className)){apply=false;break}
if(new RegExp('\\b'+currentClass+'\\b').test(firstUL.getElementsByTagName('li')[j].className)){apply=false;break}
}
}
}
}
Line 270: Line 270:
if(apply)
if(apply)
{
{
firstUL.className+=firstUL.className==''?toHideCla ss:' '+toHideClass;
firstUL.className+=firstUL.className==''?toHideClass:' '+toHideClass;
// check if there is a class to prevent hover effects and only apply the function
// check if there is a class to prevent hover effects and only apply the function
// onclick if that is the case, otherwise apply it onclick and onhover
// onclick if that is the case, otherwise apply it onclick and onhover
Line 285: Line 285:
} else {
} else {
lis[i].keepopen=1;
lis[i].keepopen=1;
firstUL.className+=firstUL.className==''?toShowCla ss:' '+toShowClass;
firstUL.className+=firstUL.className==''?toShowClass:' '+toShowClass;
lis[i].className=lis[i].className.replace(parentClass,activeParentClass);
lis[i].className=lis[i].className.replace(parentClass,activeParentClass);
}
}
Line 315: Line 315:
if(childUL)     
if(childUL)     
{       
{       
if(new RegExp('\\b'+preventHoverClass+'\\b').test(d.class Name))
if(new RegExp('\\b'+preventHoverClass+'\\b').test(d.className))
{
{
if(new RegExp('\\b'+activeParentClass+'\\b').test(lis[i].className))
if(new RegExp('\\b'+activeParentClass+'\\b').test(lis[i].className))
Line 323: Line 323:
} else {
} else {


swap(childUL,isobj?toHideClass:toShowClass,isobj?t oShowClass:toHideClass);     
swap(childUL,isobj?toHideClass:toShowClass,isobj?toShowClass:toHideClass);     
swap(lis[i],isobj?parentClass:activeParentClass,isobj?activeP arentClass:parentClass);   
swap(lis[i],isobj?parentClass:activeParentClass,isobj?activeParentClass:parentClass);   
}
}
} else {
} else {
swap(childUL,isobj?toHideClass:toShowClass,isobj?t oShowClass:toHideClass);     
swap(childUL,isobj?toHideClass:toShowClass,isobj?toShowClass:toHideClass);     
swap(lis[i],isobj?parentClass:activeParentClass,isobj?activeP arentClass:parentClass);   
swap(lis[i],isobj?parentClass:activeParentClass,isobj?activeParentClass:parentClass);   
}
}
}  
}  

Navigation menu