forked from james/TFL-Live-Bus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move ios stuff to a js include and use on stop page too. Add ios home…
… screen web app link fix
- Loading branch information
Showing
3 changed files
with
33 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Hide address bar on iOS | ||
window.addEventListener("load",function() { | ||
setTimeout(function () { | ||
window.scrollTo(0, 1); | ||
}, 0); | ||
}); | ||
|
||
// Mobile Safari in standalone mode | ||
if(("standalone" in window.navigator) && window.navigator.standalone){ | ||
|
||
// If you want to prevent remote links in standalone web apps opening Mobile Safari, change 'remotes' to true | ||
var noddy, remotes = false; | ||
|
||
document.addEventListener('click', function(event) { | ||
|
||
noddy = event.target; | ||
|
||
// Bubble up until we hit link or top HTML element. Warning: BODY element is not compulsory so better to stop on HTML | ||
while(noddy.nodeName !== "A" && noddy.nodeName !== "HTML") { | ||
noddy = noddy.parentNode; | ||
} | ||
|
||
if('href' in noddy && noddy.href.indexOf('http') !== -1 && (noddy.href.indexOf(document.location.host) !== -1 || remotes)) | ||
{ | ||
event.preventDefault(); | ||
document.location.href = noddy.href; | ||
} | ||
|
||
},false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters