Thanks Jeroen, this was insightful!
So if we wrap the call
addOnloadHook(smw_tooltipInit);
into a
$j(function() { addOnloadHook(smw_tooltipInit); });
it should work, but it seems that $j is not defined yet when SMW_tooltip.js is
included. So it seems to break there, as jQuery is not loaded yet.
Yes, taking a look at he JavaScript code in SMW, and having programmed quite
some JS lately, my fingers itch to rewrite the code slightly. It is currently
full of global variables, and I am sure we can reduce that a lot.
Thanks again!
Cheers,
Denny
On Oct 13, 2010, at 15:35, Jeroen De Dauw wrote:
> Hey,
>
> The problem is coming from the Resource Loader [0] changes in MediaWiki 1.17,
> which loads JavaScript, such as wikibits.js, which contains addOnloadHook, at
> the end of page. Scripts attempting to use it before that point break. The
> solution is to simply use the resource loader when it's available. I have
> already changed SMWOutputs::requiredHeadItems [1] a while back to do exactly
> this. I'm not sure this covers 100% of the SMW JavaScript that got broken by
> the resource loader, so it'd be nice if people could try out trunk to see if
> everything is ok.
>
> MediaWiki ships it's own jQuery since 1.16. SMW has it's own copy to be able
> to use it with MW 1.15.x. If the installed MW has it's own jQuery, that copy
> is used.
>
> In any case, I think there is still work to be done to take full advantage of
> the benefits the resource loader provides. This will require some re-ordering
> or even re-writing of scripts at places though.
>
> [0] http://www.mediawiki.org/wiki/Resource_loader
> [1]
> http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SemanticMediaWiki/includes/SMW_Outputs.php?r1=74097&r2=74195
>
> Cheers
>
> --
> Jeroen De Dauw
> * http://blog.bn2vs.com
> * http://wiki.bn2vs.com
> Don't panic. Don't be evil. 50 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69
> 66 65!
> --
>
>
> On 14 October 2010 00:17, Denny Vrandecic <[email protected]> wrote:
> Hi,
>
> it seems that the current MediaWiki has removed the addOnloadHook, and we
> depend on a number of places (tool tip, sortable tables, etc.)
>
> I wanted to know if anyone has already looked into that, or if I should take
> a look?
>
> Also, I would like to change the SMWOutputs::requiredHeadItems to use the
> addScriptFile method, as otherwise we cannot guarantee to have jQuery already
> loaded (which seems to provide the usual replacement for the addOnloadHook).
>
> Another question: why does SMW include a jQuery library? Isn't there now one
> in MW proper?
>
> I am finally not very sure on how this would all deal with downward
> compatibility, I mean it is a pain to write for 1.15 and 1.16 and 1.17. I
> understand that we should definitively keep with 1.16 (since it is the latest
> stable release), but how much of a pain would it be to drop 1.15?
>
> Cheers,
> Denny
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Semediawiki-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel