Commit graph

310 commits

Author SHA1 Message Date
Fomafix 3d103f09b5 JavaScript: Use single quotes instead of double quotes for
strings

* This avoids escaping of double quotes.
* Exceptions: "''" and "'''"
* https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript#Quotes

Set "validateQuoteMarks": { "mark": "'", "escape": true } in .jscsrc
This tests for single quotes but allows double quotes to avoid escaping.

Change-Id: Ibd32a63c4c97a7ef8938c6d2dff83b952cfca43e
2016-02-07 18:22:06 +00:00
Fomafix 0b5c23d42b Use .prop() instead of .attr()/.removeAttr() for boolean HTML attributes
https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript#Pitfalls

Create elements according to
https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript#Creating_elements

Change-Id: I14a7f6e8d2c0a43b89d0d186398a4fea76b7d362
2016-02-07 14:22:56 +00:00
Fomafix 7d8b6a1ab6 Use boolean values for .prop() on boolean HTML attributes
.prop() expects a boolean value. .id() returns a boolean value.

Change-Id: If3dc6197f9dded92e99faeaa33e31dc937ebf66f
2016-01-15 12:43:37 +00:00
jenkins-bot 60d9feb204 Merge "Use background-image instead of <img> for toolbar icons" 2016-01-07 19:35:23 +00:00
jenkins-bot af564f288b Merge "Add format-bold-Iab image for lang ce" 2015-12-28 09:15:22 +00:00
jenkins-bot 6b6109e222 Merge "Use mw.Message#text() instead of plain() in wikiEditor.autoMsg()" 2015-12-28 08:42:09 +00:00
Paladox 38d28d5631 Add format-bold-Iab image for lang ce
Also use the icon for Chechen. Also requested by Bug: T119716

Add these icons for lang ce

png

https://commons.wikimedia.org/wiki/File:Toolbaricon_bold_%D3%80%D0%B0%D1%8C.png

svg

https://commons.wikimedia.org/wiki/File:Toolbaricon_bold_%D3%80%D0%B0%D1%8C.svg

This was requested at
https://ru.wikipedia.org/wiki/%D0%92%D0%B8%D0%BA%D0%B8%D0%BF%D0%B5%D0%B4%D0%B8%D1%8F:%D0%A4%D0%BE%D1%80%D1%83%D0%BC/%D0%A2%D0%B5%D1%85%D0%BD%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9#.D0.9F.D0.B0.D0.BD.D0.B5.D0.BB.D1.8C

Bug: T119716
Change-Id: I4b41aa53138eae660ebeb9b1d9f6f547cfcca7a4
2015-12-27 20:54:23 +00:00
Timo Tijhof f583469ece Use mw.Message#text() instead of plain() in wikiEditor.autoMsg()
* Follows-up 6a73d06 by removing the hardcoded SITENAME regex.
* Follows-up 1b797b7f6a which introduced this regression in the first
  place. This is exactly the reason why mw.msg() defaults to format
  'text' instead of 'plain' without transformations.

Change-Id: I7f1b877710fb6baa45b83054d1e30a24979b37b4
2015-12-25 21:33:47 +01:00
Derk-Jan Hartman 95ab425166 Remove non-working {{#special:mypage}} from help
Bug: T44107
Change-Id: Iff987eddfb1fbe6a6ce1c88795b9dc1fd5b47f9e
2015-12-25 20:28:43 +00:00
Fomafix 19789d762b Use background-image instead of <img> for toolbar icons
Change-Id: I8af0e2c8585e8d9f6f72133953792eb88a176bcf
2015-12-22 13:36:36 +00:00
2nd-player 6a73d06932 Substitute {{SITENAME}} in the title of dialogs
Bug: T62695
Change-Id: I7e5378b37e66b8b35bb7b3aa2121eea3cbf1defd
2015-12-21 20:03:32 +00:00
Fomafix de74cc81f5 Use mw. instead of mediaWiki. in code
Change-Id: Ib7905bbbb8954cf8e268acac45e00ceba959b00b
2015-12-13 12:44:49 +00:00
Paladox bfc5e2a6bd Fix ie 8 support in js follows-up: I039bc4c17fbba3c74a5050066b20af05434ca482
Change-Id: Icfea4cedde88efb88307cbb1842edc8a17ebf83a
2015-11-25 10:32:05 +00:00
paladox bdb67f719c build: Test JS code with jshint and jscs via npm
Change-Id: I039bc4c17fbba3c74a5050066b20af05434ca482
2015-11-18 12:06:36 +00:00
Prateek Saxena 5ea5952cd1 Use mw.Upload.Dialog to upload and insert file
Bug: T115748
Change-Id: I2427cd959f0d9b6872866e120e7bd0e7e298ec27
2015-10-23 16:54:24 +00:00
Timo Tijhof c4a6039f8c Remove use of deprecated 'modulemessages'
Deprecated as of MediaWiki 1.26, replaced with an empty array.

Change-Id: Ic5f308060f796b896f98de34e153bb8bd11f8e6c
2015-09-24 18:01:24 +01:00
Alex Monk 7eba01c398 Finish updates for Schema:Edit
Follows-up Ib5fc6004

Bug: T111421
Change-Id: I3f1148ed7ec424875d73b0eb6571c8f38180685f
2015-09-04 20:46:56 +01:00
Derk-Jan Hartman 1d654454c6 Dialogs: handle jQuery content for dialogs
Follow up to Change Ia7ad5aaa9cac429d1c9d706bdf6760e3eda358bc

Bug: T109781
Change-Id: I5373600f4d3c0bb4e5192ca5ce1acea2b853dc3a
2015-08-22 01:01:37 +02:00
Schnark 522331ddda Wikieditor: Rework deferred building of toolbar
Currently sections of the toolbar can be built deferred. This
is done for the help section and the special characters. The
disadvantage is, that you can't modify such sections before
they are really loaded.

This patch modifies the behavior by doing the following:

* Toolbars are always built directly. After all, deferring isn't
  used there anyway in the standard configuration.
* When a booklet is requested to be built only when it's needed,
  the index and all pages will be built immediately, only the
  content of the pages is deferred and built only when it is
  needed.

Even on slow machines building all pages immediately doesn't cause
noticeable pauses, in fact, opening a page with special characters
seems even faster because only the page you need is built, not all
pages.

Since all pages exist from beginning, you can remove and add pages
from user scripts. It is still not possible to modify an existing
page (add or remove a row to a help page, add or remove a character,
unless it is the page that was opened last time), but this is something
that shouldn't be needed very often, so it should be acceptable that
it still doesn't work.

Bug: T25479
Bug: T70791
Change-Id: I0e61b1fd4f6139a251e53a1fac28b3821bc6b860
2015-08-14 13:11:39 +00:00
Schnark 6602d905ee WikiEditor: Move HTML for dialogs to separate files
Move the HTML for the dialogs to separate template files,
using the template mechanism from core.
It is still possible to specify the HTML directly as before,
to be used in gadgets etc.

Change-Id: Ia7ad5aaa9cac429d1c9d706bdf6760e3eda358bc
2015-08-14 13:07:27 +00:00
This, that and the other 52d3e279a1 Replace hidesig module with a more robust implementation
Per T42972, the current hidesig implementation is broken, and only
hides the signature button in namespace 0 regardless of the value of
$wgContentNamespaces.

Seeing as the old implementation of hidesig was broken, I don't really
think backward compatibility with old configurations is a useful
concern here. In particular, hiding of the signature button is no longer
able to be configured in Special:Preferences (why such a trivial pref was
ever able to be exposed to users, I don't know).

Bug: T59727
Change-Id: I596fd435bc9be8c37da43177c1bea90ebff0b2fe
2015-08-05 13:59:00 +10:00
Derk-Jan Hartman 1b02e98296 Toolbar: Remove Opera redraw hack
The versions of Opera that this was targeting aren't really supported
anymore anyways. So let's just remove this hack.

Bug: T106574
Change-Id: I1b11fc8ec30f3c33b681daff7f676fa965fb78cb
2015-07-22 21:06:28 +02:00
jenkins-bot 10ff6c36de Merge "WikiEditor shouldn't store wrong cookies for booklets" 2015-07-21 23:01:58 +00:00
jenkins-bot 75021184a9 Merge "Fix spaces" 2015-07-21 23:01:55 +00:00
jenkins-bot 8173336157 Merge "WikiEditor: Improve help section" 2015-07-21 16:56:45 +00:00
Ebrahim Byagowi 2d188d18f9 Use "B" and "I" icon for Persian
Change-Id: I4e6f69debc489d34e611bc177975fba9c3874a54
2015-07-20 22:31:04 +00:00
Schnark 27353c44b7 WikiEditor: Improve help section
* Internal links: Show simple example first
* References: Show use of unnamed references
* Discussion: Use --~~~~ for consistency with what the toolbar button inserts

Bug: T26128
Change-Id: I08de0ad416727447eccad914c2ade3a93e5a8ae2
2015-07-20 07:42:35 +00:00
Fomafix 7c932c06da Fix spaces
Change-Id: Icce6ba3de9e472472b8b9e98e78e4aece82e806d
2015-07-20 07:12:45 +00:00
Schnark 72d7413480 WikiEditor shouldn't store wrong cookies for booklets
When additional booklets are created, or existing removed, WikiEditor
currently stores one wrong cookie for each new booklet. This is because
twice a wrong id is passed as parameter, and because a cookie is set for
the default value. This patch fixes these issues.

Additionally I replaced in the function that needed to be edited a loose
comparison with a strict one ($.cookie will return null, never undefined),
and .size() by .length.

Bug: T27184
Change-Id: Iacc1c71a1e0fc2307a3a28d9c1bb00967ac9827a
2015-07-16 07:19:25 +00:00
paladox d4b293587c Updated insert-signature image
* Some users have reported that they did not like the new colour for the wirting. New colour changed back to black.

Author is Roul P

Compressed using https://compressor.io/compress

Change-Id: Ieda03d57197bc6c2dd0361e942a819732876ac36
2015-07-14 08:31:17 +00:00
Derk-Jan Hartman e8d37102a5 Toolbar: Let's remove a speedup loop...
Change-Id: I3e965dda1c48195d7c11f1d7f23a09dd8447cfc7
2015-07-06 14:41:33 +02:00
Fomafix b365425f76 Replace deprecated 'jquery.mwExtension' by 'mediawiki.RegExp'
Replace $.escapeRE from 'jquery.mwExtension' by
mw.RegExp.escape from 'mediawiki.RegExp'.

This change requires MediaWiki 1.26+

Bug: T103993
Change-Id: I5fc19e1313fc6a06726981e0365cea6d00abb5f3
2015-06-26 15:10:20 +00:00
jenkins-bot e110a57562 Merge "Remove unused parameter lang from $.wikiEditor.auto* functions" 2015-06-23 20:51:34 +00:00
paladox e62f582d54 Add svg to LESS file
Requires patch https://gerrit.wikimedia.org/r/#/c/181786/

Bug: T37342
Change-Id: I994208cdf35fb11f0b0a724272124ac5410e2076
2015-06-23 20:43:19 +00:00
paladox 28aa2ff1d2 WikiEditor: Add svg images
* Re adds svg images that were reverted earler for causing problems.
* Adds some missing rtl svg images.
* Fixes insert-ilink.svg that was causing it to not show in some browsers eg internet explorer.

User Perhelion Fixed the problem in insert-ilink.svg and insert-signature.svg. I just added it to button-sprite.svg.

Related less file adding svg to it is at https://gerrit.wikimedia.org/r/#/c/195529/

Bug: T37342
Change-Id: I14482c7b66901609689bf9ddb67b8d2add937612
2015-06-23 14:45:03 +01:00
jenkins-bot 03e93d626d Merge "Reduce 'Edit' EventLogging schema sampling rate to 6.25% (1/16th)" 2015-06-22 15:00:07 +00:00
Fomafix a27f478bf5 Remove unused parameter lang from $.wikiEditor.auto* functions
Change-Id: I71680155b668b6e87be909d2b765f9cbed064bbf
2015-06-22 07:08:54 +00:00
Fomafix edbee613fc Support fallback languages for icons
Use mw.language.getFallbackLanguageChain() to get the
fallback language chain. This chain currently always contains 'en'
as last element. Remove the last element to prevent a fallback to 'en'.

Reimplement autoIconOrOffset to correctly prefer sprite before icon.

Bug: T87247
Change-Id: I452dd45d20ea4dd542d63274b7aad0272e20ea12
2015-06-21 15:42:18 +00:00
James D. Forrester ab9dbac995 Reduce 'Edit' EventLogging schema sampling rate to 6.25% (1/16th)
Bug: T103036
Change-Id: Ib437c2542f9f6ed4d333047383ff66e637b5065e
2015-06-18 16:39:29 -07:00
Roan Kattouw d1270ed4b6 Populate abort.type in Schema:Edit logging
Using document.activeElement at the time of the unload
event as a proxy for whether the user is switching to VE.

Switching to VE is weighed more heavily than whether or not
the user made changes: switching to VE causes abort.type to be
'switchwithout' regardless of whether changes were made; only
if the user isn't switching to VE do we look at whether changes
were made and use 'abort' or 'nochange' as appropriate.

When wgAction === 'submit' (i.e. we're on a preview / show changes
view), it is assumed that the user has made changes.

Bug: T95938
Change-Id: Ic91b87c4fc5b601e1fd98b237100d808e97400bd
2015-05-04 18:15:18 -07:00
Roan Kattouw cc5ca3a2f6 Perform 25% sampling on the client side as well
Needed because session IDs can be generated on the client
from the unload handler (when the back button is used).

Bug: T95919
Change-Id: Iac921bc36806205fc11ac76154ed8b3890f10d31
2015-04-28 14:55:54 -07:00
Roan Kattouw 418baf1efa Regenerate editingStatsId on unload
So that the ID isn't reused when the user uses the back button
to navigate back to an edit page.

It would be more natural to use pageshow for this, but that
event also fires on initial load. There is a .persisted property
that indicates whether the page was recycled, but that
property doesn't work in Chrome:
https://code.google.com/p/chromium/issues/detail?id=344507

Doing this from pagehide doesn't work either, because that
runs before unload (at least in Chrome) and causes the
abort event to be emitted with the new ID. So instead,
regenerate the ID in the unload handler after the
abort event has been sent.

Bug: T95919
Change-Id: I20a602a7896e75ffa116dcd2c137306ca84164b6
2015-04-21 01:01:41 +00:00
Roan Kattouw 1a96528f69 Remove extraneous comma
Change-Id: Ica0bb9f5a266e265647ade4a13e1e1d368c928d2
2015-04-19 15:35:39 -07:00
Fomafix 465d411536 Rework color definitions in LESS
* Use #rgb instead of #rrggbb where possible.
* Use lower case letters.

Change-Id: I390bf23d44bc2d78eb1d2185fd89b94297d1f05f
2015-04-14 21:39:04 +00:00
Alex Monk 596a790d00 Try to unbreak WikiEditor modules
Some very weird issues going on involving multiple wikiEditor instances being
set up on the same textarea element. It's probably a race condition of some
sort and I'm hoping that restoring the modules like this will fix it.

Bug: T93384
Change-Id: I44c9c013993220ab709893d239614552d7b25d46
2015-04-07 19:51:58 +01:00
Fomafix 539dabeeed Escape messages
* Use .text() instead of .append() to add a text.
* Integrate only once used variables.

Change-Id: I62cd1a402fc44d90e746ec79e96a13aa49e7f926
2015-03-28 23:42:47 +00:00
Alex Monk fb4f71a46b Move WikiEditor's special character data and messages out to core
Core part done in If9c5cdbe

Bug: T91608
Change-Id: Ifd0ed245ca9d1209b3dad5334f3fcfca428ceeec
2015-03-27 22:46:24 +00:00
Alex Monk 2b914eeddf Don't try to do event logging if we don't have a stats ID
I found that pages like:
https://pl.wikipedia.org/w/index.php?title=Wikipedia:Strona_g%C5%82%C3%B3wna&action=edit
which load WE dynamically don't have this.

Change-Id: Ib3952f4efbf265dbb0d1e25b2059e1be934565a7
2015-03-20 01:26:31 +00:00
Alex Monk bf15f72dc7 Try to prevent crazy EventLogging entries with no session ID etc.
Seems to be causing errors on view (!) on plwiki, and I would not expect this
to work on non-wikitext pages.

Bug: T93242
Change-Id: I0336a85a2ab4bef1d20086382012047688ffa909
2015-03-19 21:29:57 +00:00
Alex Monk 4d54fa4471 Only do client-side instrumentation on action=edit/action=submit
So we don't break the tests

Bug: T93119
Change-Id: Ib0545f581fd2a845b893a046ab7aa7161e27180e
2015-03-18 23:59:24 +00:00