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
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
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
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
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
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
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
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
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
> 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
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
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
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
Replace $.escapeRE from 'jquery.mwExtension' by
mw.RegExp.escape from 'mediawiki.RegExp'.
This change requires MediaWiki 1.26+
Bug: T103993
Change-Id: I5fc19e1313fc6a06726981e0365cea6d00abb5f3
* 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
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
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
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
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
This patch sets the "thumb" format as the default format for images added
using wikieditor toolbar, with or without dialogs enabled.
Change-Id: I707b02c63b7253bd29b960a58c0fc10e1d013fb4
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
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
API returns an empty string for invalid and missing properties.
If missing / invalid property are defined, page is correctly flagged.
Change-Id: Id8b28f9ce4fc250853206019e864fe108351add9
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
* 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
* 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
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.