Commit graph

111 commits

Author SHA1 Message Date
Ori.livneh
2b6eb60ce5 Revert "Optimize order of styles and scripts"
The patch did not improve performance. I'd like to think that the increased
control over when inline scripts are executed makes the patch worthwhile
regardless, but that is post hoc justification and possibly a bit of personal
ego. Krinkle agrees that we may use some of the ideas in this patch in the
future but he thinks we're better off not heading down this path before we
have a better sense of where we're going, and I trust his judgment.

This reverts commit e86e5f8460.

Change-Id: I151f74a41dd664b5a0aa5cfd99fcc95e2686a1e6
2015-03-25 04:40:46 +00:00
Ori Livneh
e86e5f8460 Optimize order of styles and scripts
The current ordering of scripts and stylesheets in <head> causes all major
browsers to serialize and defer requests that could be performed in parallel.

The problem is that external stylesheets are loaded before inline scripts. As
Steven Souders explains, "all major browsers preserve the order of CSS and
JavaScript. The stylesheet has to be fully downloaded, parsed, and applied
before the inline script is executed. And the inline script must be executed
before the remaining resources can be downloaded. Therefore, resources that
follow a stylesheet and inline script are blocked from downloading."[1]

In other words: the browser could start loading body images, but it refuses to
do that until it has executed inline scripts in head. And it refuses to execute
those scripts until the external CSS is downloaded, parsed and applied. You can
see the effect of this in this image, showing the request waterfall for
[[en:Gothic Alphabet]]: [2]. Notice how no images were requested before the
browser had finished processing the three load.php requests at the top.

To fix this, we want to move the inline scripts above the external CSS. This is
a little bit tricky, because the inline scripts depend on mw.loader, which is
loaded via an external script. If we move the external script so that it too is
above the external stylesheet, we force the browser to serialize requests,
because the browser will not retrieve the external CSS until it has retrieved
and executed the external JS code. So what we want is to move the inline
scripts above the external stylesheet, but keep the external script (which the
inline scripts depend on) below the external stylesheet.

We can do this by wrapping the inline script code in a closure (which binds
'mw') and enqueuing the closure in a global array which will be processed by
the startup module at just the right time.

Net result: external CSS and JS is retrieved in parallel, retrieval of images
(and other external assets) is unblocked, but the order in which code is
evaluated remains the same.

[1]: <http://www.stevesouders.com/blog/2009/05/06/positioning-inline-scripts/>
[2]: <http://people.wikimedia.org/~ori/enwiki-waterfall.png> (excerpted from
 <http://www.webpagetest.org/result/150316_0C_7MB/1/details/>.

Change-Id: I98d383a6299ffbd10210431544a505338ca8643f
2015-03-17 03:10:49 +01:00
Chad Horohoe
aa21e125a3 Remove obvious function-level profiling
Xhprof generates this data now. Custom profiling of various
sub-function units are kept.

Calls to profiler represented about 3% of page execution
time on Special:BlankPage (1.5% in/out); after this change
it's down to about 0.98% of page execution time.

Change-Id: Id9a1dc9d8f80bbd52e42226b724a1e1213d07af7
2015-01-07 11:14:24 -08:00
jenkins-bot
665eaa175d Merge "Set mw.config wgFileExtensions only on Upload instead of site-wide" 2014-12-30 18:14:45 +00:00
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