Skip to content

Commit

Permalink
add a compatibility tester to the pluto website
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsLap committed Jun 9, 2024
1 parent a43b448 commit d018333
Show file tree
Hide file tree
Showing 4 changed files with 251 additions and 2 deletions.
143 changes: 143 additions & 0 deletions browsertesting.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Pluto</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&amp;display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="style.css" />
<script>
// loading indicator
window.addEventListener("DOMContentLoaded", () => {
const loader = document.createElement("div");
loader.classList.add("loader");
loader.innerHTML = `<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_1114_2788)"><path d="M44.3563 24C46.3687 24 48.0283 22.3595 47.7239 20.3703C47.4328 18.4675 46.9131 16.6022 46.1731 14.8156C44.967 11.9038 43.1992 9.25804 40.9706 7.02944C38.742 4.80083 36.0962 3.033 33.1844 1.82689C30.2726 0.620778 27.1517 -1.37766e-07 24 0C20.8483 1.37766e-07 17.7274 0.620779 14.8156 1.82689C11.9038 3.033 9.25804 4.80083 7.02944 7.02944C4.80083 9.25804 3.033 11.9038 1.82689 14.8156C1.08686 16.6022 0.56719 18.4675 0.276061 20.3703C-0.0282817 22.3595 1.63132 24 3.64366 24C5.656 24 7.24768 22.3498 7.68294 20.3851C7.89306 19.4367 8.18597 18.5061 8.55949 17.6043C9.39938 15.5767 10.6304 13.7343 12.1823 12.1823C13.7343 10.6304 15.5767 9.39939 17.6043 8.55949C19.632 7.7196 21.8053 7.28732 24 7.28732C26.1947 7.28732 28.368 7.7196 30.3957 8.55949C32.4233 9.39939 34.2657 10.6304 35.8176 12.1823C37.3696 13.7343 38.6006 15.5767 39.4405 17.6043C39.814 18.5061 40.1069 19.4367 40.3171 20.3851C40.7523 22.3498 42.344 24 44.3563 24Z" fill="url(#paint0_linear_1114_2788)"/></g><defs><linearGradient id="paint0_linear_1114_2788" x1="0" y1="24" x2="48" y2="24" gradientUnits="userSpaceOnUse"><stop stop-opacity="0"/><stop offset="1" stop-color="white"/></linearGradient><clipPath id="clip0_1114_2788"><rect width="48" height="48" fill="white"/></clipPath></defs></svg>`;
document.body.appendChild(loader);
document.querySelector('meta[name="theme-color"]').remove();
});
window.addEventListener("load", () => {
const loader = document.querySelector(".loader");
loader.remove();
});
</script>
<meta
property="og:title"
content="Pluto • The web OS that runs in your browser."
/>
<meta
property="og:description"
content="Welcome to Pluto, a “web operating system” focused on productivity, security and privacy."
/>
<meta property="og:type" content="article" />
<meta property="og:url" content="https://pluto.zeon.dev" />
<meta
property="og:image"
content="https://pluto.zeon.dev/assets/images/banner.png"
/>
<meta name="twitter:site" content="My Website" />
<meta
name="twitter:title"
content="Pluto • The web OS that runs in your browser."
/>
<meta
name="twitter:description"
content="Welcome to Pluto, a “web operating system” focused on productivity, security and privacy."
/>
<meta name="twitter:card" content="summary_large_image" />
<meta
name="twitter:image:src"
content="https://pluto.zeon.dev/assets/images/banner.png"
/>
<meta name="theme-color" content="#6c9dff" />
<meta name="darkreader-lock" />
</head>

<body>
<p id="H" style="display:none"></p>
<div style="display:none" id="arrayCode">
function h()
{
var x = [1,2,3];
if (x.find)
{
var result = x.find(
function(i)
{
console.log(i);
if (i === 1)
{
return true
}
else
{
return false
}
}
);

if (result === 1) { return true }
else { return false }
}
else
{
return false
}
};

h();
</div>
<nav class="navbar">
<div class="left">
<a href class="logo">
<em>pluto</em>
</a>
</div>
<div class="right">
<a href="/" >Home</a>
<a href="/faq.html">FAQ</a>
<a href="/browsertesting.html" class="selected">Tester</a>

<a href="https://pluto-app.zeon.dev">Try it</a>
</div>
<div class="menu-toggle">Toggle</div>
</nav>
<article class="sections-container">
<section class="section">
<div class="center">
<h1 class="big">Browser Testing</h1>
</div>
</section>
<section class="section">
<div class="mw">
<h2 class="big">Pluto Compatibility Tester</h2>
<p class="semi-big">
<pre id="log"></pre>
</p>
<p>If any of these fail Pluto will</p>
<ul>
<li>show a black screen.</li>
<li>crash more.</li>
<li>be less secure.</li>
<!-- <li>be less private.</li> -->
</ul>
</div>
<img src="./assets/images/javascript.svg" style="border-radius: 4px" />
</section>
<footer class="footer">
<p class="semi-big">
&copy; <a href="https://zeon.dev">zeon.dev</a> 2024 &mdash; All rights
reserved.
</p>
</footer>
</article>
</body>
<script defer src="./browsertesting.js">

</script>
</html>
97 changes: 97 additions & 0 deletions browsertesting.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
function test(item, callback) {
try {
var result = callback();
} catch (e) {
alert(item + " failed : " + e + "\n\n" + e.stack);
}

var str = "";

console.log(result);
if (result === true) {
str = "Passed:";
} else {
str = "Failed:";
}

document.getElementById("log").innerHTML += str + " " + item + "\n";
}

// document.getElementById("gobutton").addEventListener("click"

window.addEventListener("load", function () {
try {
test("async", function () {
var isAsync = true;

try {
eval("async () => {}");
} catch (e) {
if (e instanceof SyntaxError) isAsync = false;
else throw e; // throws CSP error
}
return isAsync;
});
test("let", function () {
var result = eval("function h(){let x = true;return x};h()");
if (result == true) {
return result;
}
});
test("const", function () {
var result = eval("function h(){const x = true;return x};h()");
if (result == true) {
return result;
}
});
test("array", function () {
var result = eval(document.getElementById("arrayCode").innerText);
if (result == true) {
return result;
}
});
test("WebSocket", function () {
if ("WebSocket" in window) {
return true;
} else return false;
});
test("WeakSet", function () {
if ("WeakSet" in window) {
return true;
} else return false;
});
test("querySelector", function () {
if ("querySelector" in document) {
// test querySelector
var elm = document.body.querySelector("p#H");
if (elm != null) {
return true;
}
return false;
} else return false;
});
test("fetch", function () {
if ("fetch" in window) {
return true;
} else return false;
});
test("import", function () {
var isImportSupported = true;

try {
new Function("import('data:,a')");
} catch (e) {
if (e instanceof SyntaxError) isImportSupported = false;
else throw e; // throws CSP error
}
return isImportSupported;
});
test("maps", function () {
if ("Map" in window) {
return true;
} else return false;
});
} catch (e) {
alert("oops " + e + "\n\n" + e.stack);
}
});
12 changes: 10 additions & 2 deletions faq.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,21 @@
/>
<meta property="og:type" content="article" />
<meta property="og:url" content="https://pluto.zeon.dev" />
<meta property="og:image" content="https://pluto.zeon.dev/assets/images/banner.png" />
<meta
property="og:image"
content="https://pluto.zeon.dev/assets/images/banner.png"
/>
<meta name="twitter:site" content="My Website" />
<meta name="twitter:title" content="Pluto • FAQ" />
<meta
name="twitter:description"
content="View a summary of frequently asked questions for Pluto."
/>
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image:src" content="https://pluto.zeon.dev/assets/images/banner.png" />
<meta
name="twitter:image:src"
content="https://pluto.zeon.dev/assets/images/banner.png"
/>
<meta name="theme-color" content="#6c9dff" />
<meta name="darkreader-lock" />
</head>
Expand All @@ -56,6 +62,8 @@
<div class="right">
<a href="/">Home</a>
<a href="/faq.html" class="selected">FAQ</a>
<a href="/browsertesting.html">Tester</a>

<a href="https://pluto-app.zeon.dev">Try it</a>
</div>
<div class="menu-toggle">Toggle</div>
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<div class="right">
<a href="/" class="selected">Home</a>
<a href="/faq.html">FAQ</a>
<a href="/browsertesting.html">Tester</a>
<a href="https://pluto-app.zeon.dev">Try it</a>
</div>
<div class="menu-toggle">Toggle</div>
Expand Down

0 comments on commit d018333

Please sign in to comment.