Commit graph

270 commits

Author SHA1 Message Date
Nikerabbit
2759e2a5ef Merge "Fixed dependencies for jquery.collapsibleTabs" 2012-10-19 19:38:14 +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
Marius Hoch
8845c48d5a Fixed dependencies for jquery.collapsibleTabs
Added jquery.delayedBind as dependency for jquery.collapsibleTabs
as it's used on line 29.

This wasn't causing errors (at least I'm not aware of it causing errors),
but still it's better to have all dependencies declared.

Change-Id: Iaff2ee952822d1be9a91fc7b8634a63ac61f8252
2012-10-17 17:16:33 +02:00
Brion Vibber
966cda2f80 Initial stab at responsive images for screen densities.
* adds $wgResponsiveImages setting, defaulting to true, to enable the feature
* adds 'srcset' attribute with 1.5x and 2x URLs to image links and image thumbs
* adds jquery.hidpi plugin to check pixel density and implement partial 'srcset' polyfill
** $.devicePixelRatio() returns window.devicePixelRatio, with compat fallback for IE 10
** $().hidpi() performs a 'srcset' polyfill for browsers with no native 'srcset' support
* adds mediawiki.hidpi RL script to trigger hidpi loads after main images load

Note that this is a work in progress. There will be places where this doesn't yet work which output their imgs differently. If moving from a low to high-DPI screen on a MacBook Pro Retina display, you won't see images load until you reload.

Confirmed basic images and thumbs in wikitext appear to work in Safari 6, Chrome 21, Firefox 18 nightly on MacBook Pro Retina display, and IE 10 in Windows 8 at 150% zoom, 200% zoom, and 140% and 180%-ratio Metro tablet sizes.

Internally this is still a bit of a hack; Linker::makeImageLink and Linker::makeThumbLink explicitly ask for 1.5x and 2x scaled versions and insert their URLs, if different, into the original thumbnail object which (in default handler) outputs the srcset. This means that a number of places that handle images differently won't see the higher-resolution versions, such as <gallery> and the large thumbnail on the File: description page.

At some point we may wish to redo some of how the MediaHandler stuff works so that requesting a single thumbnail automatically produces the extra sizes in all circumstances. We might also consider outputting a 'srcset' or multiple src sizes in 'imageinfo' API requests, which would make ApiForeignRepo/InstantCommons more efficient. (Currently it has to make three requests for each image to get the three sizes.)

Change-Id: Id80ebd07a1a9f401a2c2bfeb21aae987e5aa863b
2012-10-11 10:54:21 -07:00
Alexandre Emsenhuber
01f11f8e98 Improve documentation of maintenance scripts and test suite.
Change-Id: If5d695dc3665635fbed73a713583c0b03c14ebb1
2012-10-02 22:24:33 +02: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
Trevor Parscal
8016a0d162 Merge "mediawiki.action.edit.preview: New module replacing preview.js" 2012-09-25 18:49:23 +00:00
Siebrand
24f2539241 Merge "Remove all custom plural rules and use CLDR plural rule system" 2012-09-21 22:45:42 +00:00
Timo Tijhof
4d4bfc27a1 mediawiki.action.edit.preview: New module replacing preview.js
With all the recent improvements, it's time this module got
promoted away from legacy. Its no longer just an old script to
that provides preview functionality and is minimally
maintained within "legacy", its reborn!

Minor clean up follows-up:
* e75054174c
* b12dc64a11

Change-Id: I85ca97a1d8df25a09baad78030d6da379a06c0f1
2012-09-21 16:47:30 +02:00
helder.wiki
a88fd2501d (bug 40415) Add missing dependencies for some modules
* "mediawiki.user" depends on "user.options" and "user.tokens"
* "mediawiki.action.view.dblClickEdit" depends on "mediawiki.page.startup"

Change-Id: I5ef5e4ab68ff1a472d2aebcea474e3fd76e510fe
2012-09-21 05:05:13 +02:00
Santhosh Thottingal
575db10b96 Remove all custom plural rules and use CLDR plural rule system
We have a data driven plural rule evaluation system in core now.
See I1aa3b081

Added more tests

(This was I4451fc7d and reverted because javascript references
 were not removed from Resources.php)

Change-Id: I57c3c238c0717664384da50aa2cbfa74369d7a55
2012-09-20 10:49:11 -07:00
Timo Tijhof
e9186da841 Pass JSHint on resources/{mediawiki.api,jquery,mediawiki}/*
Notes:
* JSHint stuff
* Code conventions
* jQuery best practices
* mediawiki.debug:
  - Append a text node instead of html. Though .append()
    does check if it looks "like" not-html and creates a text
    node, this is not more a sanity/security thing than a
    reliable documented feature. http://api.jquery.com/append/ :
    "HTML string, DOM element(s) or jQuery object".

While at it:
* Update .jshintignore to also cover:
  - resources/mediawiki.libs/CLDRPluralRuleParser.js
* Update .jshintrc to set onevar back to true (was set to false
  temporarily but not removed).
* Fix files in resources/mediawiki and resources/jquery as well.
  These dirs where already covered, perhaps these were missed or
  recently introduced, again.
* Add missing dependencies:
  jquery.highlightText -> jquery.mwExtension ($.escapeRE)
  jquery.tablesorter -> jquery.mwExtension ($.escapeRE)
  mediawiki.page.watch.ajax -> jquery.mwExtension ($.escapeRE)

Change-Id: I30a55717d0963ce23e51cef1f1df9e549e4c232e
2012-09-03 23:44:08 +02:00
Krinkle
9a5695d4c1 Merge "[mw.notification] Introduce a full fledged notification system into core replacing jsMessage." 2012-09-02 19:27:42 +00:00
Daniel Friesen
d7847099a1 [mw.notification] Introduce a full fledged notification system into core replacing jsMessage.
- Support for multiple messages instead of just one is included.
- Persistent messages are also supported.
- Tagged message replacement is supported so that only one message of a type will show up at once.
- A light flood protection is included to stop all the notifications from disappearing at once.
- Watchlist uses it's own tag now.
- Legacy jsMessage messages still replace each other by using a tag: 'legacy' option
- #mw-js-message was an old id used for something with a completely different style. So rather than re-using it that id is being dropped. Skins can now style the new notifications.
- Core is no longer using messageBox and no extension uses it so instead of making a compatibility layer for it that module is just being dropped.

This is a follow up to I41c70d78.

Change-Id: I2b3d9cbce6d1514d754b4403ec878d89ea6af29d
2012-09-02 21:25:10 +02:00
MatmaRex
e75054174c LivePreview: properly use jquery.form (as dependency)
... instead of just using two outdated functions copied from there god knows when.

Change-Id: Ifcc7e7c51cf20b3b93e4b16bd9ba55dfe45b445c
2012-09-01 16:20:16 +02:00
Hoo man
260c1f48ed Adding ResourceLoader module "jquery.jStorage"
Adding jStorage from http://www.jstorage.info/ to MediaWiki
It's MIT-style licensed and useful for local caching of data.

Adding to .jshintignore since it is a third party library.

Change-Id: I2343744304191d5846cf346e4ac6ca083a6414b3
2012-08-27 19:48:31 +02:00
Niklas Laxström
405518b8d9 Adding JavaScript CLDR plural parser.
The JavaScript code of the parser was written by Santhosh.
The original project is hosted at GitHub:
https://github.com/santhoshtr/CLDRPluralRuleParser

Introduces resourceloader modules: mediawiki.cldr and
mediawiki.libs.pluralruleparser.

hi.js and ar.js removed since it has only convertPlural method. More [lang].js
needs to remove convertPlural, but not done in this commit.

The actual rules will be taken straight from CLDR and they are not
integrated in this commit yet.

Change-Id: I1aa3b081f4dad68515fd6cd46e4ab2dbdb3291eb
2012-08-23 12:21:54 +05:30
Alex Monk
65062d3c05 (bug 38151) Implement mw.user.getRights and getGroups
* Also deprecate name() and anonymous()
  in favour of getName() and isAnon() (to match User.php), just
  like getRights and getGroups are now as well.

* Added unit tests for all.

Change-Id: I5970be9e8593589018152f4878f168b9b85ca5d5
2012-07-31 21:13:20 -07:00
Krinkle
e676c6953f Merge "Revert "AJAXify watchlist editor"" 2012-08-01 03:19:28 +00:00
Krinkle
6f6b786d90 Revert "AJAXify watchlist editor"
Doesn't properly work on Special:EditWatchlist, some of the titles being unwatched are not fading out and staying behind.

There's also a small code quality issue unaddressed. Please re-submit for further review.

This reverts commit b46ec8fde5
2012-08-01 03:19:12 +00:00
Catrope
125d6d5fec Merge "AJAXify watchlist editor" 2012-08-01 00:24:46 +00:00
Eranroz
b46ec8fde5 AJAXify watchlist editor
This patch makes the watchlist editor to use pagination. That would
avoid old browsers crashing (bug 20483).
Patch also add some AJAX operations to the editor, for example to remove
items from watchlist (bug 32151).

The AJAX support is an ALTERNATIVE to the form based method, to keep
support for non javascript users.

This change contains a required change in the API for watch operation,
to allow batch operation, by support titles parameter. The old title
(single page) parameter is still used to keep backward compatibility.

Change-Id: I1d8c66db9ba6456858ef655397935a2b3a421632
2012-07-31 00:47:36 +03:00
Andrew Garrett
f239fb3905 Clean up badger.{css,js} from PageTriage, generalise it and move it into core.
Change-Id: I0f5e754146359448eb125456e240cf5768d4f541
2012-07-30 14:41:37 -07:00
Reedy
2ce8852245 Ugrade jQuery UI to 1.8.22
http://blog.jqueryui.com/2012/07/jquery-ui-1-8-22/

Change-Id: I770ca9eaae180dbac8ac785113a5787b71acc67d
2012-07-26 23:57:02 -07:00
Timo Tijhof
0452a5c167 mw.toolbar: Clean up the API of the classic toolbar.
* Several methods were added here recently during 1.20 development
  that should not have been public methods.

* Also in the creation of this new module (replacing the old
  mwCustomEditButtons) a design flaw was made. Instead of using
  a key-value pair object, the signature was changed to a tentacle
  function with 7 (for callers, unnamed) arguments.

* Changed it back with the compatibility fix the other way around.
  So everything is backwards compatible.

* Moved to local scope:
 - buttons queue
 - $toolbar
 - insertButton
 These were recently introduced during 1.20 development but not
 meant to be public. When used too early or too late from outside
 the module it will break or be ignored. For example $toolbar is
 false before dom ready, buttons queue is ignored after domready,
 insertButton will break if called before dom ready because the
 target element doesn't exist yet. These are not bugs, but result
 of calling internal methods before they are initialized.
 The public API takes care of these state differences by using
 the queue and the dom ready handler.

 Scripts should (and do) only use the addButton API.

* Kept:
 - addButton
 - insertTags
 - init (empty b/c function, was already there)

* Improved:
 - addButton: Now takes an object as well, just like
   mwCustomEditButtons used to do.
 - Cache Array.prototype.slice instead of re-grabbing from
   a new dummy array.
 - Store buttons[i] in a local variable in both cases, not just
   for legacy. Saves 2 property lookups. Minor gain, but
   in this case it was already going to be stored in a local
   variable, so might as well do it in the other case.

* Fixes:
 - Clear queue array after it has been used. Though in practice
   it should never happen that it is iterated over twice, just in
   case.
 - Added comment to init() function explaining where it is used.
 - Updated closure arguments per code conventions.
 - Made it a position-top module so that it actually can be used
   before the document is ready.

* Example usages tested:
<code>
// Legacy way from wikibits.js:
// Has to be done before document ready
window.mwCustomEditButtons[window.mwCustomEditButtons.length] = {
  imageFile: 'http://placehold.it/23x22',
  speedTip: 'tool tip',
  tagOpen: 'x-',
  tagClose: '-y'
};

// mw.toolbar: List of arguments
mw.toolbar.addButton( 'http://placehold.it/23x22', 'tooltip', 'x-', '-y' );

// mw.toolbar: Object
mw.toolbar.addButton({
  imageFile: 'http://placehold.it/23x22',
  speedTip: 'tool tip',
  tagOpen: 'x-',
  tagClose: '-y'
});
</code>

Change-Id: Id19819707c937c2c3144ad8177b75baa46f5073c
2012-07-21 17:04:46 -07:00
Timo Tijhof
ee1b4f2eaa (follow-up) Fix "file not found" error in mediawiki.language.
* Follows-up f47dfe9939, which forgot
  to remove the deleted files from the module definition as well.

exception 'MWException' with message 'ResourceLoaderFileModule::readScriptFiles: script file not found: "~/Development/mediawiki/core/resources/mediawiki.language/languages/nl.js"' in ~/Development/mediawiki/core/includes/resourceloader/ResourceLoaderFileModule.php:564
Stack trace:

Change-Id: Ib40d09071ba315da6b17fc94cca5746ed4c26342
2012-06-22 22:23:10 +02:00
Catrope
c62cc318d9 Alias mw.action.watch.ajax to mw.page.watch.ajax
This module was recently renamed, and we'll need the alias for caching
reasons

Change-Id: Ic0df459dfc1cca58f4e01325375c20c46091c89b
2012-06-21 11:26:15 -07:00
Rob Moen
2e089a4e58 Move action.watch to a more suitable place and expose updateWatchLink
method in mw.page.watch.  Update method to toggle watch, unwatch
list item id attribute.
Patchset 2- Expose method with less code duplication, restore
comments, cleanup whitespace.
Patchset 3-5 Whitespace cleanup
Patchset 6 - Trigger a watch event on the updated li
Patchset 7 - Only trigger watch event if not updating
state, announce opposite of icon action, to properly
indicate action taken.
Patchset 8 - Cleanup spacing and comments issues,
change event namespace.
Patchset 9 - actually add the change
Change-Id: I591f9f847db391c5d1477dc2ed41de54ec266261
2012-06-20 12:56:50 -07:00
Siebrand
f2e6488dd8 Merge "(bug 34933) Create "Check: [All] [None]" buttons with JavaScript" 2012-06-15 13:12:55 +00:00
Siebrand
abc2de3145 Merge "Custom grammar rules in javascript for some languages" 2012-06-12 11:54:08 +00:00
Reedy
48e81851e8 jQuery UI 1.8.21
http://blog.jqueryui.com/2012/06/jquery-ui-1-8-21/

Change-Id: Ie389a7275396ac4e5c9e41c2e18e1beae3e43c66
2012-06-09 15:29:30 +01:00
awjrichards
c29fd59775 Big oops - merged to wrong branch.
Revert "Revert to arbitrarily old point before initial remote branch creation to help clean up"

This reverts commit ee0d3d330f
2012-06-05 22:58:54 +00:00
Santhosh Thottingal
7c680ba0dc Custom grammar rules in javascript for some languages
Splitted from https://gerrit.wikimedia.org/r/4554
Grammar rules ported to js based on the php code.
Depends on the javascript Grammar parsing support by jqueryMsg

Change-Id: I701954a623467bf6c9abd3160e239c59cab567e9
2012-06-04 14:49:35 +05:30
awjrichards
ee0d3d330f Revert to arbitrarily old point before initial remote branch creation to help clean up
Change-Id: I41a3d1e55d3ea9dffa42451237fe065f9334361d
2012-06-02 08:43:04 -07:00
Timo Tijhof
3fc0174d64 Clean up Resources.php
* Trailing whitespace
* Array-usage similar to rest of file

Change-Id: I08908af2541750cb28474d1209d80ea6072b77cf
2012-06-05 16:08:52 +02:00
Santhosh Thottingal
4c6c50f206 Reverse the dependency for mediawiki.language.data
* Previously mediawiki.language.data depended on mediawiki.language,
  making any module using langauge data having to explicitly define
  it as a dependency. This is not good. We should abstract the data
  generation part and for the users of the module.
  mediawiki.language should take care of having the required data.

* So, reversing the dependency so that mediawiki.language depends on
  mediawiki.language.data. Then a simple dependency declaration with
  "mediawiki.language" is enough to have associated data available.

This supersedes change set I810fb0a5

Change-Id: Iede836bb3e2fd700cb7c58caeebe9ec2e0043dfb
2012-06-05 15:54:27 +02:00
Liangent
d0548f775e (bug 34933) Create "Check: [All] [None]" buttons with JavaScript
This hides unusable buttons for users without JavaScript support.

Change-Id: I5c5752a75993218c5d62604224640ad8435f8b3e
2012-05-17 13:04:41 +08:00
Kaldari
e2e1cbe1a4 Changing HD threshold to 1000px per request.
Apparently iPhone and iPad use 980px width and the new layout doesn't
give enough room to the content area according to Heather.

Patchset 2: adjusting per comment
Change-Id: Ie6b0474f285366d0bfedb6393d1d6f65b55fc604
2012-05-11 14:13:48 -07:00
Catrope
c47bd7668b Merge "Remove 'jquery.ui.button' as dependency for mediawiki.action.history" 2012-05-09 22:43:45 +00:00
Timo Tijhof
617b159672 Remove 'jquery.ui.button' as dependency for mediawiki.action.history
- Follows-up 91c38e63da
  which last updated this module after which jquery.ui was no longer
  used.

Change-Id: If8c6b64ca76dd4c03e8c65145efba30e579e39a8
2012-05-09 05:08:26 +02:00
Timo Tijhof
6540260001 (bug 36669) Installer CSS outdated
Change-Id: I7ac606f2e8538eb5fd10a3944cf9d8b42bbc5ed5
2012-05-09 02:20:03 +02:00
Trevor Parscal
04045b71ac (bug 36047) Adds high definition (HD) CSS for the Vector skin
This patch adds a high definition (HD) style sheet for vector which adjusts
various margin and padding properties to give the page a less crammed-
together feel. All properties transition over 250ms and only activated if
the browser is 900px wide or greater. This size should work well for 1024px
wide screens sans scroll bar, window borders, space around browser, etc.

Change-Id: I85fc70e324b3b93c943efcc827eefdfb3bda7fdf
2012-04-18 15:23:25 -07:00
Santhosh Thottingal
931c31c7bd (bug 33658) support for {{GRAMMAR:}} in jqueryMsg
This add GRAMMAR support to the mediawiki.jqueryMsg module:

1. make jqueryMsg understand GRAMMAR(case insensitive)
2. mw.language get convertGrammar, can be overridden per language as in
   php
3. Introduce resourceloader module ResourceLoaderLanguageDataModule
4. Language.php get a method to filter wgGrammerForms for the current
   contentLanguage.
5. Qunit tests
6. This code was originally written in jsgrammar branch of svn and had
   reviewed during the last slush time.

Change-Id: I90dd0b2f0cb30fd30539896c292829adc4fc7364
2012-04-10 11:47:39 +02:00
Reedy
522814502d Bug 35681 - Upgrade jQuery UI to 1.8.18
http://blog.jqueryui.com/2012/02/jquery-ui-1-8-18/

Change-Id: I31e870279e239733437c7222c5e69be112e8aba1
2012-04-03 22:49:36 +01:00
Antoine Musso
160a471957 (bug 34302) Add CSS classes to email fields in user preferences
Patch by Nischay Nahata whom I have mentored earlier this week.
2012-03-07 09:56:24 +00:00
Krinkle
1e2c889d03 [ResourceLoader] Minor clean up
* Re-order special modules and add a few comments
* Single quote in QUnitTestResources.php
* Space in ResourceLoader.php

(Separated from another commit while skimming code)
2012-03-04 22:56:43 +00:00
Krinkle
05b7b4b979 [Resources.php] Fix missing dependency on jquery.textSelection (follows-up r81648, r81651) 2012-03-02 19:23:58 +00:00
Krinkle
f114600228 [mediawiki.api.watch] Re-use watch() in unwatch().
- Fix dependency issue. In practice not an issue due to user.tokens being in the HTML output before the first mw.loader.load()
- Follows-up r107969, r107350
2012-02-26 15:57:01 +00:00
Ryan Kaldari
de045ec7f9 wikistandard.css is not a common skin file, it is only used by the classic/standard skin. moving from skins/common/ to skins/standard 2012-02-24 20:13:30 +00:00
Brion Vibber
8fd74954c4 * (bug 33045) Use locally-sourced spinner image for mediawiki.feedback module instead of Commons image
Switched from an <img> with a hardcoded Commons link to a <span>, a stylesheet, and a locally-hosted copy of the image.
2012-02-23 00:53:29 +00:00