Last modified: 2008-04-13 18:31:56 UTC
I have been trying to force preview for anonymous users in vo.wikibooks. Despite the fact that the piece of code inserted into Common.js works fine in the vo.wikipedia, it was not working in vo.wikibooks. After some tests, I realized the inserted function gets executed when a user is logged in. Although, for IPs, the function doesn't get executed (tested by forcing button caption change on function entry which didn't have any effect when not logged in). This led me to believe Common.js is not being loaded for unregistered users.
A user at #wikimedia-tech mentioned MediaWiki:Common.js not being loaded for anons but then esporadically it seemed to load. As a side note, it may be relevant to mention that the MediaWiki namespace is called Sitanuns in vo.wb.
Looking at the page source, not logged in, I see this line: <script type="text/javascript" src="/w/index.php?title=-&action=raw&gen=js&useskin=monobook"><!-- site js --></script> Following the URL, I find this content: --------------------------------------------------------------------- /* generated javascript */ var skin = 'monobook'; var stylepath = '/skins-1.5'; /* MediaWiki:Common.js */ /* El JavaScript isik alseimik pogebon pro gebans valik pö padilogam valik. */ /** Müt büologeda *********************************************************************** * Bepenam: müton gebanis no peregistarölis ad logedön padalogoti labü redakots onsik bü dakip. ********************************************************************************************/ // Müton eli IP ad büologön votükamis bü dakip onsik. // Copyright Marc Mongenet, 2006 function forcePreview() { if (wgUserName != null || wgAction != "edit") return; saveButton = document.getElementById("wpSave"); if (!saveButton) return; saveButton.disabled = true; saveButton.style.fontWeight = "normal"; document.getElementById("wpPreview").style.fontWeight = "bold"; } addOnloadHook(forcePreview); /* MediaWiki:Monobook.js (deprecated; migrate to Common.js!) */ /* Deprecated; use [[MediaWiki:common.js]] */ --------------------------------------------------------------------- Which is exactly as expected. Firebug shows that the script is loaded. Moreover, when I attempt to edit a page, the "Save page" button is grayed out, as expected. WORKSFORME. Make sure JavaScript is enabled in your browser, and that caches are cleared.