From d54c1a867e790e455d96cae6f32787eac74c17d0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 28 Jan 2010 19:18:00 -0700 Subject: [PATCH] E-book viewer: Workaround to display images that have been embedded in svg containers. Fixes #4716 (Unable to view ePUB cover images in calibre viewer) --- resources/viewer/images.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/resources/viewer/images.js b/resources/viewer/images.js index ea68009254..46cb968d4c 100644 --- a/resources/viewer/images.js +++ b/resources/viewer/images.js @@ -20,4 +20,20 @@ function setup_image_scaling_handlers() { }); } +function extract_svged_images() { + $("svg").each(function() { + var children = $(this).children("img"); + if (children.length == 1) { + var img = $(children[0]); + var href = img.attr('xlink:href'); + if (href != undefined) { + $(this).replaceWith('
SVG Image
'); + } + } + }); +} + +$(document).ready(function() { + extract_svged_images(); +});