User talk:Walling/Archive/Discussion1

From OSDev Wiki
Jump to navigation Jump to search

Main Page title

I have gotten your code to work on my mediawiki installation. It seems to work well enough.

On this wiki I assume that user javascript is disallowed until chase adds

$wgAllowUserJs = true;

to LocalSettings.php (that did the trick on my install).

Or alternatively, adding

function hideMainPageTitle(e){
   var mainPageTitle = "Main Page";
   var headings = document.getElementsByTagName("h1");
   for (var i = 0; i < headings.length; i++){
      var heading = headings[i];
      if (heading.className == "firstHeading"){
         if ((heading.innerHTML == mainPageTitle) && (document.getElementById("contentSub").innerHTML  == "")){
            heading.style.display = "none";
            document.getElementById("siteSub").style.display = "none";
            document.getElementById("contentSub").style.display = "none";
         }
         break;
      }
   }
}

addOnloadHook(hideMainPageTitle);

to MediaWiki:monobook.js will enable it for all users. (currently used on my installation)

I'll leave you to decide what to do currently. I'm personally a little uncomfortable with looping through every h1 tag. Seems to be begging for an exploit. -Jhawthorn 18:34, 18 December 2006 (CST)

Thanks, for the testing it. Then I know it could work. Maybe you could test these as well. There is a php implementation (which I think is the best solution) and another in javascript, which is used by enwiki. The javascript solution works using a combination of javascript, which locates the main page, and then writes some css code. Maybe it is better than the other javascript solution, but still I think it should be done serverside. The php solution is a patch file, but I don't know how to apply it. It could be cumbersome to edit the files yourself. --Walling 02:11, 19 December 2006 (CST)
The php patch works perfectly. It does seem to be the better solution. -Jhawthorn 00:45, 25 December 2006 (CST)