Skip to content

Truly independent web browser

Base: Restyle the browser's own pages

Andreas Klinge0bdd2d9298c
diff --git a/Base/res/ladybird/about-pages/about.html b/Base/res/ladybird/about-pages/about.html
index d08ce39fb21..9effc32bbb2 100644
--- a/Base/res/ladybird/about-pages/about.html
+++ b/Base/res/ladybird/about-pages/about.html
@@ -5,6 +5,37 @@
<meta name="color-scheme" content="light dark" />
<title>About URLs</title>
<link rel="icon" type="image/png" href="resource://icons/48x48/app-browser.png" />
+ <link rel="stylesheet" type="text/css" href="resource://ladybird/ladybird.css" />
+ <style>
+ body {
+ max-width: 640px;
+ margin: 0 auto;
+ padding: 30px 24px;
+ }
+
+ h1 {
+ margin-bottom: 18px;
+ font-size: 22px;
+ font-weight: 600;
+ }
+
+ ul {
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ list-style: none;
+ }
+
+ a {
+ color: var(--link);
+ text-decoration: none;
+ border-radius: 4px;
+ }
+
+ a:hover {
+ text-decoration: underline;
+ }
+ </style>
</head>
<body>
<h1>List of About URLs</h1>
@@ -12,7 +43,6 @@
<li><a href="about:about">about:about</a></li>
<li><a href="about:blocking">about:blocking</a></li>
<li><a href="about:bookmarks">about:bookmarks</a></li>
- <li><a href="about:newtab">about:newtab</a></li>
<li><a href="about:settings">about:settings</a></li>
<li><a href="about:services">about:services</a></li>
<li><a href="about:version">about:version</a></li>
diff --git a/Base/res/ladybird/about-pages/bookmarks.html b/Base/res/ladybird/about-pages/bookmarks.html
index 594a573e1e6..23c080b9ede 100644
--- a/Base/res/ladybird/about-pages/bookmarks.html
+++ b/Base/res/ladybird/about-pages/bookmarks.html
@@ -1,227 +1,328 @@
<!doctype html>
<html>
<head>
- <title>Bookmark Manager</title>
+ <title>Bookmarks</title>
<link rel="icon" type="image/png" href="resource://icons/48x48/app-browser.png" />
<link rel="stylesheet" type="text/css" href="resource://ladybird/ladybird.css" />
<link rel="stylesheet" type="text/css" href="resource://ladybird/about-pages/webui.css" />
<style>
- .header-menu {
- position: relative;
- margin-left: auto;
+ body {
+ display: flex;
+ max-width: none;
+ min-height: 100vh;
+ margin: 0;
+ padding: 0;
+ box-sizing: border-box;
}
- .tree-empty {
- color: var(--secondary-text-color);
-
- padding: 40px 20px;
+ .folders {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+ flex-shrink: 0;
+ width: 240px;
+ padding: 26px 12px;
+ box-sizing: border-box;
+ box-shadow: inset -1px 0 0 var(--separator-soft);
+ }
- text-align: center;
- font-size: 14px;
+ .folders h1 {
+ margin: 0;
+ padding: 0 10px 12px;
+ font-size: 22px;
+ font-weight: 600;
}
- .tree-item-row {
+ .folder-link {
display: flex;
align-items: center;
- gap: 8px;
-
- padding: 14px 12px;
+ gap: 9px;
+ height: 30px;
+ padding: 0 10px;
border-radius: 6px;
+ color: var(--text);
+ text-decoration: none;
+ cursor: default;
+ }
- font-size: 14px;
- cursor: grab;
+ .folder-link:hover {
+ background-color: var(--control);
}
- .tree-item-row.dragging {
- cursor: grabbing;
- opacity: 0.4;
+ .folder-link[aria-current="page"] {
+ background-color: var(--control);
}
- .tree-item-row.drag-over-inside {
- background-color: var(--item-selected-color);
+ .folder-link.drop-inside {
+ background-color: var(--information, rgba(10, 122, 255, 0.18));
}
- .tree-item-row:hover {
- background-color: var(--item-hover-color);
+ .folder-link .name {
+ flex: 1;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
}
- .tree-item-row.expandable {
- cursor: pointer;
+ .count {
+ color: var(--muted);
+ font-size: 12px;
+ font-variant-numeric: tabular-nums;
}
- .tree-children {
- padding-left: 24px;
+ .folder-icon {
+ flex-shrink: 0;
+ width: 15px;
+ height: 15px;
+ color: var(--body);
}
- .drop-indicator {
- background-color: var(--violet-100) !important;
+ main {
+ flex: 1;
+ min-width: 0;
+ padding: 30px 40px;
+ box-sizing: border-box;
+ }
- height: 2px;
- margin: -1px 12px;
+ header {
+ gap: 10px;
+ margin-bottom: 14px;
+ }
- pointer-events: none;
+ header h2 {
+ flex: 1;
+ margin: 0;
+ font-size: 15px;
+ font-weight: 600;
}
- .expand-toggle {
+ .header-menu {
+ position: relative;
+ }
+
+ .rows {
+ display: flex;
+ flex-direction: column;
+ }
+
+ .row {
+ position: relative;
display: flex;
align-items: center;
- justify-content: center;
- flex-shrink: 0;
+ gap: 12px;
+ height: 34px;
+ padding: 0 6px 0 10px;
+ border-radius: 6px;
+ }
- width: 20px;
- height: 20px;
+ .row:hover {
+ background-color: var(--control);
+ }
- cursor: pointer;
+ .row.dragging {
+ opacity: 0.35;
}
- .expand-toggle svg {
- width: 14px;
- height: 14px;
+ .row.drop-inside {
+ background-color: var(--information, rgba(10, 122, 255, 0.18));
}
- .expand-toggle.collapsed svg {
- transform: rotate(-90deg);
+ .row.drop-above::before,
+ .row.drop-below::before {
+ content: "";
+ position: absolute;
+ left: 4px;
+ right: 4px;
+ height: 2px;
+ border-radius: 1px;
+ background-color: var(--accent);
}
- .tree-spacer {
- width: 20px;
- flex-shrink: 0;
+ .row.drop-above::after,
+ .row.drop-below::after {
+ content: "";
+ position: absolute;
+ left: 0;
+ width: 8px;
+ height: 8px;
+ box-sizing: border-box;
+ border: 2px solid var(--accent);
+ border-radius: 4px;
+ background-color: var(--page);
+ }
+
+ .row.drop-above::before {
+ top: -1px;
+ }
+
+ .row.drop-above::after {
+ top: -4px;
}
- .item-icon {
+ .row.drop-below::before {
+ bottom: -1px;
+ }
+
+ .row.drop-below::after {
+ bottom: -4px;
+ }
+
+ .favicon {
display: flex;
flex-shrink: 0;
- align-items: center;
+ width: 16px;
+ height: 16px;
}
- .item-icon img,
- .item-icon svg {
+ .favicon img {
width: 16px;
height: 16px;
+ border-radius: 3px;
}
- .item-info {
- display: flex;
- align-items: center;
- gap: 8px;
+ .favicon svg {
+ width: 16px;
+ height: 16px;
+ color: var(--muted);
+ }
- flex-grow: 1;
- min-width: 0;
+ .favicon .folder-icon {
+ width: 15px;
+ height: 15px;
+ margin: auto;
+ color: var(--body);
}
- .item-title {
+ .title {
+ flex: 0 1 340px;
+ min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
+ color: var(--text);
+ text-decoration: none;
+ }
- flex-shrink: 1;
+ .detail {
+ flex: 1;
min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ color: var(--muted);
+ font-size: 12px;
}
- .item-title a {
- color: inherit;
- text-decoration: none;
+ .more-button {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ flex-shrink: 0;
+ width: 26px;
+ height: 24px;
+ padding: 0;
+ border: 0;
+ border-radius: 5px;
+ color: var(--body);
+ background-color: var(--control);
+ visibility: hidden;
+ position: relative;
}
- .item-title a:hover {
- text-decoration: underline;
+ /* The button takes clicks from a 32 px square around it. */
+ .more-button::after {
+ content: "";
+ position: absolute;
+ inset: -4px -3px;
}
- .item-url {
- color: var(--secondary-text-color);
-
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
+ .row:hover .more-button,
+ .row:focus-within .more-button {
+ visibility: visible;
+ }
- font-size: 12px;
- min-width: 0;
+ .more-button svg {
+ width: 14px;
+ height: 14px;
}
.search-highlight {
color: inherit;
- background-color: var(--item-selected-color);
+ background-color: var(--information, rgba(10, 122, 255, 0.18));
border-radius: 2px;
}
- .search-no-results {
- color: var(--secondary-text-color);
-
+ .empty {
padding: 40px 20px;
-
+ color: var(--muted);
text-align: center;
- font-size: 14px;
+ font-size: 13px;
}
</style>
</head>
<body>
- <header>
- <picture>
- <source srcset="resource://icons/128x128/app-browser.png" media="(prefers-color-scheme: dark)" />
- <img src="resource://icons/128x128/app-browser-dark.png" />
- </picture>
+ <nav class="folders" id="folders" aria-label="Bookmark folders">
<h1>Bookmarks</h1>
- <div class="header-menu">
- <button class="menu-toggle" id="menu-toggle" aria-label="Bookmark options">
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
- <circle cx="12" cy="5" r="2" />
- <circle cx="12" cy="12" r="2" />
- <circle cx="12" cy="19" r="2" />
+ </nav>
+
+ <main>
+ <header>
+ <h2 id="folder-title">Bookmarks bar</h2>
+ <div class="search-container">
+ <svg
+ class="search-icon"
+ viewBox="0 0 16 16"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="1.5"
+ stroke-linecap="round"
+ aria-hidden="true"
+ >
+ <path d="M7 2.5a4.5 4.5 0 1 1 0 9a4.5 4.5 0 1 1 0-9zM10.5 10.5L14 14" />
</svg>
- </button>
- <div class="menu-dropdown hidden" id="menu-dropdown">
- <button class="menu-item" id="import-button">Import from HTML...</button>
- <button class="menu-item" id="export-button">Export to HTML...</button>
+ <input
+ type="text"
+ class="search-input"
+ id="search-input"
+ placeholder="Search bookmarks"
+ aria-label="Search bookmarks"
+ />
</div>
- </div>
- <input type="file" id="import-file" accept=".html,text/html" hidden />
- </header>
-
- <div class="search-container">
- <svg
- class="search-icon"
- xmlns="http://www.w3.org/2000/svg"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- stroke-width="2"
- >
- <circle cx="11" cy="11" r="7" />
- <line x1="16" y1="16" x2="22" y2="22" />
- </svg>
- <input type="text" class="search-input" id="search-input" placeholder="Search bookmarks" />
- </div>
-
- <div class="card">
- <div class="card-body" id="bookmark-tree"></div>
- </div>
+ <button class="secondary-button" id="new-folder-button">New folder</button>
+ <div class="header-menu">
+ <button class="menu-toggle" id="menu-toggle" aria-label="Bookmark options">
+ <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
+ <circle cx="12" cy="5" r="2" />
+ <circle cx="12" cy="12" r="2" />
+ <circle cx="12" cy="19" r="2" />
+ </svg>
+ </button>
+ <div class="menu-dropdown hidden" id="menu-dropdown">
+ <button class="menu-item" id="import-button">Import from HTML…</button>
+ <button class="menu-item" id="export-button">Export to HTML…</button>
+ </div>
+ </div>
+ <input type="file" id="import-file" accept=".html,text/html" hidden />
+ </header>
+
+ <div class="rows" id="rows" role="list"></div>
+ </main>
<script type="module">
- // Inline folder icon.
- const FOLDER_SVG = `
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
- <path d="M 1.96875 5.273438 C 1.523438 5.367188 1.101562 5.695312 0.890625 6.117188 L 0.773438 6.351562 L 0.773438 19.148438 L 0.914062 19.40625 C 1.054688 19.710938 1.3125 19.96875 1.640625 20.109375 L 1.851562 20.226562 L 11.179688 20.226562 C 20.390625 20.25 20.53125 20.25 20.742188 20.15625 C 21.140625 20.015625 21.46875 19.710938 21.632812 19.3125 L 21.75 19.054688 L 21.75 8.648438 L 21.609375 8.390625 C 21.46875 8.0625 21.210938 7.804688 20.90625 7.664062 L 20.648438 7.546875 L 15.960938 7.523438 L 11.25 7.5 L 10.101562 6.375 L 8.976562 5.25 L 5.554688 5.25 C 3.679688 5.25 2.0625 5.273438 1.96875 5.273438 "/>
- </svg>`;
-
- // Inline expanded-folder indicator.
- const FOLDER_ARROW_DOWN_SVG = `
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
- <path d="M 4.5 6 L 12 13.5 L 19.5 6 L 21 9 L 12 18 L 3 9 Z M 4.5 6 "/>
- </svg>`;
-
- // Inline bookmark icon.
- const BOOKMARK_SVG = `
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
- <path d="M 10.96875 1.40625 C 9.234375 1.570312 7.546875 2.179688 6.09375 3.140625 C 5.507812 3.539062 4.945312 3.984375 4.453125 4.5 C 2.835938 6.117188 1.804688 8.15625 1.453125 10.476562 C 1.359375 11.132812 1.359375 12.867188 1.453125 13.523438 C 1.898438 16.523438 3.585938 19.195312 6.117188 20.882812 C 7.335938 21.703125 8.90625 22.3125 10.453125 22.546875 C 11.15625 22.640625 12.84375 22.640625 13.546875 22.546875 C 15.421875 22.265625 17.203125 21.46875 18.679688 20.296875 C 19.265625 19.804688 19.804688 19.265625 20.296875 18.679688 C 21.492188 17.203125 22.265625 15.421875 22.546875 13.546875 C 22.640625 12.84375 22.640625 11.132812 22.546875 10.453125 C 22.21875 8.203125 21.164062 6.117188 19.546875 4.5 C 19.265625 4.21875 18.984375 3.960938 18.679688 3.703125 C 17.179688 2.53125 15.398438 1.757812 13.523438 1.453125 C 13.03125 1.382812 11.460938 1.335938 10.96875 1.40625 M 12.515625 3.304688 C 12.703125 3.398438 12.867188 3.539062 13.007812 3.679688 C 14.203125 4.875 15.023438 7.476562 15.257812 10.757812 L 15.28125 11.109375 L 8.71875 11.109375 L 8.742188 10.757812 C 8.90625 8.414062 9.328125 6.539062 10.03125 5.109375 C 10.546875 4.054688 11.085938 3.421875 11.671875 3.210938 C 11.90625 3.140625 12.257812 3.164062 12.515625 3.304688 M 8.484375 4.171875 C 7.640625 5.8125 7.078125 8.25 6.9375 10.640625 L 6.914062 11.109375 L 3.1875 11.109375 L 3.210938 10.898438 C 3.304688 10.195312 3.515625 9.421875 3.796875 8.71875 C 4.242188 7.570312 4.828125 6.679688 5.765625 5.765625 C 6.328125 5.179688 6.796875 4.804688 7.453125 4.40625 C 7.828125 4.171875 8.507812 3.84375 8.601562 3.84375 C 8.625 3.84375 8.578125 3.960938 8.484375 4.171875 M 15.796875 4.007812 C 16.335938 4.265625 16.851562 4.570312 17.320312 4.921875 C 17.8125 5.296875 18.703125 6.1875 19.078125 6.679688 C 19.992188 7.921875 20.578125 9.375 20.789062 10.898438 L 20.8125 11.109375 L 17.085938 11.109375 L 17.0625 10.640625 C 16.921875 8.25 16.335938 5.8125 15.515625 4.171875 C 15.421875 3.984375 15.375 3.84375 15.398438 3.84375 C 15.421875 3.84375 15.609375 3.914062 15.796875 4.007812 M 6.9375 13.382812 C 7.078125 15.773438 7.664062 18.1875 8.484375 19.828125 C 8.578125 20.015625 8.648438 20.15625 8.648438 20.179688 C 8.648438 20.226562 7.875 19.851562 7.5 19.617188 C 6.867188 19.242188 6.28125 18.773438 5.765625 18.234375 C 5.460938 17.953125 5.179688 17.648438 4.921875 17.320312 C 4.007812 16.078125 3.421875 14.648438 3.210938 13.101562 L 3.1875 12.914062 L 6.914062 12.914062 L 6.9375 13.382812 M 15.257812 13.265625 C 15.09375 15.679688 14.625 17.671875 13.875 19.078125 C 13.289062 20.203125 12.609375 20.835938 12 20.835938 C 11.039062 20.835938 9.9375 19.265625 9.304688 16.945312 C 9.023438 15.914062 8.835938 14.671875 8.742188 13.265625 L 8.71875 12.914062 L 15.28125 12.914062 L 15.257812 13.265625 M 20.789062 13.101562 C 20.578125 14.625 19.992188 16.078125 19.078125 17.320312 C 18.914062 17.53125 18.539062 17.953125 18.234375 18.234375 C 17.71875 18.773438 17.132812 19.242188 16.5 19.617188 C 16.125 19.851562 15.351562 20.226562 15.351562 20.179688 C 15.351562 20.15625 15.421875 20.015625 15.515625 19.828125 C 16.335938 18.210938 16.921875 15.773438 17.0625 13.382812 L 17.085938 12.914062 L 20.8125 12.914062 L 20.789062 13.101562 "/>
- </svg>`;
+ const FOLDER_SVG = `<svg class="folder-icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round" aria-hidden="true"><path d="M2 4.2c0-.6.4-1 1-1h3.3l1.4 1.5H13c.6 0 1 .4 1 1v6.6c0 .6-.4 1-1 1H3c-.6 0-1-.4-1-1z"/></svg>`;
+ const GLOBE_SVG = `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.2" aria-hidden="true"><circle cx="8" cy="8" r="5.5"/><path d="M2.5 8h11M8 2.5c1.6 1.6 2.3 3.5 2.3 5.5S9.6 11.9 8 13.5M8 2.5C6.4 4.1 5.7 6 5.7 8s.7 3.9 2.3 5.5"/></svg>`;
+ const MORE_SVG = `<svg viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><circle cx="3.5" cy="8" r="1.3"/><circle cx="8" cy="8" r="1.3"/><circle cx="12.5" cy="8" r="1.3"/></svg>`;
let BOOKMARKS = [];
- let EXPANDED_FOLDERS = new Set();
+ // The folder shown on the right, or null for the bookmarks bar itself.
+ let CURRENT_FOLDER_ID = null;
let DRAGGED_ITEM_ID = null;
let SEARCH_QUERY = "";
- const DROP_INDICATOR = document.createElement("div");
- DROP_INDICATOR.className = "drop-indicator";
+ const foldersNav = document.getElementById("folders");
+ const rowsContainer = document.getElementById("rows");
+ const folderTitle = document.getElementById("folder-title");
function createElement(tagName, properties = {}, children = []) {
const element = document.createElement(tagName);
@@ -230,376 +331,282 @@
return element;
}
- function createSpacer() {
- return createElement("span", { className: "tree-spacer" });
- }
-
- function createIcon(markup) {
- return createElement("span", { className: "item-icon", innerHTML: markup });
- }
-
- function createFaviconIcon(favicon) {
- if (!favicon) {
- return createIcon(BOOKMARK_SVG);
+ function findFolder(items, id) {
+ for (const item of items) {
+ if (item.type !== "folder") continue;
+ if (item.id === id) return item;
+ const found = findFolder(item.children || [], id);
+ if (found) return found;
}
-
- return createElement("span", { className: "item-icon" }, [
- createElement("img", { src: `data:image/png;base64,${favicon}` }),
- ]);
+ return null;
}
- function createBookmarkInfo(item) {
- const title = createElement("span", { className: "item-title" }, [
- createElement("a", { href: item.url, textContent: item.title || item.url }),
- ]);
-
- const url = createElement("span", { className: "item-url", textContent: item.url });
-
- return createElement("span", { className: "item-info" }, [title, url]);
+ function currentItems() {
+ if (CURRENT_FOLDER_ID === null) return BOOKMARKS;
+ return findFolder(BOOKMARKS, CURRENT_FOLDER_ID)?.children || [];
}
- function createHighlightedBookmarkInfo(item) {
- const link = createElement("a", { href: item.url });
- link.append(...highlightText(item.title || item.url, SEARCH_QUERY));
-
- const title = createElement("span", { className: "item-title" }, [link]);
-
- const url = createElement("span", { className: "item-url" });
- url.append(...highlightText(item.url, SEARCH_QUERY));
-
- return createElement("span", { className: "item-info" }, [title, url]);
+ function bookmarkCount(count) {
+ return count === 1 ? "1 bookmark" : `${count} bookmarks`;
}
- function itemMatchesQuery(item, query) {
- const lowerQuery = query.toLowerCase();
- const title = (item.title || "").toLowerCase();
-
- if (item.type === "bookmark") {
- const url = (item.url || "").toLowerCase();
- return title.includes(lowerQuery) || url.includes(lowerQuery);
- }
-
- return title.includes(lowerQuery);
- }
-
- function filterBookmarks(items, query) {
- if (!query) {
- return items;
- }
-
- const result = [];
-
- for (const item of items) {
- if (item.type === "bookmark") {
- if (itemMatchesQuery(item, query)) {
- result.push(item);
- }
- } else if (item.type === "folder") {
- const filteredChildren = filterBookmarks(item.children || [], query);
- const folderMatches = itemMatchesQuery(item, query);
-
- if (filteredChildren.length > 0) {
- result.push({ ...item, children: filteredChildren });
- } else if (folderMatches) {
- result.push({ ...item, children: [] });
- }
- }
- }
-
- return result;
+ function displayUrl(url) {
+ return (url || "").replace(/^https?:\/\//, "").replace(/\/$/, "");
}
function highlightText(text, query) {
- if (!query) {
- return [document.createTextNode(text)];
- }
+ if (!query) return [document.createTextNode(text)];
const lowerText = text.toLowerCase();
const lowerQuery = query.toLowerCase();
const fragments = [];
let lastIndex = 0;
- let matchIndex = lowerText.indexOf(lowerQuery, lastIndex);
-
- for (; matchIndex !== -1; matchIndex = lowerText.indexOf(lowerQuery, lastIndex)) {
- if (matchIndex > lastIndex) {
- fragments.push(document.createTextNode(text.slice(lastIndex, matchIndex)));
- }
-
- const mark = createElement("mark", {
- className: "search-highlight",
- textContent: text.slice(matchIndex, matchIndex + query.length),
- });
- fragments.push(mark);
-
- lastIndex = matchIndex + query.length;
- }
-
- if (lastIndex < text.length) {
- fragments.push(document.createTextNode(text.slice(lastIndex)));
+ for (
+ let index = lowerText.indexOf(lowerQuery);
+ index !== -1;
+ index = lowerText.indexOf(lowerQuery, lastIndex)
+ ) {
+ if (index > lastIndex) fragments.push(document.createTextNode(text.slice(lastIndex, index)));
+ fragments.push(
+ createElement("mark", {
+ className: "search-highlight",
+ textContent: text.slice(index, index + query.length),
+ })
+ );
+ lastIndex = index + query.length;
}
-
- return fragments.length > 0 ? fragments : [document.createTextNode(text)];
+ if (lastIndex < text.length) fragments.push(document.createTextNode(text.slice(lastIndex)));
+ return fragments;
}
- function toggleFolder(folderId) {
- if (EXPANDED_FOLDERS.has(folderId)) {
- EXPANDED_FOLDERS.delete(folderId);
- } else {
- EXPANDED_FOLDERS.add(folderId);
+ function matchingItems(items, query, parentId = null, result = []) {
+ const lowerQuery = query.toLowerCase();
+ for (const item of items) {
+ const title = (item.title || "").toLowerCase();
+ const url = (item.url || "").toLowerCase();
+ if (title.includes(lowerQuery) || url.includes(lowerQuery)) result.push({ item, parentId });
+ if (item.type === "folder") matchingItems(item.children || [], query, item.id, result);
}
-
- renderTree();
- }
-
- function addContextMenuHandler(element, item, targetFolderId, parentFolderId) {
- element.addEventListener("contextmenu", event => {
- event.preventDefault();
- event.stopPropagation();
-
- ladybird.sendMessage("showContextMenu", {
- clientX: event.clientX,
- clientY: event.clientY,
- id: item.id,
- targetFolderId,
- parentFolderId,
- });
- });
+ return result;
}
- const DROP_ABOVE = 1;
- const DROP_BELOW = 2;
- const DROP_INSIDE = 3;
-
- function getDropPosition(event, row, item) {
- const rect = row.getBoundingClientRect();
- const ratio = (event.clientY - rect.top) / rect.height;
-
- if (item.type === "bookmark") {
- return ratio < 0.5 ? DROP_ABOVE : DROP_BELOW;
- }
-
- if (ratio < 0.25) {
- return DROP_ABOVE;
- }
- if (ratio > 0.75 && !EXPANDED_FOLDERS.has(item.id)) {
- return DROP_BELOW;
- }
-
- return DROP_INSIDE;
- }
+ function showContextMenu(event, item, parentId, anchor) {
+ event.preventDefault();
+ event.stopPropagation();
- function getDropTarget(item, parentId, index, position) {
- if (position === DROP_INSIDE) {
- return {
- targetFolderId: item.id,
- targetIndex: item.children ? item.children.length : 0,
- };
+ let clientX = event.clientX;
+ let clientY = event.clientY;
+ if (anchor) {
+ const rect = anchor.getBoundingClientRect();
+ clientX = Math.round(rect.left);
+ clientY = Math.round(rect.bottom + 4);
}
- return {
- targetFolderId: parentId || null,
- targetIndex: position === DROP_ABOVE ? index : index + 1,
- };
+ ladybird.sendMessage("showContextMenu", {
+ clientX,
+ clientY,
+ id: item.id,
+ targetFolderId: item.type === "folder" ? item.id : parentId,
+ parentFolderId: parentId,
+ });
}
function moveDraggedItem(targetFolderId, targetIndex) {
- ladybird.sendMessage("moveItem", {
- id: DRAGGED_ITEM_ID,
- index: targetIndex,
- targetFolderId,
- });
-
+ if (!DRAGGED_ITEM_ID || DRAGGED_ITEM_ID === targetFolderId) return;
+ ladybird.sendMessage("moveItem", { id: DRAGGED_ITEM_ID, index: targetIndex, targetFolderId });
DRAGGED_ITEM_ID = null;
}
- function setupDragHandlers(row, item, parentId, index) {
- if (SEARCH_QUERY) {
- row.draggable = false;
- row.style.cursor = item.type === "folder" ? "pointer" : "default";
- return;
- }
+ function clearDropMarks() {
+ for (const element of document.querySelectorAll(".drop-above, .drop-below, .drop-inside"))
+ element.classList.remove("drop-above", "drop-below", "drop-inside");
+ }
+
+ // A row takes a dragged item above or below itself, and a folder's row also takes it inside.
+ function dropPosition(event, row, item) {
+ const rect = row.getBoundingClientRect();
+ const ratio = (event.clientY - rect.top) / rect.height;
+ if (item.type === "folder" && ratio > 0.25 && ratio < 0.75) return "inside";
+ return ratio < 0.5 ? "above" : "below";
+ }
+ function setUpDragAndDrop(row, item, index) {
+ if (SEARCH_QUERY) return;
row.draggable = true;
row.addEventListener("dragstart", event => {
DRAGGED_ITEM_ID = item.id;
row.classList.add("dragging");
-
event.dataTransfer.effectAllowed = "move";
event.dataTransfer.setData("text/plain", item.id);
});
-
row.addEventListener("dragend", () => {
DRAGGED_ITEM_ID = null;
row.classList.remove("dragging");
-
- DROP_INDICATOR.remove();
+ clearDropMarks();
});
-
row.addEventListener("dragover", event => {
event.preventDefault();
event.stopPropagation();
-
event.dataTransfer.dropEffect = "move";
- DROP_INDICATOR.remove();
-
- const position = getDropPosition(event, row, item);
-
- if (position === DROP_INSIDE) {
- row.classList.add("drag-over-inside");
- } else {
- const wrapper = row.closest(".tree-item");
- if (position === DROP_ABOVE) {
- wrapper.before(DROP_INDICATOR);
- } else {
- wrapper.after(DROP_INDICATOR);
- }
- }
- });
-
- row.addEventListener("dragleave", event => {
- if (!row.contains(event.relatedTarget)) {
- row.classList.remove("drag-over-inside");
- }
+ clearDropMarks();
+ row.classList.add(`drop-${dropPosition(event, row, item)}`);
});
-
row.addEventListener("drop", event => {
event.preventDefault();
event.stopPropagation();
-
- DROP_INDICATOR.remove();
-
- const position = getDropPosition(event, row, item);
- const { targetFolderId, targetIndex } = getDropTarget(item, parentId, index, position);
- moveDraggedItem(targetFolderId, targetIndex);
+ clearDropMarks();
+ const position = dropPosition(event, row, item);
+ if (position === "inside") moveDraggedItem(item.id, item.children?.length || 0);
+ else moveDraggedItem(CURRENT_FOLDER_ID, position === "above" ? index : index + 1);
});
}
- function renderTree() {
- bookmarkTreeContainer.innerHTML = "";
+ function renderFolderLink(folder, depth) {
+ const id = folder ? folder.id : null;
+ const children = folder ? folder.children || [] : BOOKMARKS;
+ const link = createElement("a", { href: "#", className: "folder-link" });
+ link.style.paddingLeft = `${10 + depth * 20}px`;
+ link.innerHTML = FOLDER_SVG;
+ link.append(
+ createElement("span", {
+ className: "name",
+ textContent: folder ? folder.title || "(no title)" : "Bookmarks bar",
+ }),
+ createElement("span", { className: "count", textContent: String(children.length) })
+ );
+ if (!SEARCH_QUERY && id === CURRENT_FOLDER_ID) link.setAttribute("aria-current", "page");
+
+ link.addEventListener("click", event => {
+ event.preventDefault();
+ CURRENT_FOLDER_ID = id;
+ searchInput.value = "";
+ SEARCH_QUERY = "";
+ render();
+ });
+ link.addEventListener("dragover", event => {
+ if (!DRAGGED_ITEM_ID) return;
+ event.preventDefault();
+ clearDropMarks();
+ link.classList.add("drop-inside");
+ });
+ link.addEventListener("dragleave", () => link.classList.remove("drop-inside"));
+ link.addEventListener("drop", event => {
+ event.preventDefault();
+ clearDropMarks();
+ moveDraggedItem(id, children.length);
+ });
+ if (folder) link.addEventListener("contextmenu", event => showContextMenu(event, folder, null));
+ foldersNav.append(link);
- if (BOOKMARKS.length === 0) {
- bookmarkTreeContainer.appendChild(
- createElement("div", {
- className: "tree-empty",
- textContent: "No bookmarks yet.",
- })
- );
- return;
+ for (const child of children) {
+ if (child.type === "folder") renderFolderLink(child, depth + 1);
}
+ }
- if (SEARCH_QUERY) {
- const filteredItems = filterBookmarks(BOOKMARKS, SEARCH_QUERY);
-
- if (filteredItems.length === 0) {
- bookmarkTreeContainer.appendChild(
- createElement("div", {
- className: "search-no-results",
- textContent: "No bookmarks matching your search.",
- })
- );
- return;
- }
-
- renderItems(bookmarkTreeContainer, filteredItems, null);
+ function renderRow(item, parentId, index) {
+ const row = createElement("div", { className: "row" });
+ row.setAttribute("role", "listitem");
+
+ if (item.type === "folder") {
+ row.append(createElement("span", { className: "favicon", innerHTML: FOLDER_SVG }));
+ const title = createElement("a", { href: "#", className: "title" });
+ title.append(...highlightText(item.title || "(no title)", SEARCH_QUERY));
+ title.addEventListener("click", event => {
+ event.preventDefault();
+ CURRENT_FOLDER_ID = item.id;
+ searchInput.value = "";
+ SEARCH_QUERY = "";
+ render();
+ });
+ row.append(
+ title,
+ createElement("span", {
+ className: "detail",
+ textContent: bookmarkCount((item.children || []).length),
+ })
+ );
} else {
- renderItems(bookmarkTreeContainer, BOOKMARKS, null);
+ const favicon = createElement("span", { className: "favicon" });
+ if (item.favicon)
+ favicon.append(createElement("img", { src: `data:image/png;base64,${item.favicon}`, alt: "" }));
+ else favicon.innerHTML = GLOBE_SVG;
+ const title = createElement("a", { href: item.url, className: "title" });
+ title.append(...highlightText(item.title || item.url, SEARCH_QUERY));
+ const detail = createElement("span", { className: "detail" });
+ detail.append(...highlightText(displayUrl(item.url), SEARCH_QUERY));
+ row.append(favicon, title, detail);
}
- }
-
- function renderItems(container, items, parentId) {
- items.forEach((item, index) => {
- const wrapper = createElement("div", { className: "tree-item" });
- const row = createElement("div", { className: "tree-item-row" });
- wrapper.appendChild(row);
- if (item.type === "bookmark") {
- renderBookmarkRow(row, item, index, parentId);
- } else {
- renderFolderRow(row, wrapper, item, index, parentId);
- }
+ const moreButton = createElement("button", { className: "more-button", innerHTML: MORE_SVG });
+ moreButton.setAttribute("aria-label", `More actions for ${item.title || item.url || "folder"}`);
+ moreButton.addEventListener("click", event => showContextMenu(event, item, parentId, moreButton));
+ row.append(moreButton);
- container.appendChild(wrapper);
- });
+ row.addEventListener("contextmenu", event => showContextMenu(event, item, parentId));
+ setUpDragAndDrop(row, item, index);
+ rowsContainer.append(row);
}
- function renderBookmarkRow(row, item, index, parentId) {
- row.appendChild(createSpacer());
- row.appendChild(createFaviconIcon(item.favicon));
- row.appendChild(SEARCH_QUERY ? createHighlightedBookmarkInfo(item) : createBookmarkInfo(item));
+ function render() {
+ for (const link of foldersNav.querySelectorAll(".folder-link")) link.remove();
+ renderFolderLink(null, 0);
- setupDragHandlers(row, item, parentId, index);
- addContextMenuHandler(row, item, parentId || null, parentId || null);
- }
+ rowsContainer.replaceChildren();
- function renderFolderRow(row, wrapper, item, index, parentId) {
- const hasChildren = item.children && item.children.length > 0;
- const isSearching = SEARCH_QUERY.length > 0;
- const isExpanded = hasChildren && (isSearching || EXPANDED_FOLDERS.has(item.id));
-
- if (hasChildren) {
- row.classList.add("expandable");
- row.addEventListener("click", () => toggleFolder(item.id));
- row.appendChild(
- createElement("span", {
- className: `expand-toggle ${isExpanded ? "expanded" : "collapsed"}`,
- innerHTML: FOLDER_ARROW_DOWN_SVG,
- })
- );
- } else {
- row.appendChild(createSpacer());
+ if (SEARCH_QUERY) {
+ folderTitle.textContent = "Search results";
+ const matches = matchingItems(BOOKMARKS, SEARCH_QUERY);
+ if (matches.length === 0) {
+ rowsContainer.append(
+ createElement("div", { className: "empty", textContent: "No bookmarks match your search." })
+ );
+ return;
+ }
+ matches.forEach(({ item, parentId }, index) => renderRow(item, parentId, index));
+ return;
}
- row.appendChild(createIcon(FOLDER_SVG));
+ const folder = CURRENT_FOLDER_ID === null ? null : findFolder(BOOKMARKS, CURRENT_FOLDER_ID);
+ if (CURRENT_FOLDER_ID !== null && !folder) CURRENT_FOLDER_ID = null;
+ folderTitle.textContent = folder ? folder.title || "(no title)" : "Bookmarks bar";
- if (isSearching) {
- const folderTitle = createElement("span", { className: "item-title" });
- folderTitle.append(...highlightText(item.title || "(no title)", SEARCH_QUERY));
- row.appendChild(folderTitle);
- } else {
- row.appendChild(
- createElement("span", {
- className: "item-title",
- textContent: item.title || "(no title)",
- })
+ const items = currentItems();
+ if (items.length === 0) {
+ rowsContainer.append(
+ createElement("div", { className: "empty", textContent: "No bookmarks here yet." })
);
+ return;
}
-
- setupDragHandlers(row, item, parentId, index);
- addContextMenuHandler(row, item, item.id, parentId || null);
-
- if (isExpanded) {
- const childrenContainer = createElement("div", { className: "tree-children" });
- renderItems(childrenContainer, item.children, item.id);
- wrapper.appendChild(childrenContainer);
- }
+ items.forEach((item, index) => renderRow(item, CURRENT_FOLDER_ID, index));
}
+ const renderTree = render;
- const bookmarkTreeContainer = document.getElementById("bookmark-tree");
-
- bookmarkTreeContainer.addEventListener("dragover", event => {
+ rowsContainer.addEventListener("dragover", event => {
+ if (!DRAGGED_ITEM_ID) return;
event.preventDefault();
event.dataTransfer.dropEffect = "move";
});
-
- bookmarkTreeContainer.addEventListener("drop", event => {
+ rowsContainer.addEventListener("drop", event => {
event.preventDefault();
- DROP_INDICATOR.remove();
-
- if (DRAGGED_ITEM_ID) {
- moveDraggedItem(null, BOOKMARKS.length);
- }
+ clearDropMarks();
+ moveDraggedItem(CURRENT_FOLDER_ID, currentItems().length);
});
- bookmarkTreeContainer.addEventListener("contextmenu", event => {
+ document.querySelector("main").addEventListener("contextmenu", event => {
+ if (event.defaultPrevented) return;
event.preventDefault();
-
ladybird.sendMessage("showContextMenu", {
clientX: event.clientX,
clientY: event.clientY,
+ targetFolderId: CURRENT_FOLDER_ID,
});
});
+ document.getElementById("new-folder-button").addEventListener("click", () => {
+ ladybird.sendMessage("newFolder", { targetFolderId: CURRENT_FOLDER_ID });
+ });
+
document.addEventListener("WebUILoaded", () => {
ladybird.sendMessage("loadBookmarks");
});
@@ -607,7 +614,7 @@
document.addEventListener("WebUIMessage", event => {
if (event.detail.name === "loadBookmarks") {
BOOKMARKS = event.detail.data;
- renderTree();
+ render();
}
});
diff --git a/Base/res/ladybird/about-pages/downloads.html b/Base/res/ladybird/about-pages/downloads.html
index 5d136095965..e72ba431b14 100644
--- a/Base/res/ladybird/about-pages/downloads.html
+++ b/Base/res/ladybird/about-pages/downloads.html
@@ -6,26 +6,9 @@
<link rel="stylesheet" type="text/css" href="resource://ladybird/ladybird.css" />
<link rel="stylesheet" type="text/css" href="resource://ladybird/about-pages/webui.css" />
<style>
- @media (prefers-color-scheme: light) {
- :root {
- --download-progress-color: #5c8ecc;
- --download-progress-track-color: #dde4ec;
- --download-status-completed-color: #1f7a3f;
- --download-status-failed-color: #b33232;
- --download-status-paused-color: #a06a12;
- --download-segment-done-color: #2f5d94;
- }
- }
-
- @media (prefers-color-scheme: dark) {
- :root {
- --download-progress-color: #77a1d1;
- --download-progress-track-color: #323841;
- --download-status-completed-color: #7bd493;
- --download-status-failed-color: #ff8585;
- --download-status-paused-color: #e0b169;
- --download-segment-done-color: #b9d3f0;
- }
+ body {
+ max-width: 860px;
+ padding: 30px 24px;
}
.downloads-content {
@@ -40,17 +23,9 @@
font-size: 13px;
}
- .downloads-header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 12px;
- }
-
.downloads-empty {
padding: 36px 12px;
text-align: center;
- font-size: 14px;
}
.downloads-list {
@@ -82,7 +57,7 @@
text-overflow: ellipsis;
white-space: nowrap;
- font-size: 14px;
+ font-size: 13px;
font-weight: 600;
}
@@ -120,12 +95,12 @@
}
.download-state progress::-webkit-progress-bar {
- background-color: var(--download-progress-track-color);
+ background-color: var(--control);
border-radius: 999px;
}
.download-state progress::-webkit-progress-value {
- background-color: var(--download-progress-color);
+ background-color: var(--accent);
border-radius: 999px;
}
@@ -136,23 +111,19 @@
width: 150px;
height: 4px;
- background-color: var(--download-progress-track-color);
+ background-color: var(--control);
border: 1px solid rgba(0, 0, 0, 0.5);
border-radius: 999px;
overflow: hidden;
}
.download-segment {
- background-color: var(--download-progress-track-color);
+ background-color: var(--control);
}
.download-segment-fill {
height: 100%;
- background-color: var(--download-progress-color);
- }
-
- .download-segment.complete .download-segment-fill {
- background-color: var(--download-segment-done-color);
+ background-color: var(--accent);
}
.download-status {
@@ -162,11 +133,11 @@
}
.download-status.completed {
- color: var(--download-status-completed-color);
+ color: var(--success);
}
.download-status.failed {
- color: var(--download-status-failed-color);
+ color: var(--error);
}
.download-status.canceled {
@@ -174,7 +145,7 @@
}
.download-status.paused {
- color: var(--download-status-paused-color);
+ color: var(--warning);
}
.download-actions {
@@ -188,11 +159,6 @@
}
@media (max-width: 640px) {
- .downloads-header {
- align-items: flex-start;
- flex-direction: column;
- }
-
.download-entry {
grid-template-columns: 1fr;
}
@@ -205,24 +171,14 @@
</head>
<body>
<header>
- <picture>
- <source srcset="resource://icons/128x128/app-browser.png" media="(prefers-color-scheme: dark)" />
- <img src="resource://icons/128x128/app-browser-dark.png" />
- </picture>
<h1>Downloads</h1>
+ <button id="prune-inactive-downloads" class="secondary-button" disabled>Clear finished</button>
</header>
- <div class="card">
- <div class="card-body downloads-content">
- <div class="downloads-header">
- <div id="downloads-status" class="downloads-status">Loading downloads...</div>
- <button id="prune-inactive-downloads" class="secondary-button" disabled>
- Clear finished downloads
- </button>
- </div>
- <div id="downloads-empty" class="downloads-empty hidden"></div>
- <div id="downloads-list" class="downloads-list"></div>
- </div>
+ <div class="downloads-content">
+ <div id="downloads-status" class="downloads-status">Loading downloads…</div>
+ <div id="downloads-empty" class="downloads-empty hidden"></div>
+ <div id="downloads-list" class="downloads-list"></div>
</div>
<script type="module">
@@ -235,11 +191,11 @@
maximumFractionDigits: 1,
});
const sizeUnits = [
- { divisor: 1, suffix: "B" },
- { divisor: 1024, suffix: "KiB" },
- { divisor: 1024 ** 2, suffix: "MiB" },
- { divisor: 1024 ** 3, suffix: "GiB" },
- { divisor: 1024 ** 4, suffix: "TiB" },
+ { divisor: 1, suffix: "bytes" },
+ { divisor: 1000, suffix: "KB" },
+ { divisor: 1000 ** 2, suffix: "MB" },
+ { divisor: 1000 ** 3, suffix: "GB" },
+ { divisor: 1000 ** 4, suffix: "TB" },
];
let downloads = [];
@@ -269,14 +225,15 @@
}
function timeRemainingLabel(seconds) {
- if (seconds < 60) return `${Math.max(seconds, 1)} sec left`;
+ if (seconds < 60) return `${pluralize(Math.max(seconds, 1), "second")} left`;
const totalMinutes = Math.ceil(seconds / 60);
- if (totalMinutes < 60) return `${totalMinutes} min left`;
+ if (totalMinutes < 60) return `${pluralize(totalMinutes, "minute")} left`;
const hours = Math.floor(totalMinutes / 60);
const minutes = totalMinutes % 60;
- return `${hours} hr ${minutes} min left`;
+ if (minutes === 0) return `${pluralize(hours, "hour")} left`;
+ return `${pluralize(hours, "hour")} ${pluralize(minutes, "minute")} left`;
}
function statusLabel(download) {
@@ -292,11 +249,11 @@
if (download.status === "failed") return download.error || "The download failed.";
if (download.status === "paused" && download.error) return download.error;
if (download.status === "in-progress" && download.isWaitingToRetry)
- return "The server asked us to slow down - waiting to retry.";
+ return "The server asked us to slow down, so Ladybird is waiting to retry.";
if (download.status !== "completed" && download.totalSize > 0) {
const unit = unitForDownloadSize(download.totalSize);
const parts = [
- `${sizeFormatter.format(download.downloadedSize / unit.divisor)}/${sizeFormatter.format(download.totalSize / unit.divisor)} ${unit.suffix}`,
+ `${sizeFormatter.format(download.downloadedSize / unit.divisor)} of ${sizeFormatter.format(download.totalSize / unit.divisor)} ${unit.suffix}`,
];
if (download.status === "in-progress") {
@@ -306,7 +263,7 @@
if (download.connectionCount > 1) parts.push(`${download.connectionCount} connections`);
}
- return parts.join(" - ");
+ return parts.join(" · ");
}
const unit = unitForDownloadSize(download.downloadedSize);
@@ -346,8 +303,8 @@
if (download.status === "paused") {
actions.replaceChildren(
- createActionButton("primary-button", "Resume", "resumeDownload", download.id),
- createActionButton("secondary-button", "Cancel", "cancelDownload", download.id)
+ createActionButton("secondary-button", "Cancel", "cancelDownload", download.id),
+ createActionButton("primary-button", "Resume", "resumeDownload", download.id)
);
return;
}
@@ -358,8 +315,8 @@
}
actions.replaceChildren(
- createActionButton("primary-button", "Open", "openDownload", download.id),
- createActionButton("secondary-button", "Show in folder", "showDownloadInFolder", download.id)
+ createActionButton("secondary-button", "Show in folder", "showDownloadInFolder", download.id),
+ createActionButton("primary-button", "Open", "openDownload", download.id)
);
}
@@ -421,7 +378,6 @@
const block = segments.children[index];
block.style.flexGrow = `${size}`;
- block.classList.toggle("complete", downloaded >= size);
block.firstChild.style.width = `${(downloaded / size) * 100}%`;
});
}
@@ -503,9 +459,9 @@
downloadsStatus.textContent = "No downloads yet.";
} else if (activeCount > 0) {
const paused = pausedCount > 0 ? `, ${pausedCount} paused` : "";
- downloadsStatus.textContent = `${pluralize(activeCount, "active download")}${paused} - ${pluralize(downloads.length, "item")} total.`;
+ downloadsStatus.textContent = `${pluralize(activeCount, "active download")}${paused} · ${pluralize(downloads.length, "item")} total.`;
} else if (pausedCount > 0) {
- downloadsStatus.textContent = `${pluralize(pausedCount, "paused download")} - ${pluralize(downloads.length, "item")} total.`;
+ downloadsStatus.textContent = `${pluralize(pausedCount, "paused download")} · ${pluralize(downloads.length, "item")} total.`;
} else {
downloadsStatus.textContent = `${pluralize(downloads.length, "download")} in this session.`;
}
diff --git a/Base/res/ladybird/about-pages/history.html b/Base/res/ladybird/about-pages/history.html
index b8c1793d6f9..053bd0173c4 100644
--- a/Base/res/ladybird/about-pages/history.html
+++ b/Base/res/ladybird/about-pages/history.html
@@ -6,56 +6,76 @@
<link rel="stylesheet" type="text/css" href="resource://ladybird/ladybird.css" />
<link rel="stylesheet" type="text/css" href="resource://ladybird/about-pages/webui.css" />
<style>
- @media (prefers-color-scheme: light) {
- :root {
- --history-entry-hover-color: #e8e8e8;
- }
+ body {
+ max-width: 908px;
+ padding: 30px 24px;
}
- @media (prefers-color-scheme: dark) {
- :root {
- --history-entry-hover-color: #2d2d2d;
- }
+ .history-header {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ margin-bottom: 18px;
}
- .history-status {
- color: var(--secondary-text-color);
- font-size: 13px;
+ .history-header h1 {
+ flex: 1;
+ font-size: 22px;
+ font-weight: 600;
}
- .history-content {
+ .search-field {
display: flex;
- flex-direction: column;
- gap: 18px;
+ align-items: center;
+ gap: 8px;
+ width: 280px;
+ height: 28px;
+ padding: 0 10px;
+ border-radius: 7px;
+ background-color: var(--control);
}
- .history-empty {
- color: var(--secondary-text-color);
- padding: 36px 12px;
- text-align: center;
- font-size: 14px;
+ .search-field:focus-within {
+ background-color: var(--page);
+ box-shadow:
+ 0 0 0 1px var(--focus-edge),
+ 0 0 0 3px var(--focus-ring);
}
- .history-groups {
- display: flex;
- flex-direction: column;
- gap: 18px;
+ .search-field svg {
+ flex-shrink: 0;
+ width: 14px;
+ height: 14px;
+ color: var(--muted);
+ }
+
+ .search-field input,
+ .search-field input:focus {
+ flex: 1;
+ min-width: 0;
+ height: auto;
+ padding: 0;
+ background: transparent;
+ box-shadow: none;
}
- .history-group {
- border-top: 1px solid var(--separator-color);
- padding-top: 18px;
+ .history-status {
+ color: var(--muted);
+ font-size: 12px;
+ padding: 0 10px;
}
- .history-group:first-child {
- border-top: none;
- padding-top: 0;
+ .history-empty {
+ color: var(--muted);
+ padding: 36px 12px;
+ text-align: center;
}
.history-group-title {
- margin: 0 0 12px 0;
- font-size: 14px;
+ padding: 14px 10px 6px;
+ font-size: 12px;
font-weight: 600;
+ color: var(--muted);
}
.history-entry-list {
@@ -67,17 +87,23 @@
display: flex;
align-items: center;
gap: 14px;
-
- border-radius: 8px;
- padding: 10px 8px;
+ height: 32px;
+ padding: 0 6px 0 10px;
+ border-radius: 6px;
}
- .history-entry:hover {
- background-color: var(--history-entry-hover-color);
+ .history-entry:hover,
+ .history-entry:focus-within {
+ background-color: var(--control);
}
- .history-entry + .history-entry {
- margin-top: 4px;
+ .entry-time {
+ flex-shrink: 0;
+ min-width: 56px;
+ white-space: nowrap;
+ font-size: 12px;
+ color: var(--muted);
+ font-variant-numeric: tabular-nums;
}
.entry-favicon {
@@ -86,14 +112,14 @@
justify-content: center;
flex-shrink: 0;
- width: 32px;
- height: 32px;
- border-radius: 8px;
+ width: 16px;
+ height: 16px;
+ border-radius: 3px;
overflow: hidden;
- background-color: var(--icon-background-color);
- color: var(--icon-color);
- font-size: 13px;
+ background-color: var(--control);
+ color: var(--body);
+ font-size: 9px;
font-weight: 700;
text-transform: uppercase;
}
@@ -103,68 +129,73 @@
height: 100%;
}
- .entry-main {
- display: flex;
- flex: 1;
- align-items: center;
- justify-content: space-between;
- gap: 16px;
- min-width: 0;
- }
-
- .entry-text {
- display: flex;
- flex-direction: column;
+ .entry-title {
flex: 1;
- gap: 4px;
min-width: 0;
- width: 100%;
- }
-
- .entry-title {
- color: inherit;
- display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
- font-size: 14px;
- font-weight: 600;
+ color: var(--text);
text-decoration: none;
}
- .entry-title:hover {
- text-decoration: underline;
- }
-
- .entry-url {
- color: var(--secondary-text-color);
+ .entry-domain {
+ flex-shrink: 0;
+ max-width: 30%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
-
- font-size: 13px;
- }
-
- .entry-meta {
- color: var(--secondary-text-color);
- flex-shrink: 0;
- text-align: right;
font-size: 12px;
- white-space: nowrap;
+ color: var(--muted);
}
.entry-actions {
display: flex;
align-items: center;
- gap: 8px;
flex-shrink: 0;
position: relative;
}
+ .menu-toggle {
+ width: 22px;
+ height: 22px;
+ border-radius: 5px;
+ color: var(--muted);
+ visibility: hidden;
+ }
+
+ .menu-toggle svg {
+ width: 14px;
+ height: 14px;
+ }
+
+ .history-entry:hover .menu-toggle,
+ .history-entry:focus-within .menu-toggle,
+ .menu-toggle[aria-expanded="true"] {
+ visibility: visible;
+ }
+
+ .menu-dropdown {
+ border-radius: 10px;
+ padding: 6px;
+ box-shadow:
+ 0 0 0 1px var(--edge),
+ 0 14px 36px rgba(0, 0, 0, 0.16);
+ border: none;
+ }
+
+ .menu-item {
+ height: 26px;
+ padding: 0 10px;
+ border-radius: 5px;
+ font-size: 13px;
+ }
+
.history-actions {
display: flex;
justify-content: center;
+ margin-top: 16px;
}
.visually-hidden {
@@ -177,65 +208,33 @@
clip: rect(0, 0, 0, 0);
border: 0;
}
-
- @media (max-width: 640px) {
- .history-entry {
- align-items: flex-start;
- }
-
- .entry-main {
- flex-direction: column;
- align-items: flex-start;
- }
-
- .entry-meta {
- text-align: left;
- }
- }
</style>
</head>
<body>
- <header>
- <picture>
- <source srcset="resource://icons/128x128/app-browser.png" media="(prefers-color-scheme: dark)" />
- <img src="resource://icons/128x128/app-browser-dark.png" />
- </picture>
+ <div class="history-header">
<h1>History</h1>
- </header>
-
- <div class="search-container">
- <label class="visually-hidden" for="history-search">Search history</label>
- <svg
- class="search-icon"
- xmlns="http://www.w3.org/2000/svg"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- stroke-width="2"
- aria-hidden="true"
- >
- <circle cx="11" cy="11" r="7" />
- <line x1="16" y1="16" x2="22" y2="22" />
- </svg>
- <input
- id="history-search"
- type="search"
- class="search-input"
- placeholder="Search history"
- spellcheck="false"
- autofocus
- />
+ <label class="search-field">
+ <span class="visually-hidden">Search history</span>
+ <svg
+ viewBox="0 0 16 16"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="1.5"
+ stroke-linecap="round"
+ aria-hidden="true"
+ >
+ <path d="M7 2.5a4.5 4.5 0 1 1 0 9a4.5 4.5 0 1 1 0-9zM10.5 10.5L14 14" />
+ </svg>
+ <input id="history-search" type="search" placeholder="Search history" spellcheck="false" autofocus />
+ </label>
+ <button id="clear-history" class="secondary-button">Clear history…</button>
</div>
- <div class="card">
- <div class="card-body history-content">
- <div id="history-status" class="history-status">Loading history...</div>
- <div id="history-empty" class="history-empty hidden"></div>
- <div id="history-groups" class="history-groups"></div>
- <div id="history-actions" class="history-actions hidden">
- <button id="load-more" class="secondary-button">Load more</button>
- </div>
- </div>
+ <div id="history-status" class="history-status">Loading history…</div>
+ <div id="history-empty" class="history-empty hidden"></div>
+ <div id="history-groups" class="history-groups"></div>
+ <div id="history-actions" class="history-actions hidden">
+ <button id="load-more" class="secondary-button">Load more</button>
</div>
<script type="module">
@@ -250,6 +249,7 @@
const loadMoreButton = document.querySelector("#load-more");
const timeFormatter = new Intl.DateTimeFormat([], { timeStyle: "short" });
+ const todayFormatter = new Intl.DateTimeFormat([], { weekday: "long", month: "long", day: "numeric" });
const dateFormatter = new Intl.DateTimeFormat([], {
weekday: "long",
month: "long",
@@ -267,10 +267,6 @@
query: "",
};
- function pluralize(count, singular, plural = `${singular}s`) {
- return `${count} ${count === 1 ? singular : plural}`;
- }
-
function startOfDay(date) {
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
}
@@ -281,16 +277,14 @@
const entryDay = startOfDay(entryDate);
const dayDelta = Math.round((today.getTime() - entryDay.getTime()) / 86400000);
- if (dayDelta === 0) return "Today";
+ if (dayDelta === 0) return `Today · ${todayFormatter.format(entryDate)}`;
if (dayDelta === 1) return "Yesterday";
return dateFormatter.format(entryDate);
}
function entryTimeLabel(entry) {
- const timeLabel = timeFormatter.format(new Date(entry.lastVisitedTime));
- if (entry.visitCount <= 1) return timeLabel;
- return `${timeLabel} - ${pluralize(entry.visitCount, "visit")}`;
+ return timeFormatter.format(new Date(entry.lastVisitedTime));
}
function faviconFallbackLabel(entry) {
@@ -359,10 +353,10 @@
className: "menu-toggle",
title: "History entry options",
innerHTML: `
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
- <circle cx="12" cy="5" r="2" />
- <circle cx="12" cy="12" r="2" />
- <circle cx="12" cy="19" r="2" />
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true">
+ <circle cx="3.5" cy="8" r="1.25" />
+ <circle cx="8" cy="8" r="1.25" />
+ <circle cx="12.5" cy="8" r="1.25" />
</svg>
`,
});
@@ -419,27 +413,27 @@
return menu;
}
+ function entryDomain(entry) {
+ try {
+ return new URL(entry.url).host;
+ } catch {
+ return "";
+ }
+ }
+
function createEntryRow(entry) {
const title = entry.title || entry.url;
return createElement("div", { className: "history-entry" }, [
+ createElement("span", { className: "entry-time", textContent: entryTimeLabel(entry) }),
createFavicon(entry),
- createElement("div", { className: "entry-main" }, [
- createElement("div", { className: "entry-text" }, [
- createElement("a", {
- className: "entry-title",
- href: entry.url,
- textContent: title,
- title,
- }),
- createElement("div", {
- className: "entry-url",
- textContent: entry.url,
- title: entry.url,
- }),
- ]),
- createElement("div", { className: "entry-meta", textContent: entryTimeLabel(entry) }),
- ]),
+ createElement("a", {
+ className: "entry-title",
+ href: entry.url,
+ textContent: title,
+ title: entry.url,
+ }),
+ createElement("span", { className: "entry-domain", textContent: entryDomain(entry) }),
createEntryMenu(entry, title),
]);
}
@@ -470,32 +464,27 @@
function renderStatus() {
if (state.isLoading && state.entries.length === 0) {
- historyStatus.textContent = "Loading history...";
+ historyStatus.textContent = "Loading history…";
return;
}
if (state.query) {
if (state.isLoading) {
- historyStatus.textContent = `Searching for "${state.query}"...`;
+ historyStatus.textContent = `Searching for "${state.query}"…`;
return;
}
- historyStatus.textContent =
- state.entries.length === 0
- ? `No results for "${state.query}".`
- : `${pluralize(state.entries.length, "result")} loaded for "${state.query}".`;
+ historyStatus.textContent = "";
return;
}
if (state.isLoading) {
- historyStatus.textContent = "Loading more history...";
+ historyStatus.textContent = "Loading more history…";
return;
}
- historyStatus.textContent =
- state.entries.length === 0
- ? "No browsing history yet."
- : `${pluralize(state.entries.length, "entry", "entries")} loaded.`;
+ // The list speaks for itself, and the empty state explains an empty one.
+ historyStatus.textContent = "";
}
function renderEmptyState() {
@@ -513,7 +502,7 @@
const shouldShowLoadMore = state.hasMore || state.isLoading;
historyActions.classList.toggle("hidden", !shouldShowLoadMore);
loadMoreButton.disabled = state.isLoading;
- loadMoreButton.textContent = state.isLoading ? "Loading..." : "Load more";
+ loadMoreButton.textContent = state.isLoading ? "Loading…" : "Load more";
}
function render() {
@@ -545,6 +534,11 @@
searchTimer = setTimeout(() => refreshHistory(), SEARCH_DEBOUNCE_DELAY);
}
+ // Clearing history is one of the choices in Settings' dialog for clearing browsing data.
+ document.querySelector("#clear-history").addEventListener("click", () => {
+ location.href = "about:settings#clearBrowsingData";
+ });
+
searchInput.addEventListener("input", scheduleSearch);
searchInput.addEventListener("search", scheduleSearch);
loadMoreButton.addEventListener("click", () => {
diff --git a/Base/res/ladybird/about-pages/search-engine-controls.js b/Base/res/ladybird/about-pages/search-engine-controls.js
deleted file mode 100644
index e92e2c0c69e..00000000000
--- a/Base/res/ladybird/about-pages/search-engine-controls.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2026-present, the Ladybird developers.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-export function populateSearchEngineSelect(select, engines, settings = {}) {
- const disabledOption = select.options[0];
- select.replaceChildren(disabledOption, document.createElement("hr"));
-
- function addEngine(engine) {
- const option = document.createElement("option");
- option.value = option.textContent = engine.name;
- option.dataset.supportsSuggestions = Boolean(engine.supportsSuggestions || engine.suggestionsUrl);
- select.append(option);
- }
-
- engines.forEach(addEngine);
- if (settings.custom?.length) {
- select.append(document.createElement("hr"));
- settings.custom.forEach(addEngine);
- }
- select.value = settings.engine || "";
-}
-
-export function updateSearchSuggestionsControl(select, checkbox, description) {
- const supportsSuggestions = select.selectedOptions[0]?.dataset.supportsSuggestions === "true";
- checkbox.disabled = !supportsSuggestions;
- if (!description) return;
- if (!select.value) description.textContent = "Choose a search engine to use search suggestions.";
- else if (!supportsSuggestions) description.textContent = `Search suggestions aren't available for ${select.value}.`;
- else description.textContent = `Sends what you type to ${select.value}.`;
-}
diff --git a/Base/res/ladybird/about-pages/settings.html b/Base/res/ladybird/about-pages/settings.html
index 698f7dddafe..5c28fdb17fa 100644
--- a/Base/res/ladybird/about-pages/settings.html
+++ b/Base/res/ladybird/about-pages/settings.html
@@ -59,7 +59,6 @@
.inline-container input[type="number"],
.inline-container input[type="text"],
.inline-container input[type="url"],
- .inline-container select,
.inline-container textarea {
width: 50%;
}
@@ -68,8 +67,18 @@
flex-shrink: 0;
}
- .inline-container > label,
- .filter-list-row label {
+ #tab-advanced .search-container {
+ width: auto;
+ margin-bottom: 16px;
+ }
+
+ #tab-layout-group {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ }
+
+ .inline-container > label {
max-width: 60ch;
margin-bottom: 0;
}
@@ -111,35 +120,10 @@
margin: 0 0 16px;
}
- .filter-list-collection {
- margin-top: 16px;
- }
-
- .filter-list-header {
- margin-bottom: 16px;
- }
-
- .filter-list-header .card-title {
- margin: 0;
- }
-
- .filter-list-metadata {
- font-size: 12px;
- }
-
.tab-panel > .description {
margin-bottom: 16px;
}
- .filter-list-row > div:first-child {
- min-width: 0;
- overflow-wrap: anywhere;
- }
-
- .filter-list-row .input-field-container {
- flex-shrink: 0;
- }
-
.form-row input {
flex: 1;
}
@@ -153,36 +137,66 @@
input[type="search"],
input[type="text"],
input[type="url"],
- select,
textarea {
- background-color: var(--input-background-color);
+ color: var(--text);
+ background-color: var(--control);
width: 100%;
- border: 1px solid var(--border-color);
+ border: none;
+ border-radius: 7px;
+ }
+
+ input[type="number"],
+ input[type="search"],
+ input[type="text"],
+ input[type="url"] {
+ height: 28px;
}
textarea {
- font-size: inherit;
+ font: inherit;
line-height: inherit;
- padding: 10px 12px;
+ padding: 6px 10px;
resize: vertical;
}
- input[type="number"].success,
- input[type="text"].success,
- input[type="url"].success {
- border: 1px solid green;
+ input[type="number"]:focus-visible,
+ input[type="search"]:focus-visible,
+ input[type="text"]:focus-visible,
+ input[type="url"]:focus-visible,
+ textarea:focus-visible {
+ background-color: var(--page);
+ outline: none;
+ box-shadow:
+ 0 0 0 1px var(--focus-edge),
+ 0 0 0 3px var(--focus-ring);
+ }
+
+ textarea:focus {
+ outline: none;
}
input[type="number"].error,
input[type="text"].error,
input[type="url"].error {
- border: 1px solid red;
+ box-shadow: inset 0 0 0 1px var(--error);
+ }
+
+ input[type="number"].error:focus-visible,
+ input[type="text"].error:focus-visible,
+ input[type="url"].error:focus-visible {
+ box-shadow:
+ inset 0 0 0 1px var(--error),
+ 0 0 0 1px var(--focus-edge),
+ 0 0 0 3px var(--focus-ring);
}
dialog {
- background-color: var(--card-background-color);
- box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
+ color: var(--text);
+ background-color: var(--surface);
+ box-shadow:
+ 0 0 0 1px var(--edge),
+ var(--dialog-shadow);
width: 90%;
max-width: 500px;
@@ -190,8 +204,8 @@
margin: auto;
padding: 0;
- border: 1px solid var(--border-color);
- border-radius: 8px;
+ border: none;
+ border-radius: 12px;
outline: none;
}
@@ -200,8 +214,6 @@
}
dialog .dialog-header {
- background-color: var(--card-header-background-color);
-
display: flex;
justify-content: space-between;
align-items: center;
@@ -248,8 +260,8 @@
}
dialog .dialog-title {
- font-size: 18px;
- font-weight: 500;
+ font-size: 15px;
+ font-weight: 600;
}
dialog .dialog-button {
@@ -274,8 +286,8 @@
}
dialog .dialog-list {
- outline: 1px solid var(--border-color);
- border-radius: 4px;
+ border-radius: 10px;
+ box-shadow: inset 0 0 0 1px var(--separator);
margin: 10px 0;
@@ -294,7 +306,7 @@
}
dialog .dialog-list-item:hover {
- background-color: var(--card-header-background-color);
+ background-color: var(--control);
}
dialog .dialog-list-item-placeholder {
@@ -324,16 +336,6 @@
flex-grow: 1;
}
- .config-name {
- font-family: monospace;
- font-size: 13px;
-
- margin-top: 6px;
-
- opacity: 0.7;
- overflow-wrap: anywhere;
- }
-
.tab-bar {
display: flex;
gap: 4px;
@@ -382,17 +384,7 @@
margin-bottom: 20px;
}
- textarea:focus {
- border-color: var(--accent);
- outline: 2px solid var(--accent);
- outline-offset: 1px;
- }
-
@media (max-width: 600px) {
- .filter-list-row {
- align-items: flex-start;
- }
-
.form-row {
align-items: stretch;
flex-direction: column;
@@ -402,424 +394,842 @@
align-self: flex-end;
}
}
+ /* The Quiet design: a sidebar of sections, and each section's settings as rows divided by soft lines. */
+ body {
+ display: grid;
+ grid-template-columns: 232px minmax(0, 1fr);
+ align-items: start;
+ max-width: none;
+ min-height: 100vh;
+ padding: 0;
+ font-size: 13px;
+ }
+
+ .settings-sidebar {
+ position: sticky;
+ top: 0;
+ display: flex;
+ flex-direction: column;
+ height: 100vh;
+ box-sizing: border-box;
+ padding: 28px 12px;
+ border-right: 1px solid var(--separator-soft);
+ overflow: auto;
+ }
+
+ .search-field {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ height: 28px;
+ margin: 0 0 14px;
+ padding: 0 10px;
+ border-radius: 7px;
+ background-color: var(--control);
+ }
+
+ .search-field:focus-within {
+ background-color: var(--page);
+ box-shadow:
+ 0 0 0 1px var(--focus-edge),
+ 0 0 0 3px var(--focus-ring);
+ }
+
+ .search-field svg {
+ flex-shrink: 0;
+ width: 14px;
+ height: 14px;
+ color: var(--muted);
+ }
+
+ .search-field input,
+ .search-field input:focus {
+ flex: 1;
+ min-width: 0;
+ height: auto;
+ padding: 0;
+ border: none;
+ background: transparent;
+ box-shadow: none;
+ }
+
+ .visually-hidden {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ margin: -1px;
+ padding: 0;
+ overflow: hidden;
+ clip: rect(0, 0, 0, 0);
+ border: 0;
+ }
+
+ .tab-bar {
+ flex-direction: column;
+ gap: 2px;
+ margin: 0;
+ border-bottom: none;
+ }
+
+ .tab-button {
+ height: 30px;
+ padding: 0 10px;
+ border: none;
+ border-radius: 6px;
+ font-size: 13px;
+ font-weight: 400;
+ text-align: left;
+ opacity: 1;
+ }
+
+ .tab-button:hover {
+ background-color: var(--control);
+ opacity: 1;
+ }
+
+ .tab-button.active {
+ background-color: var(--control);
+ }
+
+ .settings-content {
+ max-width: 712px;
+ padding: 28px 56px;
+ }
+
+ .tab-panel::before {
+ content: attr(data-title);
+ display: block;
+ margin-bottom: 10px;
+ font-size: 22px;
+ font-weight: 600;
+ line-height: 28px;
+ }
+
+ /* A list of choices or of items, in one rounded box with soft lines between its rows. */
+ .boxed-list {
+ border-radius: 10px;
+ box-shadow: inset 0 0 0 1px var(--separator);
+ overflow: hidden;
+ }
+
+ .boxed-list > * {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ min-height: 40px;
+ margin: 0;
+ padding: 8px 14px;
+ box-sizing: border-box;
+ }
+
+ .boxed-list > * + * {
+ border-top: 1px solid var(--separator-soft);
+ }
+
+ .boxed-list .item-name {
+ display: flex;
+ flex: 1;
+ flex-direction: column;
+ gap: 1px;
+ min-width: 0;
+ margin: 0;
+ overflow-wrap: anywhere;
+ }
+
+ .boxed-list .item-name .description {
+ margin: 0;
+ font-size: 12px;
+ }
+
+ .list-heading {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ gap: 16px;
+ margin-bottom: 10px;
+ }
+
+ .list-footer {
+ display: flex;
+ justify-content: flex-end;
+ margin-top: 6px;
+ }
+
+ .search-suggestions-row {
+ border-top: 1px solid var(--separator-soft);
+ }
+
+ .add-filter-list:not([hidden]) {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ margin-top: 12px;
+ }
+
+ .add-filter-list .description {
+ margin: 0;
+ }
+
+ .add-filter-list button {
+ flex-shrink: 0;
+ white-space: nowrap;
+ }
+
+ .list-section {
+ padding: 16px 0 6px;
+ }
+
+ button.link-button {
+ height: auto;
+ margin: 0;
+ padding: 2px 4px;
+ border: none;
+ border-radius: 5px;
+ background: transparent;
+ font-size: 12px;
+ color: var(--link);
+ cursor: pointer;
+ }
+
+ button.link-button:hover {
+ background: var(--control);
+ }
+
+ .engine-choice {
+ cursor: pointer;
+ }
+
+ .engine-choice input {
+ position: absolute;
+ opacity: 0;
+ pointer-events: none;
+ }
+
+ .engine-choice:has(input:checked) {
+ background: var(--choice-fill);
+ }
+
+ .engine-choice:has(input:focus-visible) {
+ box-shadow: inset 0 0 0 1.5px var(--choice);
+ }
+
+ .engine-name {
+ flex: 1;
+ }
+
+ .empty-tile {
+ flex-shrink: 0;
+ width: 18px;
+ height: 18px;
+ border-radius: 4px;
+ box-shadow: inset 0 0 0 1px var(--separator);
+ }
+
+ .engine-check {
+ width: 14px;
+ height: 14px;
+ fill: none;
+ stroke: var(--choice);
+ stroke-width: 1.8;
+ stroke-linecap: round;
+ stroke-linejoin: round;
+ visibility: hidden;
+ }
+
+ .engine-choice:has(input:checked) .engine-check {
+ visibility: visible;
+ }
+
+ .filter-list-row input[type="checkbox"] {
+ flex-shrink: 0;
+ margin: 0;
+ }
+
+ /* While searching, every section shows the settings that match, and the sidebar selects none. */
+ body.searching .tab-panel:not(.search-miss) {
+ display: block;
+ }
+
+ body.searching .tab-panel + .tab-panel:not(.search-miss) {
+ margin-top: 30px;
+ }
+
+ body.searching .tab-panel > .description,
+ body.searching .search-miss {
+ display: none !important;
+ }
+
+ body.searching .tab-button.active {
+ background-color: transparent;
+ }
+
+ .search-empty {
+ padding: 36px 0;
+ color: var(--muted);
+ text-align: center;
+ }
+
+ .card-title {
+ margin: 24px 0 2px;
+ font-size: 13px;
+ font-weight: 600;
+ color: var(--muted);
+ }
+
+ .card,
+ .card.card-body {
+ background: none;
+ border: none;
+ border-radius: 0;
+ margin-bottom: 0;
+ }
+
+ .card-body,
+ .card.card-body {
+ padding: 0;
+ }
+
+ .card-group,
+ .card.card-body.inline-container {
+ padding: 14px 0;
+ border-bottom: 1px solid var(--separator-soft);
+ }
+
+ .card-group:not(.hidden) ~ .card-group:not(.hidden) {
+ margin-top: 0;
+ padding-top: 14px;
+ border-top: none;
+ }
+
+ @media (max-width: 720px) {
+ body {
+ grid-template-columns: minmax(0, 1fr);
+ }
+
+ .settings-sidebar {
+ position: static;
+ height: auto;
+ padding: 12px;
+ border-right: none;
+ border-bottom: 1px solid var(--separator-soft);
+ }
+
+ .tab-bar {
+ flex-direction: row;
+ overflow-x: auto;
+ }
+
+ .settings-content {
+ padding: 20px;
+ }
+ }
</style>
</head>
<body>
- <header>
- <picture>
- <source srcset="resource://icons/128x128/app-browser.png" media="(prefers-color-scheme: dark)" />
- <img src="resource://icons/128x128/app-browser-dark.png" />
- </picture>
- <h1>Ladybird Settings</h1>
- </header>
-
- <div class="tab-bar" role="tablist" aria-label="Settings categories">
- <button id="tab-button-general" class="tab-button active" data-tab="general" role="tab">General</button>
- <button id="tab-button-search" class="tab-button" data-tab="search" role="tab">Search</button>
- <button id="tab-button-permissions" class="tab-button" data-tab="permissions" role="tab">
- Permissions
- </button>
- <button id="tab-button-privacy" class="tab-button" data-tab="privacy" role="tab">Privacy</button>
- <button id="tab-button-blocking" class="tab-button" data-tab="blocking" role="tab">Blocking</button>
- <button id="tab-button-services" class="tab-button" data-tab="services" role="tab">Services</button>
- <button id="tab-button-network" class="tab-button" data-tab="network" role="tab">Network</button>
- <button id="tab-button-advanced" class="tab-button" data-tab="advanced" role="tab">Advanced</button>
- </div>
-
- <div class="tab-panel active" id="tab-general">
- <h3 class="card-title">Startup</h3>
- <div class="card">
- <div class="card-body">
- <div class="card-group inline-container">
- <label for="restore-previous-session">Restore previous windows and tabs</label>
- <input id="restore-previous-session" type="checkbox" switch />
- </div>
- <div class="card-group inline-container">
- <label for="new-tab-page-url">New tab page URL</label>
- <div class="input-with-reset">
- <input id="new-tab-page-url" type="url" placeholder="about:newtab" />
- <button id="new-tab-page-url-reset" class="input-reset-button" title="Restore default">
- &times;
- </button>
+ <nav class="settings-sidebar">
+ <label class="search-field">
+ <span class="visually-hidden">Search settings</span>
+ <svg
+ viewBox="0 0 16 16"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="1.5"
+ stroke-linecap="round"
+ aria-hidden="true"
+ >
+ <path d="M7 2.5a4.5 4.5 0 1 1 0 9a4.5 4.5 0 1 1 0-9zM10.5 10.5L14 14" />
+ </svg>
+ <input id="settings-search" type="search" placeholder="Search settings" spellcheck="false" />
+ </label>
+ <div class="tab-bar" role="tablist" aria-label="Settings categories">
+ <button id="tab-button-general" class="tab-button active" data-tab="general" role="tab">General</button>
+ <button id="tab-button-search" class="tab-button" data-tab="search" role="tab">Search</button>
+ <button id="tab-button-appearance" class="tab-button" data-tab="appearance" role="tab">
+ Appearance
+ </button>
+ <button id="tab-button-privacy" class="tab-button" data-tab="privacy" role="tab">
+ Privacy and security
+ </button>
+ <button id="tab-button-permissions" class="tab-button" data-tab="permissions" role="tab">
+ Permissions
+ </button>
+ <button id="tab-button-blocking" class="tab-button" data-tab="blocking" role="tab">
+ Content blocking
+ </button>
+ <button id="tab-button-languages" class="tab-button" data-tab="languages" role="tab">Languages</button>
+ <button id="tab-button-services" class="tab-button" data-tab="services" role="tab">Services</button>
+ <button id="tab-button-network" class="tab-button" data-tab="network" role="tab">Network</button>
+ <button id="tab-button-advanced" class="tab-button" data-tab="advanced" role="tab">Advanced</button>
+ </div>
+ </nav>
+
+ <main class="settings-content">
+ <p id="search-empty" class="search-empty" hidden>No settings match this search.</p>
+ <div class="tab-panel active" id="tab-general" data-title="General">
+ <h3 class="card-title">Startup</h3>
+ <div class="card">
+ <div class="card-body">
+ <div class="card-group inline-container">
+ <label for="restore-previous-session">Restore previous windows and tabs</label>
+ <input id="restore-previous-session" type="checkbox" switch />
+ </div>
+ <div class="card-group inline-container">
+ <label for="new-tab-page-url">New tab page URL</label>
+ <div class="input-with-reset">
+ <input id="new-tab-page-url" type="url" placeholder="about:blank" />
+ <button id="new-tab-page-url-reset" class="input-reset-button" title="Restore default">
+ &times;
+ </button>
+ </div>
</div>
</div>
</div>
- </div>
- <h3 class="card-title">Appearance</h3>
- <div class="card">
- <div class="card-body">
- <div class="card-group inline-container" id="show-menu-bar-group">
- <label for="show-menu-bar">Show system menu bar</label>
- <input id="show-menu-bar" type="checkbox" switch />
- </div>
- <div class="card-group inline-container">
- <label for="show-bookmarks-bar">Show bookmarks bar</label>
- <select id="show-bookmarks-bar">
- <option value="always">Always</option>
- <option value="never">Never</option>
- <option value="onHover">Only when hovering the navigation toolbar</option>
- </select>
- </div>
- <div class="card-group inline-container">
- <label for="enable-vertical-tabs">Use vertical tabs</label>
- <input id="enable-vertical-tabs" type="checkbox" switch />
- </div>
- <div class="card-group inline-container hidden">
- <label for="vertical-tabs-expand-on-hover">Expand vertical tabs on hover when collapsed</label>
- <input id="vertical-tabs-expand-on-hover" type="checkbox" switch />
- </div>
- <div class="card-group inline-container hidden">
- <label for="vertical-tabs-position">Vertical tabs side</label>
- <select id="vertical-tabs-position">
- <option value="left">Left</option>
- <option value="right">Right</option>
- </select>
+ <h3 class="card-title">Content</h3>
+ <div class="card">
+ <div class="card-body">
+ <div class="card-group inline-container">
+ <label for="enable-force-dark">
+ Force dark mode
+ <p class="description">
+ Darken web pages that don’t provide a dark theme of their own. Photos are left as
+ they are; icons and line art are darkened along with the page.
+ </p>
+ </label>
+ <input id="enable-force-dark" type="checkbox" switch />
+ </div>
</div>
</div>
- </div>
- <h3 class="card-title">Content</h3>
- <div class="card">
- <div class="card-body">
- <div class="card-group inline-container">
- <label for="default-zoom-level">Default zoom level</label>
- <select id="default-zoom-level"></select>
- </div>
- <div class="card-group inline-container">
- <label for="enable-force-dark">
- Force dark mode
- <p class="description">
- Darken web pages that don’t provide a dark theme of their own. Photos are left as they
- are; icons and line art are darkened along with the page.
- </p>
- </label>
- <input id="enable-force-dark" type="checkbox" switch />
+ <h3 class="card-title">Browsing behavior</h3>
+ <div class="card">
+ <div class="card-body">
+ <div class="card-group inline-container">
+ <label for="enable-autoscroll">
+ Enable autoscrolling
+ <p class="description">
+ Scroll pages by pressing the middle mouse button and moving the mouse.
+ </p>
+ </label>
+ <input id="enable-autoscroll" type="checkbox" switch />
+ </div>
+ <div class="card-group inline-container" id="enable-primary-paste-group">
+ <label for="enable-primary-paste">
+ Enable primary pasting
+ <p class="description">
+ Paste text from the clipboard when the middle mouse button is clicked.
+ </p>
+ </label>
+ <input id="enable-primary-paste" type="checkbox" switch />
+ </div>
</div>
- <div class="card-group inline-container">
- <label for="languages-settings">Languages</label>
- <button id="languages-settings" class="secondary-button">Settings...</button>
+ </div>
+
+ <h3 class="card-title">Crash reports</h3>
+ <div class="card">
+ <div class="card-body">
+ <div class="inline-container">
+ <p>Open the folder containing saved crash reports.</p>
+ <button id="open-crash-reports" class="secondary-button">Open folder</button>
+ </div>
+ <p id="crash-reports-status" class="description" role="status" hidden></p>
</div>
</div>
</div>
- <h3 class="card-title">Browsing behavior</h3>
- <div class="card">
- <div class="card-body">
- <div class="card-group inline-container">
- <label for="enable-autoscroll">
- Enable autoscrolling
- <p class="description">
- Scroll pages by pressing the middle mouse button and moving the mouse.
- </p>
- </label>
- <input id="enable-autoscroll" type="checkbox" switch />
- </div>
- <div class="card-group inline-container" id="enable-primary-paste-group">
- <label for="enable-primary-paste">
- Enable primary pasting
- <p class="description">
- Paste text from the clipboard when the middle mouse button is clicked.
- </p>
- </label>
- <input id="enable-primary-paste" type="checkbox" switch />
+ <div class="tab-panel" id="tab-appearance" data-title="Appearance">
+ <div class="card">
+ <div class="card-body">
+ <div class="card-group inline-container">
+ <span>Theme</span>
+ <div id="interface-theme" class="segmented" role="radiogroup" aria-label="Theme">
+ <label><input type="radio" name="interface-theme" value="system" />System</label>
+ <label><input type="radio" name="interface-theme" value="light" />Light</label>
+ <label><input type="radio" name="interface-theme" value="dark" />Dark</label>
+ </div>
+ </div>
+ <div class="card-group inline-container">
+ <span>
+ Website appearance
+ <p class="description">
+ Whether websites are asked to show their light or dark design.
+ </p>
+ </span>
+ <div
+ id="website-color-scheme"
+ class="segmented"
+ role="radiogroup"
+ aria-label="Website appearance"
+ >
+ <label><input type="radio" name="website-color-scheme" value="system" />System</label>
+ <label><input type="radio" name="website-color-scheme" value="light" />Light</label>
+ <label><input type="radio" name="website-color-scheme" value="dark" />Dark</label>
+ </div>
+ </div>
+ <div id="tab-layout-group" class="card-group">
+ <span id="tab-layout-title">Tabs</span>
+ <div class="tab-options" role="radiogroup" aria-labelledby="tab-layout-title">
+ <label class="tab-option">
+ <input type="radio" name="tab-layout" value="horizontal" />
+ <span class="tab-preview horizontal-preview" aria-hidden="true">
+ <span class="preview-strip"><i class="active"></i><i></i><i></i></span>
+ <span class="preview-toolbar"><i></i></span>
+ </span>
+ <span class="tab-option-label">Along the top</span>
+ </label>
+ <label class="tab-option">
+ <input type="radio" name="tab-layout" value="vertical" />
+ <span class="tab-preview vertical-preview" aria-hidden="true">
+ <span class="preview-sidebar"><i></i><i class="active"></i><i></i></span>
+ <span class="preview-main"
+ ><span class="preview-toolbar"><i></i></span
+ ></span>
+ </span>
+ <span class="tab-option-label">Down the side</span>
+ </label>
+ </div>
+ </div>
+ <div class="card-group inline-container" id="show-menu-bar-group">
+ <label for="show-menu-bar">Show system menu bar</label>
+ <input id="show-menu-bar" type="checkbox" switch />
+ </div>
+ <div class="card-group inline-container">
+ <label for="show-bookmarks-bar">Show bookmarks bar</label>
+ <select id="show-bookmarks-bar">
+ <option value="always">Always</option>
+ <option value="never">Never</option>
+ <option value="onHover">Only when hovering the navigation toolbar</option>
+ </select>
+ </div>
+ <div class="card-group inline-container hidden">
+ <label for="vertical-tabs-expand-on-hover"
+ >Expand vertical tabs on hover when collapsed</label
+ >
+ <input id="vertical-tabs-expand-on-hover" type="checkbox" switch />
+ </div>
+ <div class="card-group inline-container hidden">
+ <label for="vertical-tabs-position">Vertical tabs side</label>
+ <select id="vertical-tabs-position">
+ <option value="left">Left</option>
+ <option value="right">Right</option>
+ </select>
+ </div>
+ <div class="card-group inline-container">
+ <label for="default-zoom-level">Default page zoom</label>
+ <select id="default-zoom-level"></select>
+ </div>
</div>
</div>
</div>
- <h3 class="card-title">Crash reports</h3>
- <div class="card">
- <div class="card-body">
- <div class="inline-container">
- <p>Open the folder containing saved crash reports.</p>
- <button id="open-crash-reports" class="secondary-button">Open folder</button>
+ <div class="tab-panel" id="tab-search" data-title="Search">
+ <div class="card">
+ <div class="card-body">
+ <div class="list-section">
+ <div class="list-heading">
+ <span id="search-engine-title">Search engine</span>
+ </div>
+ <div
+ id="search-engine"
+ class="boxed-list"
+ role="radiogroup"
+ aria-labelledby="search-engine-title"
+ ></div>
+ <div class="list-footer">
+ <button id="search-settings" class="link-button">Custom search engines…</button>
+ </div>
+ </div>
+ <div class="card-group inline-container search-suggestions-row">
+ <label for="search-suggestions-enabled">
+ Show search suggestions
+ <p id="search-suggestions-description" class="description"></p>
+ </label>
+ <input
+ id="search-suggestions-enabled"
+ type="checkbox"
+ switch
+ aria-describedby="search-suggestions-description"
+ />
+ </div>
</div>
- <p id="crash-reports-status" class="description" role="status" hidden></p>
</div>
</div>
- </div>
-
- <div class="tab-panel" id="tab-search">
- <div class="card">
- <div class="card-body">
- <div class="card-group">
- <label>
- Default search engine
- <p class="description">Select the search engine to use in the address bar.</p>
- </label>
- <div class="inline-container">
- <select id="search-engine" style="width: 100%">
- <option value="">Disable search</option>
- <hr />
- </select>
- <button id="search-settings" class="secondary-button">Settings...</button>
+
+ <div class="tab-panel" id="tab-permissions" data-title="Permissions">
+ <div class="card">
+ <div class="card-body">
+ <div class="card-group inline-container">
+ <span>Autoplay</span>
+ <span id="autoplay-forcibly-enabled" class="forcibly-enabled hidden">
+ This setting is controlled via the command line
+ </span>
+ <button id="autoplay-settings" class="secondary-button">Settings…</button>
</div>
</div>
- <div class="card-group inline-container">
- <label for="search-suggestions-enabled">
- Show search suggestions
- <p id="search-suggestions-description" class="description"></p>
- </label>
- <input
- id="search-suggestions-enabled"
- type="checkbox"
- switch
- aria-describedby="search-suggestions-description"
- />
- </div>
</div>
- </div>
- </div>
- <div class="tab-panel" id="tab-permissions">
- <div class="card">
- <div class="card-body">
- <div class="card-group inline-container">
- <span>Autoplay</span>
- <span id="autoplay-forcibly-enabled" class="forcibly-enabled hidden">
- This setting is controlled via the command line
- </span>
- <button id="autoplay-settings" class="secondary-button">Settings...</button>
+ <div class="card">
+ <div class="card-body">
+ <div class="card-group inline-container">
+ <label for="enable-geolocation">
+ Enable geolocation
+ <p class="description">Allow websites to request your actual location.</p>
+ </label>
+ <input id="enable-geolocation" type="checkbox" switch />
+ </div>
</div>
</div>
</div>
- <div class="card">
- <div class="card-body">
- <div class="card-group inline-container">
- <label for="enable-geolocation">
- Enable geolocation
- <p class="description">Allow websites to request your actual location.</p>
- </label>
- <input id="enable-geolocation" type="checkbox" switch />
+ <div class="tab-panel" id="tab-privacy" data-title="Privacy and security">
+ <h3 class="card-title">Browsing data</h3>
+ <div class="card">
+ <div class="card-body">
+ <p id="browsing-data-total-size" class="card-group"></p>
+
+ <div class="card-group">
+ <div class="inline-container">
+ <div>
+ <label for="browsing-data-settings-max-disk-cache-size">
+ Maximum disk cache size
+ <p class="description">Limit the space used for the HTTP disk cache.</p>
+ </label>
+ </div>
+ <div class="input-field-container">
+ <input
+ id="browsing-data-settings-max-disk-cache-size"
+ type="number"
+ min="1"
+ style="width: 150px"
+ />
+ <select id="browsing-data-settings-max-disk-cache-unit" style="width: 80px">
+ <option value="MiB">MiB</option>
+ <option value="GiB">GiB</option>
+ </select>
+ </div>
+ </div>
+ </div>
</div>
</div>
- </div>
- </div>
- <div class="tab-panel" id="tab-privacy">
- <h3 class="card-title">Browsing data</h3>
- <div class="card">
- <div class="card-body">
- <p id="browsing-data-total-size" class="card-group"></p>
+ <div class="card">
+ <div class="card-body">
+ <div class="card-group inline-container">
+ <span>Clear browsing data</span>
+ <button id="browsing-data-settings" class="secondary-button">Clear…</button>
+ </div>
+ </div>
+ </div>
- <div class="card-group">
- <div class="inline-container">
- <div>
- <label for="browsing-data-settings-max-disk-cache-size">
- Maximum disk cache size
- <p class="description">Limit the space used for the HTTP disk cache.</p>
+ <h3 class="card-title">Privacy</h3>
+ <div class="card">
+ <div class="card-body">
+ <div class="card-group">
+ <div class="inline-container">
+ <label for="global-privacy-control-toggle">
+ Global Privacy Control
+ <p class="description">Tell websites not to sell or share your data.</p>
</label>
- </div>
- <div class="input-field-container">
- <input
- id="browsing-data-settings-max-disk-cache-size"
- type="number"
- min="1"
- style="width: 150px"
- />
- <select id="browsing-data-settings-max-disk-cache-unit" style="width: 80px">
- <option value="MiB">MiB</option>
- <option value="GiB">GiB</option>
- </select>
+ <input id="global-privacy-control-toggle" type="checkbox" switch />
</div>
</div>
</div>
</div>
</div>
- <div class="card">
- <div class="card-body">
+ <div class="tab-panel" id="tab-blocking" data-title="Content blocking">
+ <div class="card card-body">
<div class="card-group inline-container">
- <span>Clear browsing data</span>
- <button id="browsing-data-settings" class="secondary-button">Clear...</button>
+ <label for="enable-content-blocking">Block ads, trackers and more</label>
+ <input id="enable-content-blocking" type="checkbox" switch />
</div>
</div>
- </div>
-
- <h3 class="card-title">Privacy</h3>
- <div class="card">
- <div class="card-body">
- <div class="card-group">
+ <template id="filter-list-row">
+ <div class="filter-list-row">
+ <input type="checkbox" />
+ <label class="item-name">
+ <span class="label"></span>
+ <span class="description"></span>
+ </label>
+ <button class="link-button">Remove</button>
+ </div>
+ </template>
+ <div class="list-section">
+ <div class="list-heading">
+ <span>Filter lists</span>
+ <span>
+ <button id="update-content-blocker-lists" class="link-button">Update enabled lists</button>
+ <button
+ id="add-filter-list"
+ class="link-button"
+ aria-expanded="false"
+ aria-controls="add-filter-list-form"
+ >
+ Add filter list…
+ </button>
+ </span>
+ </div>
+ <div id="content-blocker-lists" class="boxed-list"></div>
+ <div id="add-filter-list-form" class="add-filter-list" hidden>
+ <p class="description">
+ Add a filter list maintained by a source you trust. Automatic updates reveal your IP address
+ to that source.
+ </p>
+ <div class="input-field-container form-row">
+ <input
+ id="custom-content-blocker-subscription-url"
+ type="url"
+ placeholder="Filter list URL"
+ />
+ <button id="add-content-blocker-subscription" class="secondary-button">Add</button>
+ </div>
+ <p id="custom-content-blocker-subscription-status" class="description" role="status"></p>
<div class="inline-container">
- <label for="global-privacy-control-toggle">
- Global Privacy Control
- <p class="description">Tell websites not to sell or share your data.</p>
- </label>
- <input id="global-privacy-control-toggle" type="checkbox" switch />
+ <p class="description">Or import an Adblock-compatible list stored on this computer.</p>
+ <input id="local-content-blocker-list-picker" type="file" accept=".txt,text/plain" hidden />
+ <button id="import-local-content-blocker-list" class="secondary-button">
+ Import list…
+ </button>
</div>
+ <p id="local-content-blocker-list-status" class="description" role="status"></p>
</div>
</div>
- </div>
- </div>
-
- <div class="tab-panel" id="tab-blocking">
- <div class="card card-body">
- <div class="card-group inline-container">
- <label for="enable-content-blocking">
- Enable ad blocking
- <p class="description">Use filter lists to block ads, trackers, and other unwanted content.</p>
- </label>
- <input id="enable-content-blocking" type="checkbox" switch />
+ <details class="expandable-list">
+ <summary>Show language-specific lists</summary>
+ <div id="language-content-blocker-lists" class="boxed-list"></div>
+ </details>
+
+ <div id="content-blocker-disabled-sites-section" class="list-section" hidden>
+ <div class="list-heading"><span>Turned off on</span></div>
+ <div id="content-blocker-disabled-sites" class="boxed-list"></div>
</div>
- <div class="card-group inline-container hidden" id="show-content-blocker-count-setting">
- <label for="show-content-blocker-count">
- Show the number of blocked requests on the ad blocking icon
- </label>
- <input id="show-content-blocker-count" type="checkbox" switch />
+
+ <h3 class="card-title">Custom filters</h3>
+ <div class="card card-body">
+ <label for="custom-content-blocker-filters"> Add Adblock-compatible rules, one per line. </label>
+ <textarea id="custom-content-blocker-filters" rows="12" spellcheck="false"></textarea>
+ <div class="button-container">
+ <span id="custom-content-blocker-filters-status" class="description" role="status"></span>
+ <button id="save-custom-content-blocker-filters" class="secondary-button">Save changes</button>
+ </div>
</div>
</div>
- <template id="filter-list-row">
- <div class="card-group inline-container filter-list-row">
- <div>
- <label>
- <span class="label"></span>
- <p class="description"></p>
- </label>
- <p class="description filter-list-metadata"></p>
- </div>
- <div class="input-field-container">
- <input type="checkbox" switch />
- <button class="secondary-button">Remove</button>
+
+ <div class="tab-panel" id="tab-languages" data-title="Languages">
+ <div class="card">
+ <div class="card-body">
+ <div class="card-group inline-container">
+ <label for="languages-settings">
+ Website languages
+ <p class="description">
+ Languages that websites are asked to use, in order of preference.
+ </p>
+ </label>
+ <button id="languages-settings" class="secondary-button">Edit…</button>
+ </div>
</div>
</div>
- </template>
- <div class="inline-container filter-list-header">
- <h3 class="card-title">Filter lists</h3>
- <button id="update-content-blocker-lists" class="secondary-button">Update enabled lists</button>
</div>
- <div id="built-in-content-blocker-lists" class="card card-body"></div>
- <details class="expandable-list">
- <summary>Show language-specific lists</summary>
- <div id="language-content-blocker-lists" class="card card-body"></div>
- </details>
-
- <h3 class="card-title">Add a subscription</h3>
- <div class="card card-body">
+
+ <div class="tab-panel" id="tab-services" data-title="Services">
<p class="description">
- Add a filter list maintained by a source you trust. Automatic updates reveal your IP address to that
- source.
+ Services are automatic connections Ladybird makes for browser features in the background. These
+ controls do not affect normal browsing or actions you explicitly request, such as updating filter
+ lists.
</p>
- <div class="input-field-container form-row">
- <input id="custom-content-blocker-subscription-url" type="url" placeholder="Filter list URL" />
- <button id="add-content-blocker-subscription" class="secondary-button">Add</button>
+
+ <div class="card card-body">
+ <div class="card-group inline-container">
+ <label for="allow-services-network-access">
+ Allow automatic service connections
+ <p class="description">Let individually enabled services connect in the background.</p>
+ </label>
+ <input id="allow-services-network-access" type="checkbox" switch />
+ </div>
</div>
- <p id="custom-content-blocker-subscription-status" class="description" role="status"></p>
- <div id="custom-content-blocker-subscriptions" class="filter-list-collection"></div>
- </div>
- <h3 class="card-title">Local filter lists</h3>
- <div class="card card-body">
- <p class="description">Import Adblock-compatible filter lists stored on this computer.</p>
- <input id="local-content-blocker-list-picker" type="file" accept=".txt,text/plain" hidden />
- <button id="import-local-content-blocker-list" class="secondary-button">Import list...</button>
- <p id="local-content-blocker-list-status" class="description" role="status"></p>
- <div id="local-content-blocker-lists" class="filter-list-collection"></div>
- </div>
+ <p id="services-paused-note" class="description hidden" role="status">
+ Automatic service connections are paused. Individual service choices are preserved.
+ </p>
- <h3 class="card-title">Custom filters</h3>
- <div class="card card-body">
- <label for="custom-content-blocker-filters"> Add Adblock-compatible rules, one per line. </label>
- <textarea id="custom-content-blocker-filters" rows="12" spellcheck="false"></textarea>
- <div class="button-container">
- <span id="custom-content-blocker-filters-status" class="description" role="status"></span>
- <button id="save-custom-content-blocker-filters" class="secondary-button">Save changes</button>
- </div>
- </div>
- </div>
-
- <div class="tab-panel" id="tab-services">
- <p class="description">
- Services are automatic connections Ladybird makes for browser features in the background. These controls
- do not affect normal browsing or actions you explicitly request, such as updating filter lists.
- </p>
-
- <div class="card card-body">
- <div class="card-group inline-container">
- <label for="allow-services-network-access">
- Allow automatic service connections
- <p class="description">Let individually enabled services connect in the background.</p>
+ <h3 class="card-title">Services</h3>
+ <div class="card card-body inline-container">
+ <label for="filter-list-updates">
+ Filter list updates
+ <p class="description">Periodically download updates for enabled filter list subscriptions.</p>
</label>
- <input id="allow-services-network-access" type="checkbox" switch />
+ <input id="filter-list-updates" type="checkbox" switch />
</div>
</div>
- <p id="services-paused-note" class="description hidden" role="status">
- Automatic service connections are paused. Individual service choices are preserved.
- </p>
-
- <h3 class="card-title">Services</h3>
- <div class="card card-body inline-container">
- <label for="filter-list-updates">
- Filter list updates
- <p class="description">Periodically download updates for enabled filter list subscriptions.</p>
- </label>
- <input id="filter-list-updates" type="checkbox" switch />
- </div>
- </div>
-
- <div class="tab-panel" id="tab-network">
- <h3 class="card-title">DNS settings</h3>
- <div class="card">
- <div class="card-body">
- <span id="dns-forcibly-enabled" class="forcibly-enabled hidden">
- This setting is controlled via the command line
- </span>
- <p id="dns-proxy-note" class="description hidden"></p>
-
- <div class="card-group inline-container" id="dns-settings-container">
- <label for="dns-upstream">DNS Upstream</label>
- <select id="dns-upstream">
- <option value="system">System DNS</option>
- <option value="custom">Custom DNS Server</option>
- </select>
- </div>
- <div id="custom-dns-settings" class="hidden">
- <div class="card-group inline-container">
- <label for="dns-type">Type</label>
- <select id="dns-type">
- <option value="udp">UDP</option>
- <option value="tls">TLS</option>
+ <div class="tab-panel" id="tab-network" data-title="Network">
+ <h3 class="card-title">DNS settings</h3>
+ <div class="card">
+ <div class="card-body">
+ <span id="dns-forcibly-enabled" class="forcibly-enabled hidden">
+ This setting is controlled via the command line
+ </span>
+ <p id="dns-proxy-note" class="description hidden"></p>
+
+ <div class="card-group inline-container" id="dns-settings-container">
+ <label for="dns-upstream">DNS upstream</label>
+ <select id="dns-upstream">
+ <option value="system">System DNS</option>
+ <option value="custom">Custom DNS server</option>
</select>
</div>
- <div class="card-group inline-container">
- <label for="dnssec-toggle">Validate DNSSEC Locally</label>
- <input id="dnssec-toggle" type="checkbox" switch />
- </div>
- <div class="card-group inline-container">
- <label for="dns-server">DNS Server (IP or hostname)</label>
- <input id="dns-server" type="text" />
- </div>
- <div class="card-group inline-container">
- <label for="dns-port">Port</label>
- <input id="dns-port" type="text" placeholder="53" />
+ <div id="custom-dns-settings" class="hidden">
+ <div class="card-group inline-container">
+ <label for="dns-type">Type</label>
+ <select id="dns-type">
+ <option value="udp">UDP</option>
+ <option value="tls">TLS</option>
+ </select>
+ </div>
+ <div class="card-group inline-container">
+ <label for="dnssec-toggle">Validate DNSSEC locally</label>
+ <input id="dnssec-toggle" type="checkbox" switch />
+ </div>
+ <div class="card-group inline-container">
+ <label for="dns-server">DNS server (IP or hostname)</label>
+ <input id="dns-server" type="text" />
+ </div>
+ <div class="card-group inline-container">
+ <label for="dns-port">Port</label>
+ <input id="dns-port" type="text" placeholder="53" />
+ </div>
</div>
</div>
</div>
</div>
- </div>
- <div class="tab-panel" id="tab-advanced">
- <div class="search-container">
- <svg
- class="search-icon"
- xmlns="http://www.w3.org/2000/svg"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- stroke-width="2"
- >
- <circle cx="11" cy="11" r="7" />
- <line x1="16" y1="16" x2="22" y2="22" />
- </svg>
- <input id="config-filter" type="search" class="search-input" placeholder="Filter configuration keys" />
- </div>
- <div class="card">
- <div class="card-body">
- <div class="card-group" id="config-list"></div>
+ <div class="tab-panel" id="tab-advanced" data-title="Advanced">
+ <div class="search-container">
+ <svg
+ class="search-icon"
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ >
+ <circle cx="11" cy="11" r="7" />
+ <line x1="16" y1="16" x2="22" y2="22" />
+ </svg>
+ <input
+ id="config-filter"
+ type="search"
+ class="search-input"
+ placeholder="Filter configuration keys"
+ />
+ </div>
+ <div class="card">
+ <div class="card-body">
+ <div class="card-group" id="config-list"></div>
+ </div>
</div>
</div>
- </div>
+ </main>
<dialog id="languages-dialog" closedby="any">
<div class="dialog-header">
@@ -831,7 +1241,7 @@
<div id="languages-list" class="dialog-list"></div>
<div class="dialog-controls">
<select id="languages-select">
- <option value="">Select a language to add...</option>
+ <option value="">Select a language to add…</option>
</select>
<button id="languages-add" class="primary-button" disabled>Add</button>
</div>
@@ -840,7 +1250,7 @@
<dialog id="search-dialog" closedby="any">
<div class="dialog-header">
- <h3 class="dialog-title">Search Settings</h3>
+ <h3 class="dialog-title">Search settings</h3>
<button id="search-close" class="close-button dialog-button">&times;</button>
</div>
<div class="dialog-body" style="height: 300px">
@@ -849,7 +1259,7 @@
</div>
<div class="dialog-form">
<div class="form-group">
- <label for="search-custom-name">Search Engine Name</label>
+ <label for="search-custom-name">Search engine name</label>
<input id="search-custom-name" type="text" placeholder="Example" />
</div>
<div class="form-group">
@@ -873,7 +1283,7 @@
/>
</div>
<div class="dialog-controls">
- <button id="search-custom-add" class="primary-button">Add&nbsp;Engine</button>
+ <button id="search-custom-add" class="primary-button">Add&nbsp;engine</button>
</div>
</div>
</dialog>
@@ -893,11 +1303,11 @@
<div id="site-settings-list" class="dialog-list"></div>
<div class="dialog-controls">
<input id="site-settings-input" type="text" placeholder="example.com" />
- <button id="site-settings-add" class="primary-button">Add&nbsp;Site</button>
+ <button id="site-settings-add" class="primary-button">Add&nbsp;site</button>
</div>
</div>
<div class="dialog-footer">
- <button id="site-settings-remove-all" class="secondary-button">Remove All Sites</button>
+ <button id="site-settings-remove-all" class="secondary-button">Remove all sites</button>
</div>
</dialog>
@@ -945,7 +1355,7 @@
</label>
</div>
<div class="button-container">
- <button id="clear-browsing-data-remove-data" class="secondary-button">Remove Data</button>
+ <button id="clear-browsing-data-remove-data" class="secondary-button">Remove data</button>
</div>
</div>
</dialog>
@@ -982,6 +1392,61 @@
import { tabForDeepLink } from "resource://ladybird/about-pages/settings/dialog-deep-link.js";
const tabButtons = [...document.querySelectorAll(".tab-button")];
+ const searchInput = document.querySelector("#settings-search");
+ const searchEmpty = document.querySelector("#search-empty");
+
+ // Each setting is a row of a card, or a card of its own.
+ function searchableItems(card) {
+ return [card, ...card.querySelectorAll(".card-group, .card-body")].filter(
+ item => item.matches(".card-group, .card-body") && !item.querySelector(".card-group")
+ );
+ }
+
+ function matches(element, query) {
+ return element.textContent.toLocaleLowerCase().includes(query);
+ }
+
+ // While searching, every section shows the settings whose text matches. A section or a card whose title
+ // matches shows all of its settings.
+ function search() {
+ const query = searchInput.value.trim().toLocaleLowerCase();
+ const searching = query.length !== 0;
+ document.body.classList.toggle("searching", searching);
+
+ let anyMatch = false;
+ document.querySelectorAll(".tab-panel").forEach(panel => {
+ panel.hidden = !searching && !panel.classList.contains("active");
+ const panelMatches = searching && panel.dataset.title.toLocaleLowerCase().includes(query);
+ let panelHasMatch = panelMatches;
+ panel.querySelectorAll(".card").forEach(card => {
+ const title = card.previousElementSibling?.classList.contains("card-title")
+ ? card.previousElementSibling
+ : null;
+ const cardMatches = panelMatches || (title && searching && matches(title, query));
+ let cardHasMatch = cardMatches;
+ searchableItems(card).forEach(item => {
+ const itemMatches = !searching || cardMatches || matches(item, query);
+ item.classList.toggle("search-miss", !itemMatches);
+ cardHasMatch ||= itemMatches && !item.classList.contains("hidden");
+ });
+ card.classList.toggle("search-miss", searching && !cardHasMatch);
+ title?.classList.toggle("search-miss", searching && !cardHasMatch);
+ panelHasMatch ||= cardHasMatch;
+ });
+ panel.classList.toggle("search-miss", searching && !panelHasMatch);
+ anyMatch ||= panelHasMatch;
+ });
+ searchEmpty.hidden = !searching || anyMatch;
+ }
+
+ searchInput.addEventListener("input", search);
+ searchInput.addEventListener("keydown", event => {
+ if (event.key === "Escape" && searchInput.value.length !== 0) {
+ event.preventDefault();
+ searchInput.value = "";
+ search();
+ }
+ });
function switchTab(name) {
const button = document.querySelector(`.tab-button[data-tab="${name}"]`);
@@ -1012,6 +1477,10 @@
panel.setAttribute("aria-labelledby", button.id);
button.addEventListener("click", () => {
+ if (searchInput.value.length !== 0) {
+ searchInput.value = "";
+ search();
+ }
switchTab(button.dataset.tab);
history.replaceState(null, "", `#${button.dataset.tab}`);
});
diff --git a/Base/res/ladybird/about-pages/settings/advanced.js b/Base/res/ladybird/about-pages/settings/advanced.js
index c3998ed69b8..7e9649a67dc 100644
--- a/Base/res/ladybird/about-pages/settings/advanced.js
+++ b/Base/res/ladybird/about-pages/settings/advanced.js
@@ -67,22 +67,18 @@ function createRow(variable) {
row.classList.add("card-group");
row.classList.add("config-row");
row.classList.add("inline-container");
- row.dataset.filterText = `${variable.name} ${variable.title} ${variable.description}`.toLowerCase();
+ row.dataset.filterText = `${variable.title} ${variable.description}`.toLowerCase();
const title = document.createElement("p");
title.textContent = variable.title;
- const name = document.createElement("p");
- name.classList.add("config-name");
- name.textContent = variable.name;
-
const description = document.createElement("p");
description.classList.add("description");
description.textContent = variable.description;
const label = document.createElement("label");
label.htmlFor = variable.name;
- label.append(title, name, description);
+ label.append(title, description);
row.append(label, createControl(variable));
return row;
diff --git a/Base/res/ladybird/about-pages/settings/appearance.js b/Base/res/ladybird/about-pages/settings/appearance.js
index b1a560e5916..41fbd8626bf 100644
--- a/Base/res/ladybird/about-pages/settings/appearance.js
+++ b/Base/res/ladybird/about-pages/settings/appearance.js
@@ -1,6 +1,16 @@
const showMenuBar = document.querySelector("#show-menu-bar");
const showMenuBarGroup = document.querySelector("#show-menu-bar-group");
const showBookmarksBar = document.querySelector("#show-bookmarks-bar");
+const interfaceTheme = document.querySelector("#interface-theme");
+const websiteColorScheme = document.querySelector("#website-color-scheme");
+
+function segmentedValue(control) {
+ return control.querySelector("input:checked")?.value;
+}
+
+function setSegmentedValue(control, value) {
+ for (const input of control.querySelectorAll("input")) input.checked = input.value === value;
+}
let APPEARANCE = {};
@@ -17,6 +27,8 @@ const loadSettings = settings => {
showMenuBar.checked = !!APPEARANCE.showMenuBar;
showBookmarksBar.value = APPEARANCE.showBookmarksBar || "always";
+ setSegmentedValue(interfaceTheme, APPEARANCE.interfaceTheme || "system");
+ setSegmentedValue(websiteColorScheme, APPEARANCE.websiteColorScheme || "system");
};
function saveAppearance() {
@@ -33,6 +45,16 @@ showBookmarksBar.addEventListener("change", () => {
saveAppearance();
});
+interfaceTheme.addEventListener("change", () => {
+ APPEARANCE.interfaceTheme = segmentedValue(interfaceTheme);
+ saveAppearance();
+});
+
+websiteColorScheme.addEventListener("change", () => {
+ APPEARANCE.websiteColorScheme = segmentedValue(websiteColorScheme);
+ saveAppearance();
+});
+
document.addEventListener("WebUIMessage", event => {
if (event.detail.name === "loadFeatures") {
loadFeatures(event.detail.data);
diff --git a/Base/res/ladybird/about-pages/settings/blocking.js b/Base/res/ladybird/about-pages/settings/blocking.js
index 06b7afe9966..09ed6d2fda9 100644
--- a/Base/res/ladybird/about-pages/settings/blocking.js
+++ b/Base/res/ladybird/about-pages/settings/blocking.js
@@ -1,40 +1,32 @@
-const builtInLists = document.querySelector("#built-in-content-blocker-lists");
+const contentBlockerLists = document.querySelector("#content-blocker-lists");
const languageLists = document.querySelector("#language-content-blocker-lists");
const updateLists = document.querySelector("#update-content-blocker-lists");
+const addFilterList = document.querySelector("#add-filter-list");
+const addFilterListForm = document.querySelector("#add-filter-list-form");
const subscriptionUrl = document.querySelector("#custom-content-blocker-subscription-url");
const addSubscription = document.querySelector("#add-content-blocker-subscription");
-const customSubscriptions = document.querySelector("#custom-content-blocker-subscriptions");
const subscriptionStatus = document.querySelector("#custom-content-blocker-subscription-status");
const localListPicker = document.querySelector("#local-content-blocker-list-picker");
const importLocalList = document.querySelector("#import-local-content-blocker-list");
-const localLists = document.querySelector("#local-content-blocker-lists");
const localListStatus = document.querySelector("#local-content-blocker-list-status");
+const disabledSitesSection = document.querySelector("#content-blocker-disabled-sites-section");
+const disabledSites = document.querySelector("#content-blocker-disabled-sites");
const customFilters = document.querySelector("#custom-content-blocker-filters");
const saveCustomFilters = document.querySelector("#save-custom-content-blocker-filters");
const customFiltersStatus = document.querySelector("#custom-content-blocker-filters-status");
const enableContentBlocking = document.querySelector("#enable-content-blocking");
-const showContentBlockerCount = document.querySelector("#show-content-blocker-count");
-const showContentBlockerCountSetting = document.querySelector("#show-content-blocker-count-setting");
const maximumCustomFilterSize = 4 * 1024 * 1024;
let updateTimer;
let savedCustomFilters = "";
-function listStatus(list) {
- if (list.lastUpdatedAt != null) {
- return `Updated ${new Date(list.lastUpdatedAt).toLocaleString()}`;
- }
- return list.enabled ? "Not downloaded yet" : null;
-}
-
function createListRow(list, removable = false) {
const row = document.querySelector("#filter-list-row").content.firstElementChild.cloneNode(true);
const toggle = row.querySelector("input");
const label = row.querySelector("label");
const labelText = row.querySelector(".label");
const details = row.querySelector(".description");
- const metadata = row.querySelector(".filter-list-metadata");
const id = `content-blocker-list-${list.identifier}`;
const name = list.name ?? list.url;
@@ -43,15 +35,9 @@ function createListRow(list, removable = false) {
label.htmlFor = id;
labelText.textContent = name;
- details.id = `${toggle.id}-description`;
- details.textContent = list.description ?? "";
+ // A list added by the user has no description of its own, so it is described by where it comes from.
+ details.textContent = list.description || (list.url ? new URL(list.url).host : "Local file");
- metadata.id = `${toggle.id}-metadata`;
- metadata.textContent = [list.url ? new URL(list.url).host : "Local file", list.url && listStatus(list)]
- .filter(Boolean)
- .join(" · ");
-
- toggle.setAttribute("aria-describedby", `${details.id} ${metadata.id}`);
toggle.checked = list.enabled;
toggle.addEventListener("change", () => {
ladybird.sendMessage("setContentBlockerListEnabled", { identifier: list.identifier, enabled: toggle.checked });
@@ -68,52 +54,54 @@ function createListRow(list, removable = false) {
return row;
}
-function showEmptyState(container, message) {
- const emptyState = document.createElement("p");
- emptyState.className = "description";
- emptyState.innerText = message;
- container.append(emptyState);
-}
+function createDisabledSiteRow(site) {
+ const row = document.createElement("div");
-function loadFeatures(features) {
- showContentBlockerCountSetting.classList.toggle("hidden", !features?.contentBlockingControls);
+ const tile = document.createElement("span");
+ tile.className = "letter-tile";
+ tile.setAttribute("aria-hidden", "true");
+ tile.textContent = site.charAt(0).toUpperCase();
+
+ const name = document.createElement("span");
+ name.className = "item-name";
+ name.textContent = site;
+
+ const turnBackOn = document.createElement("button");
+ turnBackOn.className = "link-button";
+ turnBackOn.textContent = "Turn back on";
+ turnBackOn.setAttribute("aria-label", `Turn content blocking back on for ${site}`);
+ turnBackOn.addEventListener("click", () => {
+ ladybird.sendMessage("setContentBlockerEnabledForSite", { site, enabled: true });
+ });
+
+ row.append(tile, name, turnBackOn);
+ return row;
}
function loadSettings(settings) {
if (Object.hasOwn(settings, "contentBlockers")) {
const contentBlockers = settings.contentBlockers;
enableContentBlocking.checked = contentBlockers.enabled;
- showContentBlockerCount.checked = contentBlockers.showBlockedCount ?? true;
if (customFilters.value === savedCustomFilters) {
customFilters.value = contentBlockers.customFilters;
}
savedCustomFilters = contentBlockers.customFilters;
+
+ const sites = [...(contentBlockers.disabledSites ?? [])].sort();
+ disabledSites.replaceChildren(...sites.map(createDisabledSiteRow));
+ disabledSitesSection.hidden = sites.length === 0;
}
if (Object.hasOwn(settings, "contentBlockerLists")) {
- for (const container of [builtInLists, languageLists, customSubscriptions, localLists]) {
- container.replaceChildren();
- }
+ contentBlockerLists.replaceChildren();
+ languageLists.replaceChildren();
for (const list of settings.contentBlockerLists) {
- const container = list.builtIn
- ? list.languageSpecific
- ? languageLists
- : builtInLists
- : list.url
- ? customSubscriptions
- : localLists;
+ const container = list.builtIn && list.languageSpecific ? languageLists : contentBlockerLists;
container.append(createListRow(list, !list.builtIn));
}
-
- if (!customSubscriptions.children.length) {
- showEmptyState(customSubscriptions, "No custom subscriptions added.");
- }
- if (!localLists.children.length) {
- showEmptyState(localLists, "No local lists imported.");
- }
}
if (Object.hasOwn(settings, "contentBlockerListUpdateInProgress")) {
@@ -127,6 +115,12 @@ function loadSettings(settings) {
}
}
+addFilterList.addEventListener("click", () => {
+ addFilterListForm.hidden = !addFilterListForm.hidden;
+ addFilterList.setAttribute("aria-expanded", String(!addFilterListForm.hidden));
+ if (!addFilterListForm.hidden) subscriptionUrl.focus();
+});
+
enableContentBlocking.addEventListener("change", () => {
ladybird.sendMessage("setContentBlockerEnabled", enableContentBlocking.checked);
});
@@ -191,14 +185,8 @@ saveCustomFilters.addEventListener("click", () => {
customFiltersStatus.innerText = "Saved";
});
-showContentBlockerCount.addEventListener("change", () => {
- ladybird.sendMessage("setShowContentBlockerCount", showContentBlockerCount.checked);
-});
-
document.addEventListener("WebUIMessage", event => {
- if (event.detail.name === "loadFeatures") {
- loadFeatures(event.detail.data);
- } else if (event.detail.name === "loadSettings") {
+ if (event.detail.name === "loadSettings") {
loadSettings(event.detail.data);
} else if (event.detail.name === "contentBlockerResult") {
const result = event.detail.data;
diff --git a/Base/res/ladybird/about-pages/settings/languages.js b/Base/res/ladybird/about-pages/settings/languages.js
index 7240950736d..0283ab211b9 100644
--- a/Base/res/ladybird/about-pages/settings/languages.js
+++ b/Base/res/ladybird/about-pages/settings/languages.js
@@ -144,14 +144,14 @@ languagesSelect.addEventListener("change", () => {
});
registerDialogDeepLink({
- hash: "languages",
- tab: "general",
+ hash: "editLanguages",
+ tab: "languages",
dialog: languagesDialog,
onOpen: showLanguages,
});
languagesSettings.addEventListener("click", () => {
- location.hash = "languages";
+ location.hash = "editLanguages";
});
document.addEventListener("WebUILoaded", () => {
diff --git a/Base/res/ladybird/about-pages/settings/permissions.js b/Base/res/ladybird/about-pages/settings/permissions.js
index 1670f3d3c97..807c98d46d2 100644
--- a/Base/res/ladybird/about-pages/settings/permissions.js
+++ b/Base/res/ladybird/about-pages/settings/permissions.js
@@ -13,9 +13,9 @@ const autoplaySettings = document.querySelector("#autoplay-settings");
const SITE_SETTING_POLICY_OPTIONS = {
autoplay: [
- { value: "allow-audio-and-video", label: "Allow Audio and Video" },
- { value: "block-audio", label: "Block Audio" },
- { value: "block-audio-and-video", label: "Block Audio and Video" },
+ { value: "allow-audio-and-video", label: "Allow audio and video" },
+ { value: "block-audio", label: "Block audio" },
+ { value: "block-audio-and-video", label: "Block audio and video" },
],
};
diff --git a/Base/res/ladybird/about-pages/settings/search.js b/Base/res/ladybird/about-pages/settings/search.js
index 1ff52093ab2..20956cc3276 100644
--- a/Base/res/ladybird/about-pages/settings/search.js
+++ b/Base/res/ladybird/about-pages/settings/search.js
@@ -1,5 +1,3 @@
-import { populateSearchEngineSelect, updateSearchSuggestionsControl } from "../search-engine-controls.js";
-
import { registerDialogDeepLink } from "./dialog-deep-link.js";
const searchClose = document.querySelector("#search-close");
@@ -18,16 +16,77 @@ const searchSuggestionsDescription = document.querySelector("#search-suggestions
let SEARCH_ENGINE = {};
let ENGINES = [];
+function selectedEngine() {
+ return searchEngine.querySelector("input:checked");
+}
+
+// Each engine is a row of the list, with its initial on a tile, and a check mark when it's the one chosen.
+function createEngineChoice(name, supportsSuggestions) {
+ const choice = document.createElement("label");
+ choice.className = "engine-choice";
+
+ const radio = document.createElement("input");
+ radio.type = "radio";
+ radio.name = "search-engine";
+ radio.value = name;
+ radio.dataset.supportsSuggestions = supportsSuggestions;
+
+ const tile = document.createElement("span");
+ tile.setAttribute("aria-hidden", "true");
+ if (name) {
+ tile.className = "letter-tile";
+ tile.textContent = name.charAt(0).toUpperCase();
+ } else {
+ tile.className = "empty-tile";
+ }
+
+ const label = document.createElement("span");
+ label.className = "engine-name";
+ label.textContent = name || "None";
+
+ const check = document.createElementNS("http://www.w3.org/2000/svg", "svg");
+ check.setAttribute("class", "engine-check");
+ check.setAttribute("viewBox", "0 0 16 16");
+ check.setAttribute("aria-hidden", "true");
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
+ path.setAttribute("d", "M3.5 8.5l3 3 6-7");
+ check.append(path);
+
+ choice.append(radio, tile, label, check);
+ return choice;
+}
+
+function updateSearchSuggestionsControl() {
+ const engine = selectedEngine();
+ const supportsSuggestions = engine?.dataset.supportsSuggestions === "true";
+ searchSuggestionsEnabled.disabled = !supportsSuggestions;
+ if (!engine?.value) searchSuggestionsDescription.textContent = "Choose a search engine to use search suggestions.";
+ else if (!supportsSuggestions)
+ searchSuggestionsDescription.textContent = `Search suggestions aren't available for ${engine.value}.`;
+ else searchSuggestionsDescription.textContent = `Sends what you type to ${engine.value}.`;
+}
+
function renderEngineSettings() {
- populateSearchEngineSelect(searchEngine, ENGINES, SEARCH_ENGINE);
+ const engines = [...ENGINES, ...(SEARCH_ENGINE.custom || [])];
+ searchEngine.replaceChildren(
+ createEngineChoice("", false),
+ ...engines.map(engine =>
+ createEngineChoice(engine.name, Boolean(engine.supportsSuggestions || engine.suggestionsUrl))
+ )
+ );
+ const chosen = [...searchEngine.querySelectorAll("input")].find(
+ radio => radio.value === (SEARCH_ENGINE.engine || "")
+ );
+ if (chosen) chosen.checked = true;
+
searchSuggestionsEnabled.checked = SEARCH_ENGINE.suggestions === true;
- updateSearchSuggestionsControl(searchEngine, searchSuggestionsEnabled, searchSuggestionsDescription);
+ updateSearchSuggestionsControl();
if (searchDialog.open) showSearchEngineSettings();
}
function saveSearchEngineSettings() {
ladybird.sendMessage("setSearchEngineSettings", {
- engine: searchEngine.value || null,
+ engine: selectedEngine()?.value || null,
suggestions: searchSuggestionsEnabled.checked,
});
}
@@ -58,7 +117,7 @@ function showSearchEngineSettings() {
const url = document.createElement("span");
url.className = "dialog-list-item-placeholder";
url.style = "padding-left: 0";
- url.textContent = ` — ${custom.url}`;
+ url.textContent = ` · ${custom.url}`;
const engine = document.createElement("span");
engine.className = "dialog-list-item-label";
@@ -98,8 +157,8 @@ function addCustomSearchEngine() {
return;
}
- for (let i = 0; i < searchEngine.length; ++i) {
- if (searchCustomName.value === searchEngine.item(i).value) {
+ for (const radio of searchEngine.querySelectorAll("input")) {
+ if (searchCustomName.value === radio.value) {
searchCustomName.classList.add("error");
return;
}
diff --git a/Base/res/ladybird/about-pages/settings/startup.js b/Base/res/ladybird/about-pages/settings/startup.js
index 63dcc15c5a5..383edda1c21 100644
--- a/Base/res/ladybird/about-pages/settings/startup.js
+++ b/Base/res/ladybird/about-pages/settings/startup.js
@@ -35,7 +35,7 @@ newTabPageURL.addEventListener("change", () => {
});
newTabPageURLReset.addEventListener("click", () => {
- newTabPageURL.value = "about:newtab";
+ newTabPageURL.value = "about:blank";
newTabPageURL.dispatchEvent(new Event("change"));
});
diff --git a/Base/res/ladybird/about-pages/settings/tabs.js b/Base/res/ladybird/about-pages/settings/tabs.js
index a28efd96207..afb97276848 100644
--- a/Base/res/ladybird/about-pages/settings/tabs.js
+++ b/Base/res/ladybird/about-pages/settings/tabs.js
@@ -1,19 +1,23 @@
-const enableVerticalTabs = document.querySelector("#enable-vertical-tabs");
+const tabLayoutGroup = document.querySelector("#tab-layout-group");
+const tabLayoutInputs = tabLayoutGroup.querySelectorAll('input[name="tab-layout"]');
const verticalTabsExpandOnHover = document.querySelector("#vertical-tabs-expand-on-hover");
const verticalTabsPosition = document.querySelector("#vertical-tabs-position");
let TAB_SETTINGS = {};
const loadFeatures = features => {
- // When more tab settings are added, we will need to be more selective here.
- const tabSettingsCard = enableVerticalTabs.closest(".card");
- tabSettingsCard.previousElementSibling.classList.toggle("hidden", !features?.verticalTabs);
- tabSettingsCard.classList.toggle("hidden", !features?.verticalTabs);
+ // Without vertical tabs, there is no choice of tab layout to make.
+ tabLayoutGroup.classList.toggle("hidden", !features?.verticalTabs);
+ if (!features?.verticalTabs) {
+ verticalTabsExpandOnHover.parentElement.classList.add("hidden");
+ verticalTabsPosition.parentElement.classList.add("hidden");
+ }
};
const updateVerticalTabsDependentSettings = () => {
- verticalTabsExpandOnHover.parentElement.classList.toggle("hidden", !enableVerticalTabs.checked);
- verticalTabsPosition.parentElement.classList.toggle("hidden", !enableVerticalTabs.checked);
+ const verticalTabsEnabled = !!TAB_SETTINGS.verticalTabsEnabled && !tabLayoutGroup.classList.contains("hidden");
+ verticalTabsExpandOnHover.parentElement.classList.toggle("hidden", !verticalTabsEnabled);
+ verticalTabsPosition.parentElement.classList.toggle("hidden", !verticalTabsEnabled);
};
const loadSettings = settings => {
@@ -23,7 +27,8 @@ const loadSettings = settings => {
TAB_SETTINGS = settings.tabs || {};
- enableVerticalTabs.checked = !!TAB_SETTINGS.verticalTabsEnabled;
+ const layout = TAB_SETTINGS.verticalTabsEnabled ? "vertical" : "horizontal";
+ for (const input of tabLayoutInputs) input.checked = input.value === layout;
verticalTabsExpandOnHover.checked = !!TAB_SETTINGS.verticalTabsExpandOnHover;
verticalTabsPosition.value = TAB_SETTINGS.verticalTabsPosition || "left";
updateVerticalTabsDependentSettings();
@@ -33,24 +38,24 @@ function saveTabSettings() {
ladybird.sendMessage("setTabSettings", TAB_SETTINGS);
}
-function addCheckboxChangeHandler(input, name) {
+for (const input of tabLayoutInputs) {
input.addEventListener("change", () => {
- TAB_SETTINGS[name] = input.checked;
+ if (!input.checked) return;
+ TAB_SETTINGS.verticalTabsEnabled = input.value === "vertical";
updateVerticalTabsDependentSettings();
saveTabSettings();
});
}
-function addSelectChangeHandler(input, name) {
- input.addEventListener("change", () => {
- TAB_SETTINGS[name] = input.value;
- saveTabSettings();
- });
-}
+verticalTabsExpandOnHover.addEventListener("change", () => {
+ TAB_SETTINGS.verticalTabsExpandOnHover = verticalTabsExpandOnHover.checked;
+ saveTabSettings();
+});
-addCheckboxChangeHandler(enableVerticalTabs, "verticalTabsEnabled");
-addCheckboxChangeHandler(verticalTabsExpandOnHover, "verticalTabsExpandOnHover");
-addSelectChangeHandler(verticalTabsPosition, "verticalTabsPosition");
+verticalTabsPosition.addEventListener("change", () => {
+ TAB_SETTINGS.verticalTabsPosition = verticalTabsPosition.value;
+ saveTabSettings();
+});
document.addEventListener("WebUIMessage", event => {
if (event.detail.name === "loadFeatures") {
diff --git a/Base/res/ladybird/about-pages/version.html b/Base/res/ladybird/about-pages/version.html
index f859aba4a3a..7da6a6d220e 100644
--- a/Base/res/ladybird/about-pages/version.html
+++ b/Base/res/ladybird/about-pages/version.html
@@ -3,184 +3,194 @@
<head>
<meta charset="UTF-8" />
<meta name="color-scheme" content="light dark" />
+ <title>About Ladybird</title>
<link rel="icon" type="image/png" href="resource://icons/48x48/app-browser.png" />
<link rel="stylesheet" type="text/css" href="resource://ladybird/ladybird.css" />
- <link rel="stylesheet" type="text/css" href="resource://ladybird/about-pages/webui.css" />
<style>
- @media (prefers-color-scheme: light) {
- :root {
- --about-border-color: #dcdde1;
- --about-muted-color: #606873;
- --about-value-background-color: white;
- }
+ body {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ min-height: 100vh;
+ box-sizing: border-box;
+ padding: 100px 24px 26px;
+ }
+
+ .logomark {
+ width: 168px;
+ height: 141px;
+ }
+
+ .logomark path {
+ stroke: var(--brand-mark);
+ stroke-width: 1.55;
+ }
+
+ :root {
+ --brand-mark: #6a39db;
}
@media (prefers-color-scheme: dark) {
:root {
- --about-border-color: #3d3d3d;
- --about-muted-color: #a0a0a0;
- --about-value-background-color: #1d1d1d;
+ --brand-mark: #b496ff;
}
}
- .summary-card .card-body {
+ .name {
display: flex;
align-items: center;
- gap: 16px;
+ gap: 12px;
+ margin-top: 26px;
}
- .summary-card img {
- width: 72px;
- height: 72px;
- margin: 0;
+ h1 {
+ font-size: 40px;
+ font-weight: 600;
+ letter-spacing: -0.025em;
+ line-height: 1;
}
- .summary-title {
- margin: 0 0 6px 0;
-
- font-size: 24px;
+ .badge {
+ font-size: 12px;
font-weight: 600;
+ padding: 3px 8px;
+ border-radius: 6px;
+ color: var(--badge-text);
+ background: var(--badge-background);
}
- .summary-version {
- color: var(--about-muted-color);
-
- font-size: 14px;
+ .tagline {
+ margin-top: 10px;
+ font-size: 15px;
+ color: var(--muted);
}
.details {
display: flex;
- flex-direction: column;
- }
-
- .detail-row {
- display: flex;
- align-items: center;
- gap: 16px;
-
- padding: 14px 0;
- border-bottom: 1px solid var(--about-border-color);
+ align-items: flex-start;
+ gap: 12px;
+ width: 100%;
+ max-width: 460px;
+ margin-top: 30px;
+ padding: 14px 16px 14px 18px;
+ box-sizing: border-box;
+ border-radius: 8px;
+ background: var(--page);
+ box-shadow: inset 0 0 0 1px var(--separator);
}
- .detail-row:first-child {
- padding-top: 0;
+ .details dl {
+ flex: 1;
+ display: grid;
+ grid-template-columns: 96px minmax(0, 1fr);
+ row-gap: 8px;
+ font-size: 13px;
+ line-height: 1.4;
}
- .detail-row:last-child {
- padding-bottom: 0;
- border-bottom: none;
+ .details dt {
+ color: var(--muted);
}
- .detail-label {
- width: 150px;
- flex-shrink: 0;
-
- color: var(--about-muted-color);
-
- font-size: 14px;
+ .details dd {
+ overflow-wrap: anywhere;
}
- .detail-value {
- background-color: var(--about-value-background-color);
-
- flex: 1;
- min-width: 0;
- border: 1px solid var(--about-border-color);
- border-radius: 4px;
- padding: 8px 10px;
-
- font-family: monospace;
+ .copy {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ height: 28px;
+ padding: 0 10px;
+ border: none;
+ border-radius: 7px;
+ font: inherit;
font-size: 13px;
- overflow-wrap: break-word;
+ color: var(--text);
+ background: var(--control);
+ cursor: pointer;
}
- @media (max-width: 600px) {
- .summary-card .card-body {
- align-items: flex-start;
- }
+ .copy:hover {
+ background: var(--control-hover);
+ }
- .detail-row {
- flex-direction: column;
- gap: 8px;
- }
+ .copy:active {
+ background: var(--control-pressed);
+ }
- .detail-label {
- width: auto;
- }
+ .copy svg {
+ width: 12px;
+ height: 12px;
}
</style>
</head>
<body>
- <header>
- <picture>
- <source srcset="resource://icons/128x128/app-browser.png" media="(prefers-color-scheme: dark)" />
- <img src="resource://icons/128x128/app-browser-dark.png" />
- </picture>
- <h1 id="browser-name"></h1>
- </header>
-
- <h3 class="card-title">Build Details</h3>
- <div class="card">
- <div class="card-body details">
- <div class="detail-row">
- <div class="detail-label">Version</div>
- <div id="browser-version" class="detail-value"></div>
- </div>
- <div class="detail-row">
- <div class="detail-label">Commit</div>
- <div id="browser-commit" class="detail-value"></div>
- </div>
- <div class="detail-row">
- <div class="detail-label">Architecture</div>
- <div id="arch" class="detail-value"></div>
- </div>
- <div class="detail-row">
- <div class="detail-label">Operating System</div>
- <div id="platform-name" class="detail-value"></div>
- </div>
- <div class="detail-row">
- <div class="detail-label">User Agent</div>
- <div id="user-agent" class="detail-value"></div>
- </div>
- </div>
+ <svg
+ class="logomark"
+ viewBox="-11 -9.2 22 18.4"
+ fill="none"
+ stroke-linejoin="round"
+ role="img"
+ aria-label="Ladybird logomark"
+ >
+ <path
+ d="M0.00 0.00 L0.17 0.21 L0.35 0.42 L0.52 0.63 L0.70 0.84 L0.87 1.05 L1.05 1.26 L1.22 1.47 L1.39 1.68 L1.56 1.88 L1.74 2.09 L1.91 2.29 L2.08 2.49 L2.25 2.69 L2.42 2.89 L2.59 3.08 L2.76 3.28 L2.92 3.47 L3.09 3.66 L3.26 3.85 L3.42 4.03 L3.58 4.21 L3.75 4.39 L3.91 4.57 L4.07 4.74 L4.23 4.91 L4.38 5.07 L4.54 5.23 L4.69 5.39 L4.85 5.55 L5.00 5.70 L5.15 5.85 L5.30 5.99 L5.45 6.13 L5.59 6.26 L5.74 6.39 L5.88 6.52 L6.02 6.64 L6.16 6.76 L6.29 6.87 L6.43 6.98 L6.56 7.08 L6.69 7.18 L6.82 7.27 L6.95 7.36 L7.07 7.45 L7.19 7.52 L7.31 7.60 L7.43 7.67 L7.55 7.73 L7.66 7.79 L7.77 7.84 L7.88 7.88 L7.99 7.93 L8.09 7.96 L8.19 7.99 L8.29 8.02 L8.39 8.04 L8.48 8.05 L8.57 8.06 L8.66 8.06 L8.75 8.06 L8.83 8.05 L8.91 8.04 L8.99 8.02 L9.06 7.99 L9.14 7.96 L9.21 7.93 L9.27 7.88 L9.34 7.84 L9.40 7.79 L9.46 7.73 L9.51 7.67 L9.56 7.60 L9.61 7.52 L9.66 7.45 L9.70 7.36 L9.74 7.27 L9.78 7.18 L9.82 7.08 L9.85 6.98 L9.88 6.87 L9.90 6.76 L9.93 6.64 L9.95 6.52 L9.96 6.39 L9.98 6.26 L9.99 6.13 L9.99 5.99 L10.00 5.85 L10.00 5.70 L10.00 5.55 L9.99 5.39 L9.99 5.23 L9.98 5.07 L9.96 4.91 L9.95 4.74 L9.93 4.57 L9.90 4.39 L9.88 4.21 L9.85 4.03 L9.82 3.85 L9.78 3.66 L9.74 3.47 L9.70 3.28 L9.66 3.08 L9.61 2.89 L9.56 2.69 L9.51 2.49 L9.46 2.29 L9.40 2.09 L9.34 1.88 L9.27 1.68 L9.21 1.47 L9.14 1.26 L9.06 1.05 L8.99 0.84 L8.91 0.63 L8.83 0.42 L8.75 0.21 L8.66 0.00 L8.57 -0.21 L8.48 -0.42 L8.39 -0.63 L8.29 -0.84 L8.19 -1.05 L8.09 -1.26 L7.99 -1.47 L7.88 -1.68 L7.77 -1.88 L7.66 -2.09 L7.55 -2.29 L7.43 -2.49 L7.31 -2.69 L7.19 -2.89 L7.07 -3.08 L6.95 -3.28 L6.82 -3.47 L6.69 -3.66 L6.56 -3.85 L6.43 -4.03 L6.29 -4.21 L6.16 -4.39 L6.02 -4.57 L5.88 -4.74 L5.74 -4.91 L5.59 -5.07 L5.45 -5.23 L5.30 -5.39 L5.15 -5.55 L5.00 -5.70 L4.85 -5.85 L4.69 -5.99 L4.54 -6.13 L4.38 -6.26 L4.23 -6.39 L4.07 -6.52 L3.91 -6.64 L3.75 -6.76 L3.58 -6.87 L3.42 -6.98 L3.26 -7.08 L3.09 -7.18 L2.92 -7.27 L2.76 -7.36 L2.59 -7.45 L2.42 -7.52 L2.25 -7.60 L2.08 -7.67 L1.91 -7.73 L1.74 -7.79 L1.56 -7.84 L1.39 -7.88 L1.22 -7.93 L1.05 -7.96 L0.87 -7.99 L0.70 -8.02 L0.52 -8.04 L0.35 -8.05 L0.17 -8.06 L0.00 -8.06 L-0.17 -8.06 L-0.35 -8.05 L-0.52 -8.04 L-0.70 -8.02 L-0.87 -7.99 L-1.05 -7.96 L-1.22 -7.93 L-1.39 -7.88 L-1.56 -7.84 L-1.74 -7.79 L-1.91 -7.73 L-2.08 -7.67 L-2.25 -7.60 L-2.42 -7.52 L-2.59 -7.45 L-2.76 -7.36 L-2.92 -7.27 L-3.09 -7.18 L-3.26 -7.08 L-3.42 -6.98 L-3.58 -6.87 L-3.75 -6.76 L-3.91 -6.64 L-4.07 -6.52 L-4.23 -6.39 L-4.38 -6.26 L-4.54 -6.13 L-4.69 -5.99 L-4.85 -5.85 L-5.00 -5.70 L-5.15 -5.55 L-5.30 -5.39 L-5.45 -5.23 L-5.59 -5.07 L-5.74 -4.91 L-5.88 -4.74 L-6.02 -4.57 L-6.16 -4.39 L-6.29 -4.21 L-6.43 -4.03 L-6.56 -3.85 L-6.69 -3.66 L-6.82 -3.47 L-6.95 -3.28 L-7.07 -3.08 L-7.19 -2.89 L-7.31 -2.69 L-7.43 -2.49 L-7.55 -2.29 L-7.66 -2.09 L-7.77 -1.88 L-7.88 -1.68 L-7.99 -1.47 L-8.09 -1.26 L-8.19 -1.05 L-8.29 -0.84 L-8.39 -0.63 L-8.48 -0.42 L-8.57 -0.21 L-8.66 -0.00 L-8.75 0.21 L-8.83 0.42 L-8.91 0.63 L-8.99 0.84 L-9.06 1.05 L-9.14 1.26 L-9.21 1.47 L-9.27 1.68 L-9.34 1.88 L-9.40 2.09 L-9.46 2.29 L-9.51 2.49 L-9.56 2.69 L-9.61 2.89 L-9.66 3.08 L-9.70 3.28 L-9.74 3.47 L-9.78 3.66 L-9.82 3.85 L-9.85 4.03 L-9.88 4.21 L-9.90 4.39 L-9.93 4.57 L-9.95 4.74 L-9.96 4.91 L-9.98 5.07 L-9.99 5.23 L-9.99 5.39 L-10.00 5.55 L-10.00 5.70 L-10.00 5.85 L-9.99 5.99 L-9.99 6.13 L-9.98 6.26 L-9.96 6.39 L-9.95 6.52 L-9.93 6.64 L-9.90 6.76 L-9.88 6.87 L-9.85 6.98 L-9.82 7.08 L-9.78 7.18 L-9.74 7.27 L-9.70 7.36 L-9.66 7.45 L-9.61 7.52 L-9.56 7.60 L-9.51 7.67 L-9.46 7.73 L-9.40 7.79 L-9.34 7.84 L-9.27 7.88 L-9.21 7.93 L-9.14 7.96 L-9.06 7.99 L-8.99 8.02 L-8.91 8.04 L-8.83 8.05 L-8.75 8.06 L-8.66 8.06 L-8.57 8.06 L-8.48 8.05 L-8.39 8.04 L-8.29 8.02 L-8.19 7.99 L-8.09 7.96 L-7.99 7.93 L-7.88 7.88 L-7.77 7.84 L-7.66 7.79 L-7.55 7.73 L-7.43 7.67 L-7.31 7.60 L-7.19 7.52 L-7.07 7.45 L-6.95 7.36 L-6.82 7.27 L-6.69 7.18 L-6.56 7.08 L-6.43 6.98 L-6.29 6.87 L-6.16 6.76 L-6.02 6.64 L-5.88 6.52 L-5.74 6.39 L-5.59 6.26 L-5.45 6.13 L-5.30 5.99 L-5.15 5.85 L-5.00 5.70 L-4.85 5.55 L-4.69 5.39 L-4.54 5.23 L-4.38 5.07 L-4.23 4.91 L-4.07 4.74 L-3.91 4.57 L-3.75 4.39 L-3.58 4.21 L-3.42 4.03 L-3.26 3.85 L-3.09 3.66 L-2.92 3.47 L-2.76 3.28 L-2.59 3.08 L-2.42 2.89 L-2.25 2.69 L-2.08 2.49 L-1.91 2.29 L-1.74 2.09 L-1.56 1.88 L-1.39 1.68 L-1.22 1.47 L-1.05 1.26 L-0.87 1.05 L-0.70 0.84 L-0.52 0.63 L-0.35 0.42 L-0.17 0.21 L-0.00 0.00 L0.17 -0.21 L0.35 -0.42 L0.52 -0.63 L0.70 -0.84 L0.87 -1.05 L1.05 -1.26 L1.22 -1.47 L1.39 -1.68 L1.56 -1.88 L1.74 -2.09 L1.91 -2.29 L2.08 -2.49 L2.25 -2.69 L2.42 -2.89 L2.59 -3.08 L2.76 -3.28 L2.92 -3.47 L3.09 -3.66 L3.26 -3.85 L3.42 -4.03 L3.58 -4.21 L3.75 -4.39 L3.91 -4.57 L4.07 -4.74 L4.23 -4.91 L4.38 -5.07 L4.54 -5.23 L4.69 -5.39 L4.85 -5.55 L5.00 -5.70 L5.15 -5.85 L5.30 -5.99 L5.45 -6.13 L5.59 -6.26 L5.74 -6.39 L5.88 -6.52 L6.02 -6.64 L6.16 -6.76 L6.29 -6.87 L6.43 -6.98 L6.56 -7.08 L6.69 -7.18 L6.82 -7.27 L6.95 -7.36 L7.07 -7.45 L7.19 -7.52 L7.31 -7.60 L7.43 -7.67 L7.55 -7.73 L7.66 -7.79 L7.77 -7.84 L7.88 -7.88 L7.99 -7.93 L8.09 -7.96 L8.19 -7.99 L8.29 -8.02 L8.39 -8.04 L8.48 -8.05 L8.57 -8.06 L8.66 -8.06 L8.75 -8.06 L8.83 -8.05 L8.91 -8.04 L8.99 -8.02 L9.06 -7.99 L9.14 -7.96 L9.21 -7.93 L9.27 -7.88 L9.34 -7.84 L9.40 -7.79 L9.46 -7.73 L9.51 -7.67 L9.56 -7.60 L9.61 -7.52 L9.66 -7.45 L9.70 -7.36 L9.74 -7.27 L9.78 -7.18 L9.82 -7.08 L9.85 -6.98 L9.88 -6.87 L9.90 -6.76 L9.93 -6.64 L9.95 -6.52 L9.96 -6.39 L9.98 -6.26 L9.99 -6.13 L9.99 -5.99 L10.00 -5.85 L10.00 -5.70 L10.00 -5.55 L9.99 -5.39 L9.99 -5.23 L9.98 -5.07 L9.96 -4.91 L9.95 -4.74 L9.93 -4.57 L9.90 -4.39 L9.88 -4.21 L9.85 -4.03 L9.82 -3.85 L9.78 -3.66 L9.74 -3.47 L9.70 -3.28 L9.66 -3.08 L9.61 -2.89 L9.56 -2.69 L9.51 -2.49 L9.46 -2.29 L9.40 -2.09 L9.34 -1.88 L9.27 -1.68 L9.21 -1.47 L9.14 -1.26 L9.06 -1.05 L8.99 -0.84 L8.91 -0.63 L8.83 -0.42 L8.75 -0.21 L8.66 -0.00 L8.57 0.21 L8.48 0.42 L8.39 0.63 L8.29 0.84 L8.19 1.05 L8.09 1.26 L7.99 1.47 L7.88 1.68 L7.77 1.88 L7.66 2.09 L7.55 2.29 L7.43 2.49 L7.31 2.69 L7.19 2.89 L7.07 3.08 L6.95 3.28 L6.82 3.47 L6.69 3.66 L6.56 3.85 L6.43 4.03 L6.29 4.21 L6.16 4.39 L6.02 4.57 L5.88 4.74 L5.74 4.91 L5.59 5.07 L5.45 5.23 L5.30 5.39 L5.15 5.55 L5.00 5.70 L4.85 5.85 L4.69 5.99 L4.54 6.13 L4.38 6.26 L4.23 6.39 L4.07 6.52 L3.91 6.64 L3.75 6.76 L3.58 6.87 L3.42 6.98 L3.26 7.08 L3.09 7.18 L2.92 7.27 L2.76 7.36 L2.59 7.45 L2.42 7.52 L2.25 7.60 L2.08 7.67 L1.91 7.73 L1.74 7.79 L1.56 7.84 L1.39 7.88 L1.22 7.93 L1.05 7.96 L0.87 7.99 L0.70 8.02 L0.52 8.04 L0.35 8.05 L0.17 8.06 L0.00 8.06 L-0.17 8.06 L-0.35 8.05 L-0.52 8.04 L-0.70 8.02 L-0.87 7.99 L-1.05 7.96 L-1.22 7.93 L-1.39 7.88 L-1.56 7.84 L-1.74 7.79 L-1.91 7.73 L-2.08 7.67 L-2.25 7.60 L-2.42 7.52 L-2.59 7.45 L-2.76 7.36 L-2.92 7.27 L-3.09 7.18 L-3.26 7.08 L-3.42 6.98 L-3.58 6.87 L-3.75 6.76 L-3.91 6.64 L-4.07 6.52 L-4.23 6.39 L-4.38 6.26 L-4.54 6.13 L-4.69 5.99 L-4.85 5.85 L-5.00 5.70 L-5.15 5.55 L-5.30 5.39 L-5.45 5.23 L-5.59 5.07 L-5.74 4.91 L-5.88 4.74 L-6.02 4.57 L-6.16 4.39 L-6.29 4.21 L-6.43 4.03 L-6.56 3.85 L-6.69 3.66 L-6.82 3.47 L-6.95 3.28 L-7.07 3.08 L-7.19 2.89 L-7.31 2.69 L-7.43 2.49 L-7.55 2.29 L-7.66 2.09 L-7.77 1.88 L-7.88 1.68 L-7.99 1.47 L-8.09 1.26 L-8.19 1.05 L-8.29 0.84 L-8.39 0.63 L-8.48 0.42 L-8.57 0.21 L-8.66 0.00 L-8.75 -0.21 L-8.83 -0.42 L-8.91 -0.63 L-8.99 -0.84 L-9.06 -1.05 L-9.14 -1.26 L-9.21 -1.47 L-9.27 -1.68 L-9.34 -1.88 L-9.40 -2.09 L-9.46 -2.29 L-9.51 -2.49 L-9.56 -2.69 L-9.61 -2.89 L-9.66 -3.08 L-9.70 -3.28 L-9.74 -3.47 L-9.78 -3.66 L-9.82 -3.85 L-9.85 -4.03 L-9.88 -4.21 L-9.90 -4.39 L-9.93 -4.57 L-9.95 -4.74 L-9.96 -4.91 L-9.98 -5.07 L-9.99 -5.23 L-9.99 -5.39 L-10.00 -5.55 L-10.00 -5.70 L-10.00 -5.85 L-9.99 -5.99 L-9.99 -6.13 L-9.98 -6.26 L-9.96 -6.39 L-9.95 -6.52 L-9.93 -6.64 L-9.90 -6.76 L-9.88 -6.87 L-9.85 -6.98 L-9.82 -7.08 L-9.78 -7.18 L-9.74 -7.27 L-9.70 -7.36 L-9.66 -7.45 L-9.61 -7.52 L-9.56 -7.60 L-9.51 -7.67 L-9.46 -7.73 L-9.40 -7.79 L-9.34 -7.84 L-9.27 -7.88 L-9.21 -7.93 L-9.14 -7.96 L-9.06 -7.99 L-8.99 -8.02 L-8.91 -8.04 L-8.83 -8.05 L-8.75 -8.06 L-8.66 -8.06 L-8.57 -8.06 L-8.48 -8.05 L-8.39 -8.04 L-8.29 -8.02 L-8.19 -7.99 L-8.09 -7.96 L-7.99 -7.93 L-7.88 -7.88 L-7.77 -7.84 L-7.66 -7.79 L-7.55 -7.73 L-7.43 -7.67 L-7.31 -7.60 L-7.19 -7.52 L-7.07 -7.45 L-6.95 -7.36 L-6.82 -7.27 L-6.69 -7.18 L-6.56 -7.08 L-6.43 -6.98 L-6.29 -6.87 L-6.16 -6.76 L-6.02 -6.64 L-5.88 -6.52 L-5.74 -6.39 L-5.59 -6.26 L-5.45 -6.13 L-5.30 -5.99 L-5.15 -5.85 L-5.00 -5.70 L-4.85 -5.55 L-4.69 -5.39 L-4.54 -5.23 L-4.38 -5.07 L-4.23 -4.91 L-4.07 -4.74 L-3.91 -4.57 L-3.75 -4.39 L-3.58 -4.21 L-3.42 -4.03 L-3.26 -3.85 L-3.09 -3.66 L-2.92 -3.47 L-2.76 -3.28 L-2.59 -3.08 L-2.42 -2.89 L-2.25 -2.69 L-2.08 -2.49 L-1.91 -2.29 L-1.74 -2.09 L-1.56 -1.88 L-1.39 -1.68 L-1.22 -1.47 L-1.05 -1.26 L-0.87 -1.05 L-0.70 -0.84 L-0.52 -0.63 L-0.35 -0.42 L-0.17 -0.21 Z"
+ />
+ </svg>
+ <div class="name">
+ <h1 id="browser-name">Ladybird</h1>
+ <span class="badge">Pre-Alpha</span>
</div>
-
- <h3 class="card-title">Runtime</h3>
- <div class="card">
- <div class="card-body details">
- <div class="detail-row">
- <div class="detail-label">Command Line</div>
- <div id="command-line" class="detail-value"></div>
- </div>
- <div class="detail-row">
- <div class="detail-label">Executable Path</div>
- <div id="executable-path" class="detail-value"></div>
- </div>
- </div>
+ <p class="tagline">A truly independent web browser.</p>
+ <div class="details">
+ <dl>
+ <dt>Version</dt>
+ <dd id="browser-version"></dd>
+ <dt>Built</dt>
+ <dd id="browser-commit"></dd>
+ <dt>Platform</dt>
+ <dd id="platform"></dd>
+ </dl>
+ <button class="copy" id="copy" type="button">
+ <svg
+ viewBox="0 0 16 16"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="1.6"
+ stroke-linejoin="round"
+ aria-hidden="true"
+ >
+ <path d="M5.5 5.5h7v8h-7zM3.5 10.5v-8h7" />
+ </svg>
+ Copy
+ </button>
</div>
<script type="module">
- const browserName = document.querySelector("#browser-name");
- const browserVersion = document.querySelector("#browser-version");
- const browserCommit = document.querySelector("#browser-commit");
- const arch = document.querySelector("#arch");
- const platformName = document.querySelector("#platform-name");
- const userAgent = document.querySelector("#user-agent");
- const commandLine = document.querySelector("#command-line");
- const executablePath = document.querySelector("#executable-path");
+ const copyButton = document.querySelector("#copy");
+ let detailsText = "";
function renderVersionInfo(versionInfo) {
- document.title = `About ${versionInfo?.browserName}`;
-
- browserName.innerText = document.title;
- browserVersion.innerText = versionInfo?.browserVersion;
- browserCommit.innerText = versionInfo?.browserCommit;
- arch.innerText = versionInfo?.arch;
- platformName.innerText = versionInfo?.platformName;
- userAgent.innerText = navigator.userAgent;
- commandLine.innerText = versionInfo?.commandLine;
- executablePath.innerText = versionInfo?.executablePath;
+ document.title = `About ${versionInfo.browserName}`;
+ document.querySelector("#browser-name").innerText = versionInfo.browserName;
+ document.querySelector("#browser-version").innerText = versionInfo.browserVersion;
+ document.querySelector("#browser-commit").innerText = `from ${versionInfo.browserCommit.slice(0, 10)}`;
+ document.querySelector("#platform").innerText = `${versionInfo.platformName}, ${versionInfo.arch}`;
+
+ // What is copied includes the details a bug report needs beyond what the page shows.
+ detailsText = [
+ `${versionInfo.browserName} ${versionInfo.browserVersion} (${versionInfo.browserCommit})`,
+ `Platform: ${versionInfo.platformName}, ${versionInfo.arch}`,
+ `User agent: ${navigator.userAgent}`,
+ `Command line: ${versionInfo.commandLine}`,
+ `Executable path: ${versionInfo.executablePath}`,
+ ].join("\n");
}
+ copyButton.addEventListener("click", () => {
+ navigator.clipboard.writeText(detailsText);
+ });
+
document.addEventListener("WebUILoaded", () => {
ladybird.sendMessage("loadVersionInfo");
});
diff --git a/Base/res/ladybird/about-pages/webui.css b/Base/res/ladybird/about-pages/webui.css
index 1ece32ca1ab..3d69aca7001 100644
--- a/Base/res/ladybird/about-pages/webui.css
+++ b/Base/res/ladybird/about-pages/webui.css
@@ -1,41 +1,4 @@
-@media (prefers-color-scheme: light) {
- :root {
- --border-color: #dcdde1;
- --input-background-color: white;
- --card-background-color: #f5f5f5;
- --card-header-background-color: #f0f2f5;
- --icon-background-color: #dfe8f5;
- --icon-color: #37597d;
- --item-hover-color: #eceff3;
- --item-selected-color: #dfe8f5;
- --menu-background-color: #fff;
- --menu-border-color: #d8d8d8;
- --menu-shadow-color: rgba(0, 0, 0, 0.12);
- --secondary-text-color: #65707d;
- --separator-color: #e3e6eb;
- }
-}
-
-@media (prefers-color-scheme: dark) {
- :root {
- --border-color: #3d3d3d;
- --input-background-color: #1e1e1e;
- --card-background-color: #242424;
- --card-header-background-color: #252525;
- --icon-background-color: #243748;
- --icon-color: #9bc3ef;
- --item-hover-color: #2a313a;
- --item-selected-color: #243748;
- --menu-background-color: #2a2a2a;
- --menu-border-color: #4a4a4a;
- --menu-shadow-color: rgba(0, 0, 0, 0.4);
- --secondary-text-color: #a5b0bc;
- --separator-color: #323841;
- }
-}
-
:root {
- --accent: var(--violet-100);
--card-radius: 12px;
}
@@ -50,21 +13,21 @@ body {
padding: 20px;
}
+/* A page's title, with its actions on the same line. */
header {
display: flex;
align-items: center;
+ gap: 12px;
- margin-bottom: 30px;
+ margin-bottom: 18px;
}
header h1 {
- font-size: 20px;
-}
+ flex: 1;
+ margin: 0;
-header img {
- height: 48px;
- margin-right: 10px;
- float: left;
+ font-size: 22px;
+ font-weight: 600;
}
.card-title {
@@ -108,35 +71,38 @@ header img {
display: none;
}
-button:focus-visible,
-summary:focus-visible,
-input[type="checkbox"]:focus-visible {
- outline: 2px solid var(--accent);
- outline-offset: 2px;
-}
-
.search-container {
- background-color: var(--card-background-color);
+ background-color: var(--control);
display: flex;
align-items: center;
+ gap: 8px;
- max-width: 65%;
- margin: 0 auto 24px auto;
- padding: 0 12px;
+ width: 280px;
+ height: 28px;
+ padding: 0 10px;
border: none;
- border-radius: 8px;
+ border-radius: 7px;
+}
+
+.search-container:focus-within {
+ background-color: var(--page);
+ box-shadow:
+ 0 0 0 1px var(--focus-edge),
+ 0 0 0 3px var(--focus-ring);
}
.search-container .search-icon {
- color: var(--placeholder-color);
+ color: var(--muted);
flex-shrink: 0;
- width: 16px;
- height: 16px;
+ width: 14px;
+ height: 14px;
}
-.search-container .search-input {
+.search-container .search-input,
+.search-container .search-input:focus,
+.search-container .search-input:focus-visible {
background: none;
color: inherit;
@@ -145,13 +111,15 @@ input[type="checkbox"]:focus-visible {
border: none;
outline: none;
- font-size: 14px;
+ font-size: 13px;
line-height: 1.2;
width: auto;
min-width: 0;
+ height: auto;
- padding: 10px 12px;
+ padding: 0;
+ box-shadow: none;
}
.menu-toggle {
@@ -165,7 +133,7 @@ input[type="checkbox"]:focus-visible {
color: inherit;
background: none;
border: none;
- border-radius: 4px;
+ border-radius: 6px;
cursor: pointer;
}
@@ -189,13 +157,14 @@ input[type="checkbox"]:focus-visible {
flex-direction: column;
min-width: 200px;
- padding: 4px;
+ padding: 6px;
margin-top: 4px;
background-color: var(--menu-background-color);
- border: 1px solid var(--menu-border-color);
- border-radius: 6px;
- box-shadow: 0 4px 12px var(--menu-shadow-color);
+ border-radius: 10px;
+ box-shadow:
+ 0 0 0 1px var(--edge),
+ var(--popover-shadow);
}
.menu-dropdown.hidden {
@@ -206,10 +175,10 @@ input[type="checkbox"]:focus-visible {
color: inherit;
background: none;
border: none;
- border-radius: 4px;
+ border-radius: 6px;
padding: 8px 12px;
- font-size: 14px;
+ font-size: 13px;
text-align: left;
cursor: pointer;
diff --git a/Base/res/ladybird/about-pages/welcome.css b/Base/res/ladybird/about-pages/welcome.css
index 07045f26c5c..41ce19c3e4e 100644
--- a/Base/res/ladybird/about-pages/welcome.css
+++ b/Base/res/ladybird/about-pages/welcome.css
@@ -5,322 +5,147 @@
*/
body {
- max-width: 1080px;
- padding: 20px;
- font-size: 14px;
- line-height: 1.5;
min-height: 100vh;
+ box-sizing: border-box;
+}
+
+form {
display: flex;
flex-direction: column;
- justify-content: center;
+ max-width: 560px;
+ margin: 0 auto;
+ padding: 40px 24px 28px;
}
header {
+ display: flex;
flex-direction: column;
- gap: 12px;
- margin-bottom: 28px;
+ align-items: center;
text-align: center;
}
-.welcome-title {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 20px;
+.logomark {
+ width: 40px;
+ height: 33.5px;
+ color: var(--brand);
}
-header img {
- width: 64px;
- height: 64px;
- margin: 0;
+h1 {
+ margin-top: 18px;
+ font-size: 22px;
+ font-weight: 600;
+ line-height: 28px;
}
-header h1 {
- font-size: 30px;
- line-height: 1.2;
+header p {
+ margin-top: 4px;
}
-header > p {
- font-size: 16px;
- color: var(--secondary-text-color);
+h2 {
+ font-size: 13px;
+ font-weight: 600;
}
-fieldset {
- min-width: 0;
- border: none;
+.muted {
+ color: var(--muted);
}
-.setup-section {
- display: grid;
- grid-template-columns: 38% minmax(0, 1fr);
- gap: 32px;
- padding: 16px 24px;
+.small {
+ font-size: 12px;
}
-.section-heading {
+fieldset {
display: flex;
- align-items: flex-start;
- gap: 20px;
+ flex-direction: column;
+ gap: 26px;
+ margin-top: 34px;
+ border: none;
}
-.section-icon {
+section {
display: flex;
- align-items: center;
- justify-content: center;
- flex-shrink: 0;
- width: 48px;
- height: 48px;
- color: var(--icon-color);
- background-color: var(--icon-background-color);
- border-radius: 12px;
-}
-
-.section-icon svg {
- width: 24px;
- height: 24px;
-}
-
-h2 {
- margin: 2px 0 8px;
- font-size: 18px;
-}
-
-.section-heading p,
-.section-controls p,
-.tab-option p {
- color: var(--secondary-text-color);
+ flex-direction: column;
+ gap: 10px;
}
-.tab-options {
+.section-heading {
display: flex;
+ align-items: baseline;
+ justify-content: space-between;
gap: 16px;
}
-.tab-option {
- flex: 1;
- min-width: 0;
- padding: 12px;
- border: 1px solid var(--border-color);
- border-radius: 8px;
- cursor: pointer;
-}
-
-.tab-option:hover {
- background-color: var(--item-hover-color);
-}
-
-.tab-option:has(:checked) {
- border-color: var(--accent);
- box-shadow: 0 0 0 1px var(--accent);
-}
-
-.tab-option:has(:focus-visible) {
- outline: 2px solid var(--accent);
- outline-offset: 4px;
+.search-engines {
+ display: grid;
+ grid-template-columns: repeat(3, minmax(0, 1fr));
+ gap: 8px;
}
-.tab-option-heading {
+.search-engine {
display: flex;
align-items: center;
- gap: 12px;
- font-weight: 500;
+ gap: 10px;
+ height: 40px;
+ padding: 0 12px;
+ border-radius: 10px;
+ box-shadow: inset 0 0 0 1px var(--separator);
+ cursor: pointer;
}
-input[type="radio"] {
- flex-shrink: 0;
- width: 20px;
- height: 20px;
- accent-color: var(--accent);
+.search-engine input {
+ position: absolute;
+ opacity: 0;
+ pointer-events: none;
}
-.tab-option p {
- margin: 4px 0 0 32px;
- font-size: 12px;
+/* A search engine is a card like the choices of where tabs go. */
+.search-engine:has(input:checked) {
+ background: var(--choice-fill);
+ box-shadow: inset 0 0 0 1.5px var(--choice);
}
-.tab-preview {
- position: relative;
- width: 100%;
- max-width: 170px;
- height: 48px;
- margin: 0 auto 8px;
- overflow: hidden;
- background-color: var(--input-background-color);
- border: 1px solid var(--border-color);
- border-radius: 4px 4px 0 0;
+.search-engine:has(input:focus-visible) {
+ box-shadow:
+ inset 0 0 0 1.5px var(--choice),
+ 0 0 0 3px var(--focus-ring);
}
-.preview-toolbar {
- display: flex;
+.blocking {
+ flex-direction: row;
align-items: center;
- gap: 4px;
- height: 20px;
- padding: 4px 6px;
- background-color: var(--card-header-background-color);
- border-bottom: 1px solid var(--border-color);
-}
-
-.preview-toolbar i {
- flex-shrink: 0;
- width: 4px;
- height: 4px;
- background-color: var(--secondary-text-color);
- border-radius: 50%;
-}
-
-.preview-tab {
- display: block;
- width: 44px;
- height: 10px;
- padding: 3px 5px;
- background-color: var(--item-hover-color);
- border-radius: 2px;
-}
-
-.preview-tab::before {
- content: "";
- display: block;
- height: 3px;
- background-color: var(--secondary-text-color);
- border-radius: 2px;
- opacity: 0.5;
-}
-
-.horizontal-preview .preview-tab:first-of-type {
- background-color: var(--item-selected-color);
-}
-
-.vertical-preview .preview-toolbar {
- width: 60px;
+ gap: 16px;
+ padding: 12px 14px;
+ border-radius: 10px;
+ box-shadow: inset 0 0 0 1px var(--separator);
}
-.preview-sidebar {
+.blocking > div {
display: flex;
+ flex: 1;
flex-direction: column;
- gap: 3px;
- width: 60px;
- height: 36px;
- padding: 3px 6px;
- background-color: var(--card-header-background-color);
-}
-
-.vertical-preview .preview-content {
- position: absolute;
- top: 0;
- bottom: 0;
- left: 60px;
- border-left: 1px solid var(--border-color);
-}
-
-select {
- width: 100%;
- background-color: var(--input-background-color);
- border: 1px solid var(--border-color);
-}
-
-.switch-option {
- display: flex;
- align-items: center;
- gap: 12px;
- cursor: pointer;
-}
-
-.switch-option:has(input:disabled) {
- cursor: default;
- color: var(--secondary-text-color);
+ gap: 2px;
}
-.switch-option input {
+.blocking input[switch] {
flex-shrink: 0;
}
-.switch-option + .description {
- margin-left: 62px;
-}
-
-select + .switch-option {
- margin-top: 12px;
-}
-
-#content-blocker-lists {
- margin-top: 8px;
-}
-
-.filter-list {
- display: grid;
- grid-template-columns: 18px minmax(140px, 1fr) minmax(0, 1.6fr);
- align-items: start;
- gap: 12px;
- padding: 6px 0;
- cursor: pointer;
-}
-
-.filter-list + .filter-list {
- border-top: 1px solid var(--border-color);
-}
-
-.filter-list input {
- margin-top: 3px;
-}
-
-.filter-list p {
- font-size: 12px;
-}
-
footer {
- margin-top: 16px;
- text-align: center;
-}
-
-#save-status:empty {
- display: none;
-}
-
-#save-status {
- margin-bottom: 12px;
+ display: flex;
+ align-items: center;
+ justify-content: flex-end;
+ gap: 14px;
+ margin-top: 28px;
}
-#start-browsing {
- min-width: 200px;
- padding: 10px 24px;
+footer .primary-button {
+ height: 32px;
+ padding: 0 18px;
border-radius: 8px;
}
-@media (max-width: 760px) {
- .setup-section {
- grid-template-columns: minmax(0, 1fr);
- gap: 20px;
- padding: 16px 20px;
- }
-
- .section-heading {
- gap: 16px;
- }
-}
-
-@media (max-width: 440px) {
- body {
- padding: 24px 16px;
- }
-
- .welcome-title {
- flex-direction: column;
- gap: 12px;
- }
-
- header h1 {
- font-size: 26px;
- }
-
- .tab-options {
- flex-direction: column;
- }
-
- .filter-list {
- grid-template-columns: 18px minmax(0, 1fr);
- }
-
- .filter-list p {
- grid-column: 2;
+@media (max-width: 520px) {
+ .search-engines {
+ grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
diff --git a/Base/res/ladybird/about-pages/welcome.html b/Base/res/ladybird/about-pages/welcome.html
index 5c9f18691a3..ac46007c031 100644
--- a/Base/res/ladybird/about-pages/welcome.html
+++ b/Base/res/ladybird/about-pages/welcome.html
@@ -1,7 +1,6 @@
<!doctype html>
<!--
Copyright (c) 2026-present, the Ladybird developers.
-
SPDX-License-Identifier: BSD-2-Clause
-->
<html lang="en">
@@ -11,129 +10,78 @@ SPDX-License-Identifier: BSD-2-Clause
<title>Welcome</title>
<link rel="icon" type="image/png" href="resource://icons/48x48/app-browser.png" />
<link rel="stylesheet" href="resource://ladybird/ladybird.css" />
- <link rel="stylesheet" href="resource://ladybird/about-pages/webui.css" />
<link rel="stylesheet" href="resource://ladybird/about-pages/welcome.css" />
<script type="module" src="resource://ladybird/about-pages/welcome.js"></script>
</head>
<body>
- <header>
- <div class="welcome-title">
- <picture>
- <source srcset="resource://icons/128x128/app-browser.png" media="(prefers-color-scheme: dark)" />
- <img src="resource://icons/128x128/app-browser-dark.png" alt="" />
- </picture>
+ <form id="welcome-form">
+ <header>
+ <svg
+ class="logomark"
+ viewBox="-11 -9.2 22 18.4"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="1.55"
+ stroke-linejoin="round"
+ aria-hidden="true"
+ >
+ <path
+ d="M0 0 L1.39 1.68 L2.76 3.29 L4.07 4.76 L5.30 6.02 L6.43 7.02 L7.43 7.70 L8.29 8.06 L8.99 8.06 L9.51 7.70 L9.85 7.02 L9.99 6.02 L9.95 4.76 L9.70 3.29 L9.27 1.68 L8.66 0 L7.88 -1.68 L6.95 -3.29 L5.88 -4.76 L4.69 -6.02 L3.42 -7.02 L2.08 -7.70 L0.70 -8.06 L-0.70 -8.06 L-2.08 -7.70 L-3.42 -7.02 L-4.69 -6.02 L-5.88 -4.76 L-6.95 -3.29 L-7.88 -1.68 L-8.66 0 L-9.27 1.68 L-9.70 3.29 L-9.95 4.76 L-9.99 6.02 L-9.85 7.02 L-9.51 7.70 L-8.99 8.06 L-8.29 8.06 L-7.43 7.70 L-6.43 7.02 L-5.30 6.02 L-4.07 4.76 L-2.76 3.29 L-1.39 1.68 L0 0 L1.39 -1.68 L2.76 -3.29 L4.07 -4.76 L5.30 -6.02 L6.43 -7.02 L7.43 -7.70 L8.29 -8.06 L8.99 -8.06 L9.51 -7.70 L9.85 -7.02 L9.99 -6.02 L9.95 -4.76 L9.70 -3.29 L9.27 -1.68 L8.66 0 L7.88 1.68 L6.95 3.29 L5.88 4.76 L4.69 6.02 L3.42 7.02 L2.08 7.70 L0.70 8.06 L-0.70 8.06 L-2.08 7.70 L-3.42 7.02 L-4.69 6.02 L-5.88 4.76 L-6.95 3.29 L-7.88 1.68 L-8.66 0 L-9.27 -1.68 L-9.70 -3.29 L-9.95 -4.76 L-9.99 -6.02 L-9.85 -7.02 L-9.51 -7.70 L-8.99 -8.06 L-8.29 -8.06 L-7.43 -7.70 L-6.43 -7.02 L-5.30 -6.02 L-4.07 -4.76 L-2.76 -3.29 L-1.39 -1.68 Z"
+ />
+ </svg>
<h1>Welcome to Ladybird</h1>
- </div>
- <p>Choose a few basics to get started. You can change these later in Settings.</p>
- </header>
- <main>
- <form id="welcome-form">
- <fieldset id="setup-options" disabled>
- <section id="tab-mode-section" class="card setup-section" aria-labelledby="tab-mode-title">
- <div class="section-heading">
- <span class="section-icon" aria-hidden="true">
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
- <rect x="3" y="4" width="18" height="16" rx="2" />
- <path d="M9 4v16" />
- </svg>
+ <p class="muted">You can change any of this later in Settings.</p>
+ </header>
+ <fieldset id="setup-options" disabled>
+ <section aria-labelledby="search-engine-title">
+ <div class="section-heading">
+ <h2 id="search-engine-title">Search engine</h2>
+ <p class="muted small">Optional</p>
+ </div>
+ <div
+ id="search-engines"
+ class="search-engines"
+ role="radiogroup"
+ aria-labelledby="search-engine-title"
+ ></div>
+ </section>
+ <section id="tab-mode-section" aria-labelledby="tab-mode-title">
+ <h2 id="tab-mode-title">Tabs</h2>
+ <div class="tab-options" role="radiogroup" aria-labelledby="tab-mode-title">
+ <label class="tab-option">
+ <input type="radio" name="tab-mode" value="horizontal" checked />
+ <span class="tab-preview horizontal-preview" aria-hidden="true">
+ <span class="preview-strip"><i class="active"></i><i></i><i></i></span>
+ <span class="preview-toolbar"><i></i></span>
</span>
- <div>
- <h2 id="tab-mode-title">Tab mode</h2>
- <p>Choose how you'd like to organize your tabs.</p>
- </div>
- </div>
- <div class="tab-options" role="group" aria-labelledby="tab-mode-title">
- <label class="tab-option">
- <div class="tab-preview horizontal-preview" aria-hidden="true">
- <div class="preview-toolbar">
- <i></i><i></i><i></i> <span class="preview-tab"></span
- ><span class="preview-tab"></span>
- </div>
- <div class="preview-content"></div>
- </div>
- <div class="tab-option-heading">
- <input type="radio" name="tab-mode" value="horizontal" checked />
- <span>Horizontal tabs</span>
- </div>
- <p>Tabs appear at the top.</p>
- </label>
- <label id="vertical-tab-option" class="tab-option">
- <div class="tab-preview vertical-preview" aria-hidden="true">
- <div class="preview-toolbar"><i></i><i></i><i></i></div>
- <div class="preview-sidebar">
- <span class="preview-tab"></span><span class="preview-tab"></span>
- <span class="preview-tab"></span>
- </div>
- <div class="preview-content"></div>
- </div>
- <div class="tab-option-heading">
- <input type="radio" name="tab-mode" value="vertical" />
- <span>Vertical tabs</span>
- </div>
- <p>Tabs appear in a sidebar on the side.</p>
- </label>
- </div>
- </section>
- <section class="card setup-section" aria-labelledby="search-engine-title">
- <div class="section-heading">
- <span class="section-icon" aria-hidden="true">
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
- <circle cx="10" cy="10" r="7" />
- <path d="m15 15 6 6" />
- </svg>
+ <span class="tab-option-label">Along the top</span>
+ </label>
+ <label id="vertical-tab-option" class="tab-option">
+ <input type="radio" name="tab-mode" value="vertical" />
+ <span class="tab-preview vertical-preview" aria-hidden="true">
+ <span class="preview-sidebar"><i></i><i class="active"></i><i></i></span>
+ <span class="preview-main"
+ ><span class="preview-toolbar"><i></i></span
+ ></span>
</span>
- <div>
- <h2 id="search-engine-title">Default search engine</h2>
- <p>Choose your preferred search engine for the address bar.</p>
- </div>
- </div>
- <div class="section-controls">
- <select id="search-engine" aria-labelledby="search-engine-title">
- <option value="">Disable search</option>
- </select>
- <label class="switch-option">
- <input
- id="search-suggestions-enabled"
- type="checkbox"
- switch
- aria-describedby="search-suggestions-description"
- />
- <span>Show search suggestions</span>
- </label>
- <p id="search-suggestions-description" class="description"></p>
- </div>
- </section>
- <section class="card setup-section" aria-labelledby="ad-blocking-title">
- <div class="section-heading">
- <span class="section-icon" aria-hidden="true">
- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8">
- <path d="M12 2 21 6v6c0 5-9 10-9 10S3 17 3 12V6Z" />
- </svg>
- </span>
- <div>
- <h2 id="ad-blocking-title">Ad blocking</h2>
- <p>Block ads and trackers for a cleaner, faster web.</p>
- </div>
- </div>
- <div class="section-controls">
- <label class="switch-option">
- <input id="enable-content-blocking" type="checkbox" switch />
- <span>Enable ad blocking</span>
- </label>
- <div id="blocking-options">
- <p class="description">
- Enabling a filter list downloads it from a third-party provider.
- </p>
- <div id="content-blocker-lists"></div>
- </div>
- </div>
- </section>
- </fieldset>
- <footer>
- <p id="save-status" role="status"></p>
- <button id="start-browsing" class="primary-button" type="submit" disabled>Start Browsing</button>
- </footer>
- </form>
- </main>
+ <span class="tab-option-label">Down the side</span>
+ </label>
+ </div>
+ </section>
+ <section class="blocking" aria-labelledby="ad-blocking-title">
+ <div>
+ <h2 id="ad-blocking-title">Block ads, trackers and more</h2>
+ <p class="muted small">
+ Pages load faster. If a site breaks, turn it off for that site from the address bar.
+ </p>
+ </div>
+ <input id="enable-content-blocking" type="checkbox" switch aria-labelledby="ad-blocking-title" />
+ </section>
+ </fieldset>
+ <footer>
+ <p id="save-status" class="muted small" role="status"></p>
+ <button id="start-browsing" class="primary-button" type="submit" disabled>Start browsing</button>
+ </footer>
+ </form>
</body>
</html>
diff --git a/Base/res/ladybird/about-pages/welcome.js b/Base/res/ladybird/about-pages/welcome.js
index 8d97c79c1d2..be1014ef82c 100644
--- a/Base/res/ladybird/about-pages/welcome.js
+++ b/Base/res/ladybird/about-pages/welcome.js
@@ -4,17 +4,11 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-import { populateSearchEngineSelect, updateSearchSuggestionsControl } from "./search-engine-controls.js";
-
const form = document.querySelector("#welcome-form");
const setupOptions = document.querySelector("#setup-options");
const startBrowsing = document.querySelector("#start-browsing");
-const searchEngine = document.querySelector("#search-engine");
-const searchSuggestions = document.querySelector("#search-suggestions-enabled");
-const searchSuggestionsDescription = document.querySelector("#search-suggestions-description");
+const searchEngines = document.querySelector("#search-engines");
const enableContentBlocking = document.querySelector("#enable-content-blocking");
-const blockingOptions = document.querySelector("#blocking-options");
-const contentBlockerLists = document.querySelector("#content-blocker-lists");
const saveStatus = document.querySelector("#save-status");
let settings;
@@ -22,14 +16,64 @@ let engines;
let features;
let initialized = false;
-const filterListDescriptions = {
- easyList: "Blocks most ads.",
- easyPrivacy: "Blocks trackers.",
- fanboyAnnoyances: "Blocks pop-ups and other annoyances.",
-};
+function setSearchEngine(name) {
+ ladybird.sendMessage("setSearchEngineSettings", {
+ engine: name,
+ suggestions: settings.searchEngine.suggestions,
+ });
+}
+
+// The search engines are shown in a new random order each time, so that none is favored by its place in the list.
+function shuffled(items) {
+ const result = [...items];
+ for (let i = result.length - 1; i > 0; --i) {
+ const j = Math.floor(Math.random() * (i + 1));
+ [result[i], result[j]] = [result[j], result[i]];
+ }
+ return result;
+}
+
+function renderSearchEngines() {
+ const names = shuffled(engines.search.map(engine => engine.name));
+
+ searchEngines.replaceChildren();
+ for (const name of names) {
+ const tile = document.createElement("label");
+ tile.className = "search-engine";
+
+ const radio = document.createElement("input");
+ radio.type = "radio";
+ radio.name = "search-engine";
+ radio.value = name;
+ radio.checked = settings.searchEngine.engine === name;
+ radio.addEventListener("change", () => {
+ if (!initialized) return;
+ setSearchEngine(name);
+ });
+
+ // A search engine is optional, so choosing the chosen one again goes without one.
+ let wasChecked = false;
+ tile.addEventListener("pointerdown", () => {
+ wasChecked = radio.checked;
+ });
+ tile.addEventListener("click", event => {
+ if (!initialized || !wasChecked || event.target !== radio) return;
+ wasChecked = false;
+ radio.checked = false;
+ setSearchEngine(null);
+ });
-function updateBlockingOptions() {
- blockingOptions.classList.toggle("hidden", !enableContentBlocking.checked);
+ const letter = document.createElement("span");
+ letter.className = "letter-tile";
+ letter.setAttribute("aria-hidden", "true");
+ letter.textContent = name.charAt(0).toUpperCase();
+
+ const label = document.createElement("span");
+ label.textContent = name;
+
+ tile.append(radio, letter, label);
+ searchEngines.append(tile);
+ }
}
function initialize() {
@@ -40,41 +84,9 @@ function initialize() {
const tabMode = settings.tabs.verticalTabsEnabled ? "vertical" : "horizontal";
document.querySelector(`input[name="tab-mode"][value="${tabMode}"]`).checked = true;
- populateSearchEngineSelect(searchEngine, engines.search, settings.searchEngine);
- searchSuggestions.checked = settings.searchEngine.suggestions;
- updateSearchSuggestionsControl(searchEngine, searchSuggestions, searchSuggestionsDescription);
+ renderSearchEngines();
enableContentBlocking.checked = settings.contentBlockers.enabled;
- for (const list of settings.contentBlockerLists) {
- if (!Object.hasOwn(filterListDescriptions, list.identifier)) continue;
-
- const row = document.createElement("label");
- row.className = "filter-list";
- row.title = list.url;
-
- const checkbox = document.createElement("input");
- checkbox.type = "checkbox";
- checkbox.dataset.identifier = list.identifier;
- checkbox.checked = list.enabled;
- checkbox.addEventListener("change", () => {
- ladybird.sendMessage("setContentBlockerListEnabled", {
- identifier: list.identifier,
- enabled: checkbox.checked,
- });
- });
-
- const name = document.createElement("span");
- name.textContent = list.name;
-
- const description = document.createElement("p");
- description.id = `description-${list.identifier}`;
- description.textContent = filterListDescriptions[list.identifier];
- checkbox.setAttribute("aria-describedby", description.id);
-
- row.append(checkbox, name, description);
- contentBlockerLists.append(row);
- }
- updateBlockingOptions();
setupOptions.disabled = false;
startBrowsing.disabled = false;
}
@@ -89,26 +101,9 @@ for (const input of document.querySelectorAll('input[name="tab-mode"]')) {
});
}
-function saveSearchEngineSettings() {
- if (!initialized) return;
-
- ladybird.sendMessage("setSearchEngineSettings", {
- engine: searchEngine.value || null,
- suggestions: searchSuggestions.checked,
- });
-}
-
-searchEngine.addEventListener("change", () => {
- updateSearchSuggestionsControl(searchEngine, searchSuggestions, searchSuggestionsDescription);
- saveSearchEngineSettings();
-});
-
-searchSuggestions.addEventListener("change", saveSearchEngineSettings);
-
enableContentBlocking.addEventListener("change", () => {
if (!initialized) return;
- updateBlockingOptions();
ladybird.sendMessage("setContentBlockerEnabled", enableContentBlocking.checked);
ladybird.sendMessage("setFilterListUpdatesEnabled", enableContentBlocking.checked);
});
@@ -141,24 +136,11 @@ document.addEventListener("WebUIMessage", event => {
document.querySelector(`input[name="tab-mode"][value="${mode}"]`).checked = true;
}
if (Object.hasOwn(data, "searchEngine")) {
- populateSearchEngineSelect(searchEngine, engines.search, settings.searchEngine);
- searchSuggestions.checked = settings.searchEngine.suggestions;
- updateSearchSuggestionsControl(searchEngine, searchSuggestions, searchSuggestionsDescription);
+ for (const radio of searchEngines.querySelectorAll("input"))
+ radio.checked = radio.value === settings.searchEngine.engine;
}
- if (Object.hasOwn(data, "contentBlockers")) {
+ if (Object.hasOwn(data, "contentBlockers"))
enableContentBlocking.checked = settings.contentBlockers.enabled;
- updateBlockingOptions();
- }
- if (Object.hasOwn(data, "contentBlockerLists")) {
- for (const checkbox of contentBlockerLists.querySelectorAll("input")) {
- const list = settings.contentBlockerLists.find(
- list => list.identifier === checkbox.dataset.identifier
- );
- if (list) {
- checkbox.checked = list.enabled;
- }
- }
- }
}
} else if (name === "loadEngines") {
engines = data;
diff --git a/Base/res/ladybird/ladybird.css b/Base/res/ladybird/ladybird.css
index 38daca8d5d3..7284ebcfdc8 100644
--- a/Base/res/ladybird/ladybird.css
+++ b/Base/res/ladybird/ladybird.css
@@ -39,40 +39,131 @@
--slate-blue: var(--slate-blue-100);
}
+/**
+ * The Quiet design's colors for Ladybird's own pages.
+ */
+
@media (prefers-color-scheme: light) {
:root {
- --text-color: #2f3640;
- --toggle-background-color: #8f8f8f;
- --toggle-disabled-background-color: #e0e0e0;
- --toggle-disabled-knob-color: #fafafa;
- --secondary-button-color: #dddddd;
- --secondary-button-hover: #e1e1e1;
- --secondary-button-active: #e9e9e9;
+ --page: #ffffff;
+ --text: #1d1d1f;
+ --body: #3a3a40;
+ --muted: #5d5d64;
+ --separator: #dcdce0;
+ --separator-soft: #ececef;
+ --control: rgba(0, 0, 0, 0.06);
+ --control-hover: rgba(0, 0, 0, 0.075);
+ --control-pressed: rgba(0, 0, 0, 0.09);
+ --segment: #ffffff;
+ --surface: #fbfbfc;
+ --edge: rgba(0, 0, 0, 0.1);
+ --popover-shadow: 0 14px 36px rgba(0, 0, 0, 0.16);
+ --dialog-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
+ --field-edge: rgba(0, 0, 0, 0.04);
+ --link: #0a66d0;
+ --checkbox-edge: #6e6e75;
+ --error: #b3261e;
+ --success: #208a3a;
+ --warning: #8a4700;
+ --warning-icon: #b25d00;
+ --badge-background: rgba(106, 57, 219, 0.12);
+ --badge-text: #4d2bb0;
+ --brand: #6a39db;
+ --switch-off: #bcbcc2;
+ --preview-tab: #ffffff;
+ --preview-tab-inactive: #cfcfd4;
+ --preview-tab-current: #bdbdc3;
+ --preview-field: #e6e6e9;
+ --choice: var(--primary);
+ --choice-fill: rgba(10, 102, 208, 0.08);
}
}
@media (prefers-color-scheme: dark) {
:root {
- --text-color: #e0e0e0;
- --toggle-background-color: #6b6b6b;
- --toggle-disabled-background-color: #353535;
- --toggle-disabled-knob-color: #7a7a7a;
- --secondary-button-color: #555555;
- --secondary-button-hover: #505050;
- --secondary-button-active: #444444;
+ --page: #1c1c1e;
+ --text: #f2f2f5;
+ --body: #dcdce1;
+ --muted: #acacb4;
+ --separator: #3d3d42;
+ --separator-soft: #333337;
+ --control: rgba(255, 255, 255, 0.1);
+ --control-hover: rgba(255, 255, 255, 0.12);
+ --control-pressed: rgba(255, 255, 255, 0.14);
+ --segment: #48484e;
+ --surface: #333336;
+ --edge: rgba(255, 255, 255, 0.12);
+ --popover-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
+ --dialog-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
+ --field-edge: rgba(255, 255, 255, 0.06);
+ --link: #6aa8ff;
+ --checkbox-edge: #9a9aa2;
+ --error: #ff9a8f;
+ --success: #30b14f;
+ --warning: #f2a33a;
+ --warning-icon: #f2a33a;
+ --badge-background: rgba(150, 110, 255, 0.22);
+ --badge-text: #c9b5ff;
+ --brand: #7a4ce6;
+ --switch-off: #48484e;
+ --preview-tab: #2e2e31;
+ --preview-tab-inactive: #4a4a50;
+ --preview-tab-current: #5b5b61;
+ --preview-field: #3a3a3e;
+ --choice: #3d8bff;
+ --choice-fill: rgba(61, 139, 255, 0.16);
+ }
+}
+
+:root {
+ /* The accent is used for focus rings, selection and switches that are on. The primary action is a darker blue
+ that white text stays clear on. */
+ --accent: #0a7aff;
+ --primary: #0a66d0;
+ --primary-hover: #0959b8;
+ --primary-pressed: #084ea2;
+
+ /* A focus ring is a fine line of the focus edge color right outside the focused control, in a wider, fainter
+ halo. On a dark page it is a lighter blue, as the accent itself is too deep there. */
+ --focus-edge: var(--accent);
+ --focus-ring: rgba(10, 122, 255, 0.16);
+
+ /* Names that the pages' own styles use for the colors above. */
+ --text-color: var(--text);
+ --secondary-text-color: var(--muted);
+ --placeholder-color: var(--muted);
+ --border-color: var(--separator);
+ --separator-color: var(--separator-soft);
+ --card-background-color: var(--page);
+ --item-hover-color: var(--control);
+ --menu-background-color: var(--surface);
+ --toggle-background-color: var(--switch-off);
+ --toggle-disabled-background-color: var(--control);
+ --toggle-disabled-knob-color: var(--muted);
+ --secondary-button-color: var(--control);
+ --secondary-button-hover: var(--control-hover);
+ --secondary-button-active: var(--control-pressed);
+}
+
+@media (prefers-color-scheme: dark) {
+ :root {
+ --focus-edge: rgba(64, 140, 255, 0.75);
+ --focus-ring: rgba(64, 140, 255, 0.16);
}
}
* {
color-scheme: light dark;
- font-family: sans-serif;
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
margin: 0;
padding: 0;
}
body {
- color: var(--text-color);
+ color: var(--text);
+ background-color: var(--page);
+ font-size: 13px;
}
.hidden {
@@ -86,52 +177,60 @@ body {
button.primary-button,
button.secondary-button {
- font-size: 14px;
+ font: inherit;
+ font-size: 13px;
+
+ height: 28px;
+ padding: 0 16px;
border: none;
- border-radius: 4px;
- padding: 10px 15px;
+ border-radius: 7px;
cursor: pointer;
}
-button.primary-button:hover,
-button.secondary-button:hover {
- filter: unset;
-}
-
-button.primary-button:active,
-button.secondary-button:active {
- outline: none;
-}
-
button.primary-button {
color: white;
- background-color: var(--violet-100);
+ background-color: var(--primary);
+ font-weight: 500;
}
button.primary-button:hover {
- background-color: var(--violet-500);
+ background-color: var(--primary-hover);
}
button.primary-button:active {
- background-color: var(--violet-900);
+ background-color: var(--primary-pressed);
}
button.primary-button:disabled {
- background-color: var(--violet-60);
+ color: var(--muted);
+ background-color: var(--control);
+ cursor: default;
}
button.secondary-button {
- background-color: var(--secondary-button-color);
+ color: var(--text);
+ background-color: var(--control);
}
button.secondary-button:hover {
- background-color: var(--secondary-button-hover);
+ background-color: var(--control-hover);
}
button.secondary-button:active {
- background-color: var(--secondary-button-active);
+ background-color: var(--control-pressed);
+}
+
+button:focus-visible,
+a:focus-visible,
+summary:focus-visible,
+select:focus-visible,
+input[type="checkbox"][switch]:focus-visible {
+ outline: none;
+ box-shadow:
+ 0 0 0 1px var(--focus-edge),
+ 0 0 0 3px var(--focus-ring);
}
input[type="number"],
@@ -139,37 +238,90 @@ input[type="search"],
input[type="text"],
input[type="url"],
select {
- color: var(--text-color);
+ color: var(--text);
+ background-color: var(--control);
- font-size: 14px;
+ font: inherit;
+ font-size: 13px;
- border-radius: 4px;
- padding: 10px 12px;
+ height: 28px;
+ padding: 0 10px;
+
+ border: none;
+ border-radius: 7px;
}
input[type="number"]:focus,
input[type="search"]:focus,
input[type="text"]:focus,
input[type="url"]:focus,
+select:focus-visible {
+ background-color: var(--page);
+ outline: none;
+ box-shadow:
+ 0 0 0 1px var(--focus-edge),
+ 0 0 0 3px var(--focus-ring);
+}
+
select:focus {
- border-color: var(--violet-100);
outline: none;
}
-input[type="checkbox"] {
- width: 14px;
- height: 14px;
+input::placeholder {
+ color: var(--muted);
+}
+
+/* A checkbox is a small rounded square, ringed when unchecked and filled with the accent and a white check mark when
+ checked. */
+input[type="checkbox"]:not([switch]) {
+ appearance: none;
+ flex-shrink: 0;
- accent-color: var(--violet-100);
+ width: 16px;
+ height: 16px;
+
+ border: none;
+ border-radius: 4px;
+ box-shadow: inset 0 0 0 1.5px var(--checkbox-edge);
+
+ background-color: transparent;
+ background-position: center;
+ background-repeat: no-repeat;
+ background-size: 12px 12px;
outline: none;
+ cursor: pointer;
+}
+
+input[type="checkbox"]:not([switch]):checked {
+ background-color: var(--accent);
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 4.9 8.6 9.5 3.6' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
+ box-shadow: none;
+}
+
+input[type="checkbox"]:not([switch]):disabled {
+ opacity: 0.5;
+ cursor: default;
+}
+
+input[type="checkbox"]:not([switch]):checked:focus-visible {
+ box-shadow:
+ 0 0 0 1px var(--focus-edge),
+ 0 0 0 3px var(--focus-ring);
+}
+
+input[type="checkbox"]:not([switch]):not(:checked):focus-visible {
+ box-shadow:
+ inset 0 0 0 1.5px var(--checkbox-edge),
+ 0 0 0 1px var(--focus-edge),
+ 0 0 0 3px var(--focus-ring);
}
input[type="checkbox"][switch] {
- width: 50px;
- height: 24px;
+ width: 32px;
+ height: 18px;
- background-color: var(--toggle-background-color);
+ background-color: var(--switch-off);
cursor: pointer;
outline: none;
@@ -187,16 +339,188 @@ input[type="checkbox"][switch]:disabled::before {
}
input[type="checkbox"][switch]:checked {
- background-color: var(--violet-100);
+ background-color: var(--accent);
}
input[type="checkbox"][switch]::before {
background-color: white;
- border: 0.6em solid white;
+ border: 7px solid white;
- left: 3px;
+ left: 2px;
}
input[type="checkbox"][switch]:checked::before {
- left: calc(100% - 1.3em);
+ left: calc(100% - 16px);
+}
+
+/* A choice between a few options, shown side by side in a track, with the chosen one raised. */
+.segmented {
+ display: inline-flex;
+ padding: 2px;
+ border-radius: 7px;
+ background: var(--control);
+}
+
+.segmented label {
+ display: flex;
+ margin: 0;
+ align-items: center;
+ height: 24px;
+ padding: 0 14px;
+ border-radius: 5px;
+ color: var(--text);
+ font-size: 13px;
+ cursor: default;
+}
+
+.segmented input {
+ position: absolute;
+ opacity: 0;
+ pointer-events: none;
+}
+
+.segmented label:has(input:checked) {
+ background: var(--segment);
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
+}
+
+.segmented label:has(input:focus-visible) {
+ box-shadow:
+ 0 0 0 1px var(--focus-edge),
+ 0 0 0 3px var(--focus-ring);
+}
+
+/* A choice of where tabs go, each option a card with a small picture of the window, outlined in the choice blue and
+ lightly filled when chosen. */
+.tab-options {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: 8px;
+}
+
+.tab-option {
+ display: flex;
+ margin: 0;
+ flex-direction: column;
+ gap: 8px;
+ padding: 10px;
+ border-radius: 10px;
+ box-shadow: inset 0 0 0 1px var(--separator);
+ cursor: pointer;
+}
+
+.tab-option:has(input:checked) {
+ background: var(--choice-fill);
+ box-shadow: inset 0 0 0 1.5px var(--choice);
+}
+
+.tab-option:has(input:focus-visible) {
+ box-shadow:
+ inset 0 0 0 1.5px var(--choice),
+ 0 0 0 3px var(--focus-ring);
+}
+
+.tab-option-label {
+ padding: 0 2px;
+}
+
+.tab-option input {
+ position: absolute;
+ opacity: 0;
+ pointer-events: none;
+}
+
+.tab-preview {
+ display: flex;
+ height: 72px;
+ border-radius: 6px;
+ overflow: hidden;
+ background: var(--page);
+ box-shadow: 0 0 0 1px var(--separator);
+}
+
+.horizontal-preview {
+ flex-direction: column;
+}
+
+.preview-strip {
+ display: flex;
+ align-items: flex-end;
+ gap: 4px;
+ height: 15px;
+ padding: 0 8px;
+ background: var(--separator);
+}
+
+.preview-strip i {
+ width: 26px;
+ height: 6px;
+ margin-bottom: 2px;
+ border-radius: 2px;
+ background: var(--preview-tab-inactive);
+}
+
+.preview-strip i.active {
+ width: 30px;
+ height: 10px;
+ margin-bottom: 0;
+ border-radius: 3px 3px 0 0;
+ background: var(--preview-tab);
+}
+
+.preview-toolbar {
+ display: flex;
+ align-items: center;
+ height: 13px;
+ padding: 0 8px;
+ background: var(--page);
+ border-bottom: 1px solid var(--separator);
+}
+
+.preview-toolbar i {
+ flex: 1;
+ height: 6px;
+ border-radius: 3px;
+ background: var(--preview-field);
+}
+
+.preview-sidebar {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ width: 40px;
+ padding: 16px 6px 0;
+ box-sizing: border-box;
+ background: var(--separator);
+}
+
+.preview-sidebar i {
+ height: 5px;
+ border-radius: 2px;
+ background: var(--preview-tab-inactive);
+}
+
+.preview-sidebar i.active {
+ background: var(--preview-tab-current);
+}
+
+.preview-main {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+}
+
+/* A search engine is pictured by a small tile with its initial. */
+.letter-tile {
+ display: flex;
+ flex-shrink: 0;
+ align-items: center;
+ justify-content: center;
+ width: 18px;
+ height: 18px;
+ border-radius: 4px;
+ font-size: 10px;
+ font-weight: 700;
+ color: var(--page);
+ background: var(--muted);
}
diff --git a/Base/res/ladybird/templates/error.html b/Base/res/ladybird/templates/error.html
index 39ff901e1bd..d82f13dd8b8 100644
--- a/Base/res/ladybird/templates/error.html
+++ b/Base/res/ladybird/templates/error.html
@@ -2,57 +2,147 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
- <title>Error!</title>
+ <title>Can’t reach %failed_host%</title>
<style>
:root {
color-scheme: light dark;
- font-family: system-ui, sans-serif;
+ font-family:
+ -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
+ font-size: 13px;
+
+ --page: #ffffff;
+ --text: #1d1d1f;
+ --body: #3a3a40;
+ --muted: #5d5d64;
+ --control: rgba(0, 0, 0, 0.06);
+ --control-hover: rgba(0, 0, 0, 0.09);
+ --primary: #0a66d0;
+ --primary-hover: #0959b8;
+ --focus-edge: #0a7aff;
+ --focus-ring: rgba(10, 122, 255, 0.16);
+ }
+ @media (prefers-color-scheme: dark) {
+ :root {
+ --page: #1c1c1e;
+ --text: #f2f2f5;
+ --body: #dcdce1;
+ --muted: #acacb4;
+ --control: rgba(255, 255, 255, 0.1);
+ --control-hover: rgba(255, 255, 255, 0.14);
+ --focus-edge: rgba(64, 140, 255, 0.75);
+ --focus-ring: rgba(64, 140, 255, 0.16);
+ }
}
body {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- min-height: 100vh;
- box-sizing: border-box;
margin: 0;
- padding: 1rem;
- text-align: center;
+ padding: 132px 24px 48px;
+ color: var(--text);
+ background: var(--page);
}
- header {
+ main {
display: flex;
flex-direction: column;
- align-items: center;
- gap: 2rem;
- margin-bottom: 1rem;
+ gap: 14px;
+ /* The content lines up with the left edge of a centered column. */
+ max-width: 800px;
+ margin: 0 auto;
+ }
+ main > * {
+ max-width: 560px;
}
svg {
- height: 64px;
- width: auto;
- stroke: currentColor;
- fill: none;
- stroke-width: 1.5;
- stroke-linecap: round;
- stroke-linejoin: round;
+ width: 40px;
+ height: 40px;
+ color: var(--muted);
}
h1 {
margin: 0;
- font-size: 1.5rem;
+ font-size: 22px;
+ font-weight: 600;
+ overflow-wrap: anywhere;
}
p {
- font-size: 1rem;
- color: #555;
+ margin: 0;
+ line-height: 1.55;
+ color: var(--body);
+ }
+ .actions {
+ display: flex;
+ gap: 8px;
+ margin-top: 10px;
+ }
+ button,
+ summary {
+ font: inherit;
+ font-size: 13px;
+ height: 28px;
+ padding: 0 16px;
+ border: 0;
+ border-radius: 7px;
+ cursor: pointer;
+ }
+ button {
+ color: #ffffff;
+ background: var(--primary);
+ font-weight: 500;
+ }
+ button:hover {
+ background: var(--primary-hover);
+ }
+ details {
+ display: contents;
+ }
+ summary {
+ display: inline-flex;
+ align-items: center;
+ color: var(--text);
+ background: var(--control);
+ list-style: none;
+ }
+ summary::-webkit-details-marker {
+ display: none;
+ }
+ summary:hover {
+ background: var(--control-hover);
+ }
+ .details {
+ margin-top: 4px;
+ font-size: 12px;
+ color: var(--muted);
+ overflow-wrap: anywhere;
+ }
+ :focus-visible {
+ outline: none;
+ box-shadow:
+ 0 0 0 1px var(--focus-edge),
+ 0 0 0 3px var(--focus-ring);
}
</style>
</head>
<body>
- <header>
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17.5 21.5">
- <path d="M11.75.75h-9c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-13l-5-5z" />
- <path d="M10.75.75v4c0 1.1.9 2 2 2h4M5.75 9.75v2M11.75 9.75v2M5.75 16.75c1-2.67 5-2.67 6 0" />
+ <main>
+ <svg
+ viewBox="0 0 16 16"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="1.5"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ aria-hidden="true"
+ >
+ <path d="M2.5 8a5.5 5.5 0 1 0 11 0a5.5 5.5 0 1 0-11 0M4.2 4.2l7.6 7.6" />
</svg>
- <h1>Failed to load %failed_url%</h1>
- </header>
- <p>%error_message%</p>
+ <h1>Can’t reach %failed_host%</h1>
+ <p>%error_message%</p>
+ <div class="actions">
+ <details>
+ <summary>Show details</summary>
+ <div class="details">%failed_url%</div>
+ </details>
+ <button type="button" data-url="%failed_url%" onclick="location.href = this.dataset.url" autofocus>
+ Try again
+ </button>
+ </div>
+ </main>
</body>
</html>
diff --git a/UI/cmake/ResourceFiles.cmake b/UI/cmake/ResourceFiles.cmake
index 816d397ee45..f04fdb9fc88 100644
--- a/UI/cmake/ResourceFiles.cmake
+++ b/UI/cmake/ResourceFiles.cmake
@@ -43,7 +43,6 @@ set(ABOUT_PAGES
downloads.html
history.html
newtab.html
- search-engine-controls.js
settings.html
services.html
version.html