Switch to from copying source of is_webos, to using a global variable

pull/4/head
Ruthenic 2021-06-14 06:43:33 -04:00
rodzic c7a86e0b6b
commit 73b2f460d4
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 9B83455BD94F12A3
1 zmienionych plików z 6 dodań i 4 usunięć

Wyświetl plik

@ -60,11 +60,16 @@
};
</script>
<script>
var is_webos = navigator.userAgent.toLowerCase().indexOf("webos") !== -1 ||
navigator.userAgent.toLowerCase().indexOf("netcast") !== -1 ||
navigator.userAgent.toLowerCase().indexOf("smarttv") !== -1;
console.log("is_webos: " + is_webos)
// Exploit data: url navigation for browsers which didn't have following patch
// applied yet (webOS 3.x):
// https://chromium.googlesource.com/chromium/src.git/+/130ee686fa00b617bfc001ceb3bb49782da2cb4e
try {
if (window.location.protocol !== 'data:' && (navigator.userAgent.toLowerCase().indexOf("webos") !== -1 || navigator.userAgent.toLowerCase().indexOf("netcast") !== -1 || navigator.userAgent.toLowerCase().indexOf("smarttv") !== -1)) {
if (window.location.protocol !== 'data:' && is_webos) {
window.location = 'data:text/html;base64,' + btoa(document.documentElement.innerHTML
.replace('="css/common.css"', '="' + new URL('css/common.css', window.location.href).href + '"')
.replace('__START_ORIGIN__', window.location.href));
@ -212,9 +217,6 @@
document.querySelector("#main-article").innerHTML = "<pre id='log'></pre>";
var is_local = window.location.protocol === 'file:';
var is_webos = navigator.userAgent.toLowerCase().indexOf("webos") !== -1 ||
navigator.userAgent.toLowerCase().indexOf("netcast") !== -1 ||
navigator.userAgent.toLowerCase().indexOf("smarttv") !== -1;
if (!is_local && !is_webos) {
log("[Warning] You should be visiting this page from a webOS device, not your desktop web browser!");