[Mediawiki-l] add new js.file

Jim Wilson wilson.jim.r at gmail.com
Thu Aug 30 16:01:45 UTC 2007


If you want to be really slick about it, you could try adding the following
to the article [[MediaWiki:Common.js]]

(function(){
var s = document.createElement('script');
s.src = "http://path/to/external/file.js";
document.getElementsByTagName('head')[0].appendChild(s);
})();

This will dynamically create the equivalent of this:

<script src="http://path/to/external/file.js"></script>

To your the document head.

-- Jim R. Wilson (jimbojw)

On 8/30/07, Jim Hu <jimhu at tamu.edu> wrote:
>
> Use Mediawiki:Common.js on your wiki
>
> On Aug 30, 2007, at 5:13 AM, Michael Heyder wrote:
>
> > Hi,
> >
> >
> > is there a way to integrate an additional js-file without editing the
> > header.
> >
> > A look at for example the category-extension a special js-file is
> > stored
> > in the extension folder. But how is this integrated in the wiki?
> >
> > regards
> > mic
> >
> >
> > _______________________________________________
> > MediaWiki-l mailing list
> > MediaWiki-l at lists.wikimedia.org
> > http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
> =====================================
> Jim Hu
> Associate Professor
> Dept. of Biochemistry and Biophysics
> 2128 TAMU
> Texas A&M Univ.
> College Station, TX 77843-2128
> 979-862-4054
>
>
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at lists.wikimedia.org
> http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>


More information about the MediaWiki-l mailing list