Commit graph

252 commits

Author SHA1 Message Date
jenkins-bot 31430aefd8 Merge "Add ext.popups.experiment module" 2016-05-18 19:06:29 +00:00
Jdlrobson eff7dc95e6 Revert "Add properties that will be logged with each EL request"
Breaks EventLogging as the old schema is not compatible with these
new properties. We will reapply the patch later when in a better state.
My bad for merging.

This reverts commit ca20031a0e.

Change-Id: Ia961e0f99339f9045af9d0a4653599a48518cc95
2016-05-18 18:47:16 +00:00
Sam Smith 3f03d681c9 Add ext.popups.experiment module
Changes:
* Add the ext.popups.experiment module
* Add the mw.popups.experiment.isUserInCondition function, which
  returns a promise that resolves with true if the user is in the
  experimental condition, otherwise false
* If the experiment isn't configured, i.e. wgPopupsExperimentConfig is
  null or undefined, then the user isn't entered into the experiment,
  providing a kill switch

Bug: T132604
Change-Id: I49597494273e3862711a32e4951c8598e6c8bf59
2016-05-18 17:28:46 +01:00
jenkins-bot 85b27d8de8 Merge "Do not directly manipulate the cached object" 2016-05-18 09:28:41 +00:00
jenkins-bot 95d16e75de Merge "Add properties that will be logged with each EL request" 2016-05-17 21:42:53 +00:00
jdlrobson 69fff17141 Make SVG thumbnails show for Internet Explorer
IE9 does support SVG if you use  setAttributeNS.
Thus stop whitelisting SVG support there.

Don't worry about fallback rendering of SVG for IE < 9
- those that do not support SVG also do not
enjoy ResourceLoader JavaScript support.

Bug: T134979
Change-Id: I1d3d9c4c622e98df19a5e9dc4101b44242e07178
2016-05-17 20:27:09 +00:00
Baha ca20031a0e Add properties that will be logged with each EL request
Bug: T131315
Change-Id: I16f5f8170174200bb20c6bcc2835efd136d752ff
2016-05-16 16:39:07 -07:00
Baha cda1ffe425 Use mw.eventLog.Schema to log EventLogging events
This change is an intermediate step in our transition
to logging a variety of events easily.

Also:
  * Some events may need sendBeacon support and may not be
    logged if the navigator does not support sendBeacon.
  * Do not load schema code if EventLogging is not available.

Bug: T131315
Change-Id: Iff939577f65f1c6c71701dd6967939445385fb70
2016-05-16 17:29:48 -04:00
jenkins-bot 5f100a5de4 Merge "Rewrite createPopup with template for better readability" 2016-05-13 18:25:15 +00:00
Prateek Saxena 21b856f7f7 Use correct selector for div's that hold PNGs when SVGs aren't supported
* The classes in ext.popups.core.less apply to the thumbnail
which reside in .mwe-popups > div > a.popups-discreet
The thumbnail is thus not a direct child of the div parent of
popups-discreet.
* The margin-top is unnecessary.

Change-Id: If91140a55baa1aef36483002de681503c2690cf6
2016-05-13 18:12:11 +00:00
jdlrobson 7f3be6dcd4 Do not directly manipulate the cached object
Popups currently makes use of a render cache. Using a cache in this
way without protection causes problems (I will look at cleaning this up)

The hack below it
`mw.popups.$popup.html( mw.popups.$popup.html() );`
will lead to the html of the cached object being wiped out on IE9 meaning
future loads will show an empty popup.

Add a unit test (which previously would fail in IE9) to protect against this
in future.

Bug: T68496
Change-Id: Icef784fb389b0ab1856e2ba7464c9423ebcd62ab
2016-05-12 16:56:19 -07:00
jdlrobson 27d811a173 Rewrite createPopup with template for better readability
Change-Id: If646623ba4ebf5dfac2a94c73b6f053131739767
2016-05-12 16:19:13 -07:00
Sam Smith 26be90dc5a Add client-side validation of PopupsSurveyLink
Changes:
* Extract survey link element creation into
  mw.popups.render.renderers.article#createSurveyLink
* Make #createSurveyLink throw an error if the URL doesn't start with
  https or http
* Add unit tests that cover the new behaviour of #createSurveyLink

Bug: T129177
Change-Id: I8b61cb0e94ab4e30bc894c279bb05918ecc7719e
2016-05-11 14:53:30 +01:00
Sam Smith dab4f55e0d Annotate survey link with rel=noreferrer
Don't leak referrer information or `window.opener` to the survey hosting
site.

Bug: T129177
Change-Id: I828bd01391bc1e034fe5655d89209b83f192b112
2016-05-11 14:02:55 +01:00
jenkins-bot 9a9b4abdea Merge "Allow brackets in createImgThumbnail" 2016-05-11 10:16:07 +00:00
jdlrobson f3d23c975f Allow brackets in createImgThumbnail
Changes:
* Quote the URL with double quotes when generating the background-image
  rule

Bug: T129177
Change-Id: I74748c7efe67954272ce0a539455b0b00001a26a
2016-05-11 10:18:49 +01:00
Prateek Saxena 46f69baf38 article: Remove bracketed text from the title before looking to bold it in the extract
Bug: T69224
Change-Id: I5306101a7acd3c33c55989e97c7581a403594645
2016-05-10 21:51:57 +00:00
Prateek Saxena ed327f8ee6 Minor refactor
1. Add comment for empty SPAN when there is no thumbnail
2. Use footer instead of div.timestamp-* as it also contains
   the settings icon now.

Change-Id: Ia6fca32770596c980b33a9a6e58bb08b661b90d1
2016-05-10 14:23:08 -07:00
Baha 72dd872781 Add QUnit test for ext.popups.settings
Test pieces that make sense, everything else is already
covered in cucumber tests. See the following commit for more
info: I55f311b6b8845e6ebf4cc5698758afd1f9042a45.

Bug: T133025
Change-Id: I474c1569494601ae5865dcfba22ea728220ff8df
2016-04-28 16:13:20 -04:00
Baha 06b49dc6b8 Add QUnit tests for ext.popups.logger
Bug: T133024
Depends-On: Icb1e6ddc8f95da5e4b4de2916d292694c11ba731
Change-Id: I73fee2e3351de357f8f60bf6287a876e245117df
2016-04-20 18:33:53 +00:00
jenkins-bot 9f83c10ad8 Merge "Bold only first instance of title in extract" 2016-04-18 10:14:19 +00:00
Baha 8f3832e68a Add X-Analytics request header when fetching popup data
API requests to fetch the hovercards data now include
`X-Analytics: preview=1` header so that HoverCard hovers are
easily distinguishable in Hive.

Bug: T129425
Change-Id: I69df51a627951c4373b3b7463ab5b2c0a129faa1
2016-04-13 14:32:00 -04:00
Prateek Saxena 5f92196541 Bold only first instance of title in extract
Bug: T132523
Change-Id: I3145186264edd23ca898365ae55184cbe96ada6a
2016-04-13 21:24:42 +05:30
jenkins-bot 3f47fe91de Merge "Add link preview feature to mobile beta mode" 2016-03-11 23:43:01 +00:00
Florian c93047666e Add link preview feature to mobile beta mode
Linkpreview will try to fetch a text extract using the api and, if this
doesn't fail, show the extract as a drawer with a button "Continue to
article". If the query fails, it will redirect the user to the article
directly.

Bug: T113243
Depends-On: I6d8c5b80e70c3d8d1a92a70cc91e1b90d598cb0f
Change-Id: Idbaae9fe2decd89b73e623a25fbd39464c316fb2
2016-03-05 18:22:30 +01:00
Legoktm 48d5a38587 Revert "Compress PNGs with zopflipng"
This reverts commit 56c3f71426.

Change-Id: Iab018ac5cc772aede47c19dfa9d77e81b1a7c00f
2016-02-28 00:08:03 +00:00
Ori Livneh 56c3f71426 Compress PNGs with zopflipng
Zopfli is the most efficient DEFLATE compression algorithm, trading run-time
performance for file sizes that are typically 3-8% smaller than those produced
by zlib with the maximum compression setting. Its output is Deflate-compatible,
so no specialized decoder is needed.

This change was created by running zopflipng against all the PNG files in this
repository. The exact invocation was:

  git ls-files --exclude-per-directory=.gitignore -- '*.png' \|
    parallel zopflipng -m -y {} {} \;

Files which zopflipng was not able to compress more efficiently were left unmodified.

Bug: T127608
Change-Id: I3ec96a8e75ea521315b5944e91ead5e60297c6df
2016-02-21 01:19:52 +00:00
Ori Livneh 6a0dc3964f Compress PNGs with zopflipng
Zopfli is the most efficient DEFLATE compression algorithm, trading run-time
performance for file sizes that are typically 3-8% smaller than those produced
by zlib with the maximum compression setting. Its output is Deflate-compatible,
so no specialized decoder is needed.

This change was created by running zopflipng against all the PNG files in this
repository. The exact invocation was:

  git ls-files --exclude-per-directory=.gitignore -- '*.png' \|
    parallel zopflipng -m -y {} {} \;

Files which zopflipng was not able to compress more efficiently were left unmodified.

Bug: T127608
Change-Id: I0bcc35a4d27a7589cd1a3f6569ef8089e8b6ec02
2016-02-21 00:28:26 +00:00
Florian bbe958bb5d Prepare Popups for adding of mobile specific Popups implementation
For the work on T113243, the Popups extension should be structured in a
more flexible way. This is achieved with this change.

Following has changed:
 * The main/core logic of Popups now lives in ext.popups.core to be shareable
   between implementations
 * The desktop specific logic lives in ext.popups.desktop now, the frontend init
   code in ext.popups.desktopTarget and the desktop renderer in
   ext.popups.renderer.desktopRenderer

This change doesn't change the functionality of Popups.

Change-Id: I72121e0a1e4b2952f85dc1bc8cf59d06b8d22f47
2016-01-30 23:09:55 +01:00
Prateek Saxena bb321b2f23 Stop emptying link title if a TextExtract was not returned
Bug: T123460
Change-Id: I0989d32b391d849c56fd85bb05cb28cc079bc759
2016-01-13 09:59:22 +05:30
jenkins-bot 83a98925af Merge "renderer: Use NavigationPopups settings where available" 2016-01-08 06:35:48 +00:00
Prateek Saxena 853ee800a3 renderer: Unregister mouseleave handler on mw.popups.$popus on closePopup
Bug: T68315
Change-Id: I3da1b4629841a3059d585e424760b331570a3116
2016-01-08 10:31:16 +05:30
Prateek Saxena d760c12fe0 Stop showing popup for cancel link on the Wikitext editor
Bug: T122078
Change-Id: Ib275605c649829a1a04b9bdcb8ffe446921aed0c
2015-12-23 19:08:33 +05:30
Fomafix 0a386fa141 Add 'lang' and 'dir' attributes to '.mwe-popups-extract'
This change uses I26d033e33bfa60c8ff72ba70bb564cba4303a8b6 from core.

Bug: T68114
Change-Id: Iede17b777d5bb2863ea08ba5b0549b4cd7ef5a56
2015-11-04 16:53:47 +00:00
Prateek Saxena 4460321e5a renderer: Use NavigationPopups settings where available
Change-Id: I47e11d07561ebf710d39042c2a3bc4b213a821da
2015-11-01 16:39:46 +05:30
jenkins-bot 0fec4def5a Merge "Remove dead space" 2015-10-14 17:35:23 +00:00
Baha 7c6ccb3d1a Remove dead space
Make sure the popup is displayed right above or below the link.

Bug: T68317
Change-Id: Ib6ba9f1ffc5244842a1535937aa0990eae6943ae
2015-10-14 15:49:39 +05:00
jenkins-bot eaf71a1d4b Merge "ext.popups.renderer.article.js: Use mw.RegExp.escape() for RegExp escaping" 2015-10-14 00:31:07 +00:00
jenkins-bot 68500e7256 Merge "Check renderers' matcher method to find the appropriate renderers for a link" 2015-10-14 00:30:16 +00:00
Prateek Saxena ba919e5d0a settings: Remove navPopEnabled property
This doesn't need to be a property. Its being used exactly once, and
because we try to test for NavigationPopup's availability so soon we
mostly get an incorrect answer.

Moving the condition to the render method instead. Chances of NavPop
being loaded when the settings' screen is being rendered are much
higher.

Bug: T109912
Change-Id: I3723dc1e3e9400b6ed2e0160104c849a25a71881
2015-10-08 00:11:28 +05:30
Fomafix 7ac7a2abd1 ext.popups.renderer.article.js: Use mw.RegExp.escape() for RegExp escaping
mw.RegExp.escape() is already used in ext.popups.core.js and
the dependency to module 'mediawiki.RegExp' is set.

Change-Id: Iaa7ab6902693c787234fd589276fa38ce75b82da
2015-10-02 20:58:26 +00:00
Prateek Saxena 93ef48221e Check renderers' matcher method to find the appropriate renderers for a link
Right now the main renderer always picks the article renderer, no matter
if any other renderers is registered. It will now run the 'matcher'
method in the rendered, and if it returns true, we use that renderer.

Not sure how we'll avoid matchers stepping on each other.

Bug: T69434
Bug: T102921
Change-Id: Ib06812836cdbd3a5bfd54d4bc6147012fb891694
2015-10-01 10:56:15 +02:00
jenkins-bot 486e34fb38 Merge "Move the article renderer in to the renderers property" 2015-10-01 08:50:39 +00:00
Prateek Saxena 1565a1d3c9 Move the article renderer in to the renderers property
To allow multiple renderers (for different types of content)
to be defined.

Change-Id: I50320646e26f36a0a2bc425c82ccc58912840f84
2015-10-01 08:48:00 +00:00
Baha 495014a917 Feature detect SVG support
'document.implementation.hasFeature' has been deprecated and is not
reliable. See
https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature

Bug: T113200
Change-Id: I5901768d8c8642caac31884c5e9ac5b6ac74d035
2015-09-30 22:36:03 +05:00
jenkins-bot 2652cd325a Merge "core.less: Visual refinement & drop shadow" 2015-09-23 22:24:03 +00:00
Brion Vibber d90c492275 Hi-DPI/Retina support for hovercard images
Requires core changeset Ic9cb1654 for $.bracketedDevicePixelRatio()

Bug: T97935
Change-Id: I452b87a90769463328840c6c7e46b583e6148439
2015-09-09 15:40:33 +02:00
Prateek Saxena 6eef4f325b Add jscs and jshint tasks to the Gruntfile
Adds the jscs and jshint packages for development and their tasks in
Grunt. Also fixes all the code convention errors.

Change-Id: If1c9dfdbe22d4912d78b6a51b1292866970a85cc
2015-09-04 13:57:52 +05:30
jenkins-bot b1dd60ccf5 Merge "Use pg.fn.disablePopups to detect and stop NavigationPopups" 2015-08-27 20:17:37 +00:00
Timo Tijhof 41c12d3f9a Remove stray ")" from the "Enable previews" link
Follows-up dd98179a15.

Change-Id: I07b039dae272c9e66f091dd07b6e9b7d20b6d275
2015-08-27 03:06:20 +02:00