Well, the *proper* fix is a sane discussion system where messages are first-class objects and timestamps are clean metadata that can be displayed appropriately. :)
As a hack for existing talk pages though, what you're proposing should work.
Parsing the timestamps in the text is a bit tough as it may be different in different languages.... my recommendation is to include a 'data-timestamp' attribute on that span and put in a language-independent machine-readable timestamp format.
See also older discussion on bug 5347 < https://bugzilla.wikimedia.org/show_bug.cgi?id=5347%3E and 19992 < https://bugzilla.wikimedia.org/show_bug.cgi?id=19992%3E about possible implementations of this sort of thing.
-- brion
On Wed, Apr 3, 2013 at 3:28 PM, Cyril misdre+mediawiki@gmail.com wrote:
I recently tried to create a small javascript to parse user signature times on talk pages [1]. With it the readers would have been able to see the signature's timestamp in their preferred timezone (and as a side effect it would be consistent with the revision history) without breaking caching.
The main problem I had was that MediaWiki didn't provide a class attribute wrapping the date nor the whole signature. There is a bug report on that topic: https://bugzilla.wikimedia.org/show_bug.cgi?id=25141
After some time spent looking for a system message it seems the only solution is to edit includes/parser/Parser.php. I added a span with a class at this line:
https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=blob;f=includes...
It works fine (at least in my own - limited - case).
Some questions related to what I've done:
- Would it be possible to wrap dates, or at least signatures in a class, as
suggested in bug #25141? it may be useful for others too -- or perhaps to have a system message for dates (I'm not sure it's a good idea)
- Is Parser.php the good place for that?
- Would a similar solution see its way into MediaWiki some day? or are
there problems I'm not seeing? (I'm not suggesting my script would be it, it's a quick and dirty hack created with very limited knowledge.)
[1] using Moment.js http://momentjs.com/ _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l