diff --git a/CHANGELOG.md b/CHANGELOG.md index e773905..64eb0cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Fixed crash on videos without speakers (#134) +- Adapted for no-namespace ZIM (#139) ## [2.0.11] - 2022-08-01 diff --git a/ted2zim/templates/article.html b/ted2zim/templates/article.html index 6bf9035..9f058e0 100644 --- a/ted2zim/templates/article.html +++ b/ted2zim/templates/article.html @@ -9,7 +9,6 @@ - diff --git a/ted2zim/templates/assets/app.js b/ted2zim/templates/assets/app.js index 256d55a..a70e101 100644 --- a/ted2zim/templates/assets/app.js +++ b/ted2zim/templates/assets/app.js @@ -130,7 +130,7 @@ function refreshVideos(language, pageData) { a.className = 'nostyle' var img = document.createElement('img'); - img.src = ZIM_IMG_NS+'videos/'+video['id']+'/thumbnail.webp'; + img.src = 'videos/'+video['id']+'/thumbnail.webp'; var author = document.createElement('p'); author.id = 'author'; diff --git a/ted2zim/templates/assets/zim_prefix.js b/ted2zim/templates/assets/zim_prefix.js deleted file mode 100644 index 8f4b99f..0000000 --- a/ted2zim/templates/assets/zim_prefix.js +++ /dev/null @@ -1,54 +0,0 @@ - -/* Generic Zimwriterfs-related properties */ -isInZIM = function() { return document.getElementById("favicon").getAttribute("href").indexOf("/I/") !== -1; } -IS_IN_ZIM = isInZIM(); - -getImageNamespacePrefix = function() { return document.getElementById("favicon").getAttribute("href").replace("favicon.png", ""); } -ZIM_IMG_NS = getImageNamespacePrefix(); - -getMetaNamespacePrefix = function() { return ZIM_IMG_NS.replace("/I/", "/-/"); } -ZIM_META_NS = getMetaNamespacePrefix(); - -hasImageNamespacePrefix = function(target) { return target.indexOf(ZIM_IMG_NS) !== -1;} -hasMetaNamespacePrefix = function(target) { return target.indexOf(ZIM_META_NS) !== -1;} -changeNamespacePrefix = function(target, new_ns) { - var avail_ns = ["A", "-", "I"]; - new_ns = new_ns.toUpperCase(); - if (avail_ns.indexOf(new_ns) == -1) { - throw ("Invalid NS: " + new_ns); - } - var ns_char = -1; - avail_ns.forEach(function (namespace) { - if (ns_char == -1) { - ns_char = target.indexOf("/" + namespace + "/"); - } - }); - if (ns_char == -1) { - // missing prefix - return target; - } - - return target.slice(0, ns_char + 1) + new_ns + target.slice(ns_char + 2); -} - -/* ogv.js related bits */ -zim_fix_wasm_target = function(target) { - console.debug("zim_fix_wasm_target:", target); - if (!IS_IN_ZIM) { - console.debug("..not in zim"); - return target; - } - if (hasImageNamespacePrefix(target)) { - // we already have a good path, leave it - } - else if (hasMetaNamespacePrefix(target)) { - // we have a prefix, just replace it - target = changeNamespacePrefix(target, "I"); - } - else { - // we lack the prefix, add it - target = ZIM_IMG_NS + "assets/ogvjs/" + target; - } - console.debug("..target:", target); - return target; -} diff --git a/ted2zim/templates/home.html b/ted2zim/templates/home.html index 8bc20e0..87e0ab4 100644 --- a/ted2zim/templates/home.html +++ b/ted2zim/templates/home.html @@ -7,7 +7,6 @@