https://bugzilla.wikimedia.org/show_bug.cgi?id=16013





--- Comment #6 from Splarka <[email protected]>  2008-12-15 18:49:09 UTC ---
(In reply to comment #4)
> Although you can now link to a tab via
> http://en.wikipedia.org/wiki/Special:Preferences#prefsection-4 you can not 
> link
> to sections within a tab.
> 
> For example,
> http://en.wikipedia.org/wiki/Special:Preferences#wpDate2 ought to link to the
> "Time zone" section of the "time and date" tab. It briefly goes to the right
> place but then the page flicks back to the first tab. If you're trying to
> explain to someone how to change something in their preferences, it's very
> useful to be able to link them directly to the right place.
> 

Okay, I've refactored the code, which is live at
http://test.wikipedia.org/wiki/MediaWiki:Common.js/prefs.js (in demo mode, be
sure to clear cache). It now allows four kinds of anchor linking:

 http://test.wikipedia.org/wiki/Special:Preferences#top <- anchor outside the
fieldsets, no action
 http://test.wikipedia.org/wiki/Special:Preferences#editing <- anchor matching
a field name (case insensitive), goes there. 
 http://test.wikipedia.org/wiki/Special:Preferences#prefsection-2 <- anchor
matching field ID, goes there
 http://test.wikipedia.org/wiki/Special:Preferences#wpSkinchick <- anchor
matching an ID inside a field, goes to that field and that ID

After load the name-type gets normalized to the numeric section, as it is
language-specific. Sort of like [[User:Foo]] works in all content languages but
gets localized on load.

Note that the last case isn't perfect, as page anchors are approached pre-JS
collapse in most browsers (can't be helped, there was a bug on a Wikia where
they tried to set the anchor post-transform but that sent firefox into an
infinite reload loop).

Note also this sets the form action to the section you are in, so after save,
you are returned to that section (it did that before, too, but still does).

There are two easy ways to get the link: click a section and get the URI, or
right click a tab and copy link location.

It would have been easier to use URI parameters like ?section=foo or /foo but
these are notoriously unreliable (see bug 16462 ) and I couldn't have the
current URI location bar change to reflect your current tab (a snazzy feature).
With straight anchors, you can even Wikilink to a section, like
[[Special:Preferences#editing]]

Testing needed in as many browsers as possible:
- Does it work when changing the document.location.hash when clicking tabs? Do
any browsers reload the page? This is my largest concern, and that feature may
have to be disabled -> "if(!nohash) document.location.hash = '#' +
trigger.secid;"
- Does it jump down when linking to an ID inside a section in any browsers?
- Does it do any other unpredictable shit?

It still optionally would have much non-JS fallback benefit from: every
<fieldset> inside includes/specials/SpecialPreferences.php having
id="prefsection-0" ++ (but looking at the mixture of XML::fieldset() and raw
html output it is a horrid mess).

Brion showed interest in this becoming core, but it needs testing.


-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to