2014-01-10 21:11:21 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the MediaWiki extension MultimediaViewer.
|
|
|
|
*
|
|
|
|
* MultimediaViewer is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MultimediaViewer is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with MultimediaViewer. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2014-03-04 11:53:53 +00:00
|
|
|
// Included on every page which has images so keep it lightweight.
|
2018-11-12 16:33:24 +00:00
|
|
|
( function () {
|
2019-05-16 13:19:44 +00:00
|
|
|
mw.mmv = {
|
|
|
|
/**
|
|
|
|
* The media route prefix
|
2020-06-26 10:21:04 +00:00
|
|
|
*
|
2019-05-16 13:19:44 +00:00
|
|
|
* @member mw.mmv
|
|
|
|
*/
|
|
|
|
ROUTE: 'media',
|
|
|
|
/**
|
|
|
|
* RegExp representing the media route
|
2020-06-26 10:21:04 +00:00
|
|
|
*
|
2019-05-16 13:19:44 +00:00
|
|
|
* @member mw.mmv
|
|
|
|
*/
|
|
|
|
ROUTE_REGEXP: /^\/media\/(.+)$/,
|
|
|
|
/**
|
2020-06-26 10:45:20 +00:00
|
|
|
* @property {RegExp}
|
|
|
|
* Regular expression representing the legacy media route
|
2019-05-16 13:19:44 +00:00
|
|
|
* @member mw.mmv
|
|
|
|
*/
|
|
|
|
LEGACY_ROUTE_REGEXP: /^mediaviewer\/(.+)$/,
|
|
|
|
/**
|
|
|
|
* Returns the location hash (route string) for the given file title.
|
2020-06-26 10:21:04 +00:00
|
|
|
*
|
2019-05-16 13:19:44 +00:00
|
|
|
* @param {string} imageFileTitle the file title
|
|
|
|
* @return {string} the location hash
|
|
|
|
* @member mw.mmv
|
|
|
|
*/
|
|
|
|
getMediaHash: function ( imageFileTitle ) {
|
|
|
|
return '#/' + mw.mmv.ROUTE + '/' + imageFileTitle;
|
|
|
|
}
|
|
|
|
};
|
2018-11-12 16:33:24 +00:00
|
|
|
}() );
|