MediaWiki talk:Rtl.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Credit[edit]

Credit for this script and css is for me (MediaWiki talk:Monobook.js/he). ערן (talk) 07:06, 10 April 2009 (UTC)[reply]

Doesn't seem to work[edit]

RTL doesn't seem to work now. It may be related to the the 1.17 upgrade that was done today. Does anyone have an idea how to fix it? --Amir E. Aharoni (talk) 15:59, 16 February 2011 (UTC)[reply]

Had to remove some parts; no idea how to retore the righthand sidebar--DieBuche (talk) 16:20, 16 February 2011 (UTC)[reply]

Please replace the script with the following one which loads the rtl stylesheet insead of the ltr one (actually it does it by removing the ltr after it was loaded, although I thought we can intervene in the loader itself and change it's "dir" loaded to be rtl so it will call the loader.php with dir=rtl):

//set the body as rtl
$('body').addClass('rtl');
$('body').removeClass('ltr');
//load rtl stylesheet instead of ltr styleshit
var newStyle=$('link[rel=stylesheet][href*=load.php][href*=&skin=]').attr('href')+'&dir=rtl';
$('link[rel=stylesheet][href*=load.php][href*=&skin=]').attr('href',newStyle);
//in vector skin the evil search box should change its place
if (skin == "vector") {
$('#p-views').css('float','right');
$('#p-cactions').css('float','right');
$('#p-search').css('float','right');
}

/* add additional buttons, that allow to switch the direction of the edit window from ltr to rtl and back */ if (typeof(bidiSwitchSetup) != "function") importScript('MediaWiki:Gadget-BiDiEditing.js'); ערן (talk) 18:59, 16 February 2011 (UTC)[reply]

Line 5: The Url could be anything. Different lang, secure server, maybe the format is changed... I'll try to get that fixed on mw side--DieBuche (talk) 08:20, 17 February 2011 (UTC)[reply]
OK, I've changed it t o work properly in any skin and any language which is a little more cleaner and generic. Yea it's patchy, but it works ;) ערן (talk) 21:20, 17 February 2011 (UTC)[reply]
Done. Are you sure though that you want to force the content of any page to be rtl? Eg. Village Pump?--DieBuche (talk) 11:01, 2 March 2011 (UTC)[reply]
Of course it would be best not to force RTL on pages who aren't supposed be RTL, and the English Village Pump is a good example. Ideas about doing it are welcome. --Amir E. Aharoni (talk) 16:36, 2 March 2011 (UTC)[reply]

Version 1.18[edit]

{{Editprotected}} Thanks to SPQRobin there is almost no need for this hack, as the new 1.18 version has native support for users with RTL interfaces in LTR sites (as in commons). Currently this script causes blinks during the page loading, and the native support in mediawiki core is of course better.

As the new version already deployed to Commons, please remove/comment all the code here except the last line (which doesn't change the interface itself, but adds by default the useful bidi gadget). The new code should be look like this (for admins who don't talk javascript ;)):

/* make the UI RTL in RTL languages. */ 
/* add additional buttons, that allow to switch the direction of the edit window from ltr to rtl and back */
if (typeof(bidiSwitchSetup) != "function") importScript('MediaWiki:Gadget-BiDiEditing.js');

Thanks, ערן (talk) 05:45, 5 October 2011 (UTC)[reply]

done TheDJ (talk) 06:37, 5 October 2011 (UTC)[reply]
Thanks. ערן (talk) 06:57, 5 October 2011 (UTC)[reply]