Commit graph

80 commits

Author SHA1 Message Date
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