Fix javascript errors

This commit is contained in:
Jeena 2016-07-21 08:13:01 +02:00
parent 020fc6efe6
commit 99308a98c9
2 changed files with 5 additions and 4 deletions

View file

@ -37,7 +37,7 @@ function setArticle(article) {
$("article").innerHTML = article.content; $("article").innerHTML = article.content;
var as = $("article").getElementsByTagName("a"); var as = $("article").getElementsByTagName("a");
for(var i = 0; i <= as.length; i++) { for(var i = 0; i < as.length; i++) {
as[i].target = ""; as[i].target = "";
} }
} }

View file

@ -59,10 +59,11 @@ Item {
function setDefaults() { function setDefaults() {
// font name needs to be enclosed in single quotes // font name needs to be enclosed in single quotes
// and this is needed for El Capitain because ".SF NS Text" won't work // and this is needed for El Capitain because ".SF NS Text" won't work
var defFont = ', system, -apple-system, ".SFNSDisplay-Regular", "Helvetica Neue", "Lucida Grande"'; var defFont = ", system, -apple-system, '.SFNSDisplay-Regular', 'Helvetica Neue', 'Lucida Grande'";
webView.runJavaScript("document.body.style.fontFamily = \"'" + fontLabel.font.family + "'" + defFont + "\";"); var font = "'" + fontLabel.font.family + "'" + defFont;
webView.runJavaScript("document.body.style.fontFamily = \"" + font + "\";");
webView.runJavaScript("document.body.style.fontSize = '" + content.textFontSize + "pt';"); webView.runJavaScript("document.body.style.fontSize = '" + content.textFontSize + "pt';");
webView.runJavaScript("setNightmode(" + (content.nightmode ? "true" : "false") + ")") webView.runJavaScript("if(typeof setNightmode == \"function\") setNightmode(" + (content.nightmode ? "true" : "false") + ")")
} }