Commit graph

363 commits

Author SHA1 Message Date
Sam Smith 89975c4942 Remove mobile support
Note well that mobile support is a consideration in the refactoring
effort (see T149801).

Change-Id: I82adc1550b66d0a456aa299ad6c8d2d097fbb7ae
2016-11-08 09:32:04 +00:00
Jhobs 102d02b891 Revert "Revert "Fix tooltip interactions""
This reverts commit 11431dd2f6.
It also applies the fix for the original error.

Change-Id: Ib86534ffbcd20f64c8ba06c23f2e8af509437cfe
2016-11-03 13:51:36 -04:00
Jdlrobson 11431dd2f6 Revert "Fix tooltip interactions"
There is one reference to removeTooltips in 
ext.popups.targets.desktopTarget.

I suspect this got broken in a rebase. It seems Jenkins only runs
browser tests post merge. We should fix that.

Please resubmit the patch with this amended.

This reverts commit 0ff40a6532.

Change-Id: Idd8dffb853db760ebc5866190d008f173e3025ba
2016-11-03 17:46:41 +00:00
jhobs 0ff40a6532 Fix tooltip interactions
Tooltips are intended to be stripped upon `mouseenter` and `focus`
events and then restored during their corresponding `mouseleave` and
`blur` events. This was broken due to duplication of event registration
and no proper deregistration.

Changes:
 * Rename `mw.popups.removeTooltips` to `mw.popups.removeTooltip` to
   more accurately describe its effect
 * Narrow the scope of `mw.popups.removeTooltip`
 * Add `mw.popups.restoreTooltip`
 * Add `onLinkBlur` to `desktopTarget.js` to handle tooltip restoration
 * Update qunit test to reflect changes to functions
 * Minor hygiene changes regarding event namespaces

Bug: T142723
Change-Id: I776a72e436ac823fdd6b68435d9a042a91c934e5
2016-11-03 13:39:26 -04:00
jdlrobson 4d7d55ec14 Hygiene: Rename getMassagedData to processHovercardEvent
This name is more fitting to the new purpose of this method.

Change-Id: I48f5e9a3ae737a104270699742a96923c92e12e8
2016-10-31 11:25:09 +00:00
jdlrobson 9477fd5fe6 Multiple hover events should not clear dwellStartTime
If a user has hovercards disabled, when they right click a link
this will trigger another hover event which will reset dwellStartTime.
This means when a dwelledButAbandoned event fires shortly afterwards
the totalInteractionTime will not be correct.

To remedy this, the calculation of totalInteractionTime and
perceivedWait is moved into ext.popups.schemaPopups

Now that we can trigger events without logging to the server and
checking the total interaction time duration in two places,
let's always run the event and only check it once.

A `hover` event triggers the setting of a dwell start time
A `display` event triggers the setting of the perceivedWait value
* Both are reset on a dwelledButAbandoned.

Since dwellStartTime is controlled inside a single place, getMassageData
no longer needs to clear it.

The test "returns false if dwelledButAbandoned event without a dwellStartTime"
is removed as this should no longer be possible.

Bug: T147846
Change-Id: Ie5917ca86f0d0ab27f4cf507e6dfa2c271433c03
2016-10-28 17:33:10 +01:00
jdlrobson 47c2df09d4 Display and hover events are logged but not recorded
This adds two new events "display" and "hover" which are not
recorded back to the server. The benefits of having these events
is that they are important events in the lifecycle of a hovercard.

This allows us to debug trackSubscribe and ensure we see the behaviour
we expect to see and in a future patchset will allow us to use these
events to drive the calculation of interaction time in one single location
(Sneak preview:
 https://gerrit.wikimedia.org/r/316481 to get a feel for the why.)

Change-Id: I58eefc29444179fd245cfd722093dedea19455e8
2016-10-25 19:55:35 +00:00
jdlrobson c4460ba2ea Hygiene: Move logic for duplicate events into getMassagedData
Add tests.

Change-Id: I15c10f256432ab5bfa7bf7adb34764f84b17c439
2016-10-25 19:33:29 +00:00
jdlrobson 1f010664ef Hygiene: Rename track topic to be more consistent with new plans
I plan to track events that will not be logged by the schema so
am dropping the 'schema' from the topic name.

This will allow us to track events that we do not log via the schema

Change-Id: I0c2762f7ed6e54fff765513b2c2d32f73fe8902f
2016-10-25 20:00:18 +01:00
jdlrobson 74231eba4a Hygiene: Remove dead code
Since DWELL_EVENTS_MIN_INTERACTION_TIME is always
zero the check will always be true so let's not make
that check unnecessarily.

We might change this in future is not a good reason
for keeping this code.

Change-Id: I23cb7ef9caeb3df470ccf109b815c4c566b0a735
2016-10-19 13:57:16 -07:00
jdlrobson 7dfad14da1 Directory structure should reflect the ResourceLoader definitions
Given we currently have modules defined in extension.json and in hooks
it can be really confusing understanding how the code fits together.

This change hopefully makes this a little clearer by using folder names
that are named after the resource loader modules - this is also consistent
with how we do things in our other extensions.

A images folder is added to the route so that it is clearer that the images
are not used in ResourceLoader module definitions and are only used to illustrate
the beta feature.

Change-Id: Ia650ec03e3a6d3069165441ddfa069d390be4d10
2016-10-19 20:52:40 +00:00
jdlrobson bf8485b6c7 Hygiene: Pull out event handler for display of Hovercards
* Make it clearer what event is being bound, consistent with
onLinkClick and onLinkAbandon
* Don't create event data twice
* Refactor to reduce function size

Change-Id: Ie4368531612a2829ad191629410ba548eadb2007
2016-10-13 15:59:29 -07:00
Ed Sanders 469d3e7f02 Update beta feature screenshots to use proper layout and colours
Bug: T144428
Change-Id: Ic97bed840c5e9c34a4c8e81a2148e2a0af4ed286
2016-10-12 15:32:21 -07:00
jdlrobson aa5e622ca0 Event handlers should not be exposed globally
Bug: T147306
Change-Id: Ib0bae3e7c2e420a4b717391d4a25473a3a9f9128
2016-10-12 14:58:17 -07:00
jenkins-bot 46274a5518 Merge "Regression: correctly log the click action total interaction time" 2016-10-04 10:23:46 +00:00
jenkins-bot 66d8daddba Merge "Regression: Correctly log total interaction time for dismiss event" 2016-10-03 11:09:52 +00:00
Baha 3c0ea0f9cd Regression: correctly log the click action total interaction time
Per T143051, hovercards was asked to be closed after the user clicks on
the hovercard (or the link that showed it). Closing the popup before
logging the `click` event causes `logData` to be lost. This patch logs
the data first and then clears it.

The regression was introduced in Ifd6f75c2a53d8d7b5ef9fd3f232f85b55eea24c8.

Also do not attempt closing a popup when it may not be open.

Bug: T146934
Change-Id: I02febc83036130bcea0a769114c9126cb481bafe
2016-09-30 12:03:09 +00:00
Baha ae96fddb40 Regression: Correctly log total interaction time for dismiss event
Per T143051, hovercards was asked to be closed after the user clicks on
the hovercard (or the link that showed it). Doing so before logging the
`dismiss` event caused `logData` to be lost. This patch logs the data first
and the clears it.

The regression was introduced in I3f3c4780cc31dc8d84cdd76df2c77fa45fbea882

Bug: T146927
Change-Id: Ie965d43b04962b2dbe2d15caa4c14bf62d1e39ea
2016-09-30 08:02:05 -04:00
Prateek Saxena 898648dfa2 settings: Use mw-ui-progressive instead of progressive buttons
Bug: T146923
Change-Id: I35078d5f61afb368ff3fc37e2f9cf0986bed2294
2016-09-29 18:47:00 +05:30
jdlrobson f974a024f4 Clicking a Hovercards legible link should close popup
A click event is used to capture links that may be clicked via
the keyboard.

Bug: T143051
Change-Id: Ifd6f75c2a53d8d7b5ef9fd3f232f85b55eea24c8
2016-09-23 21:01:50 +00:00
jdlrobson 9f92324b4d Dismiss event should not be tied to render method
The dismiss event is currently a side effect of closing a popup.
This should be more closely coupled with the event that causes it.

This allows the closePopup method to be called without trigging
an event which is a necessary precursor to closing popups when
navigating away from the page.

Change-Id: I3f3c4780cc31dc8d84cdd76df2c77fa45fbea882
2016-09-23 20:56:46 +00:00
jdlrobson 25fabbf5f4 Hygiene: Only allow calls to closePopup on an active link
Change-Id: I7c15870e1586aa8629af723accad67dee5483369
2016-09-23 20:27:41 +00:00
jdlrobson 5a226ebd39 Hygiene: Add set and get methods for active link
Named functions help explain to a reader and reviewer what the code
is actually doing.

Change-Id: I1d059c9270fd2298285fa5e4e52e403a06f35503
2016-09-23 11:01:21 -07:00
jdlrobson da5d61e485 Improve documentation for render methods
The parameter types are incorrect and this leads to confusion
Use $ prefix for $link parameter to make clear it is a jQuery.Object

Change-Id: I3f98f3729cd06aedd791e7503233082c1402dc95
2016-09-22 15:28:57 -07:00
jenkins-bot 5520c6c4ac Merge "Merge mw.popups.experiment into mw.popups.core" 2016-09-21 22:31:39 +00:00
jenkins-bot 98d76e2591 Merge "Minor refactor - use named function for wikipage.content hook" 2016-09-21 21:34:28 +00:00
jdlrobson 523213466e Minor refactor - use named function for wikipage.content hook
The handler for the hook `wikipage.content` was long
and undocumented but is a crucial piece of code.

To make it a little easier for people not so familiar with the code
to find this code and understand what it does I've pulled it out into
a named function.

Change-Id: I3ada53e135dea7dc6846440999b0d42285e14013
2016-09-21 14:23:25 -07:00
Sam Smith 0b2961c318 Merge mw.popups.experiment into mw.popups.core
ext.popups.experiment depends on .core as it initialized the mw.popups
namespace and .core depends on .experiments for
mw.popups#getEnabledState.

By merging the experiment module into core, we can eliminate any
circular dependencies.

Changes:
* Move ext.popups.experiment.js code into ext.popups.core.js
* Remove mw.popups.experiment module and any references to it

Note: ext.popups.experiment.test.js was left in its own file for cleaner
QUnit module setups and easier removal later. I'm not entirely happy
with doing it this way, but I'm not sure changing the mw.config within
the mw.popups.core QUnit module is worth merging the files.

Bug: T146035
Change-Id: I1f024567010acaa61c1d613c6e59c998198a5976
2016-09-21 16:43:49 -04:00
joakin 8f001ee4bd Respect beta feature flag for logged in users
Both in active and inactive state (not just active like before).

Bug: T146017
Change-Id: Ieb4cd39c2870fb701cabd0f1d01c0ab42b6ebe78
2016-09-20 17:48:39 +02:00
joakin 9787f515d0 Log all dwelledButAbandoned events
Extract the minimum interaction time of dwelledButAbandoned events to
a unique place: mw.popups.render.DWELL_EVENTS_MIN_INTERACTION_TIME

Lower that interaction time to 0 so that all dwelledButAbandoned events
are logged.

Bug: T145379
Change-Id: Id68183367966b9f0d52e0cd570cab64671a3e87e
2016-09-14 14:50:39 -04:00
Baha 1d71b3d9bd Do not log the click event multiple times
When hovercards are off clicking of a link will log the click
event as many times as you hovered over the link prior to clicking.
To prevent this, stop listening to old events before listening to
new ones.

Bug: T143805
Change-Id: I3e0dd2d1f259cdadfd3e02c67a137697540ca955
2016-08-29 14:33:21 -04:00
Sam Smith 0ad88a2416 Remove jQuery.jStorage shim
Per the FIXME above, it should've been removed midway through June.

Bug: T136241
Change-Id: I10723f9067c2573786270cd40fe012adb8c19c8b
2016-08-16 13:47:05 +01:00
jhobs 672e67d7fc Fix settings dialog layout on IE
Bug: T138612
Change-Id: I6f530c12dd498705b1797faf820cb5e620c81853
2016-08-11 15:42:15 +00:00
Volker E 0282b9648f Hovercards: Improve layout of settings dialog to design spec
Improving Hovercards' settings dialog to fulfill design specification.
Also fixing HTML structure by removing invalid `radiogroup` element and
adding missing `</div>` element, fixing related QUnit test.

Changes:
 * Add close icon instead of using text
 * Style header as a table for alignment
 * Remove redundant "OK" button and have it replace "Save" instead
 * Update text of "OK" button to "Done"
 * Fix description for translation of "Done" button
 * Fix qunit and selenium tests
 * Remove unnecessary markup and less
 * Add mediawiki-ui-button and mediawiki-ui-icon dependencies
 * Shrink dialog width some per design spec
 * Fix dialog horizontal position calculation to remove hard-coded value

Bug: T138612
Change-Id: I7395e3438836149becdd576942bdaf6f21b4163f
2016-08-10 14:01:36 -04:00
Baha a49cdb37cc Use Schema revision 15777589 for logging events
The schema introduces a new field called `hovercardsSuppressedByGadget`,
which is `true` when the Navigation Popups gadget, rather than the Popups
extensions, is being used to fetch and display article summary.

Note that it may take some time before the Navigation Popups gadget is
loaded onto the page, thus actions taking place before this happens will
record the value of `hovercardsSuppressedByGadget` as `false`. This is
mostly the case with the `pageLoaded` action which almost always happens
before the gadget code is loaded.

Bug: T137203
Change-Id: Ie31deea7ae2323d6a346c67ed84fdf587ad55bd1
2016-07-19 16:00:41 +05:00
jenkins-bot 787f0d2179 Merge "Tweaks to settings page" 2016-07-08 05:19:24 +00:00
jdlrobson c1cb976ba2 Tweaks to settings page
* Change labels in English for settings options
* Update description for enable option
* Remove description for disable option

Bug: T138233
Change-Id: Id23dcc7b7e655f7939bb2e455b8680ed5a2c6331
2016-07-07 10:02:08 -07:00
Baha 1bdd8e7a7c Do not log XHR cancellations
These errors do not have any value, they just happen when the user
cancels the current request. Removing these events will result in
less noise for data analysis.

Bug: T137059
Change-Id: Ia9d921553791d1b7be5941a98716297b74b706b2
2016-07-07 18:47:54 +05:00
jenkins-bot 76fada71ce Merge "Workaround for display of SVG images in Safari" 2016-06-29 18:52:06 +00:00
jdlrobson 7d51ce9bb4 Workaround for display of SVG images in Safari
Tested in IE9 and Safari. It seems in Safari the mixture of jQuery
and setAttributeNS causes issues.

Bug: T138430
Change-Id: I4bc63da18d008487d0c8f7b906688e4c8c809efd
2016-06-29 17:59:20 +02:00
Volker E bc62902f4f Align Hovercards' Less to Coding Standards
Aligning Hovercards' Less to Coding Standards and also variablize
`linkpreview-title` font-family.

Change-Id: I11f2d71ce50dcd0fe47f3c5c528779e29a81cbc6
2016-06-24 16:23:16 +02:00
Baha 827e1dbeb2 Detect whether NavPopups gadget is enabled before showing a hovercard
Before this change we only used to check whether NavPopups gadget is
enabled once per page load. The premise was that we could figure out
whether the gadget was enabled easily given the module name. Since
the gadget module name can be different on diffirent wikis, that
solution would not scale.

With this change we check whether the gadget is enabled before each
hover over an eligible link. We rely on the existence of the global
`window.pg` object. The existence of the object means that the
gadget is enabled, thus we do not show Hovercards.

Bug: T135628
Change-Id: Ica154dd3bfd913202a8b558ea4b10ad177176f83
2016-06-07 17:39:58 -04:00
jdlrobson 7975fde745 Remove the need for global mw.popups.triggers
Change-Id: Iec1dd93a83fe393bd8717884ab4bab692ad7b6f4
2016-06-06 09:30:54 -04:00
jenkins-bot 9f91cd6d3c Merge "Correctly log the 'dismissed' action when hovering over another link" 2016-06-03 11:08:02 +00:00
Baha 049ae039a7 Do not show Hovercards when NavPopups gadget is enabled on huwiki
This is temporary fix to get Hovercards not to show up when
Navigation Popups gadget is enabled on huwiki. The gadget module is
named 'ext.gadget.latszer' and not 'ext.gadget.Navigation_popups'.

Also check whether the global 'pg' variable is created, which means
the Navigation Popups gadget is enabled.

Bug: T135630
Change-Id: I35e1b911967200bfdfd8f44ad4e4b8dcfd844ee7
2016-06-02 17:57:04 -04:00
Baha a8e8ca489f Correctly log the 'dismissed' action when hovering over another link
Unlike what was previously implemented, this patch does not care whether
the user hovers over another link while dismissing the popup.
The `dismissed` action is correctly logged in these cases too.

Bug: T136649
Change-Id: I68473cb8b66bae53213bce186345ca1ce436573f
2016-06-02 15:24:31 -04:00
jdlrobson dedb61caf9 Drop support for non-SVG browsers
According to caniuse.com SVG support is available
from IE > 8, Firefox > 3, Safari > 3.1 and Android
> 2.3. Android 3-4.3 does not support masking.

Out of all these browsers, considering market share
and ResourceLoader support, none of these browsers
are of concern to us. In IE8 for example we do not
run JavaScript for our end users. Thus we should remove
this fallback support.

Changes
* Remove createImgThumbnail method and its test
* Groups duplicate CSS groups
* Refactor createThumbnail function
** Leave a FIXME on some curious code

Change-Id: I59ac2e320b2e07815bc4136d5942016fdc1d4340
Bug: T135554
2016-05-31 15:23:07 -07:00
jdlrobson 6178781c43 Do not unnecessarily expose private variables
article.surveyLink, article.SIZES and currentRequest do not need to be
globally available on mw.popups.render object. They can be local variables.

Similarly openTimer and closeTimer should not be public APIs.

Changes:
* Add an abort method for purpose of aborting existing requests.

Change-Id: Ic2add9c611990bf80e8b80ab154563f6551a77ea
2016-05-31 16:25:03 -04:00
jdlrobson 765aa40cc1 Replace use of jStorage with mw.storage
Use the standardised MediaWiki storage system for the simple use
case of disabling/enabling Popups. The jStorage library is 12kb
uncompressed and cannot be justified for this usage (and if it becomes
the standardised library mw.storage will begin using it)

This means that browsers with full localStorage or no localStorage
support will not be able to disable Popups. Given the current ecosystem
of the web - localStorage is widely supported - and the fact that grade
A browsers enjoy localStorage support - this is not a problem.
See https://github.com/wikimedia/mediawiki/blob/REL1_27/resources/src/startup.js#L59

Changes:
* Stop using jStorage
* Cleanup and migrate previous values in jStorage with plan for removing this
in a month.

Bug: T136241
Change-Id: I6dac2911e84d6cb20731be34add01576cf407c46
2016-05-30 12:30:38 -07:00
jdlrobson feb0c76381 Render settings via template
This improves readability and separates the HTML from the
JavaScript

Change-Id: Ib765d78890b9aeb05940df00160790b01751a36b
2016-05-30 10:49:17 -07:00
Baha 017cb24d4a Disable Popups when the Navigation Popups gadget is enabled
Bug: T135628
Change-Id: I788932d169d6940e8f9d5112f973b24c76fa856b
2016-05-27 09:16:54 -04:00
jenkins-bot 269ad09c27 Merge "Use exchars instead of exsentences for the extract" 2016-05-26 18:21:24 +00:00
Joakin ea072139df Use exchars instead of exsentences for the extract
To avoid sentence parsing bugs in other languages.

We have to artificially remove the always-added ellipsis from textextracts to
mimic previous behavior, and we'll add ellipsis via CSS afterwards.

Bug: T135824
Change-Id: Idf27f2fd18f7197e588c609eeb62ac8fc80626d7
2016-05-26 19:00:11 +01:00
jenkins-bot 0071ea9fc6 Merge "Send dwelledButAbandoned action for links when popups are not enabled" 2016-05-26 12:31:02 +00:00
Baha dee5f7470e Send dwelledButAbandoned action for links when popups are not enabled
This action was sent correctly when popups are enabled, but not when
disabled. This commit sends this event also when popups are disabled
so that we are able to compare the metric with popups enabled vs disabled.

Additional changes:
* Chain events in resources/ext.popups.targets/desktopTarget.js
* Add a separate property to the list of defaults and fix formatting.

Bug: T131315
Change-Id: I426f0a1a735b8fe6b16f3d2695d9099dd0d0469b
2016-05-26 11:57:42 +00:00
Baha 107d6edd37 Fix float on wikis with long settings messages
* Remove floats;
* Get rid of margin collapsing so that the space is easy to understand;
* Fix invalid rules.

Bug: T135629
Change-Id: I3bfaf137e4d02f0dc809c809edac9b28cb4bdc3a
2016-05-25 16:20:39 -04:00
Baha aba43fd560 Switch to Schema:Popups revid 15597282
Bug: T131315
Change-Id: I2ed18e00afb3e355327b417e68e5930b46d49086
2016-05-24 14:26:46 -07:00
Ricordisamoa 058b863304 Unswap langcode and langdir variables in popup.mustache
Broken by commit 27d811a173

Bug: T135758
Change-Id: Ia9b92b4c91e54f921ad220b7818af6f245e29b61
2016-05-20 07:24:18 +02:00
Sam Smith 41dc6d396a Conditionally enable Popups
Changes:
* Disable the desktop target by default
* If the user is in the experiment condition, then enable the desktop
  target
* Add PopupsExperiment config var, which, if set to true, causes: the
  experiment config to be added to the output as config vars, as well as
  the ext.popups.desktop Resource Loader module

Bug: T132604
Change-Id: Ia71ca924c3e2ec2ee0b0191ea2573fa7ff5e8a7e
2016-05-19 23:47:02 +00:00
Sam Smith c4667fd133 Convert isUserInCondition from async to sync
As there are an unmanageable amount of synchronous checks of
mw.popups.enabled, convert mw.popups.experiment.isUserInCondition to a
synchronous method.

Follow on I4959749.

Bug: T132604
Change-Id: Ide07e62868c77bfcd78af58dcec7303a35a72157
2016-05-19 14:06:17 -07:00
Sam Smith e9ddc8328d Handle user explicitly enabling/disabling feature
Follow on I4959749.

Bug: T132604
Change-Id: I4e6780f17b0423823295be9410a4343150e1e562
2016-05-19 19:10:53 +01:00
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