diff --git a/sailfish/qml/FeedWebContentPage.qml b/sailfish/qml/FeedWebContentPage.qml index ab243e8..33de120 100644 --- a/sailfish/qml/FeedWebContentPage.qml +++ b/sailfish/qml/FeedWebContentPage.qml @@ -43,7 +43,7 @@ Page { property variant _settings: settings property bool themeApply: true readonly property color bgColor: Theme.colorScheme ? Qt.lighter(Theme.highlightBackgroundColor, 1.9) : - Qt.darker(Theme.highlightBackgroundColor, 3.0) + Qt.darker(Theme.highlightBackgroundColor, 4.0) property bool navigateBackPop: true @@ -202,9 +202,7 @@ Page { var theme = { "primaryColor": Theme.rgba(Theme.primaryColor, 1.0).toString(), "secondaryColor": Theme.rgba(Theme.secondaryColor, 1.0).toString(), "highlightColor": Theme.rgba(Theme.highlightColor, 1.0).toString(), - "highlightColorDark": (Theme.colorScheme ? Qt.lighter(Theme.highlightColor).toString() : Qt.darker(Theme.highlightColor).toString()), - "secondaryHighlightColor": Theme.rgba(Theme.secondaryHighlightColor, 1.0).toString(), - "highlightDimmerColor": root.bgColor.toString(), + "bgColor": root.bgColor.toString(), "fontFamily": Theme.fontFamily, "fontFamilyHeading": Theme.fontFamilyHeading, "pageMargin": Theme.horizontalPageMargin/Theme.pixelRatio, diff --git a/sailfish/qml/WebPreviewPage.qml b/sailfish/qml/WebPreviewPage.qml index f359477..28b3307 100644 --- a/sailfish/qml/WebPreviewPage.qml +++ b/sailfish/qml/WebPreviewPage.qml @@ -51,7 +51,7 @@ Page { property bool autoReaderMode: settings.readerMode property bool autoRead: true readonly property color bgColor: Theme.colorScheme ? Qt.lighter(Theme.highlightBackgroundColor, 1.9) : - Qt.darker(Theme.highlightBackgroundColor, 3.0) + Qt.darker(Theme.highlightBackgroundColor, 4.0) function share() { pageStack.push(Qt.resolvedUrl("ShareLinkPage.qml"),{"link": root.onlineUrl, "linkTitle": root.title}); @@ -112,9 +112,7 @@ Page { var theme = { "primaryColor": Theme.rgba(Theme.primaryColor, 1.0).toString(), "secondaryColor": Theme.rgba(Theme.secondaryColor, 1.0).toString(), "highlightColor": Theme.rgba(Theme.highlightColor, 1.0).toString(), - "highlightColorDark": (Theme.colorScheme ? Qt.lighter(Theme.highlightColor).toString() : Qt.darker(Theme.highlightColor).toString()), - "secondaryHighlightColor": Theme.rgba(Theme.secondaryHighlightColor, 1.0).toString(), - "highlightDimmerColor": root.bgColor.toString(), + "bgColor": root.bgColor.toString(), "fontFamily": Theme.fontFamily, "fontFamilyHeading": Theme.fontFamilyHeading, "pageMargin": Theme.horizontalPageMargin/Theme.pixelRatio, diff --git a/sailfish/qml/js/Readability.js b/sailfish/qml/js/Readability.js index 133f44e..e48dbbf 100644 --- a/sailfish/qml/js/Readability.js +++ b/sailfish/qml/js/Readability.js @@ -309,15 +309,17 @@ Readability.prototype = { */ _fixRelativeUris: function(articleContent) { var baseURI = this._doc.baseURI; - var documentURI = this._doc.documentURI; + var doc = this._doc; function toAbsoluteURI(uri) { // Leave hash links alone if the base URI matches the document URI: - if (baseURI == documentURI && uri.charAt(0) == "#") { + if (uri.charAt(0) == "#") { return uri; } // Otherwise, resolve against base URI: try { - return new URL(uri, baseURI).href; + var a = doc.createElement('a'); + a.href = uri; + return a.href; } catch (ex) { // Something went wrong, just return the original: } diff --git a/sailfish/qml/js/ReaderMode.js b/sailfish/qml/js/ReaderMode.js index 6e21897..19d1049 100644 --- a/sailfish/qml/js/ReaderMode.js +++ b/sailfish/qml/js/ReaderMode.js @@ -65,21 +65,21 @@ window.KaktusReaderModeObject.prototype.applyFiltering = function(doc, insert) { }; window.KaktusReaderModeObject.prototype.check = function(data) { - var loc = document.location; - var uri = { "spec": loc.href, - "host": loc.host, - "prePath": loc.protocol + "//" + loc.host, - "scheme": loc.protocol.substr(0, loc.protocol.indexOf(":")), - "pathBase": loc.protocol + "//" + loc.host + loc.pathname.substr(0, loc.pathname.lastIndexOf("/") + 1) }; - var newDoc1 = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html', null); var newBody1 = document.createElementNS('http://www.w3.org/1999/xhtml', 'body'); + var newHead1 = document.createElementNS('http://www.w3.org/1999/xhtml', 'head'); + var newBase1 = document.createElementNS('http://www.w3.org/1999/xhtml', 'base'); + newBase1.setAttribute('href', document.baseURI); + newHead1.appendChild(newBase1); + newDoc1.documentElement.appendChild(newHead1); newBody1.innerHTML = document.body.innerHTML; newDoc1.documentElement.appendChild(newBody1); + //console.log("document.baseURI: " + document.baseURI); + //console.log("document.documentURI: " + document.documentURI); var article = null; try { - article = new window.Readability(uri, newDoc1).parse(); + article = new Readability(newDoc1).parse(); } catch (err) { console.error("Exception in KaktusReaderMode.check: " + err); } @@ -94,12 +94,11 @@ window.KaktusReaderModeObject.prototype.check = function(data) { var newDoc2 = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html', null); var newBody2 = document.createElementNS('http://www.w3.org/1999/xhtml', 'body'); newBody2.innerHTML = insert + article.content; - newDoc2.documentElement.appendChild(newBody2); + newDoc2.documentElement.appendChild(newBody2); this.applyFiltering(newDoc2, insert); this.readabilityDoc = newDoc2.documentElement.innerHTML; this.orginalDoc = document.documentElement.innerHTML; - - //console.log("Readability: " + this.readabilityDoc); + //console.log("Readability doc: " + this.readabilityDoc); } kaktusPostMessage("readability_result", { possible: this.readabilityPossible, enabled: this.enabled }); diff --git a/sailfish/qml/js/Theme.js b/sailfish/qml/js/Theme.js index ea8ab01..b9c2080 100644 --- a/sailfish/qml/js/Theme.js +++ b/sailfish/qml/js/Theme.js @@ -61,26 +61,11 @@ window.KaktusThemeObject.prototype.apply = function() { var fontSize = Math.floor(this.fontSize / scale); var fontSizeTitle = Math.floor(this.fontSizeTitle / scale); - /*if (this.theme === "dark") { - css = "* { font-family: \"" + this.fontFamily + "\";\n" + - "background-color: " + this.highlightDimmerColor + " !important;\n" + - "color: " + this.primaryColor + " !important;\n }\n\n"; - css += "select { color: " + this.highlightDimmerColor + " !important; }\n"; - css += "a { color: " + this.highlightColor + " !important; }\n"; - } else if (this.theme === "light") { - css = "* { font-family: \"" + this.fontFamily + "\";\n" + - "background-color: " + this.secondaryColor + " !important;\n" + - "color: " + this.highlightDimmerColor + " !important;\n }\n\n"; - css += "select { color: " + this.highlightColorDark + " !important; }\n"; - css += "a { color: " + this.highlightColorDark + " !important; }\n"; - }*/ - var css = "* { font-family: \"" + this.fontFamily + "\";\n" + - "background-color: " + this.highlightDimmerColor + " !important;\n" + + "background-color: " + this.bgColor + " !important;\n" + "color: " + this.primaryColor + " !important;\n }\n\n"; - css += "select { color: " + this.highlightDimmerColor + " !important; }\n"; + css += "select { color: " + this.bgColor + " !important; }\n"; css += "a { color: " + this.highlightColor + " !important; }\n"; - //css += "body { max-width: " + maxWidth + "px; \n" + css += "body { " + "margin: 0; \n" +