@@ -21,7 +21,7 @@ class ReaderWebView: WKWebView {
2121 ///
2222 /// Documentation: https://developers.google.com/youtube/terms/required-minimum-functionality#set-the-referer
2323 /// See also: https://stackoverflow.com/q/79802987/496295
24- private let baseURL = URL ( string: " https://wordpress.com/reader " ) !
24+ static let baseURL = URL ( string: " https://wordpress.com/reader " ) !
2525
2626 let jsToRemoveSrcSet = " document.querySelectorAll('img, img-placeholder').forEach((el) => {el.removeAttribute('srcset')}) "
2727
@@ -53,7 +53,7 @@ class ReaderWebView: WKWebView {
5353
5454 let content = formattedContent ( addPlaceholder ( string) , additionalJavaScript: additionalJavaScript)
5555
56- super. loadHTMLString ( content, baseURL: baseURL)
56+ super. loadHTMLString ( content, baseURL: Self . baseURL)
5757 }
5858
5959 /// Given a HTML content, returns it formatted.
@@ -79,31 +79,6 @@ class ReaderWebView: WKWebView {
7979 \( additionalJavaScript)
8080 // Remove autoplay to avoid media autoplaying
8181 document.querySelectorAll('video-placeholder, audio-placeholder').forEach((el) => {el.removeAttribute('autoplay')})
82-
83- // Replaces the bundle URL with the post URL for each " blank " anchor tag (<a href= " #anchor " ></a>).
84- // this fixes an issue where tapping on one would return a file url with the anchor attached to it
85- let baseURL = " \( Bundle . wordPressSharedBundle. bundleURL) "
86- let postURL = " \( postURL? . absoluteString ?? " " ) "
87-
88- if(postURL.length > 0){
89- let anchors = document.querySelectorAll('a')
90-
91- anchors.forEach(function(elem){
92- // Ignore any regular links that don't have hashes
93- if(!elem.hash || elem.hash.length < 0) {
94- return
95- }
96-
97- let href = elem.href;
98-
99- // Skip any links that aren't the base URL
100- if(href.substr(0, baseURL.length) != baseURL){
101- return
102- }
103-
104- elem.href = postURL + elem.hash;
105- });
106- }
10782 })
10883 function debounce(fn, timeout) {
10984 let timer;
0 commit comments