Commit graph

119 commits

Author SHA1 Message Date
jenkins-bot 4d479d62f9 Merge "Search & Replace: Use actual global replace" 2018-11-19 22:54:43 +00:00
Derk-Jan Hartman 38c3f2ed98 Search & Replace: Fix using replace as first action
When you use replace, before having used find, matchIndex gets out of
sync with what replace is expecting and encapsulateSelection won't
have a selection and thus defaults to position 0.

Bug: T76750
Change-Id: I1dcc724e7548690a3cc63672f93a3099c028f123
2018-11-19 07:21:21 +00:00
jenkins-bot 7ff3ffa829 Merge "Remove the dialog version of ref inserter" 2018-11-18 14:38:23 +00:00
Derk-Jan Hartman 8284c0480d Search & Replace: Use actual global replace
The old S&R implementation introduces problems with regexes (T58228 and
T50614) and is also rather slow. At some point in the past it was faster
to do multiple search/replace actions using textSelection perhaps, but
with current browsers doing a one shot replace will perform much faster.

If you have CodeMirror enabled, there will be a delay after replacing
all content on a major page, but no worse than the original page load
one, which I think is acceptable.

Bug: T58228
Bug: T50614
Bug: T25510
Change-Id: Ifab1d071d9f09ec55aa6556b5dca04378c4e5273
2018-11-17 21:11:01 +00:00
Derk-Jan Hartman 0089645a46 LinkDialog: Switch to jquery.throttle-debounce plugin
Change-Id: Iebca0398d6bc2939a0904c4cd23395d3207cfea5
2018-11-17 12:07:39 +00:00
Derk-Jan Hartman 709e2bbdfd Remove the dialog version of ref inserter
1: reftoolbar is used in more advanced situations
2: it doesn't actually do much
3: leaner

Keeping it in the same file, because that will preserve order. seems
safer.

Change-Id: I9bb2cf1e8731d12551a00b717b11602e6192d299
2018-11-16 21:49:31 +01:00
Derk-Jan Hartman aaa454b618 Remove browser arrays
Follow-up to I189516917d805dff3819e742a9fd8ad96a161159

Change-Id: Ic2e5389cc565ef061f4f846ad628ee6ea1a8a9fb
2018-11-15 22:59:51 +01:00
Derk-Jan Hartman a686b7f580 LinkDialog: use placeholder instead of fake values
Use proper placeholder attribute instead of faking it with a value.
This predated even jquery.placeholder and is no longer needed.
Also fixes a bug where it was checking with the API for the existence
of the placeholder value.

Bug: T133716
Change-Id: I290ec48f6b1d250da28efffd7ebdb6b681c0227e
2018-11-15 07:06:20 +00:00
Ed Sanders 4fa41179e8 Remove obsolete aliases from closures
Bug: T208951
Change-Id: I0b2993912de221e810414e46708c19be163922f6
2018-11-12 22:28:40 +00:00
Zoranzoki21 7ccbaa3539 Fix "the the" typo
Bug: T201491
Change-Id: I93f905e2f83c6f93aa75a3c826897c165873f6f5
2018-08-27 20:13:56 +00:00
James D. Forrester a24d4748a5 Fix missing 'find' icon, now called 'articleSearch'
Change-Id: I364ac11825564619898c699e66de7d36963cab49
2018-08-24 09:41:17 -07:00
Volker E 17b772e314 Use 'reference' instead of 'book' icon
'reference' is the standard icon for reference.

Bug: T202463
Change-Id: I3e0ed63c449de623a139b3ee3c6866ba3faa7712
2018-08-21 15:53:22 -07:00
Ed Sanders 72e48c26e0 Convert remaining tools to OOUI
Replaces the insert and advanced-insert groups, which
are currently multi-colour icons.

Drops the button-sprite + offset mode, according to
mwgrep there are no other users of this.

Bug: T191031
Bug: T143508
Change-Id: I7032f98908a591ea5c9d3dbbb7616e2c10bbfc80
2018-04-11 15:50:23 +01:00
jenkins-bot b0a5d572d1 Merge "Remove never-used tools" 2018-03-21 19:38:23 +00:00
Ed Sanders accdb762f1 Remove never-used tools
Five tools are registered in toolbar.config, then overridden
in dialogs.config with more advanced verisons. As the dialog
module is no longer optional, the simplified versions are
no longer accessible.

Change-Id: Ib66025d209a36fb821c5619cbfe63330fb6c9a1f
2018-03-21 17:28:32 +00:00
Fomafix d5648e2c95 Avoid '|' in title is interpreted as separator on API request
mw.Api uses U+001f as separator when the title contains a '|'.
This is activated by using an array instead of a string.
The local check for an invalid title because of a '|' is not necessary
anymore.

This changes requires MediaWiki 1.28+ which is already required.

Change-Id: I8450c478d42158f064bf5309efae6bd1d81244ea
2018-03-04 09:44:27 +01:00
Ed Sanders 66a29b9c0a build: Update linters and fix errors
Change-Id: I3d316cfa7432d0600f0114608342155c1d1f6c1d
2017-10-31 18:40:57 +00:00
Fomafix 1e0621fc1f Show invalidreason from API response on invalid title
Bug: T99547
Change-Id: I34372e054e509732b008875260ba5c5e0248e551
2017-10-11 11:02:08 +02:00
James D. Forrester ba6e4e171d Follow-up d400102: Drop irrelevant comment, merge var declaration
Change-Id: I09685da71cdfa21b40258ecffc64fa9a2f6ec272
2017-05-22 13:20:09 +02:00
Ed Sanders d400102c38 Remove IE8 hacks
Change-Id: I23e33e3498487bedcc50d95e2162175e940882c4
2017-05-22 11:50:04 +02:00
Fomafix 5432a42d2d Use background-image instead of <img> for spinner
* Background images get embedded.

Change-Id: Iea1fb3db29b1eb8d5bff1b9b07a6c16145b9efc0
2017-05-05 19:09:37 +02:00
Ed Sanders 1b0bd60ee8 build: Update eslint to 0.4.0 and make pass
Change-Id: Ib0ac14fb53479eb964a5d51066661b4771b1f72e
2017-05-04 22:38:47 +00:00
jenkins-bot ecc01e9122 Merge "Explicit load module 'jquery.tablesorter' instead of use when loaded" 2017-04-27 13:04:51 +00:00
Fomafix 278ae63c04 Explicit load module 'jquery.tablesorter' instead of use when loaded
The module 'jquery.tablesorter' is already loaded a few lines above.
The previous situation depends on a race-condition of the function is called
or not.

Change-Id: If6777fcc7d9d49604eb78b6d233a32898fc82446
2017-04-27 13:50:23 +02:00
Fomafix 24ee938095 Replace deprecated jQuery.isArray with Array.isArray
jQuery.isArray was deprecated in jQuery 3.2.0. [1]

Array.isArray is part of ES5 and MediaWiki 1.29+ which ensures that
JavaScript is only used when the browser supports ES5. (T128115)

Performed using:
find . -type f -name \*.js -exec sed -i -e 's/\$\.isArray/Array.isArray/g' {} \;

[1] https://blog.jquery.com/2017/03/16/jquery-3-2-0-is-out/
[2] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray#Browser_compatibility

Change-Id: Ia1a118fefb23761fe297647442f0a598a9488968
2017-04-26 16:04:51 +00:00
Fomafix bd133991ba Replace deprecated jQuery .unbind() by .off()
jQuery .unbind() is deprecated since jQuery 3.0.
https://api.jquery.com/unbind/

The deprecated jQuery .bind() was aready replaced by .on() in 7769baa5.

Change-Id: Ia03d7a26754cc26345d9551d740719c43f598995
2017-03-23 20:36:39 +01:00
Ed Sanders 9f7fcfd80e Follow-up Ife5e782bd: Syntax fixes
Change-Id: I0a9d68344b2e5ed5589d421525e6113b72476705
2017-01-09 13:43:42 -08:00
Timo Tijhof 7769baa56e Replace deprecated jQuery bind() and size()
> JQMIGRATE: jQuery.fn.bind() is deprecated
> JQMIGRATE: jQuery.fn.size() is deprecated; use the .length property

Note that bind() is not removed in v3, merely deprecated.
Even after the jQuery Migrate phase, it will continue to work.

size() was removed in v3 and works only during the Migrate phase.

https://api.jquery.com/size/
https://api.jquery.com/bind/
https://jquery.com/upgrade-guide/3.0/

Bug: T124742
Change-Id: I6bbd8f829ecf987228c6a5abd32c84e4e088a9bd
2016-11-21 18:23:50 -08:00
Ed Sanders 7eed707a48 Replace jshint/jscs with eslint/stylelint
Change-Id: Ife5e782bd5513e0496e384655b9b203de5c841a5
2016-11-21 21:02:38 +00:00
Ramunas Geciauskas ddda9c0c13 Fix spelling mistakes and clarify code comments
No functional changes

Change-Id: I395f97640931d7902cb468d62187d6d8fd10c0b7
2016-03-31 10:28:32 -04:00
Fomafix d7d2b65487 Use formatversion=2 for API request
With formatversion=2 the JSON response uses UTF-8 instead of escape sequence
with hex for encoding of non-ASCII characters (e.g. "\u00e4" for "ä").

The JSON response from formatversion=2 has some structural improvements.
This allows a simplification of the processing of the response.
The parameter indexpageids= is not necessary anymore.

Change-Id: Ic08c8ba46b7529952c0fb2f04564b458b55112fd
2016-02-08 11:49:17 +00:00
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
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
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
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
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
Derk-Jan Hartman 1514d166e0 Insert link: trim whitespace from the external link
Bug: T25499
Change-Id: I2392ade17d3d4428784c40dabf9ae5e216fbab47
2015-03-16 00:16:13 +01:00
Fomafix d16dfb0ad5 Style code
* Fix errors and warnings from phpcs.
* Add commas at end of lines for arrays in PHP.
* Add space between // and comment.
* Add space between ) and {.
* Use tabs instead of spaces for indenting.
* Break lines in PHP with more than 100 characters.
* Remove double spaces and spaces at end of line.
* Remove spaces before comma.
* Fix some typos.

Change-Id: I9c014bdfa9832fa6a20d0190fe2fc668983d0fb9
2015-03-14 15:49:04 +00:00
Brion Vibber 4f8ad57aaf Enable search-replace dialog on IE 11+
The search-replace box in WikiEditor was blacklisted entirely from
MSIE, although it appears to work fine in IE 11 on Windows 8.1
and Windows 10 Tech Preview.

IE/Spartan team specifically requested a fix for this bug; looks like
it's an easy case of adjusting the blacklist with a version component...

(Note that in RTL the dialog positioning is bad, but that affects
other WikiEditor dialogs too.)

Bug: T88875
Change-Id: I4cf1eb76cc8a788cab233fe9ed04aaeba4af5725
2015-02-19 12:55:29 -08:00
Fomafix 000031fd48 Move style from JavaScript to CSS
Change-Id: I1bf4b886e3b9b789df377dbdd2df94eb80dd61d1
2015-01-14 07:51:24 +00:00
Fomafix 77fca50876 Use mw.Api() instead of $.ajax()
Add dependency to the already used module 'mediawiki.api'.

Change-Id: I236b3be5f64ac92f6710e5c690b0cc1800ceb1c5
2015-01-07 18:25:47 +00:00
Derk-Jan Hartman 70194d574e Dialogs: Reset values of file insertion dialog properly
Bug: 67111
Change-Id: I63a5cac9108cf9e6966964347407cc63fc0fb9b5
2014-08-14 22:02:16 +02:00
Fomafix cf74f4e0a0 Prevent conflicts with predefined names
Bug: 64896
Change-Id: I67ea669a074317f44eb09cf759c0121bad259b3c
2014-05-05 13:51:10 +00:00
jenkins-bot 996f0d07d7 Merge "Ensure that the property exists" 2014-05-05 10:18:39 +00:00
Fomafix cfcfa69fe4 Apply coding conventions for JavaScript
Change-Id: Ibae64ca7aa52c2283ff81bd942be80c83a4089f7
2014-04-30 10:59:01 +00:00
Fomafix a9fffc62bc Ensure that the property exists
Bug: 64648
Change-Id: Ia4fa64e86286bbd567c4c46e2d79028546ed7e3d
2014-04-30 06:36:02 +00:00
Derk-Jan Hartman 952d6b9d8f WikiEditor: Remove unmaintained beta iframe mode
Change-Id: I2d7369116b92d674d791e420750a906a17a46bac
2014-04-03 17:20:49 +02:00
Timo Tijhof 1a2daca06a Kranitor: Make JSHint pass
eqeqeq:
* Change loose comparisons to strict comparisons where
  it seems safe to use a strict comparision instead.
  Mostly comparisons to strings or objects, and comparisons to
  numbers where the other value is known to be a number, too.
  E.g. foo == 'string', bar == node, indexOf() != -1.
* Add eqeqeq:false to files where there are non-obvious usages
  left.

onevar, quotmark:
* Disabled in files with lots of style violations.

unused:
* Remove unused variables that have no side-effects in their
  assigned expression.

Coding style cleanups on affected lines where trivial.

Change-Id: I5db155a632740e24cb52dba2177c7fc35d5aebd5
2013-11-10 07:36:03 +00:00
umherirrender 7506688ca2 Remove extra comma to avoid fatal in IE7
jslint:
modules/jquery.wikiEditor.toolbar.config.js: line 818, col 43, Extra
comma. (it breaks older versions of IE)

Bug: 52715
Follow-Up: I8c5a52c74fa1bc83c662d748731f96bcd91374d0
Change-Id: I99c16f01176a954ad924a5c493e43fb47206fa4b
2013-08-23 15:09:15 +02:00
Krenair c8d0280517 Warn if you try to link to a disambiguation page
As marked by the Disambiguator extension.

Bug: 50160
Change-Id: I8c5a52c74fa1bc83c662d748731f96bcd91374d0
2013-07-15 13:47:16 -07:00
Siebrand Mazeland db7b05404f No longer use parameter in 'wikieditor-toolbar-tool-table-toomany'
The value is 1000 and this number can only be change in the JavaScript
code. It's unlikely this will be done, and if it's done, the message can
be changed easily.

Change-Id: Iff2553112af52ccb22627301c68db63595ec3cf2
2012-12-28 21:56:43 +01:00
Eranroz 8cf557addf Fix for bug 38827. Setting thumb as default format
This patch sets the "thumb" format as the default format for images added
using wikieditor toolbar, with or without dialogs enabled.

Change-Id: I707b02c63b7253bd29b960a58c0fc10e1d013fb4
2012-08-19 22:02:05 +03:00
Derk-Jan Hartman 7a498e18fb (bug 24566) Make the search and replace dialog non-modal
This has been a popular request, because people often have to
interrupt their search to make certain changes and then want to
resume.

Change-Id: Id537ffe439d4522add300d8c1355758774dca1c9
2012-08-04 16:16:25 +02:00
Amir E. Aharoni 2dfbca2b6d Adjust file size input length
The message that currently appears in the box is '(default)' or its
translation. This translation can be a lot longer than it is in English.
This change sets the length according to the length of the actual string.

Change-Id: I9f2151d39e6f3d1cc708ba71e069316c265a8d20
2012-08-02 15:27:12 +03:00
Rob Moen c535fb3fb6 (bug 38820) Fixed missing and invalid page conditional.
API returns an empty string for invalid and missing properties.
If missing / invalid property are defined, page is correctly flagged.

Change-Id: Id8b28f9ce4fc250853206019e864fe108351add9
2012-07-31 10:17:40 -07:00
Eranroz d0654ef864 (bug 24172) Adding dialog for file, (bug 24114) localize REDIRECT
Fix for bug 24172, by extending the wikieditor with a file
dialog (like the table and link dialog) for adding files with exended
syntax.
The added syntax is localised. This also fixes bug 24114, and the redirect
button now adds localised magic word.

Change-Id: I5950b530ab8c55aeba4b579cc80ce863f228d373
2012-07-27 00:59:23 -07:00
Timo Tijhof e7a0484eb5 (bug 38663) [Regression] WikiEditor "Table" dialog broken
* Fixed by casting to a String before doing the round-trip check

* While at it, improve user interface to make it harder to make mistakes
  and easier to do it "right". By making it an HTML5 "number" input specifically,
  and building in min/max settings into the UI.
  Old browsers fallback to a plain text input (like it was before).

  Most browsers implement this number input by allowing the use of the scroll wheel
  and the up/down arrows to adjust the numbers, and not allowing non-numbers or numbers
  outside the allowed range.

* Follows-up 7721909f9f

Change-Id: If32da14f80c6a0e4be3e1fe7fd0b650be4ed8a09
2012-07-26 11:30:27 -07:00
Timo Tijhof 7721909f9f WikiEditor: Linting and conventions
* Code clean up in preparation for enabling linting in the future

* Update code to use latest code conventions and best practices:
 - Make use of jQuery.Event (e.g. no need to check both e.keyCode
   and e.which)
 - jQuery: .size() -> .length
 - jQuery: (where appropiate) .attr() -> .prop()
   Setting properties like 'checked' via attr() has been deprecated
   in jQuery.
 - Whitespace
 - Single quotes instead of double quotes
 - Use literal keys in object literals instead of strings
 - Pass mediaWiki to closure, use mw. locally instead of "mediaWiki"
   global directly.
 - Fix indentation
 - Brackets around if, else and for bodies
 - Strict comparison to 0, null, false, true etc.
 - Fix missing radix parameter in parseInt
 - Use local $ instead of global $
 - Use `foo || bar` instead of `foo ? foo : bar`
 - Variable scope hoisting
 - Double/redundant variable declarations
 - ['foo'] is better written in dot notation
 - New line at EOF
 - Consistency in jQuery construction:
   Tag name for element creation $( '<div>' )
   Valid html for html parsing $( '<div foo="bar"></div>' )
 - Fix regex escape warnings per JSLint/JSHint.
   Do escape ][, don't escape ><
 - ..

* Add .jshintrc / .jshintignore

* Updated most files, but not all. Too much at once.

Change-Id: I445639b25a9688b3cdf9e5449e3d31cbcfa9c7ae
2012-07-17 13:27:27 -07:00
Roan Kattouw 432415b129 Followup r96944: rename "Replace next" button to "Replace" cause that's what it does now 2011-10-31 08:38:35 +00:00
Roan Kattouw 280ae464a4 (bug 31499) articlePathRegex (detection of external links within the same wiki) broken when wgServer is protocol-relative 2011-10-25 14:30:33 +00:00
Derk-Jan Hartman 11aabbd4a9 Fix bug 31604.
Table should now load the tablesorter if needed, and make sure that the table is sortable.
2011-10-22 17:21:03 +00:00
Siebrand Mazeland cc71ec5354 * bump version to 0.3.1
* stylize.php
2011-09-13 08:56:32 +00:00
Siebrand Mazeland 868eec7504 (bug 20919) Search & Replace: Change "Replace Next" functionality to "Replace" functionality. Patch by Amir E. Aharoni.
Submitter's comment: "Replace next" now replaces the currently selected text instead of finding the next occurrence and replacing it. To keep the location of the current occurrence, i added matchIndex to $(this).data.

I added some comments renamed a couple of variable for readability:
* s to textRemainder
* replace to actualReplacement

This is my first significant jQuery-style patch so it may have embarrassing mistakes - constructive criticism is welcome.
2011-09-13 08:53:12 +00:00
Mark A. Hershberger b18069c06a Bug #29106: Patch from Michael M. to address JS legacy globals in wikiEditor 2011-06-26 19:25:27 +00:00
Leo Koppelkamm 57721bd94e Followup to r86108 per CR: Fix two calls to legacy tablesorter 2011-04-30 18:58:17 +00:00
Leo Koppelkamm 724dccc131 Fix jumping of textbox in link-dialog. This happened when the link was being checked and the too large spinner image pushed the field down 2011-04-21 08:59:13 +00:00
Jan Paul Posma 8ca58dd46b A bit of a reorganisation that fixes bug 27164. Basically the extensive configuration in the ext.wikieditor.* functions is moved to the jquery plugins, to be able to use these configurations in other extensions which don't have a #wpTextbox1.
Please review this to check if this is the right way to do it!
2011-02-24 01:45:55 +00:00