Add MediaWiki:Common.js file, similar to MediaWiki:Common.css
Closed, ResolvedPublic

Description

Author: webboy

Description:
Is it possible to make a [[MediaWiki:Common.js]] just like [[MediaWiki:Common.css]]?


Version: unspecified
Severity: enhancement

bzimport added a project: MediaWiki-Interface.Via ConduitNov 21 2014, 8:58 PM
bzimport added a subscriber: Unknown Object (MLST).
bzimport set Reference to bz4178.
bzimport created this task.Via LegacyDec 5 2005, 7:29 AM
bzimport added a comment.Via ConduitDec 5 2005, 7:34 AM

robchur wrote:

Creating it would be possible. Do you mean, "would it have an effect?" I don't
believe so; not in the current incarnation.

bzimport added a comment.Via ConduitDec 5 2005, 7:38 AM

webboy wrote:

Yes, I have made one (on nl.wikipedia.org) but it doesn't work. :-(

It would be nice when it works.

bzimport added a comment.Via ConduitDec 5 2005, 7:43 AM

robchur wrote:

Changing to a feature request...

bzimport added a comment.Via ConduitDec 5 2005, 7:25 PM

gangleri wrote:

Hallo!

[[en:MediaWiki:Common.css]] does not list inside [[en:Special:Allmessages]].
Should it?

regards reinhardt [[user:gangleri]]

bzimport added a comment.Via ConduitAug 18 2006, 2:22 PM

ui2t5v002 wrote:

This could be fixed simply by adding a few lines to wikibits.js:

document.write('<scr' + 'ipt type="text/javascript"
src="http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js'

+ '&action=raw&ctype=text/javascript&dontcountme=s"></scr'
+ 'ipt>');
bzimport added a comment.Via ConduitAug 18 2006, 8:06 PM

dto wrote:

You could also easily add this functionality in an extension:
http://en.wikipedia.org/wiki/User:Dto/CommonJSext

bzimport added a comment.Via ConduitAug 18 2006, 11:20 PM

dto wrote:

(In reply to comment #6)

You could also easily add this functionality in an extension:
http://en.wikipedia.org/wiki/User:Dto/CommonJSext

Oops. Not quite. As far as I can tell, the BeforePageDisplay hook is only called
by SkinTemplate, and the standard/classic skin doesn't extend that.

bzimport added a comment.Via ConduitAug 18 2006, 11:30 PM

dto wrote:

OK. Rewrote http://en.wikipedia.org/wiki/User:Dto/CommonJSext so that it works
independent of the current skin.

bzimport added a comment.Via ConduitAug 18 2006, 11:51 PM

ingoolemo wrote:

Dan, I take it that said extension would have to be added to MediaWiki, and
couldn't be done client-side?

bzimport added a comment.Via ConduitAug 18 2006, 11:55 PM

dto wrote:

(In reply to comment #9)

Dan, I take it that said extension would have to be added to MediaWiki, and
couldn't be done client-side?

Yeah, and so does everything else, I believe. If something is going to affect
every Wikipedia user, something in MediaWiki has to change, as far as I can tell.

bzimport added a comment.Via ConduitAug 20 2006, 6:47 AM

dto wrote:

*** Bug 7072 has been marked as a duplicate of this bug. ***

bzimport added a comment.Via ConduitNov 16 2006, 6:19 AM

ayg wrote:

Okay, Brion is apparently concerned with the possibility of adding more
unnecessary server hits. Ideally I suppose all the JS should be merged via PHP
into a single <script>, so that only one server hit occurs, but in lieu of that,
why not just ditch Monobook.js in favor of Common.js (in a backwards-compatible
way)? Why does Monobook need a separate script file anyway? If someone
actually wants to do separate stuff for Monobook, we have handy variables for that.

Anyone object to this? I'd probably just add lines to both Monobook and
Skin.php to the effect of using Common.js if it exists, otherwise Monobook.js
(as a deprecated fallback).

bzimport added a comment.Via ConduitNov 16 2006, 6:39 AM

ingoolemo wrote:

(In reply to comment #12)

why not just ditch Monobook.js in favor of Common.js (in a backwards-compatible
way)? Why does Monobook need a separate script file anyway? If someone
actually wants to do separate stuff for Monobook, we have handy variables for that.

If I interpret some of what Simetrical says correctly, then it is possible to
collect scripts from all skins into a single repository; however, some scripts
would only work in certain skins, through the use of "hand variables".

If I interpret his proposal correctly, then I wholeheartedly support it. I
believe that this will be a useful step in providing better accommodation for
those of us who don't use the monobook skin.

Also, if I interpret Simetrical's proposal correctly, it would supersede the
need for a solution to Bug 6377.

CesarB added a comment.Via ConduitNov 16 2006, 1:53 PM

I don't see why it would add more server hits; AFAIK, currently Monobook.js is
output from "/w/index.php?title=-&action=raw&gen=js", together with a couple of
extra variables; you could simply output Common.js together with it. Unless I'm
misunderstanding something, it wouldn't add any new server hits.

bzimport added a comment.Via ConduitNov 17 2006, 2:06 AM

ayg wrote:

D'oh. You're right, of course. No problem, then: added in r17737.

bzimport added a comment.Via ConduitNov 17 2006, 11:02 AM

ingoolemo wrote:

Regarding comment #12: are the "handy variables" PHP variables or Javascript
variables? If the latter, then I interpret Simetrical's comment to mean that
there is a way to specify which skin a particular function in
[[MediaWiki:Common.js]] would be executed in.

If this reading is true, then the Common repository would supersede any other
skin-specific repository, and obviate the need for a solution to Bug 6377.

Did I read correctly? I have to admit that I'm not much of techie.

bzimport added a comment.Via ConduitNov 17 2006, 12:50 PM

ayg wrote:

You read correctly. The variable "skin" is provided in JavaScript on every page
and should be available to any script writers, and yes, I noted in a couple of
places that Monobook.js is deprecated (although not until I get around to
removing all those tooltips from it ;) ).

brion added a comment.Via ConduitJun 3 2008, 8:42 PM

Just a note for posterity -- I've removed those deprecation notices; MediaWiki:Monobook.js and fellows are perfectly suitable for genuinely skin-specific JS... and it is indeed served along with MediaWiki:Common.js in the same server request (but only to those actually using that skin).

While general code does belong in Common.js, there's nothing wrong with using the specific ones when it's suitable.

matmarex added a project: JavaScript.Via WebDec 21 2014, 7:07 PM

Add Comment