From c85f98198a09d4da999e671cd697d8fef1c16520 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 20 May 2018 19:13:24 +0300 Subject: use new resource loader for all iframe scripts and stylesheets --- js/read.js | 4 ++-- read.html | 35 +++++++++++++++++++---------------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/js/read.js b/js/read.js index edbc2de..a2ce59d 100644 --- a/js/read.js +++ b/js/read.js @@ -265,14 +265,14 @@ function apply_theme() { localforage.getItem("epube.theme").then(function(theme) { console.log('theme', theme); - var baseUrl = window.location.href.match(/^.*\//)[0]; + var base_url = window.location.href.match(/^.*\//)[0]; if (!theme) theme = 'default'; else theme = theme.replace("/", ""); - var theme_url = baseUrl + "themes/" + theme + ".css"; + var theme_url = base_url + "themes/" + theme + ".css"; $("#theme_css").attr("href", theme_url); diff --git a/read.html b/read.html index 74984dd..eaa9861 100644 --- a/read.html +++ b/read.html @@ -408,20 +408,14 @@ EPUBJS.Hooks.register("beforeChapterDisplay").applyTheme = function(callback, renderer) { localforage.getItem("epube.theme").then(function(theme) { - var baseUrl = window.location.href.match(/^.*\//)[0]; + var base_url = window.location.href.match(/^.*\//)[0]; if (!theme) theme = 'default'; else theme = theme.replace("/", ""); - /*window.parent.$.get(baseUrl + 'themes/' + theme + '.css', function(data) { - $(book.renderer.doc.head) - .append($("