PortableInfobox/js/PortableInfoboxMonobook.js

20 lines
510 B
JavaScript
Raw Normal View History

2016-11-03 15:56:35 +00:00
(function (window) {
'use strict';
var ImageLink = {
init: function ($content) {
2016-11-03 15:11:23 +00:00
$content.find('.portable-infobox .pi-image > a.image').on('click', function () {
var $anchor = $(this),
2016-11-03 15:56:35 +00:00
fileName = $anchor.children('.pi-image-thumbnail').data('image-key'),
href = window.wgArticlePath.replace(/\$1/, 'File:' + encodeURIComponent(fileName));
2016-11-03 15:56:35 +00:00
$anchor.attr('href', href);
});
}
};
mw.hook('wikipage.content').add(function ($content) {
ImageLink.init($content);
});
2016-11-03 15:56:35 +00:00
})(window);