Yup,
Technically it's actually modified from my version (Some time ago I
tweaked NavFrame to support span and fieldset as well as divs) but
there's really no difference anymore because I'm finding NavFrames using
$('.NavFrame') thus there is no distinction anymore (You can put a
NavFrame on a table if you want, heh, though that's a little redundant).
Also it's separate from the css.
I'm debating whether or not I should smooth over functionality between
the two. (ie: Make them both use [<a>show</a>], instead of one being
[<a>show</a>] and the other <a>[show]</a>).
If you want a list of remotely possible downsides.
- I'm using a click event instead of a horrid javascript: href. So it
only picks up on clicks on the show/hide button. If there is honestly
anyone who would actually tab through all the links in the page just to
get to the show/hide link (which I seriously doubt) I could be persuaded
to try and find a way to capture other things to.
- I shortened the code for show/hide itself to use jQuery's .toggle()
and .is(':visible'); If for some freakish reason you've managed to make
some rows/NavContent areas hidden and left others visible it will end up
alternating instead of flat showing or hiding them all.
Frankly I don't think either of those cases should be of any concern.
If anyone wanted I could also substitute .toggle for .slideToggle to
throw in some animation.
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]
George Pribul (Kirkburn) wrote:
> If I am reading correctly, this is an update for the JS shown on
> http://www.wikia.com/wiki/Help:Dynamic_navigation ?
>
> If it supports all the original functionality and is as good as you
> make it sound, it sounds like it could be a great recommendation for
> our users. :)
>
> -------------------------------------
> George Pribul (Kirkburn)
> Associate Product Manager,
> Wikia Inc.
>
>
> 2009/6/15 Daniel Friesen
> <[email protected]
> <mailto:[email protected]>>
>
> Just thought I'd let everyone know I rewrote the ShowHide (Wikipedia's
> collapsible tables and NavFrame code) to make use of jQuery which
> Wikia
> is now using.
>
> The resulting code is around 100 lines shorter than the WP code
> (basically half the size), supports the "collapsed" class in BOTH
> collapsible tables and NavFrame (The code being circulated around
> Wikia
> doesn't seam to support individual pre-collapsed NavFrames), works
> with
> whatever elements you want it to (NavFrame can work on things
> other than
> just divs), and loads quickly unlike the original WP code (jQuery's
> ready event is more reliable than MediaWiki's built in addOnloadHook
> which sometimes can actually end up being called considerably late in
> comparison; I tested using MW's onload and jQuery's onload on separate
> types of show/hide and jQuery fired considerably earlier than the MW
> code which fired quite late after the page was already loaded).
>
> The code is available on the dev wiki and can be easily included into
> any wiki using the short snippet:
> |importScriptPage('ShowHide/code.js',
> 'dev');|
> http://dev..wikia.com/wiki/ShowHide
> <http://dev.wikia.com/wiki/ShowHide>
>
> --
> ~Daniel Friesen (Dantman, Nadir-Seen-Fire)
> [http://daniel.friesen.name]
>
> _______________________________________________
> Wikia Community Mailing List.
>
> For information and subscriptions see
> http://lists.wikia.com/mailman/listinfo/wikia-l
>
> Need staff help? Try http://www.wikia.com/wiki/Special:Contact
>
>
_______________________________________________
Wikia Community Mailing List.
For information and subscriptions see
http://lists.wikia.com/mailman/listinfo/wikia-l
Need staff help? Try http://www.wikia.com/wiki/Special:Contact