Keep standard Git and Gitea terminology throughout the app while retaining Hop-specific features and fixing activity avatars to use the transparent Hop asset.

Hop-State: A_06FN8FHGBMQXYG4JKV37Q7R
Hop-Proposal: R_06FN8FGR9GVGJ1EYKH2ZDA0
Hop-Task: T_06FN8E4H2W4WC6RGTA6J6PR
Hop-Attempt: AT_06FN8E4H2WHJGF51012GH8R
This commit is contained in:
2026-07-11 19:53:09 -07:00
committed by Hop
parent 677809506a
commit 67321dd93a
3 changed files with 42 additions and 76 deletions
+9 -76
View File
@@ -1,77 +1,13 @@
(() => {
'use strict';
const exactLabels = new Map([
['Code', 'Files'],
['Issues', 'Tasks'],
['Pull Requests', 'Proposals'],
['Pull requests', 'Proposals'],
['Commits', 'Checkpoints'],
['Branches', 'Attempts'],
['New Issue', 'New Task'],
['Create Issue', 'Create Task'],
['New Pull Request', 'New Proposal'],
['Create Pull Request', 'Create Proposal'],
['Merge Pull Request', 'Accept Proposal'],
['Compare & pull request', 'Review as Proposal'],
]);
function replaceActivityAvatars() {
if (!/\/activity\/?$/.test(window.location.pathname)) return;
const main = document.querySelector('[role="main"]');
if (!main) return;
const phraseLabels = [
[/\bPull Requests\b/g, 'Proposals'],
[/\bPull requests\b/g, 'Proposals'],
[/\bpull requests\b/g, 'proposals'],
[/\bNew Issue\b/g, 'New Task'],
[/\bnew issue\b/g, 'new task'],
[/\bIssues\b/g, 'Tasks'],
[/\bissues\b/g, 'tasks'],
[/\bCommits\b/g, 'Checkpoints'],
[/\bBranches\b/g, 'Attempts'],
];
const semanticRoots = [
'#navbar',
'.secondary-nav',
'[role="main"] .ui.header',
'[role="main"] h1',
'[role="main"] h2',
'[role="main"] h3',
'[role="main"] .ui.button',
'[role="main"] .menu',
'[role="main"] .breadcrumb',
'[role="main"] label',
].join(',');
function replaceExactText(root) {
const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);
const nodes = [];
while (walker.nextNode()) nodes.push(walker.currentNode);
for (const node of nodes) {
const original = node.nodeValue;
const trimmed = original.trim();
const replacement = exactLabels.get(trimmed);
if (!replacement) continue;
node.nodeValue = original.replace(trimmed, replacement);
}
}
function replacePhrases(value) {
let result = value;
for (const [pattern, replacement] of phraseLabels) {
result = result.replace(pattern, replacement);
}
return result;
}
function replaceAccessibleLabels(root) {
const attributes = ['aria-label', 'data-text', 'data-tooltip-content', 'placeholder', 'title'];
for (const element of root.querySelectorAll('[aria-label], [data-text], [data-tooltip-content], [placeholder], [title]')) {
for (const attribute of attributes) {
const value = element.getAttribute(attribute);
if (!value) continue;
const replacement = replacePhrases(value);
if (replacement !== value) element.setAttribute(attribute, replacement);
}
for (const image of main.querySelectorAll('img.ui.avatar, .activity-bar-graph img, .activity-bar-graph-alt img')) {
image.src = '/assets/img/hop.svg?v=5';
}
}
@@ -160,8 +96,8 @@
const links = [
workflowLink(document.querySelector('.hop-native-prompts-tab'), 'Prompts'),
workflowLink(navigationLink('/issues'), 'Tasks'),
workflowLink(navigationLink('/pulls'), 'Proposals'),
workflowLink(navigationLink('/issues'), 'Issues'),
workflowLink(navigationLink('/pulls'), 'Pull Requests'),
workflowLink(navigationLink('/actions'), 'Actions'),
].filter(Boolean);
if (!links.length) return;
@@ -440,16 +376,13 @@
const brandLogo = document.querySelector('#navbar-logo img');
if (brandLogo) brandLogo.src = brandLogo.src.replace(/\/img\/(?:logo|hop)\.svg(?:\?.*)?$/, '/img/hop.svg?v=4');
replaceBrandImages();
replaceActivityAvatars();
removeHelpNavigation();
for (const root of document.querySelectorAll(semanticRoots)) replaceExactText(root);
replaceAccessibleLabels(document);
addPromptsNavigation();
addWorkflowSummary();
renderPromptPage();
bindInstallationSwitchers();
bindInstallationCopyButtons();
const title = replacePhrases(document.title);
if (title !== document.title) document.title = title;
document.documentElement.dataset.hopNative = 'true';
}