Commit graph

547 commits

Author SHA1 Message Date
S Page 4ac8f1b48b Use actual booleans in API request
Popups' API query request specifies the string 'true' as the value for
some boolean request parameters, but that's functionally identical to
specifying boolean true -- both get encoded as param=true in the HTTP
request.

Change-Id: Icc5f4b8ef6faaffe4a23c964f8cd8c2582d28381
2015-06-26 03:49:55 -07:00
Fomafix 7713e343fe Replace 'jquery.mwExtension' by 'mediawiki.RegExp'
Replace $.escapeRE from 'jquery.mwExtension' by
mw.RegExp.escape from 'mediawiki.RegExp'.

Bug: T103610
Change-Id: I1d23e4c02d92828291b98a52b4e8050fbebc06d9
2015-06-26 07:48:18 +00:00
Prateek Saxena 03f4fa63b2 core: getTitle: Return undefined for non URI links
mw.Uri throws an exception when dealing with -

    href="javascript:void(0);"
    href="mailto:abc@example.com"
    etc.

Using a try…catch to return undefined in this case.

Bug: T95215
Change-Id: I632e9dc0e70a5fddf9f2573572bfc8e7f6232923
2015-04-21 19:19:43 +05:30
jenkins-bot 4438a92585 Merge "Reduce font-size of timestamp text" 2015-04-17 08:11:43 +00:00
jenkins-bot f6b32a7963 Merge "Update font-size and line-height" 2015-04-17 08:11:35 +00:00
Prateek Saxena 503356d33c Reduce font-size of timestamp text
Bug: T96343
Change-Id: I653018e0a653ef8c25a336e73b5ff46eceed119a
2015-04-17 12:50:50 +05:30
Prateek Saxena 4ba7ec87a1 Update font-size and line-height
Bug: T94957
Change-Id: I8f67a5e43bcd0f0de22c03323585414adfa12944
2015-04-11 19:23:57 +05:30
jenkins-bot a5d4bec8fd Merge "Use href attribute to calculate titles" 2015-04-07 10:04:55 +00:00
wctaiwan 642bdf013e Use href attribute to calculate titles
This is needed for wikis that use LanguageConverter, since the title
attribute is converted to the user's variant, and the canonical title is
needed for the API unless converttitles is specified.

For filtering, instead of comparing linkHref and expectedHref, filter
out links that have other query parameters or aren't in content
namespaces.

Bug: T93605
Change-Id: I5534753307ed5e1d4b27c52c616fd143b2a397e1
2015-04-06 05:55:25 -04:00
jenkins-bot e6d43ccc16 Merge "logger: Add a sampling rate of 10" 2015-04-06 09:21:50 +00:00
jenkins-bot e21d08e0d0 Merge "Implement the new schema for when the popups are disabled" 2015-04-06 09:19:03 +00:00
jenkins-bot 0ff656a892 Merge "Implement the new schema for when the popups are enabled" 2015-04-06 09:18:16 +00:00
jenkins-bot 7fe8f5d45f Merge "Add icon and link to qualtric survey if $wgPopupsSurveyLink is defined" 2015-04-06 09:03:26 +00:00
Prateek Saxena 8fbacb9040 Add icon and link to qualtric survey if $wgPopupsSurveyLink is defined
The link to the survey is added in Ic445732197e6abeba459b40b1416d8a71bc23bd6

Bug: T1005
Change-Id: I24bfd5fd622d1afc4372dbd4bfca3879927b0c17
2015-04-02 15:29:15 +05:30
jenkins-bot 37f1c00629 Merge "renderer.article.getProcessedElements: Stop escaping the title and the extract" 2015-03-27 18:45:54 +00:00
jenkins-bot d478a820a9 Merge "Rename popups.eventLogging to popups.logger" 2015-03-27 13:18:32 +00:00
Prateek Saxena f4dbd455c6 logger: Add a sampling rate of 10
This rate was decided in T88173

Bug: T88167
Change-Id: I22776582c271fa83ba5b98d38dd01775ebbfcef1
2015-03-27 04:35:12 +05:30
Prateek Saxena c39bbc8a68 Implement the new schema for when the popups are disabled
Bug: T88167
Change-Id: If8f1c97379bd37958ec6064242bdebf5fde14b47
2015-03-27 04:34:58 +05:30
se4598 946b4f4926 Do API queries after API_DELAY
Based on the comments this is what it supposed to be.
mw.popups.render.article does the API-queries on init, so do that after
the API_DELAY-timer fired.

Change-Id: Ia235cbe1eb86fc774edda84208d320843401624e
2015-03-26 15:03:38 +01:00
Prateek Saxena 20f2bef272 renderer.article.getProcessedElements: Stop escaping the title and the extract
Both the title and the extract were being html escaped thus producing
string like ' and " when used with .text(). So, we now use
document.createTextNode() for the normal text and .text() with the bolded
one.

Bug: T93720
Change-Id: I6bbc52e427dc636b7b0be1ad4f749d9273ff61b3
2015-03-26 19:28:20 +05:30
jenkins-bot 1572bcf150 Merge "settings: Use .text() instead of .html() for option's label" 2015-03-26 10:34:41 +00:00
Prateek Saxena 2971d90831 Implement the new schema for when the popups are enabled
Bug: T88167
Change-Id: I38c9e474e0ec7da45af8338a458430e5d7427463
2015-03-26 11:42:39 +05:30
Prateek Saxena d49cfb9b65 Rename popups.eventLogging to popups.logger
...and eventLogging.logEvent to logger.log

Change-Id: I9af697a56c2248069a32ac586f5b78b55095460e
2015-03-26 04:56:29 +05:30
Prateek Saxena 3b82fb60d9 settings: Use .text() instead of .html() for option's label
Bug: T88171
Change-Id: I5d4631870f916194901f897839cad4c90c2d8d01
2015-03-24 13:37:05 +05:30
Prateek Saxena 42d0347582 renderer.article: Ignore thumnail if the URL has suspicious characters
If the URL of the thumbnail has suspicious characters like ', " or \
return a <span> instead of trying to render a thumbnail.

Bug: T88171
Change-Id: Ide052ea2a7de166599d077a385a6e788bfa63302
2015-03-24 13:31:19 +05:30
jenkins-bot 5bdfbc6802 Merge "renderer.article: Don't apply tall/not-tall classes if the image wasn't shown" 2015-03-16 10:10:10 +00:00
Prateek Saxena 3eaf2829e8 renderer.article: Remove leading spaces before brackets
Bug: T69225
Change-Id: I83f79fa0ebd19bea6ed7ea266cece0778210adb2
2015-03-05 15:32:45 +05:30
Prateek Saxena df0b988eec renderer.article: Bold the title no matter what the trailing characters
Bug: T69229
Change-Id: I833c0dcae98010bc74b6b58ae8035aaac4e6465b
2015-03-05 15:31:42 +05:30
Prateek Saxena a43ef7ca51 Remove the need of .html in article.getProcessedHtml
Instead of replacing all instances of the title in the extract -

  '$1<b>$2</b>$3'

We now put symbolic strings there which we use to split the string
and then make an array of text and <b> elements that get appended
to $contentbox.

Bug: T76378
Change-Id: I02222bbff84532f63cac67af1bf889c328ec6ff2
2015-03-05 15:30:06 +05:30
Prateek Saxena e5880ffd40 renderer.article: Don't apply tall/not-tall classes if the image wasn't shown
Bug: T91433
Change-Id: I4499cc18e140c0bd18ee3731496aa427232922b4
2015-03-05 13:24:35 +05:30
se4598 9974a75b50 Improve mw.popups.selectPopupElements
Use proven technology to create and compare URLs.
This will display popups also on anchored links again.

Change-Id: Ic010ca027017435f666782e709e641cf3bbb8767
2015-03-04 17:21:37 +05:30
Prateek Saxena 5ee43d6b3e core.less: Visual refinement & drop shadow
This what it looks like -
https://phabricator.wikimedia.org/T78641#984753

Bug: T78641
Change-Id: Id59acba49963eb02626444f91b716c53c1bef7b4
2015-03-04 16:45:56 +05:30
se4598 64195b8ff7 fix mw.popups.selectPopupElements
Hotfix for Ie34064860a81c7866b8e8b86858d2e12a8a196f4
Still won't show up popups for anchored links, but dunno if intended. 

Change-Id: I91a15153cb8bcae6d8ef2e5616855e4d45be6d78
2015-02-24 00:14:02 +01:00
jenkins-bot 782d9e37ba Merge "eventLogging: Use generateRandomSessionId" 2015-02-20 11:06:01 +00:00
jenkins-bot fd5cc437a3 Merge "Add a check for the EventLogging library before the logEvent call" 2015-02-20 11:03:32 +00:00
Prateek Saxena 44c57834b1 Disable Navigation Popups on render rather than document load
Bug: T64952
Change-Id: I7985341006d587671077f3dc32dd02e8dfb38972
2015-02-20 11:54:17 +01:00
Prateek Saxena b4cfa5c6d5 Add a check for the EventLogging library before the logEvent call
Bug: T70341
Change-Id: Idae926b1ddce544ab37b95018abc13879f515f71
2015-02-20 11:49:39 +01:00
Prateek Saxena 37442e6457 eventLogging: Use generateRandomSessionId
Bug: T88919
Change-Id: Ib859db7f55358d0cbd9f26b25d9fe96b76e718e9
2015-02-20 11:48:36 +01:00
se4598 45cf9c13e7 core: Better article link detection
Use the getUrl method to check that the <a> actually links
to the article that it has the title of. Only those elements
are returned by selectPopupElements.

Bug: T70039
Bug: T72512
Change-Id: Ie34064860a81c7866b8e8b86858d2e12a8a196f4
2015-02-18 17:02:14 +05:30
jenkins-bot 2fd9ac3569 Merge "Access native a.href property instead of attribute" 2015-02-18 10:33:55 +00:00
jenkins-bot f8e7b47bd9 Merge "core: Add missing leading '.' to oo-ui-buttonedElement-button in IGNORE_CLASSES" 2015-02-18 00:15:18 +00:00
Thiemo Mättig ddab3f9fd7 Access native a.href property instead of attribute
This is a subset of patch Ie340648. If reviewing and merging the much
larger other patch (it does much more things) is a problem, we can
merge this first, rebase the other one and have a much more focussed
discussion.

Change-Id: I4549fb1810c7dd36df8a70983d9508015c2bfadf
2015-02-17 15:03:13 +01:00
Prateek Saxena 7a51668e56 core: Add missing leading '.' to oo-ui-buttonedElement-button in IGNORE_CLASSES
Follows up I418508fad97e81127084150221e10ccec418167a

Change-Id: Ib3c187feeb8de053416bb3ef131c8f5cfedf0c63
2015-02-17 18:19:11 +05:30
Thiemo Mättig bf4016ecf1 Fix TypeError on <a> with no href
HTML5 allows <a> elements with no href="..." attribute. We do this in
Wikibase/Wikidata in a few places. Hovering these <a> elements causes
TypeErrors.

This is a hotfix. Please see Ie340648 for a much more advanced fix.

Change-Id: Ib20ef8348c964a6ba736d0fc76909fd4d496c11e
2015-02-12 15:37:37 +01:00
jenkins-bot 72362616a2 Merge "settings: Add help dialog" 2015-01-21 16:47:19 +00:00
Prateek Saxena 9c1c62ce05 Fix event logging issues
- Don't prevent the link click event.
- Check with the currentLink element rather than jQuery selectoin.
- Add click handler to images (used to be only extract).
- Stop the 'closePopup' if 'reset' has already been run.

Bug: T86378
Change-Id: I8748ecffe55954425656c5103fa9ddc99b6f3f72
2015-01-13 18:48:02 +05:30
Prateek Saxena f7d5f890b6 Re-position #mwe-popups-svg out of the view port
This <div> had been sitting visible at the bottom of the page
and went unnoticed till it caused problems with the ContentTranslation
extension.

Hiding it using 'display: none;' causes issues with the masking
of the images, thus putting the div out of the view port.

Bug: T76718
Change-Id: I731128c827aa093e0ffab52dc378aea386b0bb3c
2014-12-29 14:44:39 +05:30
jenkins-bot dbd3f6ff2b Merge "Make ':after' triangle larger so that the border of div is covered" 2014-12-03 15:37:00 +00:00
jenkins-bot eb7fb53baa Merge "article: Fix distance between image and text (landscape image & non flipped)" 2014-12-03 15:36:53 +00:00
jenkins-bot 1b6eaddba0 Merge "Reduce max height of text extract" 2014-12-03 15:33:21 +00:00
Prateek Saxena b24e39e9fc Run mw.html.escape on page extract and title
Add test for XSS attack

Bug: T69180
Change-Id: I213169bd9daed979e63f50cf3926f7196eb6181c
2014-12-01 11:23:14 -08:00
Prateek Saxena 9ab483ec6f settings: Add help dialog
Change-Id: I5f4cf435356748a1aceb05fcaf8c8980b8267804
2014-11-26 11:43:01 +05:30
jenkins-bot 895b6dfae0 Merge "Add rule to not show thumnail if its smaller than the card" 2014-11-23 20:07:41 +00:00
Prateek Saxena 77538a1001 Reduce max height of text extract
Currently .mwe-popups-extract keeps some empty space after the last
line. This shifts a little when zooming in causing part of the text
of the next line to be visible. Reducing this to have lesser extra
empty space solves the problem.

Bug: 73551
Change-Id: I968fca23fe2de04cb3f73ba4e7d4f676fbf88536
2014-11-20 14:54:14 +05:30
Prateek Saxena 24a7d02080 article: Fix distance between image and text (landscape image & non flipped)
Change-Id: I4fb6891cd89546b6a55b6952be7e1a6df41fa0b5
2014-11-20 11:46:37 +05:30
Prateek Saxena cbebde39b9 Make ':after' triangle larger so that the border of div is covered
When zooming in the border of the div is visible over the :after
pseudo element.
 - Update top and bottom triangle mixins to include @extra argument
 - Update pseudo elements to use the new mixin and position them
   correctly according the extra size

Bug: 73550
Change-Id: I05b9c74a675c69e407c4c78771504f447da754c5
2014-11-19 11:12:12 +05:30
Prateek Saxena 45172f1f7b Increase z-index of hovercards from 5 to 110
Hovercards is currently at 5 z-index which causes
it to be rendered behind the compact personal bar.
Changing this also effects the border triangles and
masked SVGs, thus incrementing them too.

Bug: 72882
Change-Id: Ib3c889c748a9c919754d8281e68fd0664db7c408
2014-11-12 14:39:47 +05:30
Prateek Saxena 0a7d7573fa Add rule to not show thumnail if its smaller than the card
Added two conditions based on portrait and landscape sizes.

Bug: 73009
Change-Id: I022267430b540be48952f0cfc8dc0cf962cd13d5
2014-11-11 10:23:34 +05:30
Prateek Saxena a9bc4e4ba8 Fix bottom margin issues with portrait images
This was happening due to:
 * Stale CSS selector
 * Incorrect margin values

Also added missing triangle pokey for a particular
orientation of the hovercard.

Bug: 71872
Change-Id: Ic4986f9cee2a92b29548ef21f9bec3f2c2117e98
2014-10-09 15:40:12 +05:30
jenkins-bot eccb7bf037 Merge "render.article: Correctly space extract for landscape images with smaller heights" 2014-09-22 16:17:20 +00:00
jenkins-bot 7c1e6398ad Merge "article: Fix settings' icon alignment" 2014-09-22 16:07:45 +00:00
Prateek Saxena 0630ff518c renderer: Actually use eventLogging
This was accidentally removed during the refactor
and went unnoticed for quite some time.

Change-Id: I850126461b503419d1e219398f3d61747fbccb23
2014-09-09 10:31:51 +05:30
Prateek Saxena 91da0e7536 article: Fix settings' icon alignment
Bug: 70147
Change-Id: I26c41395557420aea6c995a59aada0079f1a896c
2014-09-02 11:18:06 +05:30
jenkins-bot f835d52857 Merge "Force mw.popups.supportsSVG to false on InternetExplorer" 2014-08-26 17:52:55 +00:00
Prateek Saxena 7918944356 Force mw.popups.supportsSVG to false on InternetExplorer
Change-Id: I1d59167f3c2e166e32ef2f46fa4a527dd3a3410f
2014-08-26 13:56:22 +05:30
Prateek Saxena 8c0f64662e render.article: Correctly space extract for landscape images with smaller heights
Change-Id: Ie781621366650fe4c5a0affcae564fa512fab65c
2014-08-26 12:02:29 +05:30
jenkins-bot 6eb4a3a930 Merge "Reduce space between extract and timestamp" 2014-08-26 04:01:05 +00:00
jenkins-bot e50cf04603 Merge "Remove preventDefault from settings.open" 2014-08-25 17:51:59 +00:00
Prateek Saxena ca8b7f8658 Remove preventDefault from settings.open
Bug: 69579
Change-Id: I6e457542060d147c35ccb2dfeade5b90f20bd2ca
2014-08-25 18:02:46 +05:30
Prateek Saxena 13f3f1cf67 settings: Fix strings, copy and capitalization
Addresses the issues pointed out in:
https://gerrit.wikimedia.org/r/#/c/140086/16/i18n/en.json

Discussion:
https://trello.com/c/NYQ0nMeE/101-hovercards-phase-3

Bug: 68812
Change-Id: I7b4f6d2be08a1ee20b19aec95d99a73fd4bf9d29
2014-08-25 14:26:59 +05:30
Prateek Saxena fe487868d1 core: Ignore '.oo-ui-buttonedElement-button' links
Bug: 65442
Change-Id: I418508fad97e81127084150221e10ccec418167a
2014-08-21 13:07:24 +00:00
jenkins-bot 9d0a792e8f Merge "article: Fix settings icon" 2014-08-20 14:12:47 +00:00
jenkins-bot 7533c5c09a Merge "disablenavpop: Use winow onload instead of dom ready" 2014-08-20 14:12:18 +00:00
jenkins-bot 4436415d7c Merge "settings: Fix margins" 2014-08-20 14:10:34 +00:00
jenkins-bot 79cf8eb23a Merge "settings: Fix alignment issues" 2014-08-20 14:10:19 +00:00
Prateek Saxena 8f4e12d4b1 disablenavpop: Use winow onload instead of dom ready
This code has not been working because processAllPopups does
not execute. Test the change with:
https://en.wikipedia.org/wiki/User:Prtksxna/common.js

Bug: 62952
Change-Id: I3c8b5590b89693743c85c006fc0ee0a50e8b8342
2014-08-20 19:36:23 +05:30
Prateek Saxena e66ec613db article: Fix settings icon
1. Change color from #777 to #AAA
2. Add PNG fallback using `background-image-svg`

Bug: 69022
Change-Id: I0bbfe2aaa0c6e6ed1300bafa1352dd54037929b9
2014-08-19 22:22:21 +05:30
Prateek Saxena 10e9192719 settings: Fix margins
Change-Id: I3ad652b05d990377c6a01a0abb8091f1ff2443c7
2014-08-19 20:36:08 +05:30
Prateek Saxena d9322cfe9e settings: Fix alignment issues
Change-Id: Iacc1e934822f58fbc848b426783d02b5f9c9477e
2014-08-18 17:54:47 +05:30
Prtksxna 4cba605476 Merge "Don't render popup on "javascript:..." links." 2014-08-13 11:08:46 +00:00
jenkins-bot 26cd77cfdc Merge "Replace hardcoded path with wgExtensionAssetsPath" 2014-08-12 13:36:36 +00:00
Prateek Saxena d77d6005c1 Replace hardcoded path with wgExtensionAssetsPath
Change-Id: I3cf15bc4f9c9f1273b896d0e256f5821f15222fb
2014-08-12 18:08:31 +05:30
Prateek Saxena 26962431c3 Stop showing the NavigationPopups options if it isn't available
This got committed by accident in I374805eed0bc9f262b29474093f0357c56b42c83

Change-Id: Ic2dba3bd3b488aea97d7f3be3a56cf9f44912355
2014-08-12 16:10:57 +05:30
S Page 0f724cc45f Don't render popup on "javascript:..." links.
Also some doc.

Bug: 68417
Change-Id: Ib8b53f131f05477adfa12c8284f624d5c70d995f
2014-08-06 13:54:24 +01:00
Prateek Saxena dd98179a15 Add settings
Save Hovercards enabled state in localStorage (jStorage)

Change-Id: I374805eed0bc9f262b29474093f0357c56b42c83
2014-07-28 13:38:03 +05:30
Prateek Saxena e746ce668a core: Ignore '.external' links
Bug: 65929
Change-Id: Idba21c597d9d76333aa92ac40d2d0f813b02e971
2014-07-15 16:00:19 +00:00
Bartosz Dziewoński 36eaf4cec9 Use 'auto' instead of 'initial' in CSS
'initial' is not supported by all browsers (including all versions of
Internet Explorer and Opera 12 [1]), which causes visual glitches [2].

As the initial value for 'left' is 'auto' [3], this should cause no
visual changes in the browsers that supported the previous version.

[1] https://developer.mozilla.org/en-US/docs/Web/CSS/initial
[2] http://i.imgur.com/0Ze8lon.png
[3] http://www.w3.org/TR/CSS21/visuren.html#position-props

Change-Id: I8d661436f1106ca92b8b492c3fb76ac6976d80fa
2014-07-11 21:23:27 +02:00
Derk-Jan Hartman e9a56a3b85 Some small cleanup
Bunch attr actions, add to DOM as the last action, rm superfluous lines
and use strict.

Change-Id: I3e0870b108e978d7fd4093a6e7201fb6260f2e88
2014-07-09 12:03:10 +00:00
Derk-Jan Hartman 5025f2beee Handle links with empty or no title attributes
The script depends on a title being present in title attribute. So
skip links without title attributes (which were getting empty
attributes due to the implementation of removeTooltips) and bail on
trying to open a preview for links without a title.

Bug: 67728
Change-Id: I4cc744bea10af34741681f11e03d77b3d53e3a3b
2014-07-09 11:51:15 +00:00
Prtksxna e6adbef707 Merge "rename variable, and parentheses not brackets" 2014-06-25 00:50:51 +00:00
Prtksxna 8a680a2433 Merge "Raise popup show/hide delay to 500ms/300ms, respectively" 2014-06-25 00:46:15 +00:00
S Page 4c86e94e49 rename variable, and parentheses not brackets
removeBracketsFromText doesn't count it tracks nesting level, and
brackets are [] not ().  Minor detail.

Change-Id: I8f42b1ccae5233d7b6062bb311eced6ef3085d4a
2014-06-24 01:23:05 -07:00
jenkins-bot 49c0c2f669 Merge "render.article: Remove brackets using code instead of RegExp" 2014-06-24 08:12:55 +00:00
Prtksxna b65954645f Merge "Check for empty response" 2014-06-23 01:51:15 +00:00
Derk-Jan Hartman e3de26ebfe Re-use result instead of querying the DOM for selector multiple times
It's a complicated query, we should not repeat it when not necessary.

Change-Id: I71d47de088afa7dab0a6eaed214c61db699fcd0c
2014-06-23 06:47:38 +05:30
Bartosz Dziewoński 3041d358ed Raise popup show/hide delay to 500ms/300ms, respectively
Per discussion on the bug, the current values of 150ms/100ms cause a
lot of unintended actions.

Bug: 64234
Change-Id: I6fe2d89ad97630ec5c7f47d3e3b9b71d7cfc5d3f
2014-06-20 16:48:00 +02:00
Fomafix 58be4ea1de Check for empty response
In combination with other gadgets the error
TypeError: re.query is undefined
can occur because the request contains titles:'' and the response is [].

Change-Id: I46d02e7c48a55cd9af20fd7ef729b4d26f69a8c0
2014-06-18 20:57:19 +00:00
Prateek Saxena f44b1701a2 render.article: Remove brackets using code instead of RegExp
Casees:
1) Hello (and welcome)
2) Hello )and welcome(
3) (Hello (and) welcome)

The current RegExp only takes care of (1). The new code should
take care of all the cases.

Bug: 65138
Change-Id: I39f38beed0cf612067d6fc61b18295d1d38fcc22
2014-06-11 12:51:31 +05:30
Prateek Saxena 0192822522 disablenavpop: Correct type check for disablePopups global
Change-Id: I33f62c74fe231c74cf54937aa43ac35ae15a0b37
2014-06-10 16:50:24 +05:30
jenkins-bot 8682faa2f6 Merge "renderer.article: Escape RegExp syntax from the article's title" 2014-06-08 12:46:16 +00:00
jenkins-bot f0d58e0f7d Merge "animation: Use the animation mixin in core and pass fill-mode as an argument" 2014-06-06 11:10:24 +00:00
Prateek Saxena a6ad92e9fd Disable NavigationPopups (Gadget) if Popups (Extension) is enabled
Bug: 62952
Change-Id: If3757199c280bb0ad54878111dcf926b88778b64
2014-06-06 13:04:34 +05:30
Prateek Saxena 2b59d8530d renderer.article: Escape RegExp syntax from the article's title
Bug: 66203
Change-Id: Id9b523643e8540a717919fa5bb65a6d980722c0f
2014-06-06 09:56:13 +05:30
Prateek Saxena 4a15462ea0 animation: Use the animation mixin in core and pass fill-mode as an argument
Bug: 65923
Change-Id: I4222d811d56a84fe046dfe4a96eda636e76967a5
2014-06-03 11:56:00 +05:30
Prateek Saxena d1ddb95067 Flip the animation direction if the Hovercard is flipped
Change-Id: I890d49c517a52e57e0b22bcf1949b347d531d6b7
2014-05-30 16:25:14 +05:30
Prateek Saxena a52242087f animation: Add fade animations from other directions
1. fade-in-down
2. fade-out-up

Change-Id: I108b6bb6bbb8ac49401e9dc0d6599e57c42abf62
2014-05-30 05:18:05 +05:30
jenkins-bot 08c7bbf11b Merge "animation: Correctly name the animation classes" 2014-05-29 19:04:54 +00:00
jenkins-bot 1877fda630 Merge "Use only px in the stylesheet" 2014-05-29 18:46:27 +00:00
Prateek Saxena dd309071d2 animation: Correctly name the animation classes
fade-in to fade-in-up
fade-out to fade-out-down

Change-Id: I6e8877a509fdb3e3f570e16d59438bff61e2615a
2014-05-29 00:35:25 +00:00
Prateek Saxena 9cc318c3eb renderer: Ignore # links
Bug: 65425
Change-Id: Ic610ee485da668b9a141234f56477faf7bcaa447
2014-05-27 19:24:28 +05:30
jenkins-bot 5e11a35d95 Merge "Popups: The promise of the popups was not forwarding failures" 2014-05-22 13:47:14 +00:00
Derk-Jan Hartman fab07e5c6f Popups: The promise of the popups was not forwarding failures
Change-Id: Icc1d5a175ccf9ef000dd198f999994917912de3f
2014-05-22 19:14:38 +05:30
Derk-Jan Hartman cc4d67c67c Popups: Fix popups for extiw links
These links were not ignored due to a typo. This also threw an error,
because these links produced query.interwiki and not in query.pages.

Change-Id: I3b5c5b900209323e3e72b41e3b02e90f1f53b4eb
2014-05-20 00:30:29 +02:00
Prateek Saxena 7cfca498fc Reduce space between extract and timestamp
Bug: 65154
Change-Id: I9e114c820944aa54bfa3fd4afe9ba93c1024d28d
2014-05-19 21:48:37 +05:30
Prateek Saxena 418394bc8e Use only px in the stylesheet
Instead of the current incomprehensible mixture of em's and px's.
This will help resolve other positioning bugs with relative ease.

Change-Id: I9d7659736489c461ab8c0f4aa660a3ce2846bd5d
2014-05-19 15:46:58 +05:30
Thiemo Mättig b656841f8f Don't underline hovercard text when user preference is 'Always'
The setting is called 'underline' and defaults to 'Skin or
browser default' (= 2). If set to 'Always' (= 1), which is what
I personally like and do, ;-) all text in hovercards is
underlined (and the underlines disappear if you hover the
hovercard, which is a bit tricky but possible).

This simple fix removes the dependency from the default style
(which only shows underlines on hover). I think this is the most
straightforward solution.

Change-Id: Ide54ffd1949a50184d8d2a680bf1a0d35e24d563
2014-05-12 16:18:20 +02:00
Prateek Saxena 046a34b9a0 render.article: Make the title of the text bold in the extract
Bug: 65098
Change-Id: Ibd7c821d538acd2045e0ffb9a8b2274d61d99484
2014-05-11 00:00:26 +05:30
Prateek Saxena e4d18a1c0e render.article: Fix regexp for removing brackets
Change-Id: I4fbff8a5d34cf48a44aae4a12e6d2a23c362b4cf
2014-05-10 19:35:31 +05:30
jenkins-bot 770d29949c Merge "render.article: Remove text inside brackets along with the brackets" 2014-05-10 13:50:17 +00:00
Prateek Saxena b587fcda20 render.article: Remove text inside brackets along with the brackets
Change-Id: I544bf0daf935b9ddb5bb64c4eae1fd96baef2c44
2014-05-10 17:46:04 +05:30
Prateek Saxena c4f46dd7d4 Increase font size
Increase the extract font-size. Also increase
the max-height of .mwe-popups-extract so that
the text does not get cut.

Bug: 63508
Change-Id: Icde0ca8af44e68cab71816f4c89fe9a68f66b472
2014-05-10 11:42:48 +05:30
Prateek Saxena 5a7393407c render.article: Fix image placement on non-SVG browsers
Bug: 64598
Change-Id: I9e3434330a0c51e625921f6255119ff96deccbc6
2014-05-09 13:53:19 +00:00
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 1045bda2b5 render.article: Break down the createThumbnail method
Bug: 61267
Change-Id: Id17bc6d19f044d6a4837eebb6b1a264ee104ea84
2014-05-09 13:51:32 +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
Bartosz Dziewoński 84be066a29 Apply whitespace code conventions in LESS files
https://www.mediawiki.org/wiki/CC/LESS

Change-Id: Ic8df9629b76499c57114a5e399b4266dd0523002
2014-04-22 13:38:53 +02: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
jenkins-bot 6909350524 Merge "Fix border issue with non-flipped landscape hovercards" 2014-04-22 10:57:40 +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 75afbf26ff Fix border issue with non-flipped landscape hovercards
Bug: 63215
Change-Id: Id998e9c33bab551643e5e18303cbd773dc824a39
2014-04-14 11:30:27 +05:30
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 511b6f251f Add white fill in triangle for hovercards with images
Bug: 62945
Change-Id: I1b3ec90a8cd482c100ee8b2abd5ee69f3890a576
2014-04-02 06:54:38 +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 1b4a7a1f26 Fix for RTL languages
Bug: 62970
Change-Id: I7c2a2afa8fc2b52727fd7e86a7774b9d8196917c
2014-04-01 11:48:40 +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 dc75194d9b Stop overflowing text from hitting the border
Bug: 62194
Change-Id: Id055274b6f1cd2ecdc826b2bb4f3b3fb8f89dc65
2014-03-17 08:29:25 +00:00
Prateek Saxena 710b845da1 Add border around pokey of the popup
Change-Id: Idead01aea93a685f9d061361cfd5978ad3dfda17
2014-03-17 08:28:50 +00:00
Prateek Saxena 091c2e40d8 Use mixin for creating pokeys with the border method
Change-Id: I16f79dd0fc89d986d17c61ecfcd1dca0de8243c4
2014-03-17 08:27:00 +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 1b82d9b969 Make animation mixin cleaner
Change-Id: I5103daf43112d5a412c030dd90fda67a08469885
2014-02-27 15:19:41 +05:30
Prateek Saxena b6f57aebcc Minor type changes/Fix contrast
Bug: 61411
Change-Id: Ia33b94f69c3cf655a278311801f64d32841af2e7
2014-02-25 06:32:38 +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
Yuvipanda e1d6fccc90 Merge "Make padding consistent for extract and timestamp" 2014-02-24 04:06:01 +00:00
Prateek Saxena 3744726eab Truncate text for portrait popups
Change-Id: I8b1177a538f5e2b0e79f68fe2c125189363c0545
2014-02-24 09:24:25 +05:30
Prateek Saxena 180a493cdc Make padding consistent for extract and timestamp
Change-Id: I3dc9fa9631a9ab17953195cd51eb192b0b009dca
2014-02-24 09:19:16 +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 55fbaad4bd Improve color contrast further
Bug: 61411
Change-Id: I91916ce44d6ef6f823432b089e0aef4e513292ad
2014-02-21 13:17:16 +05:30
Prateek Saxena 3ce19d484b Improve contrast of old timestamps
Bug: 61411
Change-Id: If9c3517e49ed81f7d758dfa08967a3af9125956e
2014-02-21 12:56:19 +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 a54a0a4195 Position timestamp div from the bottom
Also, removes the the "+" CSS selector

Bug: 61138
Change-Id: Idc88363add5e4f82d3d44b204f7bf3c96fa27839
2014-02-17 15:09:32 +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 cde2c2f182 Reduce font size for timestamp
Change-Id: Ic54988c0613022fe11ad0019fa9c9b83151252d1
2014-02-13 06:25:44 +05:30
Prateek Saxena 6e3b49807d Remove drop shadow
Change-Id: I21b54b86e231900f0211958cd9c99ef9787ca382
2014-02-13 06:22:58 +05:30
Prateek Saxena 7b49f88bbf Change border color
Change-Id: Ie6f09773d22ff0ce4cf2d3f3c21a32c917f0424f
2014-02-13 06:21:32 +05:30
Prateek Saxena af02948903 Reduce padding on text
Change-Id: Ia203da26ed52873c2b879593bd6e56651830319e
2014-02-12 21:33:56 +05:30
Prateek Saxena 8777220853 Reduce space between extract and timestamp
Change-Id: I84d498e4633105ba3f93bab158f776bd7aec64af
2014-02-12 21:31:19 +05:30
Prateek Saxena bb5cc039f9 Update type size and leading
Change-Id: Ic933179359a9098820c9b0dfaea154c9f478c81f
2014-02-12 21:29:06 +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
Prateek Saxena cc61893f0b Remove the title attribute on hover (for links that have popups)
Change-Id: I62ce77fecd1b944d2d0454082aee8f5781e29593
2014-02-07 06:26:50 +00:00
Prateek Saxena d2b825de24 Add animation to Popups
Change-Id: I1b0c4073581cdfc58da2b590ae6f2057cafeff12
2014-02-07 06:22:50 +00:00
Prateek Saxena 551f923e64 Add JS/CSS resources
Change-Id: Idd2b8fe0a8a9e030df8668c1ca0d855e19333789
2014-02-07 11:09:43 +05:30