|
@@ -68,10 +68,15 @@
|
|
padding: 0.4em;
|
|
padding: 0.4em;
|
|
display: none;
|
|
display: none;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ #toolbar.proxy{
|
|
|
|
+ border-bottom: 2px solid #41e8e5;
|
|
|
|
+ }
|
|
|
|
+
|
|
</style>
|
|
</style>
|
|
</head>
|
|
</head>
|
|
<body>
|
|
<body>
|
|
- <div class="ui top small attached menu" style="background-color: #eceef2; padding-left: 12px; padding-right: 12px;">
|
|
|
|
|
|
+ <div id="toolbar" class="ui top small attached menu" style="background-color: #eceef2; padding-left: 12px; padding-right: 12px;">
|
|
<div class="ui menuitem">
|
|
<div class="ui menuitem">
|
|
<button class="ui circular tiny icon button" onclick="undoPage();">
|
|
<button class="ui circular tiny icon button" onclick="undoPage();">
|
|
<i class="arrow left icon"></i>
|
|
<i class="arrow left icon"></i>
|
|
@@ -105,8 +110,8 @@
|
|
</button>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<div class="ui rightMenuItem">
|
|
<div class="ui rightMenuItem">
|
|
- <button class="ui tiny icon button">
|
|
|
|
- <i class="grey download icon"></i>
|
|
|
|
|
|
+ <button class="ui tiny icon button" title="Open in new Window" onclick="openInNewWindow();">
|
|
|
|
+ <i class="grey external icon"></i>
|
|
</button>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -185,6 +190,15 @@
|
|
loadWebsite(restorePage, false);
|
|
loadWebsite(restorePage, false);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ function openInNewWindow(){
|
|
|
|
+ window.open(currentURL);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function getTitleFromURL(url){
|
|
|
|
+ var title = targetURL.substr(targetURL.indexOf("/") + 2, targetURL.length);
|
|
|
|
+ return title;
|
|
|
|
+ }
|
|
|
|
+
|
|
function loadWebsite(targetURL, writeRestoreRecord = true){
|
|
function loadWebsite(targetURL, writeRestoreRecord = true){
|
|
if (writeRestoreRecord && currentURL != targetURL){
|
|
if (writeRestoreRecord && currentURL != targetURL){
|
|
historyPopStack = [];
|
|
historyPopStack = [];
|
|
@@ -192,8 +206,10 @@
|
|
|
|
|
|
//Handle special case
|
|
//Handle special case
|
|
if (targetURL == "about:blank"){
|
|
if (targetURL == "about:blank"){
|
|
|
|
+ $("#xframe").removeAttr("srcdoc");
|
|
$("#xframe").attr("src", "blank.html");
|
|
$("#xframe").attr("src", "blank.html");
|
|
$("#urlText").val(targetURL);
|
|
$("#urlText").val(targetURL);
|
|
|
|
+ $("#toolbar").removeClass("proxy");
|
|
if (writeRestoreRecord && currentURL != targetURL){
|
|
if (writeRestoreRecord && currentURL != targetURL){
|
|
historyStack.push(JSON.parse(JSON.stringify(currentURL)));
|
|
historyStack.push(JSON.parse(JSON.stringify(currentURL)));
|
|
}
|
|
}
|
|
@@ -234,11 +250,35 @@
|
|
if (allowIframe == true){
|
|
if (allowIframe == true){
|
|
$("#xframe").removeAttr("srcdoc");
|
|
$("#xframe").removeAttr("srcdoc");
|
|
$("#xframe").attr("src", targetURL);
|
|
$("#xframe").attr("src", targetURL);
|
|
|
|
+ $("#toolbar").removeClass("proxy");
|
|
|
|
+ $("#xframe").on("load", function(){
|
|
|
|
+ //Get the page title
|
|
|
|
+ ao_module_agirun("Browser/functions/getTitle.js", {url: targetURL}, function(data){
|
|
|
|
+ if (data == ""){
|
|
|
|
+ let title = getTitleFromURL(targetURL);
|
|
|
|
+ ao_module_setWindowTitle(title);
|
|
|
|
+ }else{
|
|
|
|
+ ao_module_setWindowTitle(data);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ $("#xframe").off("load");
|
|
|
|
+ });
|
|
}else{
|
|
}else{
|
|
proxyWebContent(targetURL, function(content){
|
|
proxyWebContent(targetURL, function(content){
|
|
$("#xframe").attr("src", "");
|
|
$("#xframe").attr("src", "");
|
|
$("#xframe").attr("srcdoc", content);
|
|
$("#xframe").attr("srcdoc", content);
|
|
-
|
|
|
|
|
|
+ $("#toolbar").addClass("proxy");
|
|
|
|
+
|
|
|
|
+ //Extract the title
|
|
|
|
+ var matches = content.match(/<title>(.*?)<\/title>/);
|
|
|
|
+ if (matches == null){
|
|
|
|
+ let title = getTitleFromURL(targetURL);
|
|
|
|
+ ao_module_setWindowTitle(title);
|
|
|
|
+ }else{
|
|
|
|
+ var title = matches[0].replace(/(<([^>]+)>)/gi, "");
|
|
|
|
+ ao_module_setWindowTitle(title);
|
|
|
|
+ }
|
|
|
|
+
|
|
});
|
|
});
|
|
//alert("Target website do not allow embedding");
|
|
//alert("Target website do not allow embedding");
|
|
}
|
|
}
|