Commit graph

52 commits

Author SHA1 Message Date
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
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
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
Fomafix 83c079ceb6 Reuse variable profile instead of $.client.profile()
Change-Id: I66543bd0838b062bea08ca4b5f4fded41ff835cc
2015-03-14 18:01:58 +00: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
Alex Monk 74da530f2d Schema:Edit instrumentation
Depends on Ib8612626

Bug: T88027
Change-Id: I67f1000d23cb257df29d5d4be8ae85764458e6c1
2015-03-10 14:56:45 +01:00
Brion Vibber ab2c7e3ce6 Skip an old IE 8 bug workaround in WikiEditor on IE 11/Spartan
An early version of WikiEditor added a workaround for a reported
bug with IE 8 where textarea scroll and selection state was lost
when the contents were modified.

This doesn't seem to be needed on modern versions of IE such as 11
and above and the newer 'Edge' HTML engine mode in Windows 10.

Actually, I can't reproduce it in Windows 7 or XP with IE 8 either
from the original bugs, but just in case it's needed on some particular
version that we don't know about I've only added a check for modern
IEs, which is already in use on other old-IE workarounds in the
module.

Bug: T88875
Change-Id: I25b667a8d8378c417441adee5d97571c71a1c8c7
2015-02-19 21:01:21 +00:00
Matthew Flaschen 736b94f827 Update autoMsg doc for plain call
* Reflect that we're now calling mw.message( ... ).plain()
* Remove vague statement about "may eventually become a wrapper for
  some kind of core MW functionality."

Change-Id: Ibe743162c1f72bb3977ec16e2ba4b023a66e3907
2015-02-14 22:32:35 -05:00
Fomafix 78bdeffcc6 Use "obj.hasOwnProperty( prop )" instead of "prop in obj"
'constructor' in {}; // true
Object.prototype.hasOwnProperty( {}, 'constructor' ); // false

Bug: T86643
Change-Id: I4356608956d722dc086e6876a53fdd93435c6f0a
2015-02-05 13:34:03 +01:00
Fomafix 790a1af231 Fix whitespaces in JavaScript
* Use a singe space as whitespace.
* Remove space before colon when not used as ternary operator

Change-Id: I6391bbcf10d26fadf82686d7ff226b773868415c
2015-01-14 07:14:44 +00:00
Fomafix bfe2fc6c4e Workaround for a scrolling bug in IE8 on resize
Bug: T63910
Change-Id: I6dacc1ed2f2fdf4ea615a477b711dc78667bae68
2014-12-06 12:40:50 +00:00
Derk-Jan Hartman f64a3c26c6 Enable WikiEditor toolbar on iOS
Since we now have a full fledged mobile solution, I think we should
strive to have the site 'proper' work as much on any platform as
possible.

WikiEditor traditionally was not loaded on iOS.
No one really knows why this was not loaded. It can have been bugs or
just to 'slim down'. It works on iOS 6 and iOS 7, so for that reason
I'm now changing the blacklist in this respect. It might work with
earlier versions, but I can't really test that right now.

Bug: 63277
Change-Id: I605eb0e093b84203f1157d9e20788eaa0040ddbf
2014-05-26 14:34:17 +00:00
Fomafix cfcfa69fe4 Apply coding conventions for JavaScript
Change-Id: Ibae64ca7aa52c2283ff81bd942be80c83a4089f7
2014-04-30 10:59:01 +00:00
jenkins-bot c964783792 Merge "Revert "Revert "Preserve textarea state when building WikiEditor UI""" 2014-04-29 22:45:57 +00:00
Mwalker b5696dc435 Revert "Revert "Preserve textarea state when building WikiEditor UI""
Ib97f47ef1d66420682bd429c9c12e66c3392e77d Didn't cause
problems so this is now safe to reapply (to wmf2).

This reverts commit 908e7cc56c.

Change-Id: I510536959b58ff0adacd7908f6150c95bfdb3ec1
2014-04-29 22:43:32 +00:00
jenkins-bot 38b2328296 Merge "Revert "Preserve textarea state when building WikiEditor UI"" 2014-04-25 20:12:25 +00:00
Mwalker 908e7cc56c Revert "Preserve textarea state when building WikiEditor UI"
Sadly this caused bug 64289; so we're going to revert this for now;
then redeploy this and Ib97f47ef1d66420682bd429c9c12e66c3392e77d
in one of the swats next week.

This reverts commit effd98be7e.

Change-Id: Idde3e51e894f8c92f47fb06f0cf08d01e82ccb48
2014-04-25 20:12:09 +00:00
jenkins-bot 3bd860d220 Merge "Cleanup borders of wikiEditor" 2014-04-16 19:50:20 +00:00
Derk-Jan Hartman effd98be7e Preserve textarea state when building WikiEditor UI
When we are wrapping the textarea in the Editor UI, the focus state,
cursor position and the scrollposition might get lost. This is
especially annoying on slower machines, where users might have started
using the textarea before the WikiEditor UI was constructed.

Bug: 41911
Change-Id: Ie472c6c88d98f7ba89873a2db73463ef01bd995a
2014-04-16 08:40:19 +02:00
Derk-Jan Hartman 12e5de632e Cleanup borders of wikiEditor
We had some crazy stuff here with negative margins, border boxes and
what not. There were some problems with IE versions, zooming in and out
in pages and with the side by side preview.

This should take care of those. Mostly it moves the borders inside the
elements that are 100%. This was also required because of the
side-by-side preview which was using a dirty trick to hide the border at
the top

Bug: 26828
Change-Id: I3c3466fac53df3e79de6f12f404005e55409fa7c
2014-04-08 15:32:00 +00:00
Derk-Jan Hartman 952d6b9d8f WikiEditor: Remove unmaintained beta iframe mode
Change-Id: I2d7369116b92d674d791e420750a906a17a46bac
2014-04-03 17:20:49 +02:00
Fomafix 895f737b87 Workaround for a scrolling bug in IE8
Bug: 61908
Change-Id: I69dbfa267b26916628181553b213f05add909c99
2014-02-25 12:41:12 +00:00
Ori Livneh f5b2b18a01 mw.loader#version -> mw.loader#getVersion
mw.loader#version was removed in I57d340015.

Change-Id: Icb8e591c379b083cfc5f05a1a24320e0f13f7d12
2014-02-18 14:54:29 -08:00
umherirrender 37a1deb799 document.selection is undefined in IE11
IE11 replaced document.selection by window.getSelection, which breaks
dialogs in WikiEditor, because document.selection.createRange was
accessed without check. Inserting this check unbreaks the dialogs.

Bug: 57489
Change-Id: I70d49fb43bbf7602f43e9a8086ecd32027cb6d6f
2014-01-05 17:49:54 +01: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
Helder.wiki 1b797b7f6a Use mediaWiki.message( ... ).plain()
Bug: 42107
Change-Id: Ic17aa1ff18528cec402bef08cace6987529f2782
2013-09-28 09:10:11 -03: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
Sam Reed 7f10e92044 Swap
/*
 *

for

/**
 *
2011-10-26 03:49:06 +00:00
Siebrand Mazeland cc71ec5354 * bump version to 0.3.1
* stylize.php
2011-09-13 08:56:32 +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
Brion Vibber 2b22c37b88 * (bug 29322) Move some iframe-specific code in WikiEditor JS to its proper module 2011-06-09 18:10:02 +00:00
Brion Vibber 85ec51cce0 Fix for WikiEditor iframe extension on IE: use $.inArray() instead of Array.indexOf(), which is not in earlier JS standards as implemented in IE 8.
Use of Array.indexOf was added in r74271 when the iframe bits were broken out to an extension.
2011-06-09 00:20:13 +00:00
Krinkle 40bb0c72b5 Extension:WikiEditor Code quality, JSHint validation and JSPERF
- Leaked globals
- Strict comparison to 0, false and ''
- Missing semicolon
- Variable name collision
- Minor improvements in caching (in a few places "var $that" cached $(this), but wasn't actually used)
- Replace calls to deprecated $j with $
- Checking undefined by strictly comparing references instead of a string comparison and typeof (speed)

(see bug 29106)
2011-06-06 23:18:13 +00:00
Jan Paul Posma 6e998359f0 Fixes bug 24088: WikiEditor toolbar RTL icons 2011-04-25 12:26:20 +00:00
Roan Kattouw ee3a8e68b0 WikiEditor: Add missing message and shut up a source of JS errors 2011-02-23 20:50:52 +00:00
Roan Kattouw 9eaa77a549 WikiEditor: Use wgExtensionAssetsPath instead of wgScriptPath + '/extensions' 2011-02-16 14:52:34 +00:00
Roan Kattouw b7f45b1e01 WikiEditor: Add some var statements to code introduced in r74271 2011-02-08 07:04:12 +00:00
Roan Kattouw 94c2e2f19d WikiEditor: Fix usage of $.client 2011-02-07 21:59:01 +00:00
Sam Reed a3cba4154c Remove a couple of commas 2010-12-06 11:07:50 +00:00
Trevor Parscal bb88f087b4 Mostly reverted r75487, making use of a new version of mediaWiki.msg. 2010-10-27 00:16:32 +00:00
Trevor Parscal 55a8f66322 Updated use of mediaWiki.msg to mediaWiki.message 2010-10-26 23:42:23 +00:00
Trevor Parscal 49eb154f2c * Fixed mistake made in r74271 where some functions were moved from core jquery.wikiEditor into jquery.wikiEditor.iframe, causing errors for textarea mode. These changes properly split the functions, allowing the iframe to override the textarea functions, and using $.client to only execute them on IE. (tested in IE7)
* Also fixed IE bug, where "delete window.myThing;" fails but "delete myThing;" succeeds.
2010-10-05 20:54:38 +00:00
Trevor Parscal c92c4436a5 Fixed autoMsg misusing mediaWiki.msg.get 2010-10-04 21:17:08 +00:00
Trevor Parscal 0a71513db4 * Introduced the concept of context extensions
* Abstracted the requirements concept being used to hack in the iframe as a context extension requirement
* Removed some hardcoding for iframe stuff
* Moved about 60k of JavaScript code out of the main wikiEditor script, and into an iframe only context extension.
2010-10-04 20:12:30 +00:00
Trevor Parscal fd441d4b6d Remapped image and html paths to new extension location. 2010-09-16 22:54:59 +00:00
Trevor Parscal 9862d7d871 Removed dependency on global variable "wgWikiEditorIconVersion" 2010-09-16 22:40:24 +00:00
Trevor Parscal 6b8e5f2f54 This extension now functions. iframe dependendt modules need more work still. 2010-09-16 21:11:46 +00:00