mirror of
https://github.com/Universal-Omega/PortableInfobox.git
synced 2024-12-21 04:22:35 +00:00
20 lines
510 B
JavaScript
20 lines
510 B
JavaScript
(function (window) {
|
|
'use strict';
|
|
|
|
var ImageLink = {
|
|
init: function ($content) {
|
|
$content.find('.portable-infobox .pi-image > a.image').on('click', function () {
|
|
var $anchor = $(this),
|
|
fileName = $anchor.children('.pi-image-thumbnail').data('image-key'),
|
|
href = window.wgArticlePath.replace(/\$1/, 'File:' + encodeURIComponent(fileName));
|
|
|
|
$anchor.attr('href', href);
|
|
});
|
|
}
|
|
};
|
|
|
|
mw.hook('wikipage.content').add(function ($content) {
|
|
ImageLink.init($content);
|
|
});
|
|
})(window);
|