mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:58:51 +02:00
fixed the twitter link
This commit is contained in:
parent
2bf7b12c7d
commit
f60deb0cfc
2 changed files with 21 additions and 4 deletions
|
@ -28,6 +28,7 @@ Item {
|
||||||
property alias webView: webview
|
property alias webView: webview
|
||||||
property alias profile: webview.profile
|
property alias profile: webview.profile
|
||||||
property bool remove: false
|
property bool remove: false
|
||||||
|
property bool newPage: false
|
||||||
|
|
||||||
|
|
||||||
property int currentPage: -1 // used as a model for repeater
|
property int currentPage: -1 // used as a model for repeater
|
||||||
|
@ -144,9 +145,22 @@ Item {
|
||||||
view.setEnabled(true);
|
view.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isNewPageOpen() {
|
||||||
|
return (web.newPage && web.currentPage > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function shouldLoadUrl(url) {
|
||||||
|
switch (url) {
|
||||||
|
case "https://twitter.com/intent/sessions":
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
function urlAppend(url) {
|
function urlAppend(url) {
|
||||||
if (removingPage) {
|
console.log(url);
|
||||||
|
if (removingPage || shouldLoadUrl(url) || isNewPageOpen()) {
|
||||||
removingPage = false;
|
removingPage = false;
|
||||||
|
web.newPage = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var lurl = decodeURIComponent(url)
|
var lurl = decodeURIComponent(url)
|
||||||
|
@ -156,7 +170,7 @@ Item {
|
||||||
if (currentPage === -1 || (pagesModel.get(currentPage).webUrl !== lurl && !timer.running)) {
|
if (currentPage === -1 || (pagesModel.get(currentPage).webUrl !== lurl && !timer.running)) {
|
||||||
timer.start();
|
timer.start();
|
||||||
pagesModel.append({webUrl: lurl});
|
pagesModel.append({webUrl: lurl});
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
onCurrentPageChanged: {
|
onCurrentPageChanged: {
|
||||||
|
@ -228,6 +242,7 @@ Item {
|
||||||
worldId: WebEngineScript.MainWorld
|
worldId: WebEngineScript.MainWorld
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property string urlTag: "noDownload=false";
|
||||||
userScripts: [ createGlobalEventBridge, raiseAndLowerKeyboard, userScript ]
|
userScripts: [ createGlobalEventBridge, raiseAndLowerKeyboard, userScript ]
|
||||||
|
|
||||||
property string newUrl: ""
|
property string newUrl: ""
|
||||||
|
@ -254,9 +269,9 @@ Item {
|
||||||
keyboard.resetShiftMode(false);
|
keyboard.resetShiftMode(false);
|
||||||
// Required to support clicking on "hifi://" links
|
// Required to support clicking on "hifi://" links
|
||||||
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
|
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
|
||||||
urlAppend(loadRequest.url.toString());
|
var url = loadRequest.url.toString();
|
||||||
|
urlAppend(url);
|
||||||
loadingPage = true;
|
loadingPage = true;
|
||||||
var url = loadRequest.url.toString();
|
|
||||||
if (urlHandler.canHandleUrl(url)) {
|
if (urlHandler.canHandleUrl(url)) {
|
||||||
if (urlHandler.handleUrl(url)) {
|
if (urlHandler.handleUrl(url)) {
|
||||||
root.stop();
|
root.stop();
|
||||||
|
@ -270,6 +285,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
onNewViewRequested: {
|
onNewViewRequested: {
|
||||||
|
web.newPage = true;
|
||||||
request.openIn(webview);
|
request.openIn(webview);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,7 @@ Item {
|
||||||
// Required to support clicking on "hifi://" links
|
// Required to support clicking on "hifi://" links
|
||||||
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
|
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
|
||||||
var url = loadRequest.url.toString();
|
var url = loadRequest.url.toString();
|
||||||
|
console.log(url);
|
||||||
url = (url.indexOf("?") >= 0) ? url + urlTag : url + "?" + urlTag;
|
url = (url.indexOf("?") >= 0) ? url + urlTag : url + "?" + urlTag;
|
||||||
if (urlHandler.canHandleUrl(url)) {
|
if (urlHandler.canHandleUrl(url)) {
|
||||||
if (urlHandler.handleUrl(url)) {
|
if (urlHandler.handleUrl(url)) {
|
||||||
|
|
Loading…
Reference in a new issue