Last modified: 2006-06-05 15:59:18 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 4474 - Provide an OutputPage::addScript() function
Provide an OutputPage::addScript() function
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: javascript
  Show dependency treegraph
 
Reported: 2006-01-04 07:46 UTC by Joe
Modified: 2006-06-05 15:59 UTC (History)
0 users

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


Attachments

Description Joe 2006-01-04 07:46:58 UTC
The ability to add javascripts in the <head> tags.
When creating a extension, enabling this feature would be very helpfull to dev's.
Comment 1 Rob Church 2006-01-04 10:54:33 UTC
Would this be accepting JavaScript as a parameter (to be slapped between
<script> tags), the path to a .js file, or both?
Comment 2 Joe 2006-01-04 11:36:04 UTC
I would say both so it can please a wider range of people (two different calls).
Personaly, the path to a script file would be fine.

I've noticed $wgOut->addScript() but it seams to do nothing when a page is rendered.
You can hold info with it and check that info $wgOut->getScript() but it
out-puts nothing.
Comment 3 Rob Church 2006-01-04 11:41:10 UTC
I'll look into it and either tweak how the existing functions work, or add
something else.
Comment 4 Joe 2006-01-04 11:53:37 UTC
Sounds good.
Right now its not a big deal being the extention is in the begining stages, i
just edited the MonoBook.php file, but in the past while making forum mods &
add-ons i always tried to do the least amount of editing to the orginal files as
possable.

Thanks for the responce.
Comment 5 Ævar Arnfjörð Bjarmason 2006-01-05 01:52:35 UTC
This should be done via hooks, not by adding a custom function that duplicates
what we have in the codebase already for cases like these.
Comment 6 Rob Church 2006-01-05 07:33:10 UTC
(In reply to comment #5)
> This should be done via hooks, not by adding a custom function that duplicates
> what we have in the codebase already for cases like these.

I hadn't even gotten round to doing it yet. If you want to, go ahead and
implement it with hooks.
Comment 7 Joe 2006-01-23 09:16:07 UTC
Forgotten about ?
Comment 8 James Robinson 2006-03-06 19:45:59 UTC
I ran into this, and Google landed me here.  In short, none of the default
templates use SkinTemplate::html to get the 'headscripts' data element that is
populated from OutputPage::getScript().  To get the data you shoved into
OutputPage::addScript(), add the following to a template in the 'right' place:

<?php $this->html('headscripts') ?>

Perhaps that should be another bug entry...
Comment 9 Rob Church 2006-06-05 15:59:18 UTC
MediaWiki 1.6+ contains OutputPage::addScript() and it works. Closing FIXED.

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


Navigation
Links