Commit graph

1819 commits

Author SHA1 Message Date
Translation updater bot 00f1ed2de6 Localisation updates from https://translatewiki.net.
Change-Id: I53de4572ef3460960b3d8de5d7f7669fd73da54c
2018-04-13 22:13:00 +02:00
Stephen Niedzielski 2eeaa0a2e4 Hygiene: consolidate clip-path manipulation
The clip-path SVG property was conditionally set in thumbnail.js and
also conditionally set or removed in renderer.js. This patch refactors
the logic to occur in a single place, renderer.js.

The refactor was made with the following considerations:

• The one condition under which thumbnail.js would set clip-path was,
  given a thumbnail exists, the thumbnail was not tall and clip-path
  would be set to `url(#mwe-popups-mask)`. Otherwise, thumbnail.js would
  not set clip-path.

• The logic in renderer.js for setting the attribute doesn't change
  since overwriting the clip-path is equivalent to not having a
  preexisting value. The case for removing the attribute itself is
  replaced by inverting the condition, `flippedY`, and combining it with
  the thumbnail.js condition, `!isTall`. The operation is only valid for
  an existing thumbnail so the `hasThumbnail` remains unchanged.

This patch also clarifies that the "flipped" classes are exclusively set
by using an if / else chain instead of reconsidering all inputs for each
condition.

Bug: T190831
Change-Id: I4062ec7068dcadecbdbc4791447ea2ed1ce2a1de
2018-04-13 09:25:22 -05:00
Stephen Niedzielski 007efbef05 Hygiene: remove unused strings
Remove popups-redirects and popups-send-feedback, which are unused. They
appear to be remnants of the code before the rewrite:

- popups-redirects was removed in I42fb9cc1a8b26eaf6807243e4e7bdbf0b56dc35c
- send-feedback was removed in If545873bb97b1da8ea5001dce575b1ef512903fb

Also, add detail to prefs-reading qqq string.

Change-Id: I072d416b2805a2a05e76aa28f083db730e0a523a
2018-04-11 22:47:54 +00:00
Translation updater bot 281ae31dc0 Localisation updates from https://translatewiki.net.
Change-Id: Ia7b0bb3d562136ac125c653c20a1de1baa6252aa
2018-04-10 22:15:35 +02:00
joakin 4e639b09d4 Update mw-node-qunit to 3.1.0
* 3.1.0
  * Added CONTRIBUTING.md
  * Update jsdom from 11.3.0 to 11.7.0
  * Upgrade jQuery from 3.2.1 to 3.3.1
  * Update QUnit from 2.4.1 to 2.6.0
  * Update prettier, fix formatting glob

* Commits https://github.com/joakin/mw-node-qunit/compare/v3.0.0...v3.1.0
* Changelog https://github.com/joakin/mw-node-qunit/blob/master/CHANGELOG.md#310

Change-Id: I16d4e4f86f59f9a2f441c915a31d1f0617b40c82
2018-04-09 11:58:04 +02:00
Translation updater bot 5a27a3ba98 Localisation updates from https://translatewiki.net.
Change-Id: Ide5d3f37750a7d04ef2647353aba3960f50f8a36
2018-04-08 22:30:20 +02:00
Translation updater bot 3a52dc64c6 Localisation updates from https://translatewiki.net.
Change-Id: I08caf318d417d127770dad8c5abd8ec8006f2bd7
2018-04-07 22:34:35 +02:00
Translation updater bot 4ff34bd834 Localisation updates from https://translatewiki.net.
Change-Id: I4b99c29d9a810aff23620a51a522a2b4d385bc36
2018-04-06 22:20:23 +02:00
Translation updater bot 896227d0db Localisation updates from https://translatewiki.net.
Change-Id: Iab4e983a93e893af8f69f26c44361c16b8977300
2018-04-05 22:22:30 +02:00
jenkins-bot 563cc05fa7 Merge "Bump VirtualPageView schema to 17780078" 2018-04-05 13:26:05 +00:00
Translation updater bot b314dc70b0 Localisation updates from https://translatewiki.net.
Change-Id: Ibe252cc214535ca438b4f060f3f8501cfa924ca0
2018-04-04 22:50:55 +02:00
Stephen Niedzielski c61513f0ea Hygiene: split LESS into components
Bug: T165036
Change-Id: I916f27138b5abe6b9fe23719cffb10f20e604b89
2018-04-03 16:37:05 -07:00
jdlrobson 663218d974 All images are served by ResourceLoaderImageModule
This moves the footer icon into the ResourceLoaderImage module
providing us a consistent way of serving image assets.

This means we no longer need to provide PNGs for icons

However, given mw-ui-icon-large is not large enough for the given
use case we do have to wrestle with icon styles and override them
to get the desired result. I think this is a small price to pay given
icons are now discoverable

Change-Id: I38b62c01fd930dcbfb73b95e6128885cb483f86e
2018-04-03 16:34:49 -07:00
Translation updater bot 8721acbc77 Localisation updates from https://translatewiki.net.
Change-Id: I6e566e1d1a649ed9fd7ea1c7b7f315cc4b336f4e
2018-04-01 09:39:00 +02:00
Translation updater bot 8ee48f0f4c Localisation updates from https://translatewiki.net.
Change-Id: Ief7afa26fdd08e6cc92dd892c1aed6744883116e
2018-03-30 09:34:53 +02:00
jdlrobson 5bbfe9c4e5 Bump VirtualPageView schema to 17780078
This should be a noop since edits only relate
to documentation changes but is done to avoid
confusion

Change-Id: I9b4a4924a301e0cdec617d89b9b7d817941a95ef
2018-03-29 14:55:04 -07:00
jdlrobson e6202b6ce4 VirtualPageViews bypass EventLogging for logging virtual events
We are using EventLogging to track page views not user behaviour.
This is an exception to the rule and requires special handling.

Bug: T190188
Change-Id: If096ccaf0ac884d57744ed57e2f26b51446de2d7
2018-03-29 16:53:20 +00:00
jenkins-bot 9eccf1c103 Merge "Add eslint auto-fixing to Gruntfile" 2018-03-29 16:52:36 +00:00
jenkins-bot 833cd2e126 Merge "Up the max asset and entry point sizes" 2018-03-29 16:52:24 +00:00
jenkins-bot 4a59593e2c Merge "PopupsContext::areDependenciesMet should respect PopupsGateway config" 2018-03-29 15:22:51 +00:00
libraryupgrader a89f613678 build: Updating mediawiki/mediawiki-codesniffer to 17.0.0
Change-Id: Ia9519ea4f530e024d36c4d8fdbb50b7452c848cf
2018-03-29 05:09:20 +00:00
Piotr Miazga 915a9708fb PopupsContext::areDependenciesMet should respect PopupsGateway config
On all wikis Popups use Restbase as default gateway. In that case we
do not require the TextExtracts nor PageImages extensions. Code should
reflect that.

Bug: T190818
Change-Id: If4ce8f709b2ca1bb3cc381afa5e80e978adf2498
2018-03-28 16:31:15 -07:00
jdlrobson 3c892ca9f8 Add eslint auto-fixing to Gruntfile
Run `npm run lint:fix` to use

Change-Id: I445c17a57b5f240ddaa48956d7881cc3228eab76
2018-03-27 12:57:40 -07:00
jdlrobson bb2ad2ed38 Up the max asset and entry point sizes
40kb seems a good time to pause and reflect on the total size.
The current maximum is impossible to meet without no further
changes to the code.

12kb is also more flexible than 11.5

Change-Id: I5ee8c236d90542afacc0e8de513a45a15ccd529b
2018-03-27 12:57:17 -07:00
Stephen Niedzielski eeba12ce50 Doc: add image to readme
Change-Id: I1fcef97d8a7477b5fcc19466e9884bd3f7caf2f3
2018-03-27 14:12:12 -05:00
jdlrobson 1acd15adb1 Standardise disambiguation icon
All icons should be 20 by 20 by standard.
(Previously it was 24 by 24)

Bug: T190558
Change-Id: I0956c9c31f1606f0a77b4be29bde5a56b5c5ebb8
2018-03-23 13:54:31 -07:00
jdlrobson 90b787ed9c Abandon use of skinStyles for settings dialog
We already use pixels to define font sizes in the pixels so rather
fight Vector's styles explicitly declare the font size in the header
(which it controls) instead for more readable code.

Also copy across several rules that are implied by Vector but needed
for the settings dialog so that this renders nicely in Monobook and
Minerva.

Change-Id: I196b8af23fe6ebcdb472c059cf1536d251a5b978
2018-03-23 11:13:00 -07:00
jenkins-bot 68650116a3 Merge "Doc: ADR for replacing Mustache with ES6 strings" 2018-03-23 15:57:33 +00:00
joakin b18ea67ea1 Hygiene: Update comment of application initialization
Comment became a bit stale. This updates it to reflect reality and
normalizes the verb forms for consistency.

Noticed as part of https://gerrit.wikimedia.org/r/c/420839/2/src/index.js#167

Additional changes:
* Merged all the const statements in L63 into one, for consistency.
  Before, some were merged and some were independent.

Change-Id: I23aa824bb811f03a3630b4695e84c468bd9cd8b5
2018-03-23 09:32:52 -05:00
Stephen Niedzielski 133c921098 Doc: ADR for replacing Mustache with ES6 strings
Add architectural decision record for replacing Mustache.js with ES6
template literals. Also, fix the date format on a previous ADR to be
consistent with the others.

Bug: T165036
Change-Id: I561ab4aaf6258e27cb12787b370407626547d48c
2018-03-23 09:17:52 -05:00
jenkins-bot b3784925e8 Merge "Doc: update some of the popups / preview terminology" 2018-03-23 10:24:39 +00:00
Stephen Niedzielski 4dd9df12eb Doc: update some of the popups / preview terminology
Bug: T165036
Change-Id: Id75543d4d886e4cca8278baaf4f4a21c8e4389b7
2018-03-23 11:18:26 +01:00
Translation updater bot 9bce75dd24 Localisation updates from https://translatewiki.net.
Change-Id: I62affe4740b01acf07837cb25620c3f7e30efa1e
2018-03-22 22:09:03 +01:00
Stephen Niedzielski c4b50b04ac Hygiene: remove unused resources
In I7395e3438836149becdd576942bdaf6f21b4163f the settings templates
were rewritten so that they no longer displayed an image.

descriptionText and images were dropped from the template but not from
the template provider. These are artifacts from relating to that patch
and are no longer used.

Change-Id: I1be7ef288d37f338e83dab3cf041e628a06608d2
2018-03-21 17:07:18 -05:00
Stephen Niedzielski f974fc4f3c Fix: use localized close labels in settings dialog
Use i18n close label in the settings dialog since we have it instead of
hardcoding English. A cross is shown instead of the text so this change
may not be visible in all browsers.

Change-Id: I66284b04fe905cc8e460ea10b56c88cacd66ed28
2018-03-21 21:50:47 +00:00
jdlrobson 3245a2ac6e Hygiene: restrict use of $.each and fix offenders
Bug: T190142
Change-Id: I5da7a4a1ffe14647ec70b10b3a7ab9b935c5ca84
2018-03-21 14:24:22 -05:00
Stephen Niedzielski 18f5c3d060 Fix: erroneous build product diffs
When resources/dist was removed or modified, the diff check erroneously
complained that the resources differed. This could be resolved by simply
running the tests again. This patch fixes the issue by leveraging Git to
do the diffs which eliminates the need for a temporary test-build
directory and has the side-effect of improving the grep experience for
the repo.

Change-Id: Idf33f4d52aab6a2907debf6a7d6c7be5c83d9ee6
2018-03-21 08:08:14 -05:00
Stephen Niedzielski 007cc5ab7c Hygiene: favor string templates over concatenation
Update the ESLint config to favor ES6 strings where variables or string
concatenation is used and fix *all* offenders automatically via:

  eslint \
    --cache \
    --max-warnings 0 \
    --report-unused-disable-directives \
    --fix \
    src tests

Change-Id: I1a9345162348e5ded21d541e7a2ce251ea72ab5a
2018-03-21 08:05:55 -05:00
Stephen Niedzielski e284163014 Hygiene: use consistent ESLint severity syntax
Bug: T165036
Change-Id: I43a500fceb8179d30240dbec8ed56f8d4c7551e9
2018-03-21 10:45:09 +00:00
Stephen Niedzielski 2221055bc1 Hygiene: forbid lint warnings
Bug: T165036
Change-Id: I257b0e3ac410d8153161b55b7fec85bf28644795
2018-03-21 10:44:52 +00:00
Stephen Niedzielski 57762e0417 Hygiene: favor const
Bug: T165036
Change-Id: I17d374eaac6627ca6a8ba178862b2a9cff2538c0
2018-03-21 10:44:24 +00:00
jenkins-bot 875789adf2 Merge "Hygiene: replace var with let and const" 2018-03-21 10:41:34 +00:00
Timo Tijhof 7d70739b79 build: Remove redundant excludes from "eslint:sources" task
None of the exclude patterns were matching the included patterns,
as such they were no-ops.

Change-Id: I99fca4f6e2f6252c818a6fbb8588f6ba68dfe054
2018-03-20 17:23:31 -07:00
Timo Tijhof 0f08ac9a9c Tooling: Remove some redundant max-len patterns
- `///` is not used in any linted files.
  It is/was used in webpack dist, but those are not and should not
  be passed through ESLint.
- `QUnit` was presumably added prematurely on the assumption
  that overly long test names should not be broken over multiple
  lines. However, being strings, they are already ignored.
- `// (?!eslint..)` was redundant. Ignoring warnings from max-len
  about an eslint-disable line has no influence on the actual
  parsing of those lines by ESLint.

Follows-up 807100b.

Bug: T185295
Change-Id: I2be2492848190b53d45240b38a08784b4a370819
2018-03-20 17:23:14 -07:00
Stephen Niedzielski 0bee0906d4 Hygiene: replace var with let and const
eslint \
    --cache \
    --max-warnings 0 \
    --report-unused-disable-directives \
    --fix \
    src tests

Change-Id: I051275126ae7fa9affd16c2504017c0584f2d9c7
2018-03-20 14:14:02 -05:00
Stephen Niedzielski 422a02d61a Hygiene: remove unneeded renderer test setup
Change-Id: Id3e0a4af1f88c57c3ef141dac67a8b13643a2dcb
2018-03-20 09:27:08 -05:00
Stephen Niedzielski ece4670710 Hygiene: use arrow for anonymous functions
In some places, the arrow function seems more natural. This patch
approximates the following with manual amendments:

  find \
    -not \( \( -name node_modules -o -name .git -o -name vendor -o -name doc -o -name resources \) -prune \) \
    -iname \*.js|
  xargs -rd\\n sed -ri 's%function\s*(\([^)]*\))%\1 =>%g'

Files to focus on were identified with:

  rg -slg\!/resources/dist/ -g\!/i18n/ -g\!/doc/ 'this|self|arguments|bind|call|apply|new'|
  xargs -rd\\n git difftool -y

Bug: T165036
Change-Id: Ic66b6000b8fc000f9bfde39749f9cfa69924a13c
2018-03-20 09:27:08 -05:00
Stephen Niedzielski a67466acc0 Hygiene: replace obvious function methods
Replace easily identifiable object functions with method syntax:

  find \
    -not \( \( -name node_modules -o -name .git -o -name vendor -o -name doc -o -name resources \) -prune \) \
    -iname \*.js|
  xargs -rd\\n sed -ri 's%:\s*function\s*(\([^)]*\))%\1%g'

Bug: T165036
Change-Id: I90693ee99a6a36dff820dd5ae6f6000429763058
2018-03-20 09:27:07 -05:00
Stephen Niedzielski a2a743d775 Hygiene: use object shorthand where obvious
Approximately:

  find \
    -not \( \( -name node_modules -o -name .git -o -name vendor -o -name doc -o -name resources \) -prune \) \
    -iname \*.js|
  xargs -rd\\n sed -ri 's%(\b\S+\b)\s*:\s*\b\1\b%\1%g'

Bug: T165036
Change-Id: I48869dc93b66f908e070288eb2f035bb064993e3
2018-03-20 09:26:20 -05:00
Stephen Niedzielski 5872c8376d Fix: JSDoc Node.js file copy bug
Upgrade JSDoc from v3.4.3 to 3.5.5:
- v3.5.0 JSDoc can parse any JavaScript that is supported by Babel
  compiler.
- v3.5.1 fixes an incompatibility bug in Node.js < v5.10.0
- v3.5.5 fixes an incompatibility bug in Node.js v8.5.0

Prior to this change, object shorthand caused the following errors:

  jsdoc -c jsdoc.json
  fs.js:1979
    binding.copyFile(src, dest, flags);
            ^

  Error: EISDIR: illegal operation on a directory, copyfile '/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/templates/default/static/fonts/OpenSans-Bold-webfont.eot' -> 'doc/autogenerated/fonts'
      at Object.fs.copyFileSync (fs.js:1979:11)
      at /home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/templates/default/publish.js:471:12
      at Array.forEach (<anonymous>)
      at Object.exports.publish (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/templates/default/publish.js:468:17)
      at Object.module.exports.cli.generateDocs (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/cli.js:430:39)
      at Object.module.exports.cli.processParseResults (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/cli.js:383:20)
      at module.exports.cli.main (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/cli.js:227:14)
      at Object.module.exports.cli.runCommand (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/cli.js:180:5)
      at /home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/jsdoc.js:103:9
      at Object.<anonymous> (/home/stephen/dev/wmf/vagrant2/mediawiki/extensions/Popups/node_modules/jsdoc/jsdoc.js:104:3)
      at Module._compile (module.js:662:30)
      at Object.Module._extensions..js (module.js:673:10)
      at Module.load (module.js:575:32)
      at tryModuleLoad (module.js:515:12)
      at Function.Module._load (module.js:507:3)
      at Function.Module.runMain (module.js:703:10)

https://github.com/jsdoc3/jsdoc/releases/tag/3.5.0
https://github.com/jsdoc3/jsdoc/releases/tag/3.5.1
https://github.com/jsdoc3/jsdoc/releases/tag/3.5.2
https://github.com/jsdoc3/jsdoc/releases/tag/3.5.3
https://github.com/jsdoc3/jsdoc/releases/tag/3.5.4
https://github.com/jsdoc3/jsdoc/releases/tag/3.5.5

Bug: T165036
Change-Id: Ic7a22b6992d45fa0ea3d011a9ad5200d7cc73b80
2018-03-20 09:24:06 -05:00