Commit graph

157 commits

Author SHA1 Message Date
umherirrender
7dabc84e7a Set mw.config wgFileExtensions only on Upload instead of site-wide
It is just used by mediawiki.special.upload

Change-Id: I433e29866fe184ba80c5dda35722e228e79f9307
2014-12-19 18:08:05 +01:00
umherirrender
e9586a8e36 Use more pretty output in ResourceLoader debug mode for arrays
Effected:
- mw.language.data
- mw.language.names
- mw.config.set
- mw.user.options.set for defaults
- mw.toolbar

Change-Id: I8a9e718ab15f0b3f80e12b817295c6843a570d46
2014-12-19 17:55:46 +01:00
Ricordisamoa
12dec5d85d Fix some stuttering in comments and documentation
Change-Id: I9c0088b9aab37335203cad45a1d6fa8ac3f43321
2014-12-17 19:44:10 +00:00
Aaron Schulz
e369f66d00 Replace wfRunHooks calls with direct Hooks::run calls
* This avoids the overhead of an extra function call

Change-Id: I8ee996f237fd111873ab51965bded3d91e61e4dd
2014-12-10 12:26:59 -08:00
Timo Tijhof
c0c221bfe4 resourceloader: Refactor empty value trimming for mw.loader.register
We already did this, but it was rather convoluted with lots of
if/elseif sequences checking all the possible values.

Remove this logic from ResourceLoaderStartUpModule. Simplying it
simply create the array and pass it to ResourceLoader::makeLoaderRegisterScript.

In makeLoaderRegisterScript, we apply a filter to the array(s) that
trim empty values.

While at it:
* As with other registration properties' default values (like for dependencies,
  group, and skip) also use 'null' for the default value of 'source'.
  The mediawiki.js client was already compatible with this, and the server omitted
  it if it was the last value in the list. But in all other cases it explicitly
  outputs "local". Use null instead of simplicity sake. This also gains us a
  few characters in the output, and a relatively larger win after gzip since
  there's lots more re-using of "null".
* Remove stray casting of $version to int. This only happened in case of
  registering a single module (which don't do anywhere), and is redundant.

Change-Id: I1f321e7b8bd3b5cffc550b51169957a3da9b971d
2014-12-09 00:47:14 +00:00
Trevor Parscal
ecfdb88dfd Index ResourceLoader dependency lists in startup
By using the existing indexes of modules in the array being passed to
mw.loader.register we can reduce the size of the startup module by about
6% after gzip (nearly 20% before) on a wiki with very few modules (such
as my localhost). Comparing data from en.wikipedia.org shows about 9%
after gzip (nearly 30% before).

The technique adds a function to mediawiki.js which resolves the indexes
before registering the modules, which costs a little bit of data in that
payload, but it's negligible (118 bytes after gzip) in comparison to the
overall reduction.

Also, cleaned up lies in documentation and strange use of "m" as an
iterator variable.

Bonus: fix ISO8601 timestamp instead of UNIX timestamp being passed
to custom loader scripts.

Change-Id: If12991413fa6129cd20ceab0e59a3a30a4fdf5ce
2014-12-08 11:04:41 -08:00
Timo Tijhof
6a1ec17e79 resourceloader: Make timestamp handling more consistent
* Use time() instead of:
  - wfTimestamp()
  - wfTimestamp( TS_UNIX )
  - wfTimestamp( TS_UNIX, 0 )
  - wfTimestamp( TS_UNIX, time() )
  - intval( wfTimestamp( TS_UNIX, time() ) )

* Consistently use 1 as default instead of 0. Previously the
  unwritten convention was that anything "final" max()'ed with 1,
  and any internal method would use 0, but this wasn't applied
  consistently made it fragile. There doesn't seem to be any
  value in returning 0 only to have it maxed up to 1 (because if
  the 0 would ever make it out alive, we'd be in trouble).

* wfTimestamp returns a string for TS_UNIX. In PHP this doesn't
  matter much. In fact, max() takes number-like integers so
  transparently, it even preserves it:
  > max( 1, 3, '2' );
  < 3
  > max( 1, '3', 2 );
  < "3"
  Just cast it in one place at the very end (StartupModule)
  instead of doing intval( wfTimestamp() ).

* Fix weird documentation claiming getModifiedTime can return
  an array, or mixed.

* Remove 'version > 1 ? version : 1' logic in
  ResourceLoader::makeLoaderRegisterScript. The client doesn't
  have "0 means now" behaviour so this isn't needed. And the method
  was only doing it for variadic argument calls.

Removal of quotes around timestamps reduced the size of the startup
module from 26.8KB to 25.9KB before gzip. After gzip the size was
and still is 5.7KB, though. (From 5456 bytes to 5415 bytes.)

Change-Id: If92ca3e7511e78fa779f2f2701e2ab24db78c8a8
2014-12-05 21:29:57 +00:00
Amir E. Aharoni
46b3698947 Avoid extra-long code lines
Makes phpcs happy.

Change-Id: Ideb4d4e7b9f5c385f108b91b26a796ecf6833d47
2014-10-04 16:25:50 +00:00
Fomafix
900b772ed8 Set mw.config wgFileCanRotate only on Special:Upload instead of
site-wide

UploadWizard also uses wgFileCanRotate and set the variable by
I3c50b56e6a11742cfc1c02d3d8dbeb0c151b0e91 itself.

Change-Id: Iff6a952c8f4f21c0e27bd6b4191f3b0b453eec03
2014-09-20 21:53:58 +02:00
Brian Wolff
757a70ae0a Split BitmapHandler into two classes.
BitmapHandler has a lot of generic-ish functionality that could
be re-usable by extension classes (Such as how it organizes
$scalerParams array, or various image magick escaping methods).
However it's combined with a lot of very format specific things,
such as the shell-out call to image magick.

Try to separate out the more generic stuff into
TransformationalImageHandler. In order to do this, I also made
canRotate, autoRotateEnabled, and getScalerType non-static. No
extensions in our repo appeared to be using these methods, and they
don't really make sense to be static (imo).

In particular, I think code duplication can be reduced in
PagedTiffHandler by extending this new class. See comments
on I1b9a77a4a56eeb65.

Change-Id: Id3a8b25a598942572cb5791a95e86054d7784961
2014-09-14 22:10:37 +00:00
Kunal Mehta
1e063f6078 resourceloader: Don't register raw modules client-side
Prevents modules from depending on raw modules, like 'mediawiki' & 'jquery'.

To do that, those modules (as designated by raw=>true), aren't
registered in the module registry.

Change-Id: Iac37a236964dc40d6259988a0baaaa6331b54ec6
2014-08-28 20:30:25 +00:00
umherirrender
9f3f72f504 Use lowercase array in ResourceLoaderStartUpModule.php
Change-Id: Idf28e6d302e3b28c1c5cfb9f8f108dd9a69a092c
2014-08-15 15:29:28 +02:00
jenkins-bot
c54bcbc5b9 Merge "resourceloader: Wrap only=script responses in "if(window.mw)"" 2014-08-13 00:50:10 +00:00
Timo Tijhof
9272bc6c47 resourceloader: Wrap only=script responses in "if(window.mw)"
We currently have a few legacy requests to the load.php end point
that bypass the ResourceLoader client by coding a request to
load.php via a "<script src>" directly. Most prominently the
request for the 'site' wiki module (aka MediaWiki:Common.js).

Remove the manual wrapping of embedded private modules as this
is now taken are of by ResourceLoader::makeModuleResponse itself.

Misc:
* Mark "jquery" and "mediawiki" as Raw modules. While the startup
  module had this already, these didn't. Without this, they'd
  get the conditional wrap – which would be a problem since mediawiki.js
  can't be conditional on 'window.mw' for that file defines that
  namespace itself.
* Strip the cache-key comment in the unit tests because the hash
  no longer matches and using the generic 'wiki' dbname was breaking
  DB queries.
* Relates to bug 63587.
* See also 05d0f6fefd which expands the reach of the non-JS
  environment to IE6 and helped expose this bug.

Change-Id: Icf6ede09b51ce212aa70ff6be4b341762ec75b4d
2014-08-12 23:20:42 +00:00
Kunal Mehta
4b1a87c96e includes/resourceloader/: Use Config instead of globals
Change-Id: Iaa1f4ae9c397575c9bb86dacbc342456e6f5f532
2014-08-07 18:47:34 +01:00
umherirrender
dd8921c9d9 Cleanup some docs (includes/[m-r])
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: I8ebfbcea0e2ae2670553822acedde49c1aa7e98d
2014-07-24 19:43:25 +02:00
umherirrender
4ee680a8b3 Fixed spacing
- Removed spaces after not operator (!)
- Removed spaces inside array index
- use tab as indent instead of spaces
- Add newline at end of file
- Removed spaces after casts

Change-Id: I9ba17c4385fcb43d38998d45f89cf42952bc791b
2014-07-24 11:53:04 +02:00
Ori Livneh
7fb6675a8f Remove ResourceLoaderGetStartupModules hook
Deprecated only since 1.23, but universally reviled, and used only by
MwEmbedSupport, which no longer uses it as of I43af3c87a).

Change-Id: I36c89b273fdb0ec3a76034c7a6d2f48a15d5457f
2014-07-11 13:49:00 -07:00
Timo Tijhof
75c08916b0 resourceloader: Implement "skip function" feature
A module can be registered with a skip function. Such function,
if provided, will be invoked by the client when a module is
queued for loading. If the function returns true, the client will
bypass any further loading action and mark the module as 'ready'.

This can be used to implement a feature test for a module
providing a shim or polyfill.

* Change visibility of method ResourceLoader::filter to public.

So that it can be invoked by ResourceLoaderStartupModule.

* Add option to suppress the cache key report in ResourceLoader::filter.

We usually only call the minifier once on an entire request
reponse (because it's all concatenated javascript or embedded
javascript in various different closures, still valid as one
large script) and only add a little bottom line for the cache
key. When embedding the skip function we have to run the minifier
on them separately as they're output as strings (not actual
functions). These strings are typically quite small and blowing
up the response with loads of cache keys is not desirable in
production.

* Add method to clear the static cache of ResourceLoader::inDebugMode.

Global static state is evil but, as long as we have it, we at
least need to clear it after switching contexts in the test suite.

Also:
* Remove obsolete setting of 'debug=true' in the FauxRequest in
  ResourceLoaderTestCase. It already sets global wgResourceLoaderDebug
  in the setUp() method.

Bug: 66390
Change-Id: I87a0ea888d791ad39f114380c42e2daeca470961
2014-06-12 03:48:26 +02:00
Robmoen
476997b3bb Merge "Implement mediawiki.cookie module" 2014-05-14 18:17:55 +00:00
Sam Smith
7c585b5a33 Implement mediawiki.cookie module
Provides functonality similar to WebRequest#getCookie and WebResponse#setcookie.

Wraps $.cookie and automatically takes care of wgCookiePrefix etc.

Bug: 49156
Change-Id: I217ef258aecf1acd335e2cea56ae08b22541c7d4
Co-Author: Matthew Flaschen <mflaschen@wikimedia.org>
Co-Author: Timo Tijhof <krinklemail@gmail.com>
2014-05-14 00:52:41 -04:00
Ori Livneh
72c0ce43a8 Add $wgServerName
This partially reverts r73950 which removed $wgServerName on the ground that it
was only used for {{SERVERNAME}}. When it was pointed out that $wgServerName was
also used by several extensions, the response was not to restore the variable, but
to proceed to remove it from extensions as well.

It is a useful variable to have, as the discussion on Id819246a9 makes clear
(see Tim's comment on PS12 and Timo's reply). So let's reintroduce it, and expose
it in mw.config and ApiQuerySiteInfo as well.

Change-Id: I40a6fd427d38c64c628f70a2f407b145443ea204
2014-05-09 11:53:56 +02:00
jenkins-bot
280cb03b4d Merge "resourceloader: Optimize module registry sent in the startup module" 2014-04-27 15:45:10 +00:00
Marius Hoch
df8176e8a5 resourceloader: Optimize module registry sent in the startup module
The optimization basically works like this:

* Given module A with the dependencies B and C and module B with the
  dependency C.
* Don't tell the client that A depends on C, as that's already included
  in module B.

This way we can reduce the amount of data for module registration sent
to the client.

The code here isn't polished yet, but it works and should be good enough
to demonstrate my idea and implementation.

Change-Id: I7732a3b1d879c5eef059e136a5241d6d48046872
2014-04-25 19:32:19 +02:00
jenkins-bot
622f2ddb63 Merge "Fixed some @params documentation (includes/*)" 2014-04-22 10:05:49 +00:00
umherirrender
dcf6955e5c Fixed some @params documentation (includes/*)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.

Change-Id: Ifbb1da2a6278b0bde2a6f6ce2e7bd383ee3fb28a
2014-04-20 23:33:05 +02:00
Ori Livneh
e8b46e5e66 Deprecate ResourceLoaderGetStartupModules
In bug 63240, Roan calls it a 'misfeature', which I think is exactly right. It
has been used as a lazy workaround for having to think about load-order,
dependency management, and race conditions.

Bug: 63240
Change-Id: Ic48ad39c6d3d166d6bb8f60dfdd5f95aa7ed16a6
2014-04-20 14:07:54 -07:00
James D. Forrester
648667ac9f Split /resources into /resources/lib and /resources/src
Currently, MediaWiki has a mess of resources, some but not all of which are upstream libraries.
This means that occasionally people will attempt to make local modifications of the libraries
by accident, or deliberately but do not flag it, making dependency management a challenge (and
fixing upstream-related bugs a headache).

Instead, we now split the /resources directory into a /resources/lib directory for those items
which are used purely as intact upstream libraries, and a /resources/src directroy for those
which are either local libraries written for MediaWiki and mastered here, or downstream forks
of upstream libraries which require particular care and attention when being upgraded. Also,
some incidental files which are not to be loaded as part of a module have been moved to better
locations.

Upstream libaries

* jquery
	resources/jquery/jquery.js

* jquery.appear
	resources/jquery/jquery.appear.js

* jquery.async
	resources/jquery/jquery.async.js

* jquery.chosen
	resources/jquery.chosen/*

* jquery.cookie
	resources/jquery/jquery.cookie.js

* jquery.form
	resources/jquery/jquery.form.js

* jquery.fullscreen.js
	resources/jquery/jquery.fullscreen.js

* jquery.hoverIntent
	resources/jquery/jquery.hoverIntent.js

* jquery.json
	resources/jquery/jquery.json.js

* jquery.mockjax
	resources/jquery/jquery.mockjax.js

* jquery.qunit
	resources/jquery/jquery.qunit.css
	resources/jquery/jquery.qunit.js

* jquery.jStorage
	resources/jquery/jquery.jStorage.js

* jquery.throttle-debounce
	resources/jquery/jquery.ba-throttle-debounce.js

* jquery.validate
	resources/jquery/jquery.validate.js

* jquery.xmldom
	resources/jquery/jquery.xmldom.js

* moment
	resources/moment/*

* OOjs
	resource/oojs/*

* OOjs UI
	resources/oojs-ui/*

* jquery.ui.*
	resources/jquery.ui/*
		resources/jquery.ui/themes/default moved to resources/lib/jquery.ui/themes/
		resources/jquery.ui/themes/vector moved to resources/src/jquery.ui-themes/

* jquery.effects.*
	resources/jquery.effects/*

* sinon
	resources/sinonjs/*

Upstream libraries forked for MediaWiki

* jquery.color
	resources/jquery/jquery.color.js

* jquery.tipsy
	resources/jquery.tipsy/*

Local libraries

* jquery.arrowSteps
	resources/jquery/jquery.arrowSteps.css
	resources/jquery/jquery.arrowSteps.js
	resources/jquery/images/jquery.arrowSteps.divider-ltr.png
	resources/jquery/images/jquery.arrowSteps.divider-rtl.png
	resources/jquery/images/jquery.arrowSteps.head-ltr.png
	resources/jquery/images/jquery.arrowSteps.head-rtl.png
	resources/jquery/images/jquery.arrowSteps.tail-ltr.png
	resources/jquery/images/jquery.arrowSteps.tail-rtl.png

* jquery.autoEllipsis
	resources/jquery/jquery.autoEllipsis.js

* jquery.badge
	resources/jquery/jquery.badge.css
	resources/jquery/jquery.badge.js

* jquery.byteLength
	resources/jquery/jquery.byteLength.js

* jquery.byteLimit
	resources/jquery/jquery.byteLimit.js

* jquery.checkboxShiftClick
	resources/jquery/jquery.checkboxShiftClick.js

* jquery.client
	resources/jquery/jquery.client.js

* jquery.colorUtil
	resources/jquery/jquery.colorUtil.js

* jquery.delayedBind
	resources/jquery/jquery.delayedBind.js

* jquery.expandableField
	resources/jquery/jquery.expandableField.js

* jquery.farbtastic
	resources/jquery/jquery.farbtastic.css
	resources/jquery/jquery.farbtastic.js
	resources/jquery/images/marker.png
	resources/jquery/images/mask.png
	resources/jquery/images/wheel.png

* jquery.footHovzer
	resources/jquery/jquery.footHovzer.css
	resources/jquery/jquery.footHovzer.js

* jquery.getAttrs
	resources/jquery/jquery.getAttrs.js

* jquery.hidpi
	resources/jquery/jquery.hidpi.js

* jquery.highlightText
	resources/jquery/jquery.highlightText.js

* jquery.localize
	resources/jquery/jquery.localize.js

* jquery.makeCollapsible
	resources/jquery/jquery.makeCollapsible.css
	resources/jquery/jquery.makeCollapsible.js

* jquery.mw-jump
	resources/jquery/jquery.mw-jump.js

* jquery.mwExtension
	resources/jquery/jquery.mwExtension.js

* jquery.placeholder
	resources/jquery/jquery.placeholder.js

* jquery.spinner
	resources/jquery/jquery.spinner.css
	resources/jquery/jquery.spinner.js
	resources/jquery/images/spinner-large.gif
	resources/jquery/images/spinner.gif

* jquery.suggestions
	resources/jquery/jquery.suggestions.css
	resources/jquery/jquery.suggestions.js

* jquery.tabIndex
	resources/jquery/jquery.tabIndex.js

* jquery.tablesorter
	resources/jquery/jquery.tablesorter.css
	resources/jquery/jquery.tablesorter.js
	resources/jquery/images/sort_both.gif
	resources/jquery/images/sort_down.gif
	resources/jquery/images/sort_none.gif
	resources/jquery/images/sort_up.gif

* jquery.textSelection
	resources/jquery/jquery.textSelection.js

* jquery.qunit.completenessTest
	resources/jquery/jquery.qunit.completenessTest.js

* mediawiki
	resources/mediawiki/mediawiki.js
	resources/mediawiki/mediawiki.log.js

* mediawiki.api
	resources/mediawiki.api/mediawiki.api.js

* mediawiki.api.category
	resources/mediawiki.api/mediawiki.api.category.js

* mediawiki.api.edit
	resources/mediawiki.api/mediawiki.api.edit.js

* mediawiki.api.login
	resources/mediawiki.api/mediawiki.api.login.js

* mediawiki.api.parse
	resources/mediawiki.api/mediawiki.api.parse.js

* mediawiki.api.watch
	resources/mediawiki.api/mediawiki.api.watch.js

* mediawiki.debug
	resources/mediawiki/mediawiki.debug.js
	resources/mediawiki/mediawiki.debug.less
	resources/mediawiki/mediawiki.debug.profile.css
	resources/mediawiki/mediawiki.debug.profile.js

* mediawiki.debug.init
	resources/mediawiki/mediawiki.debug.init.js

* mediawiki.feedback
	resources/mediawiki/mediawiki.feedback.css
	resources/mediawiki/mediawiki.feedback.js
	resources/mediawiki/mediawiki.feedback.spinner.gif

* mediawiki.hidpi
	resources/mediawiki/mediawiki.hidpi.js

* mediawiki.hlist
	resources/mediawiki/mediawiki.hlist.css
	resources/mediawiki/mediawiki.hlist.js

* mediawiki.htmlform
	resources/mediawiki/mediawiki.htmlform.js

* mediawiki.icon
	resources/mediawiki/mediawiki.icon.less
	resources/mediawiki/images/arrow-collapsed-ltr.png
	resources/mediawiki/images/arrow-collapsed-ltr.svg
	resources/mediawiki/images/arrow-collapsed-rtl.png
	resources/mediawiki/images/arrow-collapsed-rtl.svg
	resources/mediawiki/images/arrow-expanded.png
	resources/mediawiki/images/arrow-expanded.svg

* mediawiki.inspect
	resources/mediawiki/mediawiki.inspect.js

* mediawiki.notification
	resources/mediawiki/mediawiki.notification.css
	resources/mediawiki/mediawiki.notification.hideForPrint.css
	resources/mediawiki/mediawiki.notification.js

* mediawiki.notify
	resources/mediawiki/mediawiki.notify.js

* mediawiki.searchSuggest
	resources/mediawiki/mediawiki.searchSuggest.css
	resources/mediawiki/mediawiki.searchSuggest.js

* mediawiki.Title
	resources/mediawiki/mediawiki.Title.js

* mediawiki.toc
	resources/mediawiki/mediawiki.toc.js

* mediawiki.Uri
	resources/mediawiki/mediawiki.Uri.js

* mediawiki.user
	resources/mediawiki/mediawiki.user.js

* mediawiki.util
	resources/mediawiki/mediawiki.util.js

* mediawiki.action.edit
	resources/mediawiki.action/mediawiki.action.edit.js

* mediawiki.action.edit.styles
	resources/mediawiki.action/mediawiki.action.edit.styles.css

* mediawiki.action.edit.collapsibleFooter
	resources/mediawiki.action/mediawiki.action.edit.collapsibleFooter.css
	resources/mediawiki.action/mediawiki.action.edit.collapsibleFooter.js

* mediawiki.action.edit.preview
	resources/mediawiki.action/mediawiki.action.edit.preview.js

* mediawiki.action.history
	resources/mediawiki.action/mediawiki.action.history.js

* mediawiki.action.history.diff
	resources/mediawiki.action/mediawiki.action.history.diff.css

* mediawiki.action.view.dblClickEdit
	resources/mediawiki.action/mediawiki.action.view.dblClickEdit.js

* mediawiki.action.view.metadata
	resources/mediawiki.action/mediawiki.action.view.metadata.js

* mediawiki.action.view.postEdit
	resources/mediawiki.action/mediawiki.action.view.postEdit.css
	resources/mediawiki.action/mediawiki.action.view.postEdit.js
	resources/mediawiki.action/images/green-checkmark.png

* mediawiki.action.view.redirectToFragment
	resources/mediawiki.action/mediawiki.action.view.redirectToFragment.js

* mediawiki.action.view.rightClickEdit
	resources/mediawiki.action/mediawiki.action.view.rightClickEdit.js

* mediawiki.action.edit.editWarning
	resources/mediawiki.action/mediawiki.action.edit.editWarning.js

* mediawiki.action.watch.ajax
  No files associated with this resource.

* mediawiki.language
	resources/mediawiki.language/mediawiki.language.js
	resources/mediawiki.language/mediawiki.language.numbers.js
	resources/mediawiki.language/languages/bs.js
	resources/mediawiki.language/languages/dsb.js
	resources/mediawiki.language/languages/fi.js
	resources/mediawiki.language/languages/ga.js
	resources/mediawiki.language/languages/he.js
	resources/mediawiki.language/languages/hsb.js
	resources/mediawiki.language/languages/hu.js
	resources/mediawiki.language/languages/hy.js
	resources/mediawiki.language/languages/la.js
	resources/mediawiki.language/languages/os.js
	resources/mediawiki.language/languages/ru.js
	resources/mediawiki.language/languages/sl.js
	resources/mediawiki.language/languages/uk.js

* mediawiki.cldr
	resources/mediawiki.language/mediawiki.cldr.js

* mediawiki.libs.pluralruleparser
  Possibly should be moved to /lib
	resources/mediawiki.libs/CLDRPluralRuleParser.js

* mediawiki.language.init
	resources/mediawiki.language/mediawiki.language.init.js

* mediawiki.jqueryMsg
	resources/mediawiki/mediawiki.jqueryMsg.js
	resources/mediawiki/mediawiki.jqueryMsg.peg

* mediawiki.language.months
	resources/mediawiki.language/mediawiki.language.months.js

* mediawiki.libs.jpegmeta
	resources/mediawiki.libs/mediawiki.libs.jpegmeta.js

* mediawiki.page.gallery
	resources/mediawiki.page/mediawiki.page.gallery.js

* mediawiki.page.ready
	resources/mediawiki.page/mediawiki.page.ready.js

* mediawiki.page.startup
	resources/mediawiki.page/mediawiki.page.startup.js

* mediawiki.page.patrol.ajax
	resources/mediawiki.page/mediawiki.page.patrol.ajax.js

* mediawiki.page.watch.ajax
	resources/mediawiki.page/mediawiki.page.watch.ajax.js

* mediawiki.page.image.pagination
	resources/mediawiki.page/mediawiki.page.image.pagination.js

* mediawiki.special
	resources/mediawiki.special/mediawiki.special.css
	resources/mediawiki.special/mediawiki.special.js

* mediawiki.special.block
	resources/mediawiki.special/mediawiki.special.block.css
	resources/mediawiki.special/mediawiki.special.block.js

* mediawiki.special.changeemail
	resources/mediawiki.special/mediawiki.special.changeemail.css
	resources/mediawiki.special/mediawiki.special.changeemail.js

* mediawiki.special.changeslist
	resources/mediawiki.special/mediawiki.special.changeslist.css

* mediawiki.special.changeslist.legend
	resources/mediawiki.special/mediawiki.special.changeslist.legend.css

* mediawiki.special.changeslist.legend.js
	resources/mediawiki.special/mediawiki.special.changeslist.legend.js

* mediawiki.special.changeslist.enhanced
	resources/mediawiki.special/mediawiki.special.changeslist.enhanced.css

* mediawiki.special.movePage
	resources/mediawiki.special/mediawiki.special.movePage.js

* mediawiki.special.pagesWithProp
	resources/mediawiki.special/mediawiki.special.pagesWithProp.css

* mediawiki.special.preferences
	resources/mediawiki.special/mediawiki.special.preferences.css
	resources/mediawiki.special/mediawiki.special.preferences.js

* mediawiki.special.recentchanges
	resources/mediawiki.special/mediawiki.special.recentchanges.js

* mediawiki.special.search
	resources/mediawiki.special/mediawiki.special.search.css
	resources/mediawiki.special/mediawiki.special.search.js

* mediawiki.special.undelete
	resources/mediawiki.special/mediawiki.special.undelete.js

* mediawiki.special.upload
	resources/mediawiki.special/mediawiki.special.upload.js

* mediawiki.special.userlogin.common.styles
	resources/mediawiki.special/mediawiki.special.userlogin.common.css
	resources/mediawiki.special/images/icon-lock.png

* mediawiki.special.userlogin.signup.styles
	resources/mediawiki.special/mediawiki.special.userlogin.signup.css
	resources/mediawiki.special/images/icon-edits.png
	resources/mediawiki.special/images/icon-pages.png
	resources/mediawiki.special/images/icon-contributors.png

* mediawiki.special.userlogin.login.styles
	resources/mediawiki.special/mediawiki.special.userlogin.login.css
	resources/mediawiki.special/images/glyph-people-large.png

* mediawiki.special.userlogin.common.js
	resources/mediawiki.special/mediawiki.special.userlogin.common.js

* mediawiki.special.userlogin.signup.js
	resources/mediawiki.special/mediawiki.special.userlogin.signup.js

* mediawiki.special.javaScriptTest
	resources/mediawiki.special/mediawiki.special.javaScriptTest.js

* mediawiki.special.version
	resources/mediawiki.special/mediawiki.special.version.css

* mediawiki.ui
	resources/mediawiki.ui/default.less
	resources/mediawiki.ui/vector.less
	resources/mediawiki.ui/components/utilities.less
	resources/mediawiki.ui/components/default/forms.less
	resources/mediawiki.ui/components/vector/containers.less
	resources/mediawiki.ui/components/vector/forms.less
	resources/mediawiki.ui/mixins/effects.less
	resources/mediawiki.ui/mixins/forms.less
	resources/mediawiki.ui/mixins/type.less
	resources/mediawiki.ui/mixins/utilities.less
	resources/mediawiki.ui/settings/colors.less
	resources/mediawiki.ui/settings/typography.less
	resources/mediawiki.ui/styleguide.md

* mediawiki.ui.button
	resources/mediawiki.ui/components/default/buttons.less
	resources/mediawiki.ui/components/vector/buttons.less

Legacy modules, untouched:

* mediawiki.legacy.ajax
* mediawiki.legacy.commonPrint
* mediawiki.legacy.config
* mediawiki.legacy.protect
* mediawiki.legacy.shared
* mediawiki.legacy.oldshared
* mediawiki.legacy.upload
* mediawiki.legacy.wikibits

Miscellaneous files moved elsewhere

* A currently-failing (unused?) script attempting to build some kss style documentation.
  Previously in the root of the resources directory, now moved to a new folder, /docs/kss.
	Makefile
	README.txt
	package.json
	scripts/nodecheck.sh
	styleguide-template/index.html
	styleguide-template/public/kss.less
	styleguide-template/public/less.js

* ResourceLoader startup JS code was also moved to /src
	resources/startup.js

* mediawiki.mixins, hard-coded to be loaded by ResourceLoader, also moved to /src
	resources/mediawiki.less/mediawiki.mixins.animation.less
	resources/mediawiki.less/mediawiki.mixins.less
	resources/mediawiki.less/mediawiki.mixins.rotation.less

* jquery.cycle.all.js appears not to be refered to (?!):
  (added in 2f1f0abc6b)
	resources/jquery/jquery.cycle.all.js

Change-Id: Id5ead1453412e763bdb3763084e43694517088fd
2014-04-07 12:21:21 -07:00
Timo Tijhof
c006441016 resourceloader: Separate gathering of registry data from mw.loader call
This will make it easier to debug this code and generally to interact
with the registry data before it gets sent out.

Change-Id: I01808ce5d6a0ac6f7a15719bdd2aa90908cb2fbd
2014-03-28 19:44:48 +00:00
jenkins-bot
feeac7bdfc Merge "ResourceLoaderStartUpModule: Use hashMtime to detect config changes" 2014-03-26 22:36:45 +00:00
jenkins-bot
5aaadefd99 Merge "ResourceLoaderStartUpModule: Improve comment about modifiedTime hack" 2014-03-21 10:49:01 +00:00
jenkins-bot
15bd6e2b0b Merge "ResourceLoaderStartUpModule: Remove no-op "delete isCompatible"" 2014-03-21 10:46:45 +00:00
umherirrender
2000672ac3 Fixed spacing
- Added spaces after if/foreach/catch
- Added new line before end of file
- Added or removed spaces before/after parenthesis, comma
- Added spaces around string concat

Change-Id: I0590070f1b3542108e242730e8d9a3ba9831e94f
2014-03-20 20:37:30 +00:00
Timo Tijhof
f9a951abc2 ResourceLoaderStartUpModule: Use hashMtime to detect config changes
Changes to the static startup.js file are covered by the file
mtime in #getModifiedTime.

Changes to the module registrations are covered by the max
module mtime loop in #getModifiedTime.

But changes to LocalSettings.php etc. affecting mw.config values
embedded in #getScript aren't traceable. Resort to hashing those
and detecting changes between calls that way.

Without this, changes to mw.config never made it live (not even
after the rebuild every 5 minutes) because of 304 Not Modified
being sent between Apache and Varnish. Changes to config either
didn't matter to front-end right away and made it with the next
deployment that changes a different module, or by touching
startup.js to force a version bump.

Simple third party installs were not affected by this bug as their
settings would only be coming from LocalSettings.php (as opposed
to included files) and $wgInvalidateCacheOnLocalSettingsChange is
true by default.

Bug: 28899
Change-Id: I484166923d97368d95beeb40bb209dec9b849033
2014-03-20 07:04:48 +01:00
Timo Tijhof
45ffc8c937 ResourceLoaderStartUpModule: Improve comment about modifiedTime hack
* Re-ordering code to bring the modifiedTime hack and the
  loop it serves closer together.
* Separating the fact that it needs a value and the mtime of
  startup.js since that is just one of the three factors we use.
  This way it's clearer that the startup.js mtime is not just a
  bogus value, but not more or less important than wgCacheEpoch
  and modules mtime either.
* Remove duplicate '/* Methods */' comment, we already have this
  marker a few methods higher up.

Change-Id: Id3a07f02566c0f04b612b81f8353f70fa4ab3977
2014-03-20 05:34:21 +01:00
Timo Tijhof
d0259d497d ResourceLoaderStartUpModule: Remove no-op "delete isCompatible"
Due to the way this function being defined as a function or var
declaration instead of a function expression assigned to a property
it can't be deleted.

JavaScript doesn't throw an error when deletion is not permitted
though, the operator returns false instead.

> delete isCompatible;
  false

We already removed 'delete startUp' from mediawiki.js in favour
of startUp = undefined; (r107402, r74325).

Change-Id: I7aa02e3f4deb3a4f00177b70978bfcb83c80988a
2014-03-20 05:21:36 +01:00
umherirrender
047c86f26e Fix spacing between two functions
Added and removed some new lines to have one new line between two
functions

Change-Id: I1ccfbd575dd26b160396ef3d3e2e079f5cdbe196
2014-03-15 20:57:23 +00:00
Alexandre Emsenhuber
c29d513deb Put the "else" (or "elseif") on the same line as the previous closing brace
Per https://www.mediawiki.org/wiki/Manual:Coding_conventions#Indenting_and_alignment

Change-Id: I208981db0a866524156bad18cb687f010afeac2c
2014-03-15 13:54:53 +01:00
Ori Livneh
ac99ef7c25 Emit $wgSearchType as JavaScript config variable
Allows for the search interface to be customzied for the particular
search-engine used, and allows collecting client-side performance measurements
that specify which search engine was used.

Change-Id: Ibeda834e9d5dbaf1d7e40c2dacbc60feb2cc4bba
2014-03-13 19:06:07 -07:00
dr0ptp4kt
c49189151c resourceloader: Add method to get the startup modules load url
* Needed in order to incorporate this url in cache-optimizing
  things like cache manifests.

Change-Id: I17608e3fac9f8cb5b2764d8a22aa50ff59b23d2c
2014-02-26 13:54:50 -08:00
umherirrender
073abe3e12 No variable assignment on return statement
Split the variable assignment and the return statement in two lines for
better readability.

When there was two return statements in one method the logic was swapped
to have only one return statement.

Change-Id: Id7a01b4a2df96036435f9e1a9be5678dd124b0af
2014-01-02 09:43:35 +00:00
This, that and the other
3d87e3a86b Add JavaScript variable wgContentNamespaces
Intended to be used in WikiEditor to hide the signature button in content
namespaces. Other uses could be for gadgets or extensions that only need
to work on content pages, or that are internally-facing and should only
be seen on non-content pages.

It is an array of namespace IDs, so that end-users can quickly check
whether wgNamespaceNumber is in this array.

Change-Id: I01d9671dd14aa79e79ed887299c2f5de766f7375
2013-11-29 21:19:58 +11:00
Ori Livneh
c719401661 Cache ResourceLoader modules in localStorage
To minimize the number of discrete requests that the browser has to make in
order to render the page, ResourceLoader tries to condense as many modules as
possible into each request. To ensure that the response is not stale,
ResourceLoader tacks the modification time of the most recently modified module
to the request. This behavior makes poor use of locality: an update to a single
module will change the URL that is used to retrieve it and a number of
unrelated modules, causing those modules to be re-retrieved even though they
have not changed since they were last retrieved. This is because the browser
cache is not aware that the response from load.php is a composite of modules
that should be versioned separately.

This patch adds mw.loader.store. On browsers that implement the localStorage
API, the module store serves as a smart complement to the browser cache. Unlike
the browser cache, the module store can slice a concatenated response from
ResourceLoader into its constituent modules and cache each of them separately,
using each module's versioning scheme to determine when the cache should be
invalidated.

Because the localStorage API is synchronous and slower than memory access,
modules are cached as a single JSON blob. At the beginning of the page load
process, the entire blob is loaded from storage into memory. During the load
process, any required modules that are not in the store are fetched from the
server and set in the in-memory store. When the DOM is complete, the store is
synced back to localStorage in a single operation.

* NOTE: The module store is enabled only if $wgResourceLoaderStorageEnabled is
  set to true; it is false by default. We can change the default if / when we
  establish conclusively that the feature is beneficial and stable.

Change-Id: If2ad2d80db2336fb447817f5c56599667141ec66
2013-10-28 14:14:35 -07:00
jenkins-bot
2f0636db20 Merge "Title: Add byte class to unicode class conversion for js" 2013-09-27 17:58:45 +00:00
Brion Vibber
3cfc7d5df1 Remove duplicate file extensions from output messages
If a file type was added to $wgFileExtensions by both local configuration
and defaults in an extension (eg TimedMediaHandler and LocalSettings.php
both adding 'ogg' and 'ogv') it was being listed twice in the UI messages
listing acceptable types.

Runs array_unique() over the array on various outputs.

Bug: 54378
Change-Id: I14cd098d8b27099f8f803630535f33549740295c
2013-09-27 17:49:21 +00:00
Timo Tijhof
dc9c9ee7fc Title: Add byte class to unicode class conversion for js
The upcoming rewrite of mw.Title needs to use wgLegalTitleChars,
but for that to work, it needs to be converted into something
that can work in javascript.

Signed-off-by: Timo Tijhof <krinklemail@gmail.com>
Signed-off-by: David Chan <david@sheetmusic.org.uk>
Change-Id: I163f3d7e3a680d52640a93f4bd195d8209669918
2013-09-27 19:21:14 +02:00
umherirrender
6c38a5eb72 Fixed spacing in logging/parser/profiler/rl/revdel/search folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: I11bbcfa351e945b7bde10c2105d61a3cf5622205
2013-04-20 17:38:24 +02:00
umherirrender
7c9a49082c Use wfAppendQuery to append a query
Also pass a array to wfAppendQuery, which than does the urlencoding.

Prefer a wfScript() over the global or string

Change-Id: Icada534cb4c99c9441938a2e8dcbc11a142360c6
2013-04-12 07:31:52 +00:00
jrobson
43c7094647 Make ResourceLoaderStartupModule work on mobile
Change-Id: I795828ac05e2b71499db6a328004be4516849f7d
2013-03-29 14:26:03 -07:00
Alex Monk
c2c982c4e8 (bug 36537) Rename calls to wfArrayToCGI to wfArrayToCgi
Done with this command:
grep wfArrayToCGI * -R -l -Z | xargs -0 -l sed -i -e 's/wfArrayToCGI/wfArrayToCgi/g' && git checkout -- HISTORY

Change-Id: If7f4d4bfc199289c11c43cf519c2415a1aad1c51
2013-01-28 18:04:20 +00:00
Reedy
c34dc71896 Revert excessive indenting from 28433
Also remove indenting from else statement in the same block

Change-Id: I571880a4404fbc5a4804de9d3e2eb8f9d1501a37
2012-10-19 13:13:15 +00:00
Brion Vibber
4b3a426ae0 Work in progress on ResourceLoader mobilification
Goes along with MobileFrontend changes: https://gerrit.wikimedia.org/r/28434

Adds 'targets' option to module definitions, defaulting to 'desktop'.
Only a couple more modules are whitelisted into both desktop and mobile for now.

Startup module takes a 'target' parameter (defaults to 'desktop') to filter
the resource module registration list. Only modules matching the filter get
registered, and thus will be loadable from client-side RL.

Change-Id: Ifb772d4995b8e2ec4b63776fe0bb5b0214f82e04
2012-10-18 00:55:54 +00:00
Timo Tijhof
1f987fb5ee (bug 40448) Replace legacy mwsuggest with mediawiki.searchSuggest
The module has been broken for a while now, but nobody noticed
because in plain core it is disabled by default, and in the
bundle we ship with Extension:Vector (and its SimpleSearch).

This commit removed the mediawiki.legacy.mwsuggest module (and
related components that become obsolete with its deletion) and
replaces it with the new mediawiki.searchSuggest module, which is
based on SimpleSearch from Extension:Vector (where it will be
removed soon).

The following and all references to it in core have been removed,
I also made sure that they weren't used in any of extensions/*.
Only matches in extensions/Settings and some file that dumped the startup module, and in extensions/Vector which are addressed in
I1d5bf81a8a0266c51c99d41eefacc0f4b3ae4b76.

Had to make a few updates to jquery.suggestions to make it work
in other skins. So far it was only used in Vector, but now that
it is used in mediawiki.searchSuggest, I noticed several issues
in other skins. Most importantly the fact that it assumed the
default offset was from the right corner, which isn't the case in
Monobook where the search bar is on the left (in the sidebar).

It now detects the appropiate origin corner automatically, and
also takes directionality of the page into account.

It also uses the correct font-size automatically. Previously it
used font-size: 0.8; but that only works in Vector. Every skin
seems to have its own way of making a sane font-size. In Monobook
the <body> has an extra small font-size which is then fixed in
div#globalWrapper, and in Vector it is extra large, which is then
fixed as well deeper in the document. Either way, the size on
<body> can't be used, and since this suggestions box is appended
to the <body> (it is a generic jQuery plugin without knowledge of
the document, and even if we could give it knowledge inside
the configuration, it'd have to be per-skin). So I removed the
Vector specific font-size and let it handle it automatically.
This was needed because it is now used in all skins.

Removed modules:
* mediawiki.legacy.mwsuggest:
  > Replaced with mediawiki.searchSuggest.

Removed messages:
* search-mwsuggest-enabled
* search-mwsuggest-disabled
  > No longer used.

Removed mw.config.values:
* wgMWSuggestTemplate
  > Obsolete.

* wgSearchNamespaces
  > Obsolete.

Removed server-side settings:
* $wgEnableMWSuggest
  > Suggestions are now enabled by default and can be disabled
    through the user preference `disablesuggest` still.
    They can be disabled by default site-wide or hidden from
    prefs through the standard mechanisms for that.

* $wgMWSuggestTemplate
  > Obsolete.

Removed methods
* SearchEngine::getMWSuggestTemplate()
  > Obsolete.

Filters:
 $ ack mwsuggest -i -Q --ignore-dir=languages/messages
 $ ack wgSearchNamespaces -Q

Message changes:
* vector-simplesearch-preference
  > It was wrong, it didn't activate search suggestions, that
    was handled by the Vector extension. This preference in
    MediaWiki core controls whether the SimpleSearch bar HTML
    and CSS will be used (e.g. the rectangle search box with
    the magnifying class instead of the browser-default input
    field with the plain submit buttons).

* searchsuggest-search
* searchsuggest-containing
  These come from Extension:Vector message and should be imported
  by translatewiki:
  - vector-simplesearch-search
  - vector-simplesearch-containing

Change-Id: Icd721011b40bb8d2c20aefa8b359a3e45413a07f
2012-10-02 04:51:51 +02:00
robin
5165d83505 Make dates in sortable tables depend on page content language
Make javascript variables wgDefaultDateFormat, wgMonthNames and wgMonthNames, used to sort dates in tables, depend on the page content language.

Change-Id: I18a53ba004f3dd877e2d06ed722491167e31b473
2012-07-12 14:01:15 -04:00
Max Semenik
cd7923ac16 Introduced the concept of raw ResourceLoader modules
This is needed for mobile scripts that are supposed to work on dumb
devices and as such can't rely on client-side RL, but still can take
advantage of server-side minification and concatenation.

Patchset 2: Allow loading raw modules with &raw=true appended to URL.

Change-Id: I9410ffbf6633075e07bd06b10a98a4d12d9b6106
2012-05-16 01:03:12 +04:00
Alexandre Emsenhuber
7d9016943d Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: I1815587ab2eeb24623ce4bf1c695088bd3f1c2ea
2012-04-30 09:16:10 +02:00
umherirrender
a88a09d98f fix the call of count( $module->getDependencies() ) in startup (bracket
was wrong placed)

And by the way:
* store some result of getters in local variable and use it
* Title::newMainPage always returns an object
* rename a variable
* fix intendation for mw.loader.register call in debug mode

Change-Id: I083b4b61006493602b9345a822a96d538ef89f60
2012-04-14 12:41:49 +02:00
Krinkle
558e963735 Bug 34604 - [mw.config] wgActionPaths should be an object instead of a numeral array JavaScript 2012-02-23 02:45:45 +00:00
Krinkle
f6ddf76ce8 Removing wgLegacyJavaScriptGlobals from JavaScript output
* PHP config variable itself is still needed for sure, but not needed in JavaScript output. Did get into 1.18 (accidentally added to js output as part of r87856) but undocumented and unannounced.
2011-12-28 22:29:07 +00:00
Robin Pepermans
80a090ea72 * (bug 27721) Make JavaScript variables wgSeparatorTransformTable and wgDigitTransformTable depend on page content language so the sort script sorts correctly more often. It will e.g. sort according to the user language on special pages, where localised numbers are usually used.
* New JavaScript variable wgPageContentLanguage (independent from the bug, but I assume this var can be useful)
2011-11-28 20:53:26 +00:00
Sam Reed
5bd492d51c "else if" to "elseif" 2011-11-25 00:15:27 +00:00
Sam Reed
f8a0e34ca1 Documentation
Trim trailing whitespace

Make returns return values where appropriate (ie other paths in the same method do)
2011-10-14 08:06:54 +00:00
Roan Kattouw
f4f3107209 Fix the fixme on r88053: dependency handling was broken in debug mode in certain cases. More specifically, if A is a file module that depends on B, B is a wiki module that depends on C and C is a file module, the loading order is CBA (correct) in production mode but was BCA (wrong) in debug mode. Fixed this by URL-ifying scripts and styles for those modules in debug mode, as I said to on CR. What this means is that the initial debug=true request for a module will now always return arrays of URLs, never the JS or CSS itself. This was already the case for file modules (which returned arrays of URLs to the raw files), but not for other modules (which returned the JS and CSS itself). So for non-file modules, load.php?modules=foo&debug=true now returns some JS that instructs the loader to fetch the module's JS from load.php?modules=foo&debug=true&only=scripts and the CSS from ...&only=styles .
* Removed the magic behavior where ResourceLoaderModule::getScripts() and getStyles() could return an array of URLs where the documentation said they should return a JS/CSS string. Because I didn't restructure the calling code too much, the old magical behavior should still work.
* Instead, move this behavior to getScriptURLsForDebug() and getStyleURLsForDebug(). The default implementation constructs a single URL for a load.php request for the module with debug=true&only=scripts (or styles). The URL building code duplicates some things from OutputPage::makeResourceLoaderLink(), I'll clean that up later. ResourceLoaderFileModule overrides this method to return URLs to the raw files, using code that I removed from getScripts()/getStyles()
* Add ResourceLoaderModule::supportsURLLoading(), which returns true by default but may return false to indicate that a module does not support loading via a URL. This is needed to respect $this->debugRaw in ResourceLoaderFileModule (set to true for jquery and mediawiki), and obviously for the startup module as well, because we get bootstrapping problems otherwise (can't call mw.loader.implement() when the code for mw.loader isn't loaded yet)
2011-09-13 17:13:53 +00:00
Krinkle
ef927d3904 Remove wgProto from mw.config
* Introduced in r82575 spontaneously, but was never used.
* It was removed from PHP by Tim in r90193, who gracefully kept a work-around in place to still have a protocol available in mw.config.
* Since it was new in JS in 1.18 (which hasn't been released yet), I suggest we take it out right away, especially because the PHP counterpart has been deprecated as well. No release notes needed.
2011-09-09 01:03:27 +00:00
Krinkle
cc21627b4d [ResourceLoader 2]: Add support for multiple loadScript sources
Front-end:
* New mw.loader method: addSource(). Call with two arguments or an object as first argument for multiple registrations
* New property in module registry: "source". Optional for local modules (falls back to 'local'). When loading/using one or more modules, the worker will group the request by source and make separate requests to the sources as needed.
* Re-arranging object properties in mw.loader.register to match the same order all other code parts use.
* Adding documentation for 'source' and where missing updating it to include 'group' as well.
* Refactor of mw.loader.work() by Roan Kattouw and Timo Tijhof:'
-- Additional splitting layer by source (in addition to splitting by group), renamed 'groups' to 'splits'
-- Clean up of the loop, and removing a no longer needed loop after the for-in-loop 
-- Much more function documentation in mw.loader.work()
-- Moved caching of wgResourceLoaderMaxQueryLength out of the loop and renamed 'limit' to 'maxQueryLength

Back-end changed provided through patch by Roan Kattouw (to avoid broken code between commits):
* New method in ResourceLoader: addSource(). During construction of ResourceLoader this will be called by default for 'local' with loadScript property set to $wgLoadScript. Additional sources can be registered through $wgResourceLoaderSources (empty array by default)
* Calling mw.loader.addSource from the startup module
* Passing source to mw.loader.register from startup module
* Some new static helper methods

Use:
* By default nothing should change in core, all modules simply default to 'local'. This info originates from the getSource()-method of the ResourceLoaderModule class, which is inherited to all core ResourceLoaderModule-implementations (none override it)
* Third-party users and/or extensions can create new classes extending ResourceLoaderModule, re-implementing the getSource-method to return something else.

Basic example:
$wgResourceLoaderSources['mywiki'] = array( 'loadScript' => 'http://example.org/w/load.php' );
class MyCentralWikiModule extends ResourceLoaderModule {
	function getSource(){
		return 'mywiki';
	}
}
$wgResourceModules['cool.stuff'] => array( 'class' => 'MyCentralWikiModule' );

More complicated example
// imagine some stuff with a ForeignGadgetRepo class, putting stuff in $wgResourceLoaderSources in the __construct() method
class ForeignGadgetRepoGadget extends ResourceLoaderModule {
	function getSource(){
		return $this->source;
	}
}

Loading:
Loading is completely transparent, stuff like $wgOut->addModules() or mw.loader.loader/using both take it as any other module and load from the right source accordingly.


--
This commit is part of the ResourceLoader 2 project.
2011-07-26 21:10:34 +00:00
Sam Reed
16842c0b73 Swap else if for elseif
Trimming trailing whitespace also

Doing in 3 commits (2/3), so hopefully reviewable in CR...
2011-06-17 16:05:05 +00:00
Krinkle
0e02d2f4cb (bug 29441) Expose CapitalLinks config in JS to allow modules to properly handle titles on case-sensitive wikis.
This brings us one step closer towards:
(bug 29397) Implement mw.Title module in core
2011-06-16 21:20:05 +00:00
Krinkle
7ff6dda4cd Revert r90232. 2011-06-16 21:18:40 +00:00
Krinkle
8f2c463b25 Implement mw.Title in core
* Based on UploadWizard/resources/mw.Title.js
* Refactored to use local scope and prototypes instead of per-instance private scope (less references, faster instantiation)
* Fix potential ReferenceError in the check for wgArticlePath (inline if statements will fail to evaluate for undeclared variables). Using mw.config instead
* The following were not ported because they are or were already redundant and/or merged with another method:
-- setNameText (redundant with the improved setName)
-- setPrefix (redundant wit the improved setNamespace)
* Ported all jasmine tests to QUnit. Left them exactly the same to make sure it's compatible with UploadWizard. Perhaps I'll expand or adjust the suite later to be less file-specific, but for now make sure it's compatible and the same.



@todo FIXME

* Removed assumption that every title has a namespace prefix in it by creating a separate RegExp when there is a namespace given 

** Fixes strip-bug in cases where a namespace appears to be part of a title when the namespace is also given: "Project:User:Foobar"

new mw.Title( 'User:Foobar', 4 ).toString()
> 'Project:Foobar'

** Fixes a thrown exception in case a colon is part of the title (colons are valid in MediaWiki pagenames!)

new mw.Title( 'Just some:Random page')
> Error: mw.Title> Unrecognized canonical namespace: just_some

* Added check for capitalLinks et (wasn't possible before due to bug X)

** Prevents breakages on wiktionary and other wikis with case sensitivity.
2011-06-16 21:16:50 +00:00
Tim Starling
9420ff446e Removed $wgProto. Previously, setting this undocumented global variable to anything other than the part of $wgServer before the first colon would cause various things to subtly screw up. Similarly, forgetting to set it when you override $wgServer in LocalSettings.php would break things too.
Exposing it in the default LocalSettings.php as I did in r90105 was not a good solution, really the only way to avoid breakage is to just get the protocol from $wgServer whenever you need the protocol.

Fixed $wgCookieSecure so that it will be enabled automatically if the user sets $wgServer to an https URL in LocalSettings.php. Added documentation for other cookie-related globals.

Grep indicates that $wgProto is not used by any extensions. $wgCookieSecure is used, hence the need for the Setup.php patch.
2011-06-16 05:13:29 +00:00
Krinkle
33e3d23c56 Merge conflict fix from r90096. 2011-06-14 22:51:47 +00:00
Krinkle
b3621a2826 wgNamespaceIds in JavaScript didn't include canonical namespaces. Adding them to it, in a similar way that Language->getNamespaceIds does it for the localized namespaces and the namespace aliases.
Fixes bug in mw.Title constructor when .setNamespace() is used with a canonical namespace on a non-English content-language wiki.
Example: On a German wiki "var foo = new mw.Title('bar').setNamespace('file')" will throw an Error, as wgNamespaceIds only contains localized namespaces + namespace aliases, not canonical ones (in contrary to the assumption that has been made in various places).

(bug 25375) Add canonical namespaces to JavaScript "wgNamespaceIds"
2011-06-14 22:49:38 +00:00
Roan Kattouw
674e20d91f (bug 29224) Also use a packed modules string for the startup modules (usually there's only one, but there's a hook to add more) 2011-06-01 13:51:50 +00:00
Sam Reed
16c194d0ae Fixup/add documentation
Remove trailing whitespace
2011-05-21 17:45:20 +00:00
Tim Starling
6fec4e3fde Revert r87635, r87637, r87639, r87643 (MW_MIN_PHP_VERSION etc.): breaks HipHop support. 2011-05-15 13:21:16 +00:00
Krinkle
49ce5de7d9 Creating a way to toggle mw.config LEGACY_GLOBALS from LocalSettings (bug 28916).
* I thought a while for a way to somehow get that global variable from php to the start of the main mediaWiki object creation. Considered using a (temporary) global variable and deleting afterwards, but that looked like a hack and wasn't sure about the cross-browser functioning of it. Instead ended up by moving it to the startUp module where other global variables are accessed as well. This seems to work pretty good.

* Can be toggled from LocalSettings by setting $wgLegacyJavaScriptGlobals.
* Changed some usages of mediaWiki to use the global mw alias instead.
2011-05-10 23:17:13 +00:00
Happy-melon
fd34d0354b * Implement MW_VERSION constant in Defines.php and use it in preference to $wgVersion. Defines.php will have been loaded anywhere that DefaultSettings.php has been loaded.
* Move the declaration of $wgFeedClasses from Defines.php to WebStart.php
2011-05-07 14:53:08 +00:00
Roan Kattouw
f56afa36a6 (bug 28738) Implement request splitting in mw.loader so ResourceLoader requests with query strings longer than a certain value are split up. The maximum query string length is configurable, and this behavior is disabled by default. It's needed in rare cases where there is a query string length or GET variable length limit in place that the wiki admin can't raise. 2011-05-01 18:41:42 +00:00
Nimish Gautam
61347cecbe added wgCookiePrefix to exported variables 2011-04-21 00:06:21 +00:00
Leo Koppelkamm
77e1e201f6 Followup r86088 per CR: Move month array builder into language; use mw.config.get(); Fix rowspans and some cleanup 2011-04-18 12:54:28 +00:00
Leo Koppelkamm
7d6ddfe836 Completely rewritten table sorting script.
Fixes Bug 8028, Bug 8115, Bug 15406, Bug 17141, Bug 8732

1. Sites can specify custom collations.
The script accepts an object "tableSorterCollation" which contains a lookup
table, how specific characters should be treated.
For example, after setting "tableSorterCollation={'ä':'ae', 'ß':'ss'};" in the
site's common.js any string containing an ä or Ä will be sorted as if it were a
'ae'.

2. Table rows can be forced to use a specific data type.
By setting class="sort-{Parsername}", the row will be parsed with the specified
algorithm. class="sort-date" would force date sorting etc.
The following parsers are available: text, IPAddress, number, url, currency,
date, isoDate, usLongDate, time

3. Execution time is reduced by half or more.

Sorting a 935 row * 8 columns table:

Browser     Before      After
--------    ------      -----
Chrome 10   90ms        42ms
Safari 5    115ms       48ms
Firefox 4   412ms       87ms
IE8         720ms       115ms

4. Based on the content language and the mdy vs dmy preference, the parser can
understand dates such as "17. März '11". wgMonthNames=[] and
wgMonthNamesShort=[] 
in the content language and the mdy vs dmy preference are exported to js; A
table containing the following dates would be sorted correctly:
17. Jan. 01
23 Feb 1992
9.02.05
13 November 2001
14 Oktober '76

Was tested in ie6-8, chrome, safari 5, ff3 & ff4
2011-04-14 21:47:00 +00:00
Sam Reed
757750dcac Remove getFlip code duplication
Move usual one into ResourceLoaderModule, and then move what was in ResourceLoaderModule into ResouceLoaderFileModule
2011-03-25 11:15:40 +00:00
Roan Kattouw
61195f5374 Per CR, remove round() call I accidentally reintroduced in r84401 2011-03-20 19:53:46 +00:00
Roan Kattouw
743026d69c (bug 26805) Introduce ResourceLoaderGetStartupModules hook to allow extensions to add modules to the startup set (normally this is jQuery and mediawiki). Applied patch by Michael Dale, with minor style tweaks 2011-03-20 17:15:51 +00:00
Roan Kattouw
1ce0c189ee Followup r84399: remove another round() call 2011-03-20 17:10:48 +00:00
Roan Kattouw
8d2ed2207a Remove stray round() call, rounding of timestamps was removed some time ago. Thanks to Michael for pointing this one out 2011-03-20 17:08:38 +00:00
Krinkle
e12336c269 Add missing to mw.config 2011-02-21 21:24:09 +00:00
Krinkle
e89aab93a3 mw.loader.implement now calls script without setting mw to mediaWiki since this is already globally avaiable
* Also shortens a few wrapper functions the same way
* Partial revert of r82496. Apparantly mw-alias is not available in startUp module. TODO: Find out why ?

(See also r82496 commit message)
2011-02-19 23:52:11 +00:00
Krinkle
b2378a694c Using the mw alias for mediaWiki in core. Saves bandwidth and makes sense (there's no point in a wrapper function for ($,mw) if we use jQuery and mediaWiki inside of it).
TODO: Since the alias is globally available from the start, the 'mw' argument in the wrapper is redundant, so that should be removed at some point as well.
2011-02-19 22:59:44 +00:00
Sam Reed
c0830dd868 2 subclasses of ResourceLoaderWikiModule implement a duplicate version of getFlip. Move it up into ResourceLoaderWikiModule
(Almost looks like it could all go into ResourceLoaderModule... But that uses a different version, seemingly, the only one. 3 other subclasses of ResourceLoaderModule implement the same version of getFlip as is moved into a parent class here... Seems daft to have a different version in the base abstract class... Minor oversight?)

Some documentation
2011-02-18 00:33:45 +00:00
Roan Kattouw
f5533b0c98 Per Philip Tzou, move wgUserVariant from the set of config variables to the set of pageview-specific variables, because it depends on user settings and such 2011-02-16 17:06:24 +00:00
Roan Kattouw
ab5c4d69ca Expose $wgExtensionAssetsPath in JS 2011-02-16 14:28:26 +00:00
Sam Reed
e42253eb45 Minor documentation tweaks/improvements 2011-02-08 23:09:22 +00:00
Krinkle
a972a4c2de Obviously no need for a foreach loop here. (Follow-up r80790) 2011-01-23 02:22:27 +00:00
Krinkle
db27c3b0dd adding available skins to mw.config.values 2011-01-23 02:19:58 +00:00
Bryan Tong Minh
de79cb9cde Follow-up r79867: Read out EXIF orientation in JavaScript and rotate accordingly. Added JsJpegMeta library by Ben Leslie under the MIT license.
* Added JS variabele wgFileCanRotate. If anybody knows a way to make certain variables only available to certain modules, please tell me, could not find it.
* Added JsJpegMeta as mediawiki.util.jpegmeta
* Made BitmapHandler::getScaler and BitmapHandker::canRotate static
* Bumped style version
2011-01-22 22:34:36 +00:00
Roan Kattouw
41518a86b7 Coerce mtimes to TS_UNIX before outputting them, and fix a wrong timestamp format in ResourceLoaderUserModule. This should fix bug 26704 2011-01-13 14:42:19 +00:00
Roan Kattouw
3a241d498a Fix issue with missing keys in $wgFileExtensions caused by an array_diff() somewhere. Doesn't seem needed on any of the other vars at first glance 2011-01-12 20:58:36 +00:00
Roan Kattouw
7de66bd84f Add a hook for registering variables in ResourceLoaderStartUpModule::getConfig() to complement MakeGlobalVariablesScript 2011-01-09 11:44:52 +00:00
Tim Starling
ccfe5ad97b Fix for bug 26561: clickjacking attacks. See the bug report for full documentation. 2011-01-04 06:12:33 +00:00