Commit graph

79 commits

Author SHA1 Message Date
Simon Legner 01437fd521 Replace wgMultimediaViewer with config.json packageFiles
Practically, the variable wgMultimediaViewer is not used inside user common.js, see https://global-search.toolforge.org/?q=wgMultimediaViewer

Ref: https://www.mediawiki.org/wiki/ResourceLoader/Package_files
Bug: T77349
Change-Id: Ib086c6184f76ca2dbeb701f79c3b18b336ff5433
2024-08-11 11:34:46 +02:00
Simon Legner 4672f2eb57 ThumbnailInfo: support multi lingual SVG
Bug: T208564
Change-Id: Icf082ca0dc94bc4739fd31b795de76f8a0083b70
2024-07-01 22:49:10 +02:00
Ed Sanders fa18975543 build: Update eslint-config-wikimedia to 0.28.0 and autofix
Change-Id: Iff4b874580768b008427c0bea535ab08cea14a36
2024-06-07 17:33:12 +01:00
Simon Legner 0399ffff40 Api: remove obsolete getQueryField function
Obsolete since Ia4388fe4d5e1d6112a992e826453cd5799a6a4b4.

Bug: T77349
Change-Id: I13efa32786a2ba65edbaedde214057e9efe98145
2024-06-04 19:34:30 +02:00
Simon Legner 21438d2b22 Remove FileRepoInfo API and Repo model
Repo was only used in two locations:
1. StripeButtons.set for `isCommons` - can be replaced by `descriptionUrl.includes('//commons.wikimedia.org/')`
2. EmbedFileFormatter.getSiteLink (unused)

Furthermore:
- Simplify StripeButtons (we only have one button)
- Unwrap info objects consisting of `ImageModel` and `Repo`
- Remove unused EmbedFileFormatter.getSiteLink
- Inline EmbedFileFormatter.getCaption and EmbedFileFormatter.getLinkUrl
- Fix JSDoc type `ImageModel`

Reduces mmv bundle size from 28012 to 27246.

Bug: T77349
Change-Id: Ia4388fe4d5e1d6112a992e826453cd5799a6a4b4
2024-05-31 08:13:08 +02:00
Novem Linguae b02ba00fd0 JSDoc: convert @cfg to @param
Bug: T138401
Change-Id: Ib09d471a28821f54c6f8678e788ba85fbd426d35
2024-05-28 06:25:20 -07:00
Simon Legner f00dbbb939 Remove IIFE
Remove Immediately-invoked function expression throughout production code base.

Bug: T77349
Change-Id: Ia31b556975209bbea27df8444b69d924654b181e
2024-05-21 22:31:15 +02:00
libraryupgrader 147b576b57 build: Updating dependencies
composer:
* mediawiki/mediawiki-phan-config: 0.12.1 → 0.14.0

npm:
* eslint-config-wikimedia: 0.25.1 → 0.26.0
  The following rules are failing and were disabled:
  * resources:
    * es-x/no-resizable-and-growable-arraybuffers
  * tests/qunit:
    * es-x/no-resizable-and-growable-arraybuffers

* grunt-banana-checker: 0.11.0 → 0.11.1

Change-Id: Ief610bdadaccd2325cd1b8a2cae70b7e465d8b76
2024-02-13 02:13:29 +00:00
Ed Sanders a33f7e5c57 Update linters and fix issues
Change-Id: Ib562131bbb3a9940d56602e0c4dbbe810ce7358c
2023-06-28 19:12:48 +01:00
Simon Legner 30fad6b8b8 Use ES6 features
* classes
* arrow functions
* const/let
* string templates
* Object.assign

Bug: T337102
Change-Id: I757b9993a2feeed707fb4ad213944001498f3f6a
2023-06-12 16:45:08 +00:00
Simon Legner 0683f3ecc8 Remove global mw.mmv
Bug: T337030
Change-Id: I90e8507cb1b7c30f6ba29dbdec8966e84b46aff2
2023-05-21 08:02:54 +00:00
Simon Legner 74a76718d7 Use packageFiles in mmv.test
Bug: T337030
Change-Id: Iaea2deec35003e306a8e1f12f890879c80cd8289
2023-05-21 06:41:31 +00:00
Simon Legner d82910fbb3 Use packageFiles in mmv
Bug: T337030
Change-Id: I833c7e91230272b82a2512fd55f1c7c0f61233b4
2023-05-20 10:04:41 +03:00
Simon Legner 35cd0f18c0 Use packageFiles in mmv
Bug: T337030
Change-Id: I90cdfb626c176b27b59db6b92b9edd6b2fe49b68
2023-05-20 09:34:56 +03:00
Bartosz Dziewoński 3bca077968 Remove some IE 11 support code
No longer supported by MediaWiki.

Change-Id: Ib16ecd8fc2ca8060deabf39142d5294a7b8f316f
2023-05-02 15:54:46 +02:00
Fomafix 8013fde051 Use formatversion=2 in API requests
The response of prop=imageinfo is now an array instead of an object.
Therefor it is not needed to interate over the elements anymore.
The array contains exact one element if one title is used in the query.

The function getNormalizedTitle not needed anymore because the
requested title is always the first element of the array.

Change-Id: I7a226d3950615a2152c3f55127b218cac2d21fcc
2023-04-24 20:32:11 +00:00
Fomafix a8ccfb4092 Remove .join( '|' ) for API parameters
mw.Api automatically joins parameters which are from type array.

Change-Id: I17d7ba6f2fdc36963e984062827d69ff45656a93
2023-04-17 11:50:01 +00:00
Sam Smith 34e4968b2c Remove instrumentation
The MediaViewer and MultimediaViewer* instruments were disabled circa
October 2021 in Ie7dd8739efc.

This patch removes those instruments and any supporting code and data.
Notably, this patch does not remove the mw.mmv.logging.ViewLogger
instrument, which is responsible for logging image views.

Bug: T310890
Change-Id: I97d41be93849b2ae9d1adba6660546ea716657fd
2022-07-05 17:41:24 +00:00
Ed Sanders e131da48f9 build: Update eslint-config-wikimedia to 0.22.1
Change-Id: I275ecfa03b3df8554b30f2a0f6d94d4b66da8088
2022-05-20 00:05:49 +01:00
diwanshu885 5271e7a08d Wrap the mw.Uri creation in a try-catch block
Bug: T261799
Change-Id: Ibaf027917f34d0591b7ebc669d9fbaff2f0bb442
2020-10-20 00:21:07 +05:30
Ed Sanders d554d7f426 Docs: Fix whitespace
Change-Id: I98dc12787f68bd8db60e5a5bcb9366daf9f2f6b8
2020-06-26 11:21:04 +01:00
James D. Forrester c6008c7844 build: Be more aggressive in fixing old bad JS code style
Change-Id: I7f734f1440a4a3216e774d2bddbc39b34f4125d2
2019-02-20 19:28:25 +00:00
James D. Forrester 1b21470703 build: Update eslint-config-wikimedia to 0.11.0
Change-Id: I66788a2c1fa59b617abd13b7c8e8fb59ad74130c
2019-02-20 19:22:21 +00:00
Ed Sanders a518cb03a5 build: Update eslint-config-wikimedia to 0.9.0
Change-Id: I92ed1f7093cfaed47f0372f9cb063fe4e65b4f55
2019-01-03 13:47:16 +00:00
Ed Sanders 1ded292f83 Remove obsolete aliases from closures
Bug: T208951
Change-Id: Ice695dfb489974faa23ba19d74cf17b06e3f6075
2018-11-12 16:33:24 +00:00
Zoranzoki21 007e161a76 Fix "the the" typo in mmv.provider.GuessedThumbnailInfo.js file
Bug: T201491
Change-Id: I752c08b5ec625555b03e199a800a6d1fb0c0738b
2018-08-27 20:20:32 +00:00
Ed Sanders 42b577bae9 build: Update linters
Change-Id: I7262fb369df0428c39adaf55128b83f019afb4c0
2017-10-31 18:42:04 +00:00
Gergő Tisza bbe174bca8 Display warning for licence/attribution problems
Bug: T76030
Bug: T71389
Bug: T71557
Change-Id: I38c1548a0de6cfd3a48db7efd7502a99f168d4a5
2017-09-28 15:34:30 +02:00
Ed Sanders d7ea64137c build: Replace jshint/jscs with eslint
Change-Id: I423add157245353031e36b7e44fee7ace7c753c7
2017-01-10 10:24:39 -08:00
Ed Sanders b46529d1b2 build: Introduce jshint & jscs and make a pass
These replace the hard-coded jshint task in CI.

Change-Id: Id14eec1ecba4ceae735ffd10f9114233a580302f
2016-07-19 13:48:06 -07:00
Andrew H 6005b068bf Cache imageinfo query in MultimediaViewer
Bug: T117750
Change-Id: I5560e14b13968113e768bacce9972169f270e7bc
2016-01-06 04:37:53 +00:00
Julius Alphonso a9758d21e0 Remove uploader's name from MediaViewer
Only last uploader's name is shows, this turns out to be
more confusing than useful.

Bug: T59308
Change-Id: I7d06b72c581fe8738bffc64b5e36be9983b01ccf
2015-12-29 10:56:08 +05:30
Gergő Tisza 056e339ac4 Ignore case in file extension checks
Bug: T115563
Change-Id: I27efb1a1c6510edc88357b69b1631cf55ca11539
2015-10-25 22:31:07 -07:00
Kunal Mehta e3a6c0baa3 Avoid not caching meta=filerepoinfo calls for logged in users
Change-Id: I6a1010cb4a0374ec57ccdede2f0788b914165324
2015-05-27 16:51:54 -07:00
Fomafix ae99be730e Apply coding conventions for JavaScript
Change-Id: I57a8f188eb1152438a8e94235a6f6801e2617c28
2015-01-23 12:48:27 +00:00
gladoscc 84a8df8808 Show (tm) symbol if applicable
ImageData will now parse for restrictions (this part has not been
implemented in CommonsMetadata yet), and an orange trademark label
will be displayed next to the license label if there is a 'trademarked'
restriction.

Bug: T77717
Change-Id: Ib03f9708d1e4ff0b5befddc2688b274e2c7ce1f7
2015-01-15 18:21:30 +11:00
Sn1per e4b8e860c8 Show custom Attribution line instead of Author/Credit when available
- Adds attribution variable to Image model
  - In mmv.ui.metadataPanel and mmv.EmbedFileFormatter, display
      attribution line instead of author and credit when it is set
  - Update junit tests for mmv.model.Image and mmv.EmbedFileFormatter

Bug: T67445
Change-Id: Idfe542a1542d28cf8d27c1720ab0bd54324b2f37
2014-12-29 15:56:05 -05:00
Gilles Dubuc 30029b8b78 Track the most recent upload time for performance events
Change-Id: I673f9487deea15dc148452a3a4d6b91563a2c417
Bug: T76035
2014-12-03 16:15:20 +01:00
Gergő Tisza 485944ba9d Show "and X more authors" when a file has multiple info templates
Bug: T74082
Change-Id: If53e3e364d07ef35a93b3b24430441d390aaf66e
2014-11-27 07:24:26 +00:00
Gergő Tisza 05d803e17a Text changes for better handling of PD and nonfree licenses
Bug: T70687
Change-Id: I84e0094559e5b438fcb33b8511dc0184435c1a37
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/1004
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/631
2014-11-26 02:21:50 +00:00
Gilles Dubuc 00d345f8b4 Rename Performance to PerformanceLogger
Change-Id: Iacfde35851cf8f617c4672d3ea466d4f0e2e448f
2014-11-21 11:07:40 +01:00
Gilles Dubuc ad5040a140 Add marker parameter to image requests coming from MediaViewer
This will be needed by Erik Zachte for compiling per-file image view data.
Since Media Viewer does preloading, it skews the HTTP request-based
statistics. By marking image requests coming from Media Viewer,
it allows us to remove that bias.

Change-Id: Iac8e7770c1a379691547de4b6d47b7d54467f54d
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/1002
2014-11-20 15:57:27 +01:00
Gergő Tisza a44be28c4e Fetch image title from CommonsMetadata
Change-Id: Id7d256150aedb4351778f6ad60fd7d85399b58c5
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/589
2014-10-28 10:46:31 +00:00
Gilles Dubuc 2ef45b3058 Remove categories
Change-Id: I309b01592e874579d50bf5fc0810c238d47748f5
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/835
2014-09-09 13:23:50 +00:00
Gilles Dubuc caa624d711 Remove file usage
Change-Id: I538f7734e1c06a179ee98a5cd843ccee4d91349f
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/835
2014-09-05 08:14:52 +02:00
Gergő Tisza c4c262bf44 Move logging-related code to its own directory
Also make sure class and file names have the same case.

Change-Id: I21042e40030051326f8c55fd62a86a54e9011a4a
2014-09-04 23:34:45 +00:00
Gergő Tisza deafff7046 Fix URL handling for global usage list
Also add integration tests to make sure URL generation works OK

Bug: 63908
Bug: 64910
Bug: 66147
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/570
Change-Id: I448f42e294102a633f74c305dd0a226e7dbe955d
2014-06-25 21:41:04 +00:00
Gergő Tisza d964b3fd09 Fix url encoding in URL guesser
Change-Id: I99757913cd2fe5170db37c79a2d2986b12b5aa45
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/594
2014-05-09 22:44:57 +00:00
jenkins-bot 9e0df0dd4c Merge "Refactor progressbar & blur handling" 2014-05-01 23:12:22 +00:00
Gergő Tisza fec24e02f7 Refactor progressbar & blur handling
This tries to fix a number of related issues:
* the blurred thumbnail was visible for a split-second sometimes
  when switching back to an already-loaded image. (Presumably when
  JS was sluggish enough to take more than 10 ms to execute.) We
  now check whether the promise is pending before showing a placeholder.
  (More generally, a lot of unnecessary logic was executed when paging
  through already loaded images, like displaying the placeholder, so
  this might make the UI a bit more responsive.)
* the blur could get stuck sometimes - I have seen this a few times,
  but have never been able to reproduce it, so I'm only guessing, but
  maybe the timing was really unfortunate, and we switched back less
  than 10 ms before loading finished. We now remove the blur on every
  branch, just to be sure.
* adding a progress handler to a promise might not have any immediate
  effect, so when switching to an image which was loading, the progress
  bar reacted too late. We now store the progress state per thumbnail
  so it is always available immediately.
* the progress would animate from 0 to its actual state whenever we
  navigated to the image. The change on paging is now instant; the
  progress bar only animates when we are looking at it.
* switching quickly back and forthe between a loaded and a loading
  image resulted in the loading image becoming unblurred. This seems
  fixed now, I'm not sure why. Maybe the "skip on non-pending promise"
  logic affects it somehow.

Also removes some unused things / renames some things which were
confusing, and makes an unrelated fix in the image provider, which kept
amassing fail handlers.

Change-Id: I580becff246f197ec1bc65e82acd422620e35578
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/489
2014-05-01 21:09:28 +00:00