Skip to content

Commit

Permalink
Improvement of MediaWiki plug-in
Browse files Browse the repository at this point in the history
Previous version was not restrictive enough
  • Loading branch information
GrosPoulet committed Sep 17, 2021
1 parent b920a41 commit b0e310f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/mediawiki_a.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
name:'MediaWiki_a',
version:'0.7',
version:'0.8',
prepareImgLinks:function (callback) {

var res = [];

// thumbnail: https://runescape.wiki/images/thumb/2/26/Senntisten_Kree%27arra_vs_Nodon.png/534px-Senntisten_Kree%27arra_vs_Nodon.png?de6e2
// fullsize: https://runescape.wiki/images/2/26/Senntisten_Kree%27arra_vs_Nodon.png
$('img[src*="thumb/"], image').each(function() {
$('img[src*="/images/thumb/"], image').each(function() {
let _this = $(this);
let src = '';
let srcs = [];
Expand All @@ -30,6 +30,8 @@ hoverZoomPlugins.push({
ext = src.substr(src.lastIndexOf('.'));
}

if (src.indexOf(ext + '/') == -1) return;

srcs.push(src.substring(0, src.indexOf(ext) + ext.length).replace('thumb/', ''));
_this.data().hoverZoomSrc = srcs;
res.push(_this);
Expand Down

0 comments on commit b0e310f

Please sign in to comment.