Skip to content

Commit b6b5c89

Browse files
authored
Remove injection of EPUB scripts (#220)
The EPUB scripts will be injected with the WKWebView from the navigator now, see readium/r2-navigator-swift#204. Former-commit-id: 20feed3
1 parent 78d3faa commit b6b5c89

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

streamer/r2-streamer-swift/Parser/EPUB/Resource Transformers/EPUBHTMLInjector.swift

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,11 @@ final class EPUBHTMLInjector {
6161
}
6262
}
6363

64-
if let headStart = content.endIndex(of: "<head>") {
65-
let headInjection: String
66-
if isReflowable {
67-
headInjection = """
68-
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0;"/>
69-
<style type="text/css">@font-face{font-family: "OpenDyslexic"; src:url("/fonts/OpenDyslexic-Regular.otf") format("opentype");}</style>
70-
<script type="text/javascript" src="/r2-navigator/epub/scripts/readium-reflowable.js"></script>
71-
"""
72-
} else {
73-
headInjection = """
74-
<script type="text/javascript" src="/r2-navigator/epub/scripts/readium-fixed.js"></script>
75-
"""
76-
}
77-
content = content.insert(string: headInjection, at: headStart)
64+
if isReflowable, let headStart = content.endIndex(of: "<head>") {
65+
content = content.insert(string: """
66+
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0;"/>
67+
<style type="text/css">@font-face{font-family: "OpenDyslexic"; src:url("/fonts/OpenDyslexic-Regular.otf") format("opentype");}</style>
68+
""", at: headStart)
7869
}
7970

8071
return content

0 commit comments

Comments
 (0)