MediaWiki:Gadget-ImageAnnotator.js: Difference between revisions
Content deleted Content added
V2.3a |
m TIFF support, and fix checking for thumb img URLs: last component (thumb filename) may differ depending on image scaler used; hence look at real page name (thumb directory) |
||
Line 2:
/*
THIS IS ImageAnnotator VERSION 2.
Image annotations. Draw rectangles onto image thumbnail displayed on image description
Line 1,744:
if (scope == document) {
img = LAPI.WP.getPreviewImage (wgTitle);
// TIFFs may be multi-paged: allow only for single-page TIFFs
if ( document.pageselector ) img = null;
} else if (is_other) {
img = scope;
Line 1,768 ⟶ 1,770:
name = name.replace (/ /g, '_');
if (is_thumb || is_other) {
var img_src = decodeURIComponent (img.getAttribute ('src', 2)).replace (/ /g, '_');
// img_src
var colon = name.indexOf (':');
if (colon <= 0) return null;
var img_name = name.substring (colon + 1);
if (img_src.search(new RegExp('/' + img_name.escapeRE()
return null;
// If the link is not going to file namespace, we won't find the full size later on and
Line 1,786 ⟶ 1,781:
}
}
if (name.search (/\.(jpe?g|png|gif|svg|tiff?)$/i) < 0) return null; // Only PNG, JPE?G, GIF, SVG, and TIFF?
// Finally check for wpImageAnnotatorControl
var icon_only = false;
|