mirror of
https://github.com/Universal-Omega/PortableInfobox.git
synced 2024-11-16 04:22:37 +00:00
21 lines
471 B
JavaScript
21 lines
471 B
JavaScript
|
(function () {
|
||
|
'use strict';
|
||
|
|
||
|
var ImageLink = {
|
||
|
init: function ($content) {
|
||
|
var $anchors = $content.find('.portable-infobox .pi-image > a.image');
|
||
|
|
||
|
$anchors.each(function () {
|
||
|
var $anchor = $(this),
|
||
|
fileName = $anchor.children('.pi-image-thumbnail').data('image-key');
|
||
|
|
||
|
$anchor.attr('href', '/wiki/File:' + encodeURIComponent(fileName));
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
|
||
|
mw.hook('wikipage.content').add(function ($content) {
|
||
|
ImageLink.init($content);
|
||
|
});
|
||
|
})();
|