Last modified: 2011-12-03 13:13:22 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T33958, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 31958 - Allow per-page (e.g. by means of a tag on the page) Mediawiki-namespace-based javascript inclusion
Allow per-page (e.g. by means of a tag on the page) Mediawiki-namespace-based...
Status: RESOLVED DUPLICATE of bug 6883
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.20.x
All All
: Unprioritized enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-26 12:52 UTC by Gregor Hagedorn
Modified: 2011-12-03 13:13 UTC (History)
7 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Gregor Hagedorn 2011-10-26 12:52:41 UTC
BACKGROUND: Mediawiki has very small core of php developers. As a CMS, it is ages behind the abilities of Drupal 7 or other current systems. Unless building on the strength of the wiki concept, improving the ability of community members to develop and deploy javascript editors etc. without requiring server access, Mediawiki may fall behind even further. With jQuery and the resource loader renovated, opportunities are now excellent to pursue this path.

Presently can be provided by php-developers (the small and - for good reason - tightly controlled community), by admins for all pages, or for individual users (self-created or as personally enabled widgets). For all pages is often too dangerous to become a basis for agile improvements, for one self is not very motivating.

ENHANCEMENT REQUEST: What may be be missing is a hook that enables Mediawiki-ns-based javascript on a specific page (apologies if I overlook an existing feature).

I propose to add a tag to load admin-provided scripts from the Mediawiki namespace. It could be
<javascript>Mediawiki:XYZ.js</javascript>
or
<javascript>XYZ.js</javascript>
but should always be limited to the Mediawiki namespace.

Such javascript is only executed for page on which the tag is present (in practice, the tag will most likely be included through templates). This could be the ground on which more agile experiments can be run, and on which topic-specific functionality is deployed by the community for the community.
Comment 1 Roan Kattouw 2011-10-26 17:59:41 UTC
Why would you want per-page JS? What kind of use case does this address that Gadgets doesn't already address?
Comment 2 Gregor Hagedorn 2011-10-26 20:15:57 UTC
> Why would you want per-page JS? What kind of use case does this address that
> Gadgets doesn't already address?

It would allow specific functionality needed only on certain pages to be tested and deployed only on these pages (and tested on yet a subset of those). This would allow specific code (interactive timeline, decision trees (click on http://species-id.net/wiki/Philaccolilus#Key on "Step-by-step identification" - the Javascript is needed only page having such a decision tree, but must be globally deployed), special galleries, etc.

The enable the community to develop functionality needed by the community that is either not foreseen by developers, or not implemented due to resource constraints.

Mediawiki is a publishing platform, but gadgets provide only authoring tools. Even there they are used only by a tiny fraction of editors. They are important and provide an agile development path for code later to be widely deployed. But I believe they don't cover any reader experience.
Comment 3 Gregor Hagedorn 2011-11-11 11:10:07 UTC
In fact, http://www.mediawiki.org/wiki/Extension:Widget (not Gadget) is close to what I request here, so reviewing the suitability of this extension to be used on the large communities of Wikipedia would be one way of fulfilling this enhancement request.
Comment 4 Rd232 2011-11-23 22:28:55 UTC
Wikimedia Commons has this functionality right now, via https://www.mediawiki.org/wiki/Snippets/Load_JS_and_CSS_by_URL being included in Common.js. Try a random imagefile and stick &withJS=MediaWiki:VisualFileChange.js on the end of the URL.
Comment 5 Gregor Hagedorn 2011-11-23 23:14:13 UTC
That is interesting. But can you have a template on the page that automatically causes specific javascript to be loaded? Our use case is that the page has special functionality available to all users. 

I believe adding this to mediawiki core would not only allow to have more interactive content (Yes, such content needs testing, deployment consensus, AND a careful design to have a fallback view when interactivity is broken), which is why I think the functionality should be such:

* A page in a user namespace searches for the corresponding javascript in User:Name/Mediawiki:JavascriptName.js
* A page in any other namespace searches for the corresponding javascript in Mediawiki:JavascriptName.js which is writeable only by admins.
Comment 6 Rd232 2011-12-03 13:13:22 UTC

*** This bug has been marked as a duplicate of bug 6883 ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links