mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
Base: Replace the new tab page with a dark mode friendly blank page
about:blank in most other browsers has a white background regardless of dark mode. So rather than messing with that, remove the contents of the NTP for now, and set a dark background-color in dark mode.
This commit is contained in:
parent
afaaa23c70
commit
94a0b941f7
Notes:
sideshowbarker
2024-07-17 02:39:10 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/94a0b941f7 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/289
1 changed files with 5 additions and 93 deletions
|
@ -4,100 +4,12 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>New Tab</title>
|
<title>New Tab</title>
|
||||||
<style>
|
<style>
|
||||||
body {
|
/* FIXME: We should be able to remove the HTML style when "color-scheme" is supported */
|
||||||
display: flex;
|
@media (prefers-color-scheme: dark) {
|
||||||
align-items: center;
|
html {
|
||||||
justify-content: center;
|
background-color: rgb(20, 20, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
|
||||||
text-align: center;
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
/* Adjust this as more buttons are added */
|
|
||||||
max-width: 480px;
|
|
||||||
}
|
|
||||||
|
|
||||||
img {
|
|
||||||
image-rendering: pixelated;
|
|
||||||
}
|
|
||||||
|
|
||||||
input[type=search] {
|
|
||||||
width: 100%;
|
|
||||||
padding: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#search-buttons {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
button:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
|
||||||
<main>
|
|
||||||
<br>
|
|
||||||
<img src="resource://icons/32x32/app-browser.png" width="64" height="64"><br><br>
|
|
||||||
<form>
|
|
||||||
<input type="search" name="q" id="user_query"><br><br>
|
|
||||||
<div id="search-buttons">
|
|
||||||
<button type="button" onclick="search('bing')">Bing</button>
|
|
||||||
<button type="button" onclick="search('duckduckgo')">DuckDuckGo</button>
|
|
||||||
<button type="button" onclick="search('github')">GitHub</button>
|
|
||||||
<button type="button" onclick="search('google')">Google</button>
|
|
||||||
<button type="button" onclick="search('wiby')">Wiby</button>
|
|
||||||
<button type="button" onclick="search('wikipedia')">Wikipedia</button>
|
|
||||||
<button type="button" onclick="search('yandex')">Yandex</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<br><br>
|
|
||||||
<p>Your user agent is: <b><span id="ua"></span></b></p>
|
|
||||||
<p>This page loaded in <b><span id="loadtime"></span></b> ms</p>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
|
||||||
document.getElementById("ua").innerHTML = navigator.userAgent;
|
|
||||||
document.getElementById("loadtime").innerHTML = performance.now();
|
|
||||||
});
|
|
||||||
|
|
||||||
function search(searchEngine) {
|
|
||||||
let query = document.getElementById("user_query").value;
|
|
||||||
|
|
||||||
if (!query) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let url;
|
|
||||||
if (searchEngine == "bing") {
|
|
||||||
url = new URL("https://www.bing.com/search");
|
|
||||||
url.searchParams.set("q", query);
|
|
||||||
} else if (searchEngine == "duckduckgo") {
|
|
||||||
url = new URL("https://duckduckgo.com");
|
|
||||||
url.searchParams.set("q", query);
|
|
||||||
} else if (searchEngine == "github") {
|
|
||||||
url = new URL("https://github.com/search");
|
|
||||||
url.searchParams.set("q", query);
|
|
||||||
} else if (searchEngine == "google") {
|
|
||||||
url = new URL("https://google.com/search");
|
|
||||||
url.searchParams.set("q", query);
|
|
||||||
} else if (searchEngine == "wiby") {
|
|
||||||
url = new URL("https://wiby.me");
|
|
||||||
url.searchParams.set("q", query);
|
|
||||||
} else if (searchEngine == "wikipedia") {
|
|
||||||
url = new URL("https://en.wikipedia.org/w/index.php?title=Special:Search");
|
|
||||||
url.searchParams.set("search", query);
|
|
||||||
} else if (searchEngine == "yandex") {
|
|
||||||
url = new URL("https://yandex.com/search");
|
|
||||||
url.searchParams.set("text", query);
|
|
||||||
}
|
|
||||||
window.location.href = url.toString();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue