Commit Graph

15 Commits

Author SHA1 Message Date
Stephen Niedzielski 874d9c9e3b Hygiene: update JSDoc boxed and JQuery types
From TypeScript's do's and don'ts:[0]

  Don’t ever use the types Number, String, Boolean, or Object. These
  types refer to non-primitive boxed objects that are almost never used
  appropriately in JavaScript code.

Although Minerva only uses JSDocs at this time which seemingly doesn't
care about casing[1], we should endeavor to use the proper return types.

This patch lowercases typing to indicate primitive / boxed type as
appropriate.[2] As a special case, function types are uppercased for
compatibility with TypeScript type checking.

Also, JQuery types are of type "JQuery". The global JQuery object's
identifier is "jQuery". This patch uppercases J's where appropriate.

Lastly, replace unsupported type "Integer" with "number" and a comment.

[0] https://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html#general-types

[1] https://github.com/jsdoc3/jsdoc/issues/1046#issuecomment-126477791

[2] find resources tests -iname \*.js|
    xargs -rd\\n sed -ri '
      s%\{\s*(number|string|boolean|object|null|undefined)%{\L\1%gi;
      s%\{\s*function%{Function%g;
      s%\{\s*jquery%{JQuery%gi;
      s%\{\s*integer\s*\}%{number} An integer.%gi
    '

Change-Id: I6cbac15940e4501aee7ede8f421b77ffd027170d
2018-07-03 11:10:12 -05:00
Stephen Niedzielski 41a43c5ce1 Hygiene: remove window.location use from overlays
Bug: T173539
Depends-On: I158dd7883be2846cf0d48bbd7e89fe2cd64a57d3
Change-Id: I87741667ca06cc701e5265aff13ba0492501de26
2018-03-07 17:13:59 -06:00
Stephen Niedzielski 27bc7e7212 Chore: move window.location use to client
Move window.location manipulation from ImageOverlay view to MinervaNeue.
Also, don't leave a hanging empty URL fragment when closing the overlay.

Bug: T173539
Related: I292c0578716ff56e0e069aa8006f840025d78a88
Change-Id: I56ba9217aa9cd4e0a925c623060022392e3021c7
2018-03-06 08:35:48 -06:00
jdlrobson 326ec90cd5 Disable download button on Chrome like browsers
Add Dolphin, Opera and Maxthon to whitelist

Bug: T182059
Change-Id: I39bf9d016aba189016b2ce5b42a2e95b58cb33ce
2018-02-01 10:59:18 -08:00
Piotr Miazga 4ca5666c06 Show Download button only on Android >= 5 & Chrome >= 41
Changes:
 - moved DownloadButtton checks & initialization to separate function
 - introduced supportedNamespaces variable for better readability
 - reorganized huge if(){} statement to set of smaller if's with
 nice comments why this configuration is not supported
 - introduced getAndroidVersion and getChromeVersion helper functions
 - added check to not allow Android < 5 or Chrome < 41
 - added unit tests

Bug: T182059
Change-Id: Ib5064459ee56aed68179389f37b4bc3b5c2c4492
2018-01-16 22:15:07 +01:00
Piotr Miazga 3c4f3a0ddd Send events when user taps download icon
To track "download" button interactions we have to notify
EventLogging that button was clicked. The easiest approach is
to use mw.track() and then in WikimediaEvents subscribe to the
`minerva.downloadAsPdf` events and track page impressions.

Bug: T181297
Change-Id: Iecbebe37c165dda3f26af47906662f6e5a81321d
2018-01-11 18:50:31 +00:00
jdlrobson eaa4dae5af Disable download button in all namespaces except main
The MinervaDownloadIcon config option is replaced with a
more specific wgMinervaDownloadNamespaces config option.
If the list is empty then the download button will not be
shown.

Since the download icon is enabled everywhere in production now
this is good as it means Minerva reflects the production value.

Bug: T181152
Change-Id: Id78c1de9e8e9013530106bc0d45d3cf0297897b5
2017-11-29 20:29:12 +00:00
jdlrobson 7697c262db Limit download button to Google Chrome
As discussed on ticket the download button only appears
to work on Google Chrome on mobile browsers.

Bug: T179529
Bug: T179914
Change-Id: I8bbda8d5a8aa42dd23773fea424c1a70e31d6f85
2017-11-09 21:11:02 +00:00
jdlrobson 58729578ae BetaOptin now managed by MobileFrontend
Depends-On: I83dc2165081332453cd6fc586ae7a3ba04bd3416
Change-Id: I11200f0ff90b359e363ea7a95bf4f3b9e92a67b4
2017-10-30 17:23:41 -07:00
jdlrobson 571895b754 Disable print button on iOS
As documented on the ticket, iOS does not provide PDF functionality
via print.

iOS 11 provides PDF generation but the resulting PDF is unreadable for
our content and missing styles (see T177215#3700576) and we do not know
of any way to invoke that just yet.

Bug: T177215
Change-Id: I7e195ae067625c7865dccee31fa7a2c3c0ee57e5
2017-10-23 16:06:25 -04:00
jdlrobson 45a1b3b423 Add feature flagged DownloadIcon
Shortcut for print. Disabled by default and controlled by
wgMinervaDownloadIcon

Note that with lazy images enabled, images will not appear
in the printed article. This can be easily addressed inside
the onClick function in a later patchset with a few modifications
to the Skin class.

Currently the flag when enabled will show on all browsers. There
are some open questions on the ticket about how we want to limit
the feature. This shouldn't block review or merging.

Bug: T177215
Change-Id: I49f1736870c743990b3fb9916247e07a597b2f59
2017-10-23 18:12:20 +00:00
jdlrobson c04c58a4d7 Minerva is responsible for loading tablet modules in tablet mode
Since Minerva is the only skin which does this kind of thing, it
was premature to add this logic to the Skin module.

By forcing Minerva to do this itself, we allow MobileFrontend to
be responsible for creating a Skin without having to know about
what that skin may want to load in tablet mode.
(see I8503c26bd064ae0d203f95a35031468c7c678ac1)

Bug: T173454
Change-Id: I32e2b4a10799a06138bfee08abc6769a6b96004d
2017-10-11 15:41:46 -07:00
jdlrobson 38474ed73f Hygiene: Cleanup initialisation files
* Remove deprecated module definitions
* Remove unnecessary check for Minerva skin (this is only
ever run by Minerva skin)
* Move overlayManager to place it is first used
* Make Skin::getMainMenu method redundant

Change-Id: I17ea52172e7fae0a8f0e06b8418c7ed5bb01ef64
2017-09-07 17:48:58 +00:00
jdlrobson 9500297090 Don't show ImageOverlay in desktop mode - delegate to multimedia viewer
Bug: T169622
Change-Id: Ie34297a56f8571b161802ea8a708a8bed37c9173
2017-07-27 15:26:31 +00:00
jdlrobson 2cc9516cde Minerva is its own skin
This is programmatic output from python3 scripts/migrate.py

This will result in a Minerva skin dependent on MobileFrontend.

Post merge we will rename message keys to have minerva- prefix

Bug: T166748
Change-Id: Iff1f7e63e796cc5d4a6d2ab0370e0c33248d2fce
2017-07-12 08:12:40 -07:00