MediaWiki talk:InterProject.js

From Wikimedia Commons, the free media repository
Revision as of 11:16, 6 December 2014 by DieBuche (talk | contribs) (Cookie)
Jump to navigation Jump to search

Vector.js

Here's the respective part from vector.js:

  
    function toggle($element) {
        $j.cookie('vector-nav-' + $element.parent().attr('id'), $element.parent().is('.collapsed'), {
            'expires': 30,
            'path': '/'
        });
        $element.parent().toggleClass('expanded').toggleClass('collapsed').find('div.body').slideToggle('fast');
    }
  
    $headings.keydown(function(event) {
        if (event.which == 13 || event.which == 32) {
            toggle($j(this));
        }
    }).mousedown(function() {
        toggle($j(this));
        $j(this).blur();
        return false;
    });

--DieBuche (talk) 13:46, 24 October 2010 (UTC)[reply]

And here's the original, including the code for setting the initial state. I'd rather like to keep reusing it instead of duplicating it if I possibly can, though. —Ilmari Karonen (talk) 01:03, 25 October 2010 (UTC)[reply]
An here's the patched bug, which enables us to add the new submenu at any time: https://bugzilla.wikimedia.org/show_bug.cgi?id=25726 --DieBuche (talk) 23:00, 1 November 2010 (UTC)[reply]
Wow, cool! I didn't even know jQuery could do that. Although I think that still leaves the issue of setting the initial state (based on cookies) unsolved. :( Would you happen to know some neat jQuery trick for that too? —Ilmari Karonen (talk) 01:53, 2 November 2010 (UTC)[reply]
I don't think that's possible without further changing collapsibleNav.js. Something like this should work though:

if ($.cookie('vector-nav-p-interproject')=='true') $('#p-interproject').mousedown();

--DieBuche (talk) 16:45, 4 November 2010 (UTC)[reply]

Sister projects

At Special:Recentchanges, link to "Sister projects" doesn't work. I can't find why. Similar thing happens on Meta. Any ideas? -Aleator (talk) 02:09, 29 November 2012 (UTC)[reply]

This seems to be caused by gerrit:30361 / gerrit:34702, which replaced the h5 elements by h3. I just fixed our version of the hack at ptwiki. Helder 19:48, 20 December 2012 (UTC)
✓ Done, Revision #88060112. –Krinkletalk 04:33, 19 January 2013 (UTC)[reply]

Wikibase Client

@Krinkle and Ilmari Karonen: does this script work with mw:Extension:Wikibase Client#Other projects sidebar? AFAIU that feature is going to be deployed on more and more sites, to gradually replace the old system. Hint: s:fr:Special:Diff/4387651/4517757. --Ricordisamoa 11:40, 11 August 2014 (UTC)[reply]

@Krinkle, Ilmari Karonen, and DieBuche: , since the collapsable menu are not wokring anymore, does the following code still needed?

var state = $.cookie('vector-nav-' + interProject.id);
if (state === 'true') {
    $(interProject).addClass('expanded').find('.body, .pBody').show();
} else {
    $(interProject).addClass('collapsed');
}

--Andyrom75 (talk) 20:30, 3 December 2014 (UTC)[reply]

Yes, that could be safely removed. How are things going here? --DieBuche (talk) 11:16, 6 December 2014 (UTC)[reply]