MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
(weird spacing fixes)
No edit summary
Line 243: Line 243:
if(d)
if(d)
{
{
d.className+=d.className==''?indicateJSClass:' '+indicateJSClass;
d.className+=d.className==''?indicateJSClass:''+indicateJSClass;
var lis,i,firstUL,j,apply;
var lis,i,firstUL,j,apply;


Line 256: Line 256:
{
{
lis[i].childNodes[0].onclick=function(){return false;}
lis[i].childNodes[0].onclick=function(){return false;}
lis[i].className+=lis[i].className==''?parentClass:' '+parentClass;
lis[i].className+=lis[i].className==''?parentClass:''+parentClass;
// check if there is a "current" element  
// check if there is a "current" element  
apply=true;
apply=true;
Line 270: Line 270:
if(apply)
if(apply)
{
{
firstUL.className+=firstUL.className==''?toHideClass:' '+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
if(new RegExp('\\b'+preventHoverClass+'\\b').test(d.class Name))
if(new RegExp('\\b'+preventHoverClass+'\\b').test(d.className))
{
{
lis[i].onclick=function(){doddm(this);}
lis[i].onclick=function(){doddm(this);}
Line 285: Line 285:
} else {
} else {
lis[i].keepopen=1;
lis[i].keepopen=1;
firstUL.className+=firstUL.className==''?toShowClass:' '+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 304: Line 304:
swap=function(tmpobj,tmporg,tmprep)
swap=function(tmpobj,tmporg,tmprep)
{
{
tmpobj.className=tmpobj.className.replace(tmporg,t mprep)       
tmpobj.className=tmpobj.className.replace(tmporg,tmprep)       
}
}
// if the current LI does not have an indicator to be kept visible
// if the current LI does not have an indicator to be kept visible
Line 319: Line 319:
if(new RegExp('\\b'+activeParentClass+'\\b').test(lis[i].className))
if(new RegExp('\\b'+activeParentClass+'\\b').test(lis[i].className))
{
{
swap(childUL,isobj?toShowClass:toHideClass,isobj?t oHideClass:toShowClass);     
swap(childUL,isobj?toShowClass:toHideClass,isobj?toHideClass:toShowClass);     
swap(lis[i],isobj?activeParentClass:parentClass,isobj?parentC lass:activeParentClass);   
swap(lis[i],isobj?activeParentClass:parentClass,isobj?parentClass:activeParentClass);   
} else {
} else {


Navigation menu