| 1 | /* |
| 2 | * This file is part of the MediaWiki extension MultimediaViewer. |
| 3 | * |
| 4 | * MultimediaViewer is free software: you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation, either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * MultimediaViewer is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with MultimediaViewer. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
| 18 | /** |
| 19 | * Represents information about an image thumbnail |
| 20 | */ |
| 21 | class Thumbnail { |
| 22 | /** |
| 23 | * @param {string} url URL to the thumbnail |
| 24 | * @param {number} width Width in pixels |
| 25 | * @param {number} height Height in pixels |
| 26 | */ |
| 27 | constructor( url, width, height ) { |
| 28 | if ( !url || !width || !height ) { |
| 29 | throw new Error( 'All parameters are required and cannot be empty or zero' ); |
| 30 | } |
| 31 | |
| 32 | /** @property {string} url The URL to the thumbnail */ |
| 33 | this.url = url; |
| 34 | |
| 35 | /** @property {number} width The width of the thumbnail in pixels */ |
| 36 | this.width = width; |
| 37 | |
| 38 | /** @property {number} height The height of the thumbnail in pixels */ |
| 39 | this.height = height; |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | module.exports = Thumbnail; |