Thanks for the recipe, only issue is that if the Monobook.js file changes between minor MediaWIki versions, this needs to be patched in over and over again.
I would request if this was a configuration setting in the next MediaWiki releases, so it could be enabled/disabled per need. Thx, Kent
On 5/26/06, Marco Rota marcor@sorint.it wrote:
Now is ok!! Thank you!!!
Marco
----- Original Message ----- From: "Rotem Liss" mail@rotemliss.com To: "MediaWiki announcements and site admin list" mediawiki-l@Wikimedia.org Sent: Friday, May 26, 2006 1:05 PM Subject: Re: [Mediawiki-l] Remove Main Page header from the main page
Force-Refresh the Main Page (Ctrl+F5 or Shift+F5).
Marco Rota wrote:
I've added the code but it seem nothing is happend...
Sorry... I'm not a programmer.
----- Original Message ----- From: "Rotem Liss" mail@rotemliss.com To: "MediaWiki announcements and site admin list" mediawiki-l@Wikimedia.org Sent: Friday, May 26, 2006 11:43 AM Subject: Re: [Mediawiki-l] Remove Main Page header from the main page
I use the following code in MediaWiki:Monobook.js:
/* Hide the main page title */ function hideMainPageTitle(e) { e = (e) ? e : event; var mainPageTitle = "Main Page"; var headings = document.getElementsByTagName("h1"); var i, done = false; for (i = 1; ((!done) && (i <= headings.length)); i++) { if (headings[i - 1].className == "firstHeading") { done = true; if ((headings[i - 1].innerHTML == mainPageTitle) && (document.getElementById("contentSub").innerHTML == "")) { headings[i - 1].style.display = "none"; document.getElementById("siteSub").style.display = "none"; document.getElementById("contentSub").style.display = "none"; } } } } window.onload = hideMainPageTitle;
It works just fine. However, if you use window.onload also for other functions, you should use instead window.addEventListener for the standard browsers, and window.attachEvent for the evil browser Internet Explorer. You can check the user agent or "document.all" (true in IE, false in the other browsers), and you can read about these functions in the W3C standard/Mozilla documentation (addEventListener), and in the MSDN (attachEvent).
Also, I haven't checked it, but I think using the following function:
addOnloadHook(hideMainPageTitle);
will also work.
Brion Vibber wrote:
Kent Sandvik wrote:
I tried to google and read the MediaWiki FAQ, but I could not find the answer. What's the trick to remove the <h1 class="firstHeading">Main Page</h1> and the lines from the main page, so there's no block above the contents, similar to the top page in wikipedia?
It's some sort of JavaScript hack in MediaWiki:Monobook.js.
-- brion vibber (brion @ pobox.com)
MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
-- #define Name RotemLiss #define Mail mailSTRUDELrotemlissDOTcom #define Site www.rotemliss.com
MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
-- #define Name RotemLiss #define Mail mailSTRUDELrotemlissDOTcom #define Site www.rotemliss.com
MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l