You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
3.4 KiB

5 years ago
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>浏览器</title>
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">
<link rel="stylesheet" type="text/css" href="../../lib/css/mui.min.css">
<link rel="stylesheet" type="text/css" href="app.css" />
<link rel="stylesheet" type="text/css" href="../../lib/css/basic.css" />
<script src="../../lib/js/rem-layout.js"></script>
<script type="text/javascript" src="../../lib/js/mui.min.js"></script>
<script type="text/javascript" src="../../lib/js/app.js"></script>
</head>
<style>
/*html,
body {
background-color: #FFFFFF;
}
.mui-bar .mui-title {
right: 88px;
left: 88px;
text-align: center;
}*/
</style>
<body>
<header class="mui-bar mui-bar-nav">
<a id="web-back" class="mui-icon app-icon icon-back mui-pull-left mui-action-back mui-icon-left-nav"></a>
<a id="web-home" class="mui-icon app-icon icon-home mui-pull-left mui-icon-left-nav" style="margin-left:1rem;"></a>
<h1 id="web-title" class="mui-title mui-ellipsis"></h1>
<a id="web-more" class="mui-icon app-icon icon-more mui-pull-right mui-icon-right-nav"></a>
<a id="web-refresh" class="mui-icon app-icon icon-refresh mui-pull-right mui-icon-right-nav" style="margin-right:1rem;"></a>
</header>
<script type="text/javascript" charset="utf-8">
mui.init();
//判断是否为iphoneX
var isIphoneX = window.devicePixelRatio && window.devicePixelRatio === 3 && window.screen.width === 375 && testUA('iPhone');
if(isIphoneX) {
var pageTop = "88px";
} else {
var pageTop = "69px";
}
function testUA(str) {
return navigator.userAgent.indexOf(str) > -1
}
var subpage_style = {
top: pageTop,
bottom: '0px'
};
//创建子页面,首个选项卡页面显示,其它均隐藏;
mui.plusReady(function() {
var self = plus.webview.currentWebview();
var webUrl = self.webUrl;
var webTitle = self.title;
if(webTitle) {
document.getElementById("web-title").innerText = webTitle;
}
var data = {
'eth': app.getLocalStorage(app.walletKey + "ETH")
};
var webPage = plus.webview.create(webUrl, webUrl, subpage_style, data);
webPage.setJsFile("../../lib/js/app.js");
self.append(webPage);
webPage.addEventListener("error", function() {
plus.nativeUI.closeWaiting();
}, false);
document.getElementById("web-back").addEventListener("tap", function() {
webPageBack(webPage, self);
});
document.getElementById("web-home").addEventListener("tap", function() {
self.close();
});
document.getElementById("web-more").addEventListener("tap", function() {
shareSystem(webPage);
});
document.getElementById("web-refresh").addEventListener("tap", function() {
webPage.reload(true);
});
// mui.back = function(event) {
// webPageBack(webPage, self)
// };
});
function webPageBack(webPage, self) {
//后退
webPage.canBack(function(event) {
var canBack = event.canBack;
if(canBack) {
webPage.back();
} else {
self.close();
}
});
}
/**
* 调用系统分享
*/
function shareSystem(webPage) {
var url = webPage.getURL();
var msg = {
content: url,
href: url
}
plus.share.sendWithSystem(msg, function() {}, function(e) {});
}
</script>
</body>
</html>