diff --git a/README.md b/README.md new file mode 100644 index 000000000..fe5704fd6 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# MultimediaViewer + +Provided interface for viewing full-size, or nearly full-size, images in their browser without extraneous page loads or confusing interstitial pages. diff --git a/jsdoc.json b/jsdoc.json new file mode 100644 index 000000000..c3d037edf --- /dev/null +++ b/jsdoc.json @@ -0,0 +1,46 @@ +{ + "opts": { + "destination": "docs/js", + "package": "package.json", + "pedantic": true, + "readme": "README.md", + "recurse": true, + "template": "node_modules/jsdoc-wmf-theme" + }, + "plugins": [ + "plugins/markdown" + ], + "source": { + "include": [ "resources" ] + }, + "sourceType": "module", + "templates": { + "cleverLinks": true, + "default": { + "useLongnameInNav": true + }, + "wmf": { + "linkMap": { + "Array": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", + "Event": "https://developer.mozilla.org/en-US/docs/Web/API/Event", + "HTMLElement": "https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement", + "HTMLImageElement": "https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement", + "Image": "https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image", + "jQuery": "https://api.jquery.com/Types/#jQuery", + "jQuery.Deferred": "https://api.jquery.com/category/deferred-object/", + "jQuery.Event": "https://api.jquery.com/category/events/event-object/", + "jQuery.Promise": "https://api.jquery.com/Types/#Promise", + "mw.Api": "https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.Api", + "mw.Map": "https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.Map", + "mw.SafeStorage": "https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.SafeStorage", + "mw.Title": "https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.Title", + "mw.widgets.CopyTextLayout": "https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.widgets.CopyTextLayout", + "Object": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", + "OO.Router": "https://doc.wikimedia.org/oojs-router/master/#!/api/OO.Router", + "OO.ui.DropdownWidget": "https://doc.wikimedia.org/oojs-ui/master/js/#!/api/OO.ui.DropdownWidget", + "OO.ui.MenuOptionWidget": "https://doc.wikimedia.org/oojs-ui/master/js/#!/api/OO.ui.MenuOptionWidget", + "OO.ui.MenuSelectWidget": "https://doc.wikimedia.org/oojs-ui/master/js/#!/api/OO.ui.MenuSelectWidget" + } + } + } +} diff --git a/jsduck.categories.json b/jsduck.categories.json deleted file mode 100644 index 36f395dda..000000000 --- a/jsduck.categories.json +++ /dev/null @@ -1,107 +0,0 @@ -[ - { - "name": "Media Viewer classes", - "groups": [ - { - "name": "Base", - "classes": [ - "mw.mmv", - "mw.mmv.Config", - "mw.mmv.EmbedFileFormatter", - "mw.mmv.HtmlUtils", - "mw.mmv.LightboxImage", - "mw.mmv.LightboxInterface", - "mw.mmv.MultimediaViewer", - "mw.mmv.MultimediaViewerBootstrap", - "mw.mmv.ThumbnailWidthCalculator" - ] - }, - { - "name": "Loggers", - "classes": [ - "mw.mmv.logging.*" - ] - }, - { - "name": "Models", - "classes": [ - "mw.mmv.model.*" - ] - }, - { - "name": "Providers", - "classes": [ - "mw.mmv.provider.*" - ] - }, - { - "name": "Interface", - "classes": [ - "mw.mmv.ui.*" - ] - } - ] - }, - - { - "name": "External", - "groups": [ - { - "name": "jQuery", - "classes": [ - "jQuery", - "jQuery.Promise", - "jQuery.Deferred", - "jQuery.Event", - "jQuery.jqXHR" - ] - }, - { - "name": "JavaScript natives", - "classes": [ - "Array", - "Boolean", - "Date", - "Function", - "Number", - "Object", - "RegExp", - "String" - ] - }, - { - "name": "OOjs Router", - "classes": [ - "OO.Router" - ] - }, - { - "name": "OOUI", - "classes": [ - "OO.ui.*" - ] - }, - { - "name": "MediaWiki", - "classes": [ - "mw", - "mw.Api", - "mw.Title", - "mw.Map", - "mw.storage", - "mw.SafeStorage", - "mw.eventLog", - "mw.widgets.CopyTextLayout" - ] - }, - { - "name": "Browser native classes", - "classes": [ - "HTMLElement", - "HTMLImageElement", - "XMLHttpRequest" - ] - } - ] - } -] diff --git a/jsduck.external.js b/jsduck.external.js deleted file mode 100644 index 38af91cdf..000000000 --- a/jsduck.external.js +++ /dev/null @@ -1,102 +0,0 @@ -/** - * @class mw - * - * @singleton - */ - -/** - * @class mw.Api - * - */ - -/** - * @class mw.Title - * - */ - -/** - * @class mw.eventLog - * - */ - -/** - * @class mw.Map - * Associative array which is used for various configuration objects, most prominently mw.config: - * - */ - -/** - * @class mw.storage - * - */ - -/** - * @class mw.SafeStorage - * - */ - -/** - * @class mw.widgets.CopyTextLayout - * - */ - -/** - * @class HTMLElement - * An HTML element. - */ - -/** - * @class HTMLImageElement - * @extends HTMLElement - * An HTML element. - */ - -/** - * @class OO.Router - * - */ - -/** - * @class OO.ui.MenuOptionWidget - * - */ - -/** - * @class OO.ui.MenuSelectWidget - * - */ - -/** - * @class OO.ui.DropdownWidget - * - */ - -/** - * @class XMLHttpRequest - * An AJAX request - */ - -/** - * @class jQuery - * A jQuery object. - */ - -/** - * @class jQuery.Promise - * A jQuery promise object. - */ - -/** - * @class jQuery.Deferred - * A jQuery deferred object. - */ - -/** - * @class jQuery.Event - * An event object with extra jQuery data. - */ - -/** - * @class jQuery.jqXHR - * An XMLHttpRequest object wrapped by jQuery - */ diff --git a/package-lock.json b/package-lock.json index 5f6c39fbc..adb07aea9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,8 @@ "grunt-banana-checker": "0.10.0", "grunt-eslint": "24.0.1", "grunt-stylelint": "0.18.0", + "jsdoc": "3.6.10", + "jsdoc-wmf-theme": "^0.0.5", "stylelint-config-wikimedia": "0.14.0", "svgo": "2.8.0" } @@ -118,6 +120,18 @@ "node": ">=4" } }, + "node_modules/@babel/parser": { + "version": "7.21.8", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.8.tgz", + "integrity": "sha512-6zavDGdzG3gUqAdWvlLFfk+36RilI+Pwyuuh7HItyeScCWP3k6i8vKclAQ0bM/0y/Kz/xiwvxhMv9MgTJP5gmA==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/@csstools/selector-specificity": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-2.2.0.tgz", @@ -305,6 +319,28 @@ "node": ">=10.13.0" } }, + "node_modules/@types/linkify-it": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-3.0.2.tgz", + "integrity": "sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA==", + "dev": true + }, + "node_modules/@types/markdown-it": { + "version": "12.2.3", + "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-12.2.3.tgz", + "integrity": "sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ==", + "dev": true, + "dependencies": { + "@types/linkify-it": "*", + "@types/mdurl": "*" + } + }, + "node_modules/@types/mdurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-1.0.2.tgz", + "integrity": "sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==", + "dev": true + }, "node_modules/@types/minimatch": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", @@ -486,6 +522,12 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", + "dev": true + }, "node_modules/boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -612,6 +654,18 @@ } ] }, + "node_modules/catharsis": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.9.0.tgz", + "integrity": "sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A==", + "dev": true, + "dependencies": { + "lodash": "^4.17.15" + }, + "engines": { + "node": ">= 10" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -1070,6 +1124,12 @@ "url": "https://github.com/fb55/domhandler?sponsor=1" } }, + "node_modules/domino": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/domino/-/domino-2.1.6.tgz", + "integrity": "sha512-3VdM/SXBZX2omc9JF9nOPCtDaYQ67BGp5CoLpIQlO2KCAPETs8TcDHacF26jXadGbvUteZzRTeos2fhID5+ucQ==", + "dev": true + }, "node_modules/domutils": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", @@ -2729,6 +2789,44 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/js2xmlparser": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.2.tgz", + "integrity": "sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA==", + "dev": true, + "dependencies": { + "xmlcreate": "^2.0.4" + } + }, + "node_modules/jsdoc": { + "version": "3.6.10", + "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.10.tgz", + "integrity": "sha512-IdQ8ppSo5LKZ9o3M+LKIIK8i00DIe5msDvG3G81Km+1dhy0XrOWD0Ji8H61ElgyEj/O9KRLokgKbAM9XX9CJAg==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.9.4", + "@types/markdown-it": "^12.2.3", + "bluebird": "^3.7.2", + "catharsis": "^0.9.0", + "escape-string-regexp": "^2.0.0", + "js2xmlparser": "^4.0.2", + "klaw": "^4.0.1", + "markdown-it": "^12.3.2", + "markdown-it-anchor": "^8.4.1", + "marked": "^4.0.10", + "mkdirp": "^1.0.4", + "requizzle": "^0.2.3", + "strip-json-comments": "^3.1.0", + "taffydb": "2.6.2", + "underscore": "~1.13.2" + }, + "bin": { + "jsdoc": "jsdoc.js" + }, + "engines": { + "node": ">=8.15.0" + } + }, "node_modules/jsdoc-type-pratt-parser": { "version": "2.2.5", "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-2.2.5.tgz", @@ -2738,6 +2836,26 @@ "node": ">=12.0.0" } }, + "node_modules/jsdoc-wmf-theme": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/jsdoc-wmf-theme/-/jsdoc-wmf-theme-0.0.5.tgz", + "integrity": "sha512-YRVucO3yiKF6a54oIR+gQLDynO60o2m0lOiCBCws0vIORJOn9T++tGJrOCVy5TSaSAmJTX1cnTbUCH7L+c1JCw==", + "dev": true, + "dependencies": { + "domino": "^2.0.1", + "lunr": "2.3.0", + "taffydb": "^2.6.2" + } + }, + "node_modules/jsdoc/node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -2765,6 +2883,15 @@ "node": ">=0.10.0" } }, + "node_modules/klaw": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-4.1.0.tgz", + "integrity": "sha512-1zGZ9MF9H22UnkpVeuaGKOjfA2t6WrfdrJmGjy16ykcjnKQDmHVX+KI477rpbGevz/5FD4MC3xf1oxylBgcaQw==", + "dev": true, + "engines": { + "node": ">=14.14.0" + } + }, "node_modules/known-css-properties": { "version": "0.26.0", "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.26.0.tgz", @@ -2856,6 +2983,15 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, + "node_modules/linkify-it": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", + "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", + "dev": true, + "dependencies": { + "uc.micro": "^1.0.1" + } + }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -2907,6 +3043,12 @@ "node": ">=10" } }, + "node_modules/lunr": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.0.tgz", + "integrity": "sha512-9JOUUgCp71jGy7V+lYdpw1LKe8TiyMEP49H37pkyQPVl8QEgFLF3ts4ZTdsYghAe8OaRRh1nG1JCiRSkmbMuAw==", + "dev": true + }, "node_modules/make-iterator": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", @@ -2940,6 +3082,59 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/markdown-it": { + "version": "12.3.2", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz", + "integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1", + "entities": "~2.1.0", + "linkify-it": "^3.0.1", + "mdurl": "^1.0.1", + "uc.micro": "^1.0.5" + }, + "bin": { + "markdown-it": "bin/markdown-it.js" + } + }, + "node_modules/markdown-it-anchor": { + "version": "8.6.7", + "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-8.6.7.tgz", + "integrity": "sha512-FlCHFwNnutLgVTflOYHPW2pPcl2AACqVzExlkGQNsi4CJgqOHN7YTgDd4LuhgN1BFO3TS0vLAruV1Td6dwWPJA==", + "dev": true, + "peerDependencies": { + "@types/markdown-it": "*", + "markdown-it": "*" + } + }, + "node_modules/markdown-it/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/markdown-it/node_modules/entities": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz", + "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==", + "dev": true, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/marked": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "dev": true, + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 12" + } + }, "node_modules/mathml-tag-names": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz", @@ -2956,6 +3151,12 @@ "integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==", "dev": true }, + "node_modules/mdurl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", + "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", + "dev": true + }, "node_modules/meow": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz", @@ -3051,6 +3252,18 @@ "node": ">= 6" } }, + "node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -3804,6 +4017,15 @@ "node": ">=0.10.5" } }, + "node_modules/requizzle": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.4.tgz", + "integrity": "sha512-JRrFk1D4OQ4SqovXOgdav+K8EAhSB/LJZqCz8tbX0KObcdeM15Ss59ozWMBWmmINMagCwmqn4ZNryUGpBsl6Jw==", + "dev": true, + "dependencies": { + "lodash": "^4.17.21" + } + }, "node_modules/resolve": { "version": "1.22.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", @@ -4416,6 +4638,12 @@ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "dev": true }, + "node_modules/taffydb": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz", + "integrity": "sha512-y3JaeRSplks6NYQuCOj3ZFMO3j60rTwbuKCvZxsAraGYH2epusatvZ0baZYA01WsGqJBq/Dl6vOrMUJqyMj8kA==", + "dev": true + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -4499,6 +4727,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/uc.micro": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", + "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", + "dev": true + }, "node_modules/unc-path-regex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", @@ -4508,6 +4742,12 @@ "node": ">=0.10.0" } }, + "node_modules/underscore": { + "version": "1.13.6", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz", + "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==", + "dev": true + }, "node_modules/underscore.string": { "version": "3.3.6", "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.6.tgz", @@ -4664,6 +4904,12 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/xmlcreate": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.4.tgz", + "integrity": "sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg==", + "dev": true + }, "node_modules/xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", @@ -4836,6 +5082,12 @@ } } }, + "@babel/parser": { + "version": "7.21.8", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.8.tgz", + "integrity": "sha512-6zavDGdzG3gUqAdWvlLFfk+36RilI+Pwyuuh7HItyeScCWP3k6i8vKclAQ0bM/0y/Kz/xiwvxhMv9MgTJP5gmA==", + "dev": true + }, "@csstools/selector-specificity": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@csstools/selector-specificity/-/selector-specificity-2.2.0.tgz", @@ -4970,6 +5222,28 @@ "integrity": "sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==", "dev": true }, + "@types/linkify-it": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-3.0.2.tgz", + "integrity": "sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA==", + "dev": true + }, + "@types/markdown-it": { + "version": "12.2.3", + "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-12.2.3.tgz", + "integrity": "sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ==", + "dev": true, + "requires": { + "@types/linkify-it": "*", + "@types/mdurl": "*" + } + }, + "@types/mdurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-1.0.2.tgz", + "integrity": "sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==", + "dev": true + }, "@types/minimatch": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", @@ -5114,6 +5388,12 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", + "dev": true + }, "boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -5193,6 +5473,15 @@ "integrity": "sha512-2SodVrFFtvGENGCv0ChVJIDQ0KPaS1cg7/qtfMaICgeMolDdo/Z2OD32F0Aq9yl6F4YFwGPBS5AaPqNYiW4PoA==", "dev": true }, + "catharsis": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.9.0.tgz", + "integrity": "sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A==", + "dev": true, + "requires": { + "lodash": "^4.17.15" + } + }, "chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -5535,6 +5824,12 @@ "domelementtype": "^2.2.0" } }, + "domino": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/domino/-/domino-2.1.6.tgz", + "integrity": "sha512-3VdM/SXBZX2omc9JF9nOPCtDaYQ67BGp5CoLpIQlO2KCAPETs8TcDHacF26jXadGbvUteZzRTeos2fhID5+ucQ==", + "dev": true + }, "domutils": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", @@ -6762,12 +7057,63 @@ "esprima": "^4.0.0" } }, + "js2xmlparser": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.2.tgz", + "integrity": "sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA==", + "dev": true, + "requires": { + "xmlcreate": "^2.0.4" + } + }, + "jsdoc": { + "version": "3.6.10", + "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.10.tgz", + "integrity": "sha512-IdQ8ppSo5LKZ9o3M+LKIIK8i00DIe5msDvG3G81Km+1dhy0XrOWD0Ji8H61ElgyEj/O9KRLokgKbAM9XX9CJAg==", + "dev": true, + "requires": { + "@babel/parser": "^7.9.4", + "@types/markdown-it": "^12.2.3", + "bluebird": "^3.7.2", + "catharsis": "^0.9.0", + "escape-string-regexp": "^2.0.0", + "js2xmlparser": "^4.0.2", + "klaw": "^4.0.1", + "markdown-it": "^12.3.2", + "markdown-it-anchor": "^8.4.1", + "marked": "^4.0.10", + "mkdirp": "^1.0.4", + "requizzle": "^0.2.3", + "strip-json-comments": "^3.1.0", + "taffydb": "2.6.2", + "underscore": "~1.13.2" + }, + "dependencies": { + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true + } + } + }, "jsdoc-type-pratt-parser": { "version": "2.2.5", "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-2.2.5.tgz", "integrity": "sha512-2a6eRxSxp1BW040hFvaJxhsCMI9lT8QB8t14t+NY5tC5rckIR0U9cr2tjOeaFirmEOy6MHvmJnY7zTBHq431Lw==", "dev": true }, + "jsdoc-wmf-theme": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/jsdoc-wmf-theme/-/jsdoc-wmf-theme-0.0.5.tgz", + "integrity": "sha512-YRVucO3yiKF6a54oIR+gQLDynO60o2m0lOiCBCws0vIORJOn9T++tGJrOCVy5TSaSAmJTX1cnTbUCH7L+c1JCw==", + "dev": true, + "requires": { + "domino": "^2.0.1", + "lunr": "2.3.0", + "taffydb": "^2.6.2" + } + }, "json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -6792,6 +7138,12 @@ "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true }, + "klaw": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-4.1.0.tgz", + "integrity": "sha512-1zGZ9MF9H22UnkpVeuaGKOjfA2t6WrfdrJmGjy16ykcjnKQDmHVX+KI477rpbGevz/5FD4MC3xf1oxylBgcaQw==", + "dev": true + }, "known-css-properties": { "version": "0.26.0", "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.26.0.tgz", @@ -6878,6 +7230,15 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, + "linkify-it": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", + "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", + "dev": true, + "requires": { + "uc.micro": "^1.0.1" + } + }, "locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -6920,6 +7281,12 @@ "yallist": "^4.0.0" } }, + "lunr": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.0.tgz", + "integrity": "sha512-9JOUUgCp71jGy7V+lYdpw1LKe8TiyMEP49H37pkyQPVl8QEgFLF3ts4ZTdsYghAe8OaRRh1nG1JCiRSkmbMuAw==", + "dev": true + }, "make-iterator": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", @@ -6941,6 +7308,46 @@ "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", "dev": true }, + "markdown-it": { + "version": "12.3.2", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz", + "integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==", + "dev": true, + "requires": { + "argparse": "^2.0.1", + "entities": "~2.1.0", + "linkify-it": "^3.0.1", + "mdurl": "^1.0.1", + "uc.micro": "^1.0.5" + }, + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "entities": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz", + "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==", + "dev": true + } + } + }, + "markdown-it-anchor": { + "version": "8.6.7", + "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-8.6.7.tgz", + "integrity": "sha512-FlCHFwNnutLgVTflOYHPW2pPcl2AACqVzExlkGQNsi4CJgqOHN7YTgDd4LuhgN1BFO3TS0vLAruV1Td6dwWPJA==", + "dev": true, + "requires": {} + }, + "marked": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "dev": true + }, "mathml-tag-names": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz", @@ -6953,6 +7360,12 @@ "integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==", "dev": true }, + "mdurl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", + "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", + "dev": true + }, "meow": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz", @@ -7023,6 +7436,12 @@ "kind-of": "^6.0.3" } }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -7569,6 +7988,15 @@ "integrity": "sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww==", "dev": true }, + "requizzle": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.4.tgz", + "integrity": "sha512-JRrFk1D4OQ4SqovXOgdav+K8EAhSB/LJZqCz8tbX0KObcdeM15Ss59ozWMBWmmINMagCwmqn4ZNryUGpBsl6Jw==", + "dev": true, + "requires": { + "lodash": "^4.17.21" + } + }, "resolve": { "version": "1.22.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", @@ -8036,6 +8464,12 @@ } } }, + "taffydb": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz", + "integrity": "sha512-y3JaeRSplks6NYQuCOj3ZFMO3j60rTwbuKCvZxsAraGYH2epusatvZ0baZYA01WsGqJBq/Dl6vOrMUJqyMj8kA==", + "dev": true + }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -8103,12 +8537,24 @@ "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true }, + "uc.micro": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", + "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", + "dev": true + }, "unc-path-regex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", "dev": true }, + "underscore": { + "version": "1.13.6", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz", + "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==", + "dev": true + }, "underscore.string": { "version": "3.3.6", "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.6.tgz", @@ -8230,6 +8676,12 @@ "signal-exit": "^3.0.7" } }, + "xmlcreate": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.4.tgz", + "integrity": "sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg==", + "dev": true + }, "xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", diff --git a/package.json b/package.json index 01f6656c5..d3a267c9a 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "build": "npm -s run minify-svg", "test": "grunt test", "minify-svg": "svgo --config=.svgo.config.js --quiet --recursive --folder resources/", - "doc": "" + "doc": "jsdoc -c jsdoc.json" }, "devDependencies": { "eslint-config-wikimedia": "0.25.0", @@ -13,6 +13,8 @@ "grunt-banana-checker": "0.10.0", "grunt-eslint": "24.0.1", "grunt-stylelint": "0.18.0", + "jsdoc": "3.6.10", + "jsdoc-wmf-theme": "^0.0.5", "stylelint-config-wikimedia": "0.14.0", "svgo": "2.8.0" } diff --git a/resources/.eslintrc.json b/resources/.eslintrc.json index 619c50b70..48aedea52 100644 --- a/resources/.eslintrc.json +++ b/resources/.eslintrc.json @@ -3,8 +3,7 @@ "extends": [ "wikimedia/client-es6", "wikimedia/jquery", - "wikimedia/mediawiki", - "wikimedia/jsduck" + "wikimedia/mediawiki" ], "rules": { "prefer-arrow-callback": "warn", diff --git a/resources/mmv.bootstrap/mmv.Config.js b/resources/mmv.bootstrap/mmv.Config.js index 05b397c5b..1b897d9d0 100644 --- a/resources/mmv.bootstrap/mmv.Config.js +++ b/resources/mmv.bootstrap/mmv.Config.js @@ -69,7 +69,7 @@ * Get value from local storage or fail gracefully. * * @param {string} key - * @param {*} [fallback] value to return when key is not set or localStorage is not supported + * @param {any} [fallback] value to return when key is not set or localStorage is not supported * @return {string|null} stored value or fallback or null if neither exists */ getFromLocalStorage( key, fallback ) { @@ -94,7 +94,7 @@ * Set item in local storage or fail gracefully. * * @param {string} key - * @param {*} value + * @param {any} value * @return {boolean} whether storing the item was successful */ setInLocalStorage( key, value ) { diff --git a/resources/mmv.ui.download.pane/mmv.ui.download.pane.js b/resources/mmv.ui.download.pane/mmv.ui.download.pane.js index 3c5918425..24dce7c8f 100644 --- a/resources/mmv.ui.download.pane/mmv.ui.download.pane.js +++ b/resources/mmv.ui.download.pane/mmv.ui.download.pane.js @@ -61,12 +61,13 @@ const { EmbedFileFormatter, Utils } = require( 'mmv.ui.ondemandshareddependencie } /** - * @event mmv-download-cta-open * Fired when the attribution call to action panel is clicked. + * @event DownloadPane#mmv-download-cta-open */ + /** - * @event mmv-download-cta-close * Fired when the attribution area is closed. + * @event DownloadPane#mmv-download-cta-close */ /** diff --git a/resources/mmv.ui.ondemandshareddependencies/mmv.ui.utils.js b/resources/mmv.ui.ondemandshareddependencies/mmv.ui.utils.js index bcda6ab34..43f8205b4 100644 --- a/resources/mmv.ui.ondemandshareddependencies/mmv.ui.utils.js +++ b/resources/mmv.ui.ondemandshareddependencies/mmv.ui.utils.js @@ -77,6 +77,7 @@ const { HtmlUtils } = require( 'mmv.bootstrap' ); * * @param {number} width * + * @emit MMV#mmv-request-thumbnail * @return {jQuery.Promise.} */ getThumbnailUrlPromise( width ) { diff --git a/resources/mmv/mmv.js b/resources/mmv/mmv.js index 459af0455..852300a39 100644 --- a/resources/mmv/mmv.js +++ b/resources/mmv/mmv.js @@ -605,7 +605,7 @@ const ThumbnailWidthCalculator = require( './mmv.ThumbnailWidthCalculator.js' ); * taskFactory(lightboxImage) should return a preload task for the given lightboximage. * * @private - * @param {function(LightboxImage): function()} taskFactory + * @param {function(LightboxImage)} taskFactory * @return {TaskQueue} */ pushLightboxImagesIntoQueue( taskFactory ) { @@ -889,26 +889,36 @@ const ThumbnailWidthCalculator = require( './mmv.ThumbnailWidthCalculator.js' ); } /** - * @event mmv-close * Fired when the viewer is closed. This is used by the lightbox to notify the main app. + * + * @event MultimediaViewer#mmv-close */ + /** - * @event mmv-next * Fired when the user requests the next image. + * + * @event MultimediaViewer#mmv-next */ + /** - * @event mmv-prev * Fired when the user requests the previous image. + * + * @event MultimediaViewer#mmv-prev */ + /** - * @event mmv-resize-end * Fired when the screen size changes. Debounced to avoid continuous triggering while resizing with a mouse. + * + * @event MultimediaViewer#mmv-resize-end */ + /** - * @event mmv-request-thumbnail * Used by components to request a thumbnail URL for the current thumbnail, with a given size. + * + * @event MultimediaViewer#mmv-request-thumbnail * @param {number} size */ + /** * Registers all event handlers */ diff --git a/resources/mmv/mmv.lightboxinterface.js b/resources/mmv/mmv.lightboxinterface.js index fd20757e4..2e2eac401 100644 --- a/resources/mmv/mmv.lightboxinterface.js +++ b/resources/mmv/mmv.lightboxinterface.js @@ -237,6 +237,7 @@ const UiElement = require( './ui/mmv.ui.js' ); /** * Detaches the interface from the DOM. + * @fires MultimediaViewer#mmv-close */ unattach() { // We trigger this event on the document because unattach() can run diff --git a/resources/mmv/model/mmv.model.TaskQueue.js b/resources/mmv/model/mmv.model.TaskQueue.js index ee17ba500..74ecb26bd 100644 --- a/resources/mmv/model/mmv.model.TaskQueue.js +++ b/resources/mmv/model/mmv.model.TaskQueue.js @@ -27,7 +27,7 @@ * The list of functions to execute. * * @protected - * @property {Array.} + * @property {Array} */ this.queue = []; @@ -55,7 +55,7 @@ * * Tasks can only be added before the queue is first executed. * - * @param {function()} task + * @param {function(): any} task */ push( task ) { if ( this.state !== TaskQueue.State.NOT_STARTED ) { diff --git a/resources/mmv/ui/mmv.ui.canvas.js b/resources/mmv/ui/mmv.ui.canvas.js index 055dac704..ce442b3f6 100644 --- a/resources/mmv/ui/mmv.ui.canvas.js +++ b/resources/mmv/ui/mmv.ui.canvas.js @@ -171,6 +171,13 @@ const UiElement = require( './mmv.ui.js' ); /** * Registers click listener on the image. + * + * @emit ReuseDialog#mmv-reuse-opened + * @emit ReuseDialog#mmv-reuse-closed + * @emit DownloadDialog#mmv-download-opened + * @emit DownloadDialog#mmv-download-closed + * @emit OptionsDialog#mmv-options-opened + * @emit OptionsDialog#mmv-options-closed */ setUpImageClick() { this.handleEvent( 'mmv-reuse-opened', this.handleDialogEvent.bind( this ) ); @@ -202,8 +209,15 @@ const UiElement = require( './mmv.ui.js' ); /** * Registers listeners. + * + * @fires MultimediaViewer#mmv-resize-end */ attach() { + /** + * Fired when the screen size changes. Debounced to avoid continuous triggering while resizing with a mouse. + * + * @event MultimediaViewer#mmv-resize-end + */ $( window ).on( 'resize.mmv-canvas', mw.util.debounce( () => { this.$mainWrapper.trigger( $.Event( 'mmv-resize-end' ) ); }, 100 ) ); diff --git a/resources/mmv/ui/mmv.ui.canvasButtons.js b/resources/mmv/ui/mmv.ui.canvasButtons.js index a0ba1ea8b..9de7abf08 100644 --- a/resources/mmv/ui/mmv.ui.canvasButtons.js +++ b/resources/mmv/ui/mmv.ui.canvasButtons.js @@ -28,6 +28,7 @@ const UiElement = require( './mmv.ui.js' ); * @param {jQuery} $container The parent element we should put the buttons into. * @param {jQuery} $closeButton The close button element from the parent class. * @param {jQuery} $fullscreenButton The fullscreen button from the parent class. + * @fires MultimediaViewer#mmv-close */ constructor( $container, $closeButton, $fullscreenButton ) { super( $container ); @@ -194,13 +195,16 @@ const UiElement = require( './mmv.ui.js' ); } } - /** - * @event mmv-reuse-open - * Fired when the button to open the reuse dialog is clicked. - */ /** * Registers listeners. - */ + * + * @emit mmv-reuse-opened + * @emit mmv-reuse-closed + * @emit mmv-download-open + * @emit mmv-download-closed + * @emit mmv-options-opened + * @emit mmv-options-closed + */ attach() { this.$reuse.on( 'click.mmv-canvasButtons', ( e ) => { $( document ).trigger( 'mmv-reuse-open', e ); diff --git a/resources/mmv/ui/mmv.ui.dialog.js b/resources/mmv/ui/mmv.ui.dialog.js index 15c33e670..a7b97e9c6 100644 --- a/resources/mmv/ui/mmv.ui.dialog.js +++ b/resources/mmv/ui/mmv.ui.dialog.js @@ -49,7 +49,7 @@ const UiElement = require( './mmv.ui.js' ); /** @property {jQuery} $openButton The click target which opens the dialog. */ this.$openButton = $openButton; - /** @type {jQuery} $dialog The main dialog container */ + /** @property {jQuery} $dialog The main dialog container */ this.$dialog = $( '
' ) .addClass( 'mw-mmv-dialog' ); diff --git a/resources/mmv/ui/mmv.ui.download.dialog.js b/resources/mmv/ui/mmv.ui.download.dialog.js index 69d20f085..1b1656a9a 100644 --- a/resources/mmv/ui/mmv.ui.download.dialog.js +++ b/resources/mmv/ui/mmv.ui.download.dialog.js @@ -83,9 +83,10 @@ const Dialog = require( './mmv.ui.dialog.js' ); } /** - * @event mmv-download-opened * Fired when the dialog is opened. + * @event DownloadDialog#mmv-download-opened */ + /** * Opens a dialog with information about file download. */ @@ -108,9 +109,10 @@ const Dialog = require( './mmv.ui.dialog.js' ); } /** - * @event mmv-download-closed * Fired when the dialog is closed. + * @event DownloadDialog#mmv-download-closed */ + /** * Closes the download dialog. */ diff --git a/resources/mmv/ui/mmv.ui.metadataPanelScroller.js b/resources/mmv/ui/mmv.ui.metadataPanelScroller.js index 11c5d8a95..a0b49fb47 100644 --- a/resources/mmv/ui/mmv.ui.metadataPanelScroller.js +++ b/resources/mmv/ui/mmv.ui.metadataPanelScroller.js @@ -222,11 +222,19 @@ const UiElement = require( './mmv.ui.js' ); return $( window ).scrollTop() > 0; } + /** + * @event MetadataPanelScroller#mmv-metadata-open + */ + + /** + * @event MetadataPanelScroller#mmv-metadata-close + */ + /** * Receives the window's scroll events and and turns them into business logic events * - * @fires mmv-metadata-open - * @fires mmv-metadata-close + * @fires MetadataPanelScroller#mmv-metadata-open + * @fires MetadataPanelScroller#mmv-metadata-close */ scroll() { const panelIsOpen = this.panelIsOpen(); diff --git a/resources/mmv/ui/mmv.ui.permission.js b/resources/mmv/ui/mmv.ui.permission.js index 15b0e461c..c544b80bf 100644 --- a/resources/mmv/ui/mmv.ui.permission.js +++ b/resources/mmv/ui/mmv.ui.permission.js @@ -139,10 +139,14 @@ const MetadataPanelScroller = require( './mmv.ui.metadataPanelScroller.js' ); this.$html.html( permission ); } + /** + * @event Permission#mmv-permission-grow + */ + /** * Enlarge the box, show HTML instead of text. * - * @fires mmv-permission-grow + * @fires Permission#mmv-permission-grow */ grow() { // FIXME: Use CSS transition @@ -154,10 +158,14 @@ const MetadataPanelScroller = require( './mmv.ui.metadataPanelScroller.js' ); this.$container.trigger( 'mmv-permission-grow' ); } + /** + * @event Permission#mmv-permission-shrink + */ + /** * Limit the size of the box, show text only. * - * @fires mmv-permission-shrink + * @fires Permission#mmv-permission-shrink */ shrink() { this.$box.removeClass( 'full-size' ); diff --git a/resources/mmv/ui/mmv.ui.reuse.dialog.js b/resources/mmv/ui/mmv.ui.reuse.dialog.js index c92a50be7..708901557 100644 --- a/resources/mmv/ui/mmv.ui.reuse.dialog.js +++ b/resources/mmv/ui/mmv.ui.reuse.dialog.js @@ -225,9 +225,10 @@ const Dialog = require( './mmv.ui.dialog.js' ); } /** - * @event mmv-reuse-opened * Fired when the dialog is opened. + * @event ReuseDialog#mmv-reuse-opened */ + /** * Opens a dialog with information about file reuse. */ @@ -243,9 +244,10 @@ const Dialog = require( './mmv.ui.dialog.js' ); } /** - * @event mmv-reuse-closed * Fired when the dialog is closed. + * @event ReuseDialog#mmv-reuse-closed */ + /** * Closes the reuse dialog. */ diff --git a/resources/mmv/ui/mmv.ui.viewingOptions.js b/resources/mmv/ui/mmv.ui.viewingOptions.js index 3742903bc..a1e19fc04 100644 --- a/resources/mmv/ui/mmv.ui.viewingOptions.js +++ b/resources/mmv/ui/mmv.ui.viewingOptions.js @@ -140,9 +140,10 @@ const Dialog = require( './mmv.ui.dialog.js' ); } /** - * @event mmv-options-opened * Fired when the dialog is opened. + * @event OptionsDialog#mmv-options-opened */ + /** * Opens a dialog with information about file reuse. */ @@ -159,9 +160,10 @@ const Dialog = require( './mmv.ui.dialog.js' ); } /** - * @event mmv-options-closed * Fired when the dialog is closed. + * @event OptionsDialog#mmv-options-closed */ + /** * Closes the options dialog. *