Commit graph

53 commits

Author SHA1 Message Date
Prateek Saxena e7376cd517 render.article: Flip popups on X and Y axis so that they don't render outside the viewport
Bug: 62971
Change-Id: I893e239889874be83cfbf202095f617ee6091d6f
2014-05-09 13:52:16 +00:00
Prateek Saxena e6f8834841 Restructuring code
Bug: 61267
Change-Id: Ie4252c691abb7e6b2637d88b1adea5ce8871497c
2014-04-30 16:48:05 +05:30
Prateek Saxena 0c607321f8 Stop Popups from being generated if extract is empty
Bug: 62994
Change-Id: I9c43c572d0290020c7d73fdc061de077bb025299
2014-04-28 13:49:28 +05:30
Prateek Saxena cb41c8e6ff Replace animationend with setTimeout
Bug: 63253
Change-Id: Id4b998ad88bf27da8114f8194464bea8a11a0504
2014-04-28 13:27:39 +05:30
Bartosz Dziewoński 783ae1ead7 Use mw.hook to rebind events after page content is reloaded
Also moved things that don't need to be in document-ready handler
outside of it.

Bug: 63169
Change-Id: Ie681ff6722b9909d38fc06359da7614e0fc1798e
2014-04-22 18:53:15 +02:00
Bartosz Dziewoński 49a253cfd7 Extract some magic timeout values
Change-Id: Ic4c5a677ca05c4669aa44f0ce03356c19b63f3e7
2014-04-22 16:43:06 +00:00
Bartosz Dziewoński 7dd62d1581 Do not call decodeURI() on non-URIs
The title here is not percent-encoded or anything, it's just text.
Calling decodeURI() can cause errors to be thrown if it doesn't happen
to be a valid URI.

Bug: 64236
Change-Id: Iee7c1db0c01cba405f0a2a03b0de58e9edb9a171
2014-04-22 16:42:58 +00:00
Bartosz Dziewoński 26328b3fa0 Always wait at least 150ms before displaying the popup
Previously we would wait 150ms if the data was cached,
or 50ms + [API request time] if it was not.

Using some promise magic to achieve this without decreasing
performance. The behavior of sendRequest() was changed a bit.

Bug: 64235
Change-Id: Ibe6e1a5f4ac02f538dac686476ac95ba506a1a86
2014-04-22 16:26:10 +00:00
Bartosz Dziewoński c3e3df7905 Use :not() CSS pseudo-class instead of jQuery .not() filter in selector
The old version would iterate over all links on the page (try that on
[[Barack Obama]]), the new one should be optimized by the browser and
poly-filled by jQuery if unavailable.

We can't do `:not(.extiw, .image, .new, .internal, [title=""])` –
while some browsers support it, CSS specification doesn't allow
compount selectors inside :not().

Change-Id: I0e4b18752905604ebf1b7f41a9b7ac2edd8b42e0
2014-04-22 16:24:58 +00:00
Bartosz Dziewoński 31e42fd85a Prettify the embedded SVG code
* Do not escape double-quotes in single-quotes string
* Remove repeated <defs/> tags, one is enough
* Reindent

Change-Id: I6a5b53384b8d5604bee11cb993d040282accf999
2014-04-22 14:10:08 +00:00
Bartosz Dziewoński 9943ebd844 ext.popups.core.js: Whitespace cleanup
Change-Id: I861ba996cce9e9baf65e0630b1c2187d15df22b6
2014-04-22 14:09:42 +00:00
Prateek Saxena 64fdebe496 Remove viewBox from SVG, not needed.
Bug: 63590
Change-Id: Ia1e85441389377cab2720b5410cbf602a42fafe0
2014-04-22 11:16:35 +00:00
Prateek Saxena 030c2512b1 Position hovercard according to mouse position
Bug: 63159
Change-Id: I3d038af8915ff586c76f24bd5c2d623de20b09ab
2014-04-22 11:04:05 +00:00
Prateek Saxena d5dbeff0f2 Ignore internal class for links
This is being used in the rectangle icons to enlarge the image.

Bug: 64116
Change-Id: I52b93e7063fbb8e39fbc6993566210a180d1decc
2014-04-21 16:43:50 +05:30
Prateek Saxena a2242e6886 Update documentation for the createThumbnail method
Bug: 61267
Change-Id: If73e89059f5f8528a6e0aab0ec04a89a69c5d114
2014-04-21 04:26:39 +05:30
Prateek Saxena 9bd3d6551e Remove confusing variable name
Bug: 61267
Change-Id: I7bcf85c9fcdf2905f7f0e11646eb007a7d8a64ea
2014-04-21 04:26:39 +05:30
Prateek Saxena 5940db0cdc Break ternary operations into multiple lines
Bug: 61267
Change-Id: I777c658de502c934abd72eea9e4bd72ceb956560
2014-04-21 04:21:47 +05:30
Prateek Saxena fbf9bda766 Stop checking for SVG support on every hover
https://gerrit.wikimedia.org/r/#/c/121607/3/resources/ext.popups.core.js
Bug: 61267

Change-Id: Ibdd5a42c72c43cd797eeb0b3d4c7ba0166e0643d
2014-04-21 04:21:47 +05:30
jenkins-bot 5617b0f1a0 Merge "Added documentation for text extract length" 2014-04-20 21:26:40 +00:00
Prtksxna 96a44c8b22 Merge "Prevent popups after scrolling" 2014-04-16 13:36:49 +00:00
Prateek Saxena d40c4c1e8a Use document.createElementNS for svg:image
Browsers like Safari and IE9 alias <image> tags to <img>
tags and thus don't display hovercards correctly. By creating
the `image` in the svg namespace we solve this problem.

Bug: 62985
Change-Id: Iff92d59ea231d1208eea149cc8c182a5fe87701a
2014-04-14 09:09:35 +05:30
Prateek Saxena e67ae7d43a Added documentation for text extract length
Bug: 63871
Change-Id: I61c2f19b8263982550dd9b1e9badbd6ddaf288db
2014-04-13 10:28:57 +05:30
Santhosh Thottingal ad7db9cc36 Misc code formatting cleanup
* Consistant whitespace after keywords
* Misc whitespace cleanup as per JS coding guidelines
  https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript
* pass mw to IIFE and use the function arguments close to function body
  ( function ( $, mw ) {
  ...
  }( jQuery, mediaWiki ) )
* Moved prefined moment to .jshintrc. Move browser:true too

Change-Id: If488974e8e5987916bc4043e4e70bb6c60472b30
2014-04-07 15:09:59 +05:30
Spage 4ef29afb88 Merge "Fix placement issue for smaller images" 2014-04-06 09:30:17 +00:00
Prateek Saxena 43df8474cd Use escape key to hide popup
Bug: 62948
Change-Id: I9623cd95b5e2832d68d9409d8056ad6d50da0398
2014-04-05 18:39:48 +05:30
Juliusz Gonera 0719a75d08 Prevent popups after scrolling
Prevent popups from showing up when the mouse cursor accidentally
ends up hovering a link after scrolling.

Change-Id: I07a95d9eabdc22a045a97b07f98fb0d632a276c1
2014-04-03 14:56:06 -07:00
Prateek Saxena 27650cae19 Use aria-hidden for popups
Bug: 62948
Change-Id: I0d5428be2e5299e57232335c00b45649ba23ce9f
2014-04-03 19:14:26 +00:00
Prateek Saxena dd639d4020 Use tooltip role for Popups
Bug: 62948
Change-Id: I10f42bbd01e2a5925ee5323eb1c6968e0b1787a4
2014-04-03 19:14:06 +00:00
Prateek Saxena a5b57a40e4 Remove redirects to text and heading
Bug: 63155
Change-Id: I42fb9cc1a8b26eaf6807243e4e7bdbf0b56dc35c
2014-04-02 06:54:13 +00:00
Prateek Saxena b2c5424272 Show and hide Popups on focus and blur (along with mouseenter/leave)
Bug: 62948
Change-Id: Ica9ba7099cb0430983a07251baf62861d7901b9a
2014-04-02 12:16:00 +05:30
Prateek Saxena abc06cb0ef Use correct spacing conventions for jshint comment
https://gerrit.wikimedia.org/r/#/c/120752/3/resources/ext.popups.core.js

Change-Id: I66d715528997c5ec1476b61a130934bc3b642dce
2014-03-31 12:03:54 +05:30
Prateek Saxena 58438de5b1 Fix placement issue for smaller images
Bug: 63207
Change-Id: I378bda652579a2f42469676f110452cbc4941ab0
2014-03-28 23:58:27 +05:30
Prateek Saxena eb625b222d Add .jshintrc file and update core.js to remove errors
Bug: 62997
Change-Id: I89d46c913994bd620ae904fbd626621be4aca170
2014-03-25 14:58:53 +05:30
Prateek Saxena 7386f10df3 Make EventLogging a soft dependency
Based on https://gist.github.com/atdt/4652474

Bug: 61880
Change-Id: Ief5ce7eef43ffe4612541627dff2b0fc75b696ab
2014-03-20 16:47:52 +05:30
Prateek Saxena 710b845da1 Add border around pokey of the popup
Change-Id: Idead01aea93a685f9d061361cfd5978ad3dfda17
2014-03-17 08:28:50 +00:00
Prateek Saxena 541f2ca470 Flip the arrow position if the popup is flipped
- Only text popups
- Portrait popups
- Landscape popups

Had to convert the landscape popup's img into an svg:image
too. 2 new SVG masks were made to take care of the flipped
states.

Change-Id: Ib30bb7f5ff9857f6a470b07db05ab50fb0ca8a5d
2014-03-17 08:25:58 +00:00
Prateek Saxena a12adc7f6b Flip the starting point of the popup if its on the right side of the screen
Change-Id: I7a3fea220d051e0d70fcbf0be3d0557ee24c5da2
2014-03-17 08:25:09 +00:00
Prateek Saxena 44028f722b Limit image size for portrait popups
Also position the image in the center (along the y axis)

Change-Id: I4980e6d6e024515710abc1912ffcf99b71297e9e
2014-03-17 08:24:41 +00:00
Prateek Saxena 1818c0d2e6 Use moment.js instead of timeAgo method
Bug: 61481
Change-Id: I8e08335aa091c098a9efd1eb148627b134e42940
2014-03-12 11:21:27 +05:30
Prateek Saxena 240e469d9c Add Triangle/Pokey to the NavigationPopups
* Triangles using the border hack for the white part of the popups
* SVG clipPath on FF and Chrome, using SVG <image>
* Fallback to <img> on browsers with not SVG support

Change-Id: I3b1226051436652edbffe4642176c9a0e405243c
2014-02-24 21:55:09 +05:30
Prateek Saxena ecc6f4a00a Increase the space between the link and the popup
Change-Id: Ic3832bb61ac2d209fbc3d4d4204ec9d2d6106ac3
2014-02-21 15:43:15 +05:30
Prateek Saxena efc3c498fe Add EventLogging
Schema: https://meta.wikimedia.org/wiki/Schema:Popups

Change-Id: Id17e81794561f022e004e18cf3595c3ffd6f3fd0
2014-02-19 11:51:11 +05:30
Prateek Saxena 00bde78b00 Add redirects to message at the top of the popup
Change-Id: I051e4ed84f216e9c8682138927f6dcb6a407ee57
2014-02-18 16:46:12 +05:30
Prateek Saxena 37ddb1997f Use .text instead of .html for the extract
This is alright because we are setting `explaintext` to
`true` in the API call.

Change-Id: I04df151a31ca60f058ea226efe17841b0eb663c4
2014-02-18 16:02:15 +05:30
Prateek Saxena 54b409cee2 Limit container height for landscape popup's extract
This is the only way we can properly truncate text.
We can't do it on the basis of characters as it'll
take up different amount of space based on the script.

Change-Id: I77f8304315beb42eb2120c633d3befb5f83432f9
2014-02-18 14:10:43 +05:30
Prateek Saxena 2899d34a70 Use div with background-image for landscape
This is to prevent the layout from breaking on landspace popups

Change-Id: Ia9d051b4f060d549a4a188ca42fb70a97eed23ab
2014-02-18 13:49:42 +05:30
Prateek Saxena 21b41f78eb Move thumbnail creation to its own method
Change-Id: I1d1b2aff4d8b919bd65e0da8ff07b594f061ccd7
2014-02-18 12:31:17 +05:30
Prateek Saxena ce59f92489 Add time ago in words at the bottom of the popup
Change-Id: I53f77a0c802ae3b9582c51a07fc56ad56e3fd53b
2014-02-13 18:45:02 +05:30
Prateek Saxena e9ad2ef798 Change size of thumbnails in popup
Change-Id: I98ecea9d240a4400cf2277b3b393c4b024fe907f
2014-02-13 11:15:54 +05:30
Prateek Saxena c817c3fdd9 Design Update
* Hard shadows
* Light border
* Fast fadeOut animation
* Typeface/Leading
* Margin from images
* Load popup sooner

Change-Id: I19ccf88b47c37c994ebf4a84b93490e5645724a5
2014-02-12 05:39:16 +05:30