diff --git a/www/js/app.js b/www/js/app.js index 6180f840..9a9cc1a2 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -2214,15 +2214,22 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module' // Compile some regular expressions needed to modify links // Pattern to find the path in a url var regexpPath = /^(.*\/)[^\/]+$/; - // Pattern to find a ZIM URL (with its namespace) - see http://www.openzim.org/wiki/ZIM_file_format#Namespaces - var regexpZIMUrlWithNamespace = /(?:^|\/)([-ABIJMUVWX]\/.+)/; - // Regex below finds images, scripts, stylesheets and media sources with ZIM-type metadata and image namespaces [kiwix-js #378] - // It first searches for ]*?\s)(?:src|href)(\s*=\s*["'])(?:\.\.\/|\/)+(?=[-IJ]\/)/ig; + var regexpTagsWithZimUrl = /(<(?:img|script|link)\b[^>]*?\s)(?:src|href)(\s*=\s*["'])(?:\.\.\/|\/)+(?=[-IJ]\/)/ig; + // Regex below tests the html of an article for active content [kiwix-js #466] + // It inspects every