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
Given the level of documentation in this repo is extremely
low now seems a good as time as any.
The resulting documentation is a vast improvement on before
grouping functions to an owner and introducing module names.
We can iterate on the documentation over time.
Bug: T138401
Change-Id: I9e787d40931d3d72a7037ce07d3ab0db8e72d825
Changes:
* MinervaUI will now prefix any icons with `minerva`
* Update definitions in skin.json, retaining selectors for cached
HTML for icons that are rendered via PHP.
* In I9021c53c2c04bdd7ce395eed33d89986acbfea6d watch and watched
and arrow are moved to MobileFrontend so are removed from the RL module
skins.minerva.icons.images.scripts as they are not
used directly in this repo. user and anonymous are no longer used
so also removed.
* Presentation of userpage now belongs to MobileFrontend. Icons
are styles were moved there in depends on. They are retained in
skin.json to support cached HTML as user pages are subject to
cache. They can be removed in a week.
* In code review we noticed the anonymous icon was badly named. We
rename to login. No caching implications.
* Main menu icons are now prefixed with minerva rather than mf to
reflect where they come from.
Depends-On: I9021c53c2c04bdd7ce395eed33d89986acbfea6d
Bug: T182162
Change-Id: I93264024f4915fc910c792b1905b89cdc6b8b546
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
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
Short term fix to ensure icon doesn't change
when oo-ui is loaded.
Prefix with 'mf-' (we do this in main menu) to avoid nameclashes
Bug: T182162
Change-Id: Ia6ceb620ed2710d97387a326b74f1a02236cd0d0
Looks like window.print may block so keep the spinner until
it's finished execution.
This may or may not fix the larger issue being discussed in the bug
but is harmless so why not.
Bug: T181261
Change-Id: I927d4bc8c96d74c14463f71b7ce6dec62618a485
When the print button is clicked, load all images from the page
before calling window.print
Add a timeout to make sure the user doesnt wait too long.
Change-Id: Ie922d239f9c5b5757237dc10b673fb500ff203ad
Depends-on: Id7f21606be3db22fe8dfde2db675f9905547cfea
Bug: T180058
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