Commit graph

313 commits

Author SHA1 Message Date
Henning Snater
c934766061 sort method for jquery.tablesorter
the sort method allows programmatic sorting as well as instantly sorting
the table when initialising the tablesorter; furthermore, the method can
be used to reset sorting (e.g. if rows have been added later via JS);
sortEnd event may be used to reapply alternating table row colours or other purposes

patch set 2: fixed mentioned issues and added another test
patch set 3: addressed all further issues, introduced more obvious way to
specify sorting
patch set 4: implemented sort method instead of using an event; reprashed whole commit message; introduced 'sortEnd' event
patch set 5: fixed white space error
patch set 6: Add release notes and rebase

Change-Id: Id14862100cd27ebd6980c48dcf497db229c4301f
2012-10-17 21:13:50 +02:00
Timo Tijhof
ec9296e0a8 Fix up various issues leading to bug 40780.
* jquery.autoEllipsis didn't return 'this', which means whenever it
  was used in a chain, it would return undefined.

  So in mediawiki.searchSuggest append( ... autoEllipsis() ) would
  apply it to a detached node that stays detached because it
  isn't passed to append.

* Remove redundant passing of this in jQuery context to $().
  On jQuery.prototype, 'this' is obviously a jQuery object. In
  jquery.highlightText, which is called from jquery.autoEllipsis.

* Remove redundant .empty() call before calling .text( .. ),
  .text() replaces all content and naturally is forced to empty
  the element first.

* Merge use of $el and $container in jquery.autoEllipsis.js. They
  were both pointing to the same object, having two names was only
  confusing.

* Spaces.

Change-Id: I4649ec0c89d38c4d79d1dceec28227902cd48d32
2012-10-13 22:10:07 +00: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
Reedy
d6bb1851a7 Update jQuery to 1.8.2
http://blog.jquery.com/2012/09/20/jquery-1-8-2-released/

Change-Id: Ie127f95eae951c36f6c330b4bdaee05f59cd58e2
2012-10-09 22:58:00 +01:00
Timo Tijhof
287331a04e (bug 34876) Make jquery.makeCollapsible less slow.
Several optimisations:

* Re-using the same $collapsible jQuery object instead of
  re-creation of $(this).
* Use .data instead of dom manipulation (className property).
* Use $.nodeName( HTMLElement, tag ) to check something is <a>,
  instead of using creating a jQuery object and calling
  "is.('a')", which goes through a lot of selector stuff.
- Fix bug where it says it does instantHide but actually still
  triggers the event that causes initial animations.

Thanks to Lupo for most of these ideas, based on this patch:
 * https://bugzilla.wikimedia.org/attachment.cgi?id=10200

Verified that these test cases all still work:
 https://test.wikipedia.org/wiki/User:Krinkle/CollapsingTestpageMw

(copy wikitext to localhost)

Change-Id: Idb9ca00c03ec7d70903ed7fd79e427efa270ace4
2012-10-09 05:44:51 +00:00
Derk-Jan Hartman
34db074bf0 Fix an issue with the data-sort-type retrieval.
The treatment of attributes with embedded dashes was changed in jQuery
1.6 to conform to the W3C HTML5 specification. Hyphenated names become
camel-cased.

Change-Id: I4ac2ebdc1ba8350b9696e516f62ba803fa8fb46b
2012-10-08 01:54:44 +02:00
Catrope
7b9b7a44c2 Merge "(bug 40448) Replace legacy mwsuggest with mediawiki.searchSuggest" 2012-10-02 03:41:25 +00:00
Timo Tijhof
e85ff41468 jquery.byteLimit: Rewrite (fix bug 38158, bug 38163)
It used to be fairly simply and that seemed good enough. Listen
on keypress, get current value, add character from key code in
event object, and calculate the byteLength. If it is too long,
preventDefault().

However there were so many edge cases (too many of them to be
considered edge cases) where this failed whereas the native
maxLength handling was fine.

For example:
 - Cut and paste
 - Selecting text and replacing or removing it (by any of the
   methods on this list)
 - Custom javascript input methods (e.g. Narayam)
 - Spelling suggestions and corrections
 - Drag and drop
 - etc.

Now it acts on changes after the fact.

I considered building in a timeout loop in addition to this so
that when javascript gadgets change the input value it would
detect it, however I'd like to hold that off for now. We can
add that later if needed. For now scripts are expected to fire
the 'change' event if they change it, which seems reasonable.

The only challenge that it creates, however, is the need for
basic history reconstruction. Figure out what was already there
and what is new, and cut down the new part until the total sum
satisfies the limit.

This is the same behavior that WebKit browsers (and others) have.
e.g. of "barbaz" is pasted between "f" and "o" in "foo" with a
maxLength of 5, then the resulting string will be "fbaoo".

Also fixed bug 38158 while at it. Filed an upstream bug against
webkit/Chrome but was wont fixed. Either way, we'd have to be
compatible for a little while with old WebKit builds out there
(iOS 3, Safari 5, etc.).
http://code.google.com/p/chromium/issues/detail?id=136004

Use removeAttribute('maxlength') to let the browser internally
reset the maxLength property. Resetting it directly (to undefined
or with `delete el.maxLength') does not work and casts it to 0,
which blocks the input field entirely.

Updated unit tests, and also removed the "type=text" code
afterwards which that doesn't work in IE (Internet Explorer does
not support dynamic changing of input types), needs to be in the
HTML directly. So far it was passing in IE because 'text' is the
default. Tests now use attr('maxlength') everywhere for
consistency, though properties work the same. Browsers
synchronize these things (just like the "class" attribute and
"className" property).

References:
* Fixes bug 38158: Unexpected 0 maxLength.
* Fixes bug 38163: Incorrect limiting of input when using input
  methods other than basic per-char typing.
* Follows-up: 39cb0c19
* Supersedes: I70d09aae

Change-Id: I9c204243d0bdf7158aa86a62b591ce717a36fe27
2012-10-02 04:54:48 +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
Marius Hoch
9950050451 Update jStorage from upstream v0.1.7 to v0.3.0
Upstream:
* src: https://raw.github.com/andris9/jStorage/v0.3.0/jstorage.js
* log:
  https://github.com/andris9/jStorage/compare/v0.1.6.1...v0.3.0

Did not maintain the modifications made as they were not
necessary (only stylistic), and jStorage is already listed in
the .jshintignore file.

Change-Id: I9c92c47ef165157a40412100e9e532bce36fc638
2012-09-24 03:31:55 +02:00
Siebrand Mazeland
03fd336d96 Fix docs.
Change-Id: Ib6a5e5440c40ed6dab95affa7ed8ebe8acc13299
2012-09-19 17:07:00 -07:00
Reedy
8b1c84a725 Merge "Upgrade jQuery to 1.8.1 now that the remaining bug fixes have been merged" 2012-09-12 19:28:03 +00:00
Catrope
974fa832b4 Upgrade jQuery to 1.8.1 now that the remaining bug fixes have been merged
(Is this a re-upgrade? Re-re-re-upgrade? I'm losing track.)

This reverts commit 82af9811ec

Change-Id: I0a43d7667d7cfa681a087ed96acd23d3c1a386c5
2012-09-12 10:42:58 -07:00
Catrope
550f4992e1 Merge "Various javascript optimizations (fixes bug 39959)" 2012-09-12 17:36:11 +00:00
Krinkle
cacccb52da Merge "enhance jquery.spinner, keeping backwards compatibility" 2012-09-11 03:30:38 +00:00
MatmaRex
a2593d7f2b enhance jquery.spinner, keeping backwards compatibility
Replaced single `id` argument to $.createSpinner with an options object.
The options allow one to set the id (as before), spinner size (small or
large), and its display mode (inline or block). Analogic change was made
to $.fn.injectSpinner.

Default options are kept the same as they used to be, and old-style calls
still work. However, the definition of .mw-spinner CSS class has been
changed (although, with a bit of hairy code, it could be kept
compatible...).

These changes should be enough to allow us to replace old usages of
.mw-small-spinner and .mw-ajax-loader classes, as defined in shared.css.

This is a reimplementation of the idea described in Ie55ffb6b.

Copied spinner.gif and ajax-loader.gif from /skins/common/images/.

Change-Id: I0ff71ba1eef299e0e699df84c68f1be1c20492f7
2012-09-11 05:29:40 +02:00
Timo Tijhof
c9ba56de48 Various javascript optimizations (fixes bug 39959)
* (bug 39959) Right click to edit section causing browser hangs

  The :has() selector has gotten significantly slower in
  jQuery 1.8.1 however the reason it affected us so much is
  partly because of the very inefficient way we used it.

  Namely duplicated 6 times and evaluated from a live() binding
  In order words, on every instance of the event.

  Optimizing by
  - only select headings, do the :has implicitly by checking
    for the result of .find().
  - document.on(.., selector) instead of .live()
  - remove redundant and overkill 'return false'

  Results in Firefox 15/Chrome 21:
  - up to 130x (one hundred and thirty) faster!

* /resources/* (except for third party libs)
  - Use .on() instead of bind, delegate or live
  - Use .off() instead of unbind, undelegate or die
  - Use document.getElementById instead of $('#' + variable)
    not for performance but for predictability/security.
    (e.g. rel="foo.bar" should select id="foo.bar" not
    id="foo" class="bar")

  - Fix some minor whitespace and code conventions.

Change-Id: I2fefb5376d0de40f4997a3a1763eee23fcd3e7fa
2012-09-04 23:56:38 +02:00
Reedy
82af9811ec Revert back to jQuery 1.7.2
Seems we potentially have numerous bugs resulting from the 1.8/1.8.1 upgrades

Change-Id: I8ed2f2c02bd498a547599391325ce62356084847
2012-09-04 15:09:40 +01:00
Timo Tijhof
28678c3d07 Update jquery.qunit from upstream v1.9.0 to v1.10.0
Upstream:
* git-repo: https://github.com/jquery/qunit.git
* git-tag: v1.10.0
* git-commit: 900f72051b0112342feda3d700a7a049d886b9ce

* tree:
  https://github.com/jquery/qunit/tree/v1.10.0
* compare:
  https://github.com/jquery/qunit/compare/v1.9.0...v1.10.0
* release-notes:
  https://github.com/jquery/qunit/blob/v1.10.0/History.md

Change-Id: If8529952a1d9f228ad1c5697057afea12fdf3630
2012-09-03 23:05:43 +00: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
Antoine Musso
52ee390117 (bug 39908) jQuery 1.8.1
jQuery 1.8.0 has regression issues where selections with class and id
returned wrong elements (aka: $('#ca-talk.new a'). This patch upgrade
jQuery to 1.8.1 from upstream.

Change-Id: I9db28a52341eef0862aac7e1ae5e4f4e4637fd91
2012-09-02 14:50:56 +02:00
Kaldari
8dc90f63a8 Addressing problems with jquery.badge mentioned at I0f5e7541
Making sure variable types are consistant, fixing global vars,
various style fixes, etc.

Change-Id: I2f30fe07078aa3cadd730b0d6f199d037f2a4612
2012-08-30 22:46:55 +02:00
Siebrand
1cf83c086d Merge "Revert "Revert "jQuery 1.8""" 2012-08-29 17:48:44 +00:00
Krinkle
a7b4d7fd90 Revert "Revert "jQuery 1.8""
This reverts commit 4dd2c82ff4

As mentioned (on bug 39572) in the mean time, this was not related to the jQuery update. The problems were related to abuse of jsMsg to prepend arbitrary content to the top of the page.
2012-08-29 14:10:16 +00: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
Derk-Jan Hartman
6fe1f2c755 (bug 39284) Improve the tablesorter for currency.
* Make the detector for currency not trigger on cells
  starting with "." or "?".
* Make it trigger on values ending with a currency symbol.
* Add the Yen sign.
* Add a basic unit test.

Change-Id: I3c1fdf41db04ea0726ba7613fa5e1365f8fb8493
2012-08-24 17:23:48 +02:00
Catrope
4dd2c82ff4 Revert "jQuery 1.8"
This reverts commit 9023aa2d83.

Regression reported on Wikinews, see bug 39572

Change-Id: I135c9931e5d3c8b85e1e9c4cd58326c682d878f2
2012-08-22 14:28:53 -07:00
Reedy
ca90e32665 * (bug 39376) jquery.form upgraded to 3.14
Change-Id: I1d30a5def4ba09054604e5af5666c31c631bc395
2012-08-21 18:36:49 -07:00
jrobson
613cd3bb7b allow localization of elements via data-msg-text and data-msg-html
to distinguish from attributes i've reversed the order e.g. instead of
html-msg i've used msg-html

i've added the data prefix to allow for html validation.

this is important as an OPTION tag cannot have any children so currently
there is no way to localize it. This provides a route.

Documentation needed.

Change-Id: Iefdbbf0e55ab3c6c6a9564b568980a7319bc4453
2012-08-15 11:39:32 -07:00
Brad Jorsch
20d098cfb3 (bug 39296) Fix broken table sorting
Javascript's Array.sort wants -1, 0, or 1. Not false, true, or 0.

Change-Id: I2cb73668793092b53be0c1c6f7ffc647a88bf30a
2012-08-13 12:58:57 -07:00
Reedy
9023aa2d83 jQuery 1.8
http://blog.jquery.com/2012/08/09/jquery-1-8-released/

Change-Id: I7b85e1382615e76b1737c7c52691cf8079a55f6e
2012-08-10 14:59:05 +01:00
Timo Tijhof
7420e8e4ab Kranitor #2: Pass JSHint on resources/mediawiki/*
* .jshintrc
 - Update properties to reflect our conventions more

* Re-pass resources/jquery/*
* Pass resources/mediawiki/*
 - Trailing whitespace
 - Whitelist the one usage of document.write with
   a local /*jshint evil:true */ in the function that
   we allow to use it.
 - Get rid of dangling _ in var names and undescriptive
   instances of '_this'.
 - More code conventions

* Add a few documentation comments while at it

Change-Id: Ic4f2b5d473a440667a40e4d5f12f40877386b02f
2012-08-09 11:42:58 -07:00
Brad Jorsch
fda9110f5a (bug 35526) Make jquery.tablesorter use a stable sort
In r86337, jquery.tablesorter was changed from using the standard
Javascript Array.sort to a custom merge sort, with the justification
that it eliminates an eval and merge sort is stable. However, the
implementation used is not, in fact, stable, and making an in-place
merge sort stable reportedly kills performance.

Instead, let's just go back to using Array.sort, but with a closure
(basically the same comparison function used by the merge sort) rather
than an eval and using the already-calculated "position" as a tiebreaker
when two rows are otherwise equal to make it stable.

Change-Id: Idc50127d3bfec2b1727f397a9780b359fd56055e
2012-08-02 16:01:25 -04:00
Kaldari
6d6d788bab Better inline styling for badge.
Change-Id: Ie92a18478c0f9b62fceff39f54a9524432eec921
2012-08-01 16:03:35 -07:00
Trevor Parscal
55dac1f933 Added placeholder-msg support and more documentation to jquery.localize
* Added examples of all options (prefix, keys and params)
* Added example of raw attribute being used to bypass escaping
* Added documentation to code where it seemed clarification was needed
* Reduce duplication and simplified  some unnecessarily complex statements
* Added test for new placeholder-msg attribute support
* Made adding more attributes in the future easier
* Moved message wrapper function out of the localize function so we aren't defining it each time localize is used

Change-Id: I77593acf4c1b3974d502a1a8382cca9267af2d41
2012-07-30 17:10:30 -07: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
Timo Tijhof
2927ab69fd Update jquery.qunit from upstream v1.8.0 to v1.9.0
* Upstream https://github.com/jquery/qunit.git
 - tag: v1.9.0
 - tree: https://github.com/jquery/qunit/tree/v1.9.0
 - commit: e36f17de98

* Also update our testrunner.js since the format of
  QUnit.config.urlConfig has changed (it is still backwards
  compatible, but we might as well use the new format right away,
  as it makes the checkboxes look better).

Change-Id: Ia5a9eb7a40a438c126879497ec0dbecbb72e0edb
2012-07-27 16:09:20 -07:00
Timo Tijhof
089c58d232 jshint: resources/jquery/*
* .jshintrc: Updated to include more strict options that match
  our code conventions.
  Also separated into 3 groups:
  - stricter (curly, eqeqeq etc.)
  - laxer (smarttabs, laxbreak)
  - envrionment (browser)

* .jshintignore: Updated to include more third-party/upstream files
   that should not be linted.

* Most of it is just routine cleanup, a few notable points:

 - jquery.autoEllipsis: Removed unused variable $protectedText.

 - jquery.arrowSteps.js: Remove <!-- --> and language="javascript"
   that hasn't been needed for almost a decade.

 - jquery.byteLimit: Use dashToCamel key for .data(), this already
   happens internally in jQuery data(), since data storage should use
   keys that are usable as identifiers. The dashed versions are to
   populate these from data-attribute-names, which then becomes
   data.attributeNames. jQuery data() takes both forms as
   convenience.

 - jquery.client.js: To avoid a rewrite of it, allowing unexpected
   assignments (boss) and eval (evil) in the functions that use that.
   Left as it is for now, could use a rewrite later.

 - jquery.color.js: Tolerate unexpected assignment for now (boss).
   Left as it is for now, should perhaps be refactored later.
   Also re-ordered per jshint/jslint to put definition before
   invocation. This option can be disabled, but then it doesn't
   warn for invoking undefined functions (or typos) at all.

 - jquery.expandableField.js: Remove empty switch/case.

 - jquery.localize.js: Alias mw global.

 - jquery.suggestions.js: Use e.which; jQuery.Event normalizes
   e.keyCode etc.

 - jquery.tablesorter.js: Alias mw global.

 - jquery.textSelection.js: Fix leakage of variable in global scope
   of var "i" and "j".

 - mediawiki.util.test.js: Fixed implied global `pCustom`.

* Review with -w for your own sanity.

Change-Id: Ia972f79539a96a38357ec4e92b0b6e38cc301681
2012-07-15 11:13:20 -04:00
Krinkle
540dfed2a6 Merge "(bug 37604) Update jquery.cookie.js from 2009 to 2011" 2012-07-05 03:59:01 +00:00
Mark Holmquist
721a659e3e (bug 37604) Update jquery.cookie.js from 2009 to 2011
* Upstream
 - version: 2009 -> 2011
 - commit: faa09dc38b

* Copyright noted 2006, but that wasn't updated until 2009..

Change-Id: Id9277c7bb99c2e0a170b4dfa3e83b7b41926ea2e
2012-07-05 05:55:25 +02:00
Timo Tijhof
1f83a2e791 (bug 38152) jquery.tablesorter: Use .data() instead of .attr()
* .data() is faster when looking up repeatedly

* .data() will return the latest value, even if it has changed over
   time, whereas .attr() only gives the value as it was when the page
   was generated. Much like the difference between attr() and prop()
   when it comes to value, checked, disabled etc.

* Moved buildCache() call outside `if ( firstTime )`.
  Tests show that this is fast enough to do on the fly. Left inline
  comment with proposal on how to make this more elaborate in the
  future would it become necessary.

* jquery.tablesorter.test.js:
 - Add tests for bug 38152
 - Clean up double quotes
 - Use more descriptive id (prefix with mw-bug-)

Change-Id: Ie4f801c5b1f93617fd3fd173d2eaaf173a7604e9
2012-07-04 23:11:11 +02:00
Hashar
6915f4a0ac Merge "Revert "jquery.byteLimit: Partial rewrite to fix logic errors"" 2012-07-04 09:01:33 +00:00
Siebrand
1fe6a6c6e5 Revert "jquery.byteLimit: Partial rewrite to fix logic errors"
This causes bug 38158.

This reverts commit 1ceab34587
2012-07-04 08:50:02 +00:00
Catrope
fedda20d6d Merge "jquery.byteLimit: Partial rewrite to fix logic errors" 2012-07-04 06:17:35 +00:00
Timo Tijhof
1ceab34587 jquery.byteLimit: Partial rewrite to fix logic errors
* Previously it was hooking into the keypress event, this meant
  that it had to do all sorts of calculation to figure out what
  the string length would be *after* the to-be-pressed key
  is allowed to be pressed. This sounds trivial, but is quite the
  contrary. First of all are control, alt, shift etc. those were
  covered.

  What wasn't covered and imho can't be realistically covered
  without bugs is: copy/paste, drag/drop, text selection and
  replacing or removing more at once. Or even a combination of the
  above. And then there is custom insert methods such as Narayam,
  where the character will not be literally inserted at all.

  Therefore I've changed it to instead listen to *after* the insert.
  and if necessary undo the last (one or more) characters until the
  byteLimit is satisfied. This works much more stable. Still very
  fast and not noticeable to the user.

  This also fixes the bug where when the limit is reached, you
  select all and type something else, you couldn't because it would
  prevent the keypress since the limit is reached.

* Updated documentation comments.

* Updated unit tests to simulate onkeyup instead of onkeypress.
 - hasLimit option in byteLimitTest() was redundant, using limit
   directly, instead of duplicating it twice.
 - Added more comments and better test names. Tests themselves
   have not changed.
 - Removed redundant tests at the bottom that no longer make sense
   in the new version (and were broken) since the property is
   now always unset instead of just if there is a callback.
   The native limit must not interfere.

Change-Id: I9ace3ab79f488d24ad13baace32118c151c06347
2012-07-03 23:11:11 -07:00
Catrope
17435154e1 Merge "(bug 36310) jquery.byteLimit should skip < 0 due to Firefox bug." 2012-07-04 06:00:51 +00:00
Brad Jorsch
3516944806 (bug 36991) Fix jquery.tablesorter date sorting
jquery.tablesorter should extract date sort format from date string
instead of global config. Dates like "April 1 2012" and "1 April 2012" now sort correctly regardless of the content language's
DefaultDateFormat setting (exposed as wgDefaultDateFormat in
mw.config).

Previously jquery.tablesorter sorted dates like "1 Apr 2012" (DMY) or
"Apr 1 2012" (MDY) incorrectly. It just converted it to "1 4 2012"
and "4 1 2012", respectively, and then assumes MDY or DMY order based
on the global wiki configuration.

This patch fixes that.

Change-Id: I8061b1a7892633e34be4d4a0273a4dd5045fd2ee
2012-07-03 19:05:01 +02:00
Max Semenik
5098c60ea2 Compress images
Change-Id: I3d0c3310fc7fe8938dc079cb7481d138ba42c2f6
2012-06-28 21:04:47 +04:00