Last modified: 2011-03-13 18:06: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 T21252, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 19252 - User Javascripts cannot be redirected, nor use include, nor be restricted to edit screens.
User Javascripts cannot be redirected, nor use include, nor be restricted to ...
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
Redirects (Other open bugs)
unspecified
All All
: Lowest enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-06-17 05:30 UTC by Purodha Blissenbach
Modified: 2011-03-13 18:06 UTC (History)
3 users (show)

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


Attachments

Description Purodha Blissenbach 2009-06-17 05:30:52 UTC
As a translator of UI messages, I switch between skins a lot so as to find out how translations look like in various skins. Also, I have a lengthy list of additional buttons in the edit bar supporting translationsal work. They are loaded via JavaScripts in subpages of my user page, one for each skin.

Despite the fact that all look alike, I have to keep an identical copy for each skin.

#redirect [[User:.../common.js]]

{{:user:.../common.js}}

both were useful and make scripts easier to maintain, but unlike everywhere else, do not work for these JavaScripts.

My scripts do something useful only on edit screens. Else, they detect that there is no editbar, and quit. Imho, they should better not be loaded into other pages. This could be had e.g. by having specific action dependent scripts, such as:

:user:.../skinname.js/action=edit
:user:.../skinname.js/action=move

etc.
Comment 1 Alex Z. 2009-06-17 05:38:37 UTC
To include other scripts:

importScript('User:.../main.js');



To restrict scripts to certain actions:

if (wgAction == "edit") {
  importScript('User:.../edit.js');
}


JavaScript isn't parsed before its loaded, so any wikitext features like transclusion can't work as scripts are just loaded into pages with action=raw.
Comment 2 Purodha Blissenbach 2009-06-25 20:56:38 UTC
The script för edit buttons should be:

if ((wgAction == "edit") || (wgAction == "submit")) {
  importScript('User:.../edit.js');
}
Comment 3 Chad H. 2009-07-02 02:05:45 UTC
Marking WONTFIX per comment #1. I don't think we're going to change Javascript pages to be parsed (can't seem to find the bug for it...) 

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


Navigation
Links