Fixed a few errors in the browser special meta tags objects

This commit is contained in:
obscuren 2015-02-14 17:13:21 +01:00
parent 32c7ebc51d
commit befb4bc1c1
1 changed files with 28 additions and 30 deletions

View File

@ -334,16 +334,16 @@ Rectangle {
} }
z: 10 z: 10
Timer { Timer {
interval: 500; running: true; repeat: true interval: 500; running: true; repeat: true
onTriggered: { onTriggered: {
webview.runJavaScript("document.querySelector('meta[name=badge]').getAttribute('content')", function(badge) { webview.runJavaScript("try{document.querySelector('meta[name=badge]').getAttribute('content')}catch(e){}", function(badge) {
if (badge) { if (badge) {
menuItem.secondaryTitle = badge; menuItem.secondaryTitle = badge;
} }
}); });
} }
} }
onLoadingChanged: { onLoadingChanged: {
if (loadRequest.status == WebEngineView.LoadSucceededStatus) { if (loadRequest.status == WebEngineView.LoadSucceededStatus) {
@ -351,31 +351,27 @@ Rectangle {
menuItem.title = pageTitle; menuItem.title = pageTitle;
}); });
webView.runJavaScript("try{document.querySelector(\"meta[name='ethereum-dapp-url-bar-style']\").getAttribute(\"content\")}catch(e){}", function(topBarStyle){
if (!topBarStyle) return;
//var topBarStyle
webView.runJavaScript("document.querySelector(\"meta[name='ethereum-dapp-url-bar-style']\").getAttribute(\"content\")", function(topBarStyle){
if (topBarStyle=="transparent") { if (topBarStyle=="transparent") {
// Adjust for a transparent sidebar Dapp // Adjust for a transparent sidebar Dapp
navBarBackground.visible = false; navBarBackground.visible = false;
back.visible = false; back.visible = false;
appInfoPane.anchors.leftMargin = -16; appInfoPane.anchors.leftMargin = -16;
appInfoPaneShadow.anchors.leftMargin = -16; appInfoPaneShadow.anchors.leftMargin = -16;
webview.anchors.topMargin = -74; webview.anchors.topMargin = -74;
webview.runJavaScript("document.querySelector('body').classList.add('ethereum-dapp-url-bar-style-transparent')") webview.runJavaScript("document.querySelector('body').classList.add('ethereum-dapp-url-bar-style-transparent')")
} else { } else {
navBarBackground.visible = true; navBarBackground.visible = true;
back.visible = true; back.visible = true;
appInfoPane.anchors.leftMargin = 0; appInfoPane.anchors.leftMargin = 0;
appInfoPaneShadow.anchors.leftMargin = 0; appInfoPaneShadow.anchors.leftMargin = 0;
webview.anchors.topMargin = 0; webview.anchors.topMargin = 0;
};
};
}); });
webview.runJavaScript(eth.readFile("bignumber.min.js")); webview.runJavaScript(eth.readFile("bignumber.min.js"));
webview.runJavaScript(eth.readFile("ethereum.js/dist/ethereum.js")); webview.runJavaScript(eth.readFile("ethereum.js/dist/ethereum.js"));
@ -383,10 +379,12 @@ Rectangle {
var matches = cleanTitle.match(/^[a-z]*\:\/\/([^\/?#]+)(?:[\/?#]|$)/i); var matches = cleanTitle.match(/^[a-z]*\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);
var domain = matches && matches[1]; var domain = matches && matches[1];
appDomain.text = domain //webview.url.replace("a", "z") if (domain)
appTitle.text = webview.title appDomain.text = domain //webview.url.replace("a", "z")
if (webview.title)
appTitle.text = webview.title
showFullUrlBar(false); showFullUrlBar(false);
} }
} }
onJavaScriptConsoleMessage: { onJavaScriptConsoleMessage: {