js: remove ERPNext/Frappe → Jey ERP text rebrand
Drops the MutationObserver-driven rebrand IIFE and the desktop label overrides (Frappe HR → HR, ERPNext Settings → Settings). Original labels are now shown as-is.
This commit is contained in:
parent
2230a2854f
commit
54f34b26e1
|
|
@ -154,6 +154,7 @@
|
||||||
leaves: { paths: '<path d="M6 3v18"/><path d="M6 8c6-2 10 2 16 0"/><path d="M6 15c6-2 10 2 16 0"/>' },
|
leaves: { paths: '<path d="M6 3v18"/><path d="M6 8c6-2 10 2 16 0"/><path d="M6 15c6-2 10 2 16 0"/>' },
|
||||||
payroll: { paths: '<rect x="2" y="4" width="20" height="16" rx="2"/><line x1="2" y1="10" x2="22" y2="10"/><line x1="12" y1="4" x2="12" y2="20"/><line x1="6" y1="7" x2="6" y2="7.01" stroke-width="2"/><line x1="6" y1="14" x2="9" y2="14"/><line x1="6" y1="17" x2="8" y2="17"/><line x1="15" y1="14" x2="18" y2="14"/><line x1="15" y1="17" x2="19" y2="17"/>' },
|
payroll: { paths: '<rect x="2" y="4" width="20" height="16" rx="2"/><line x1="2" y1="10" x2="22" y2="10"/><line x1="12" y1="4" x2="12" y2="20"/><line x1="6" y1="7" x2="6" y2="7.01" stroke-width="2"/><line x1="6" y1="14" x2="9" y2="14"/><line x1="6" y1="17" x2="8" y2="17"/><line x1="15" y1="14" x2="18" y2="14"/><line x1="15" y1="17" x2="19" y2="17"/>' },
|
||||||
people: { paths: '<path d="M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 00-3-3.87"/><path d="M16 3.13a4 4 0 010 7.75"/>' },
|
people: { paths: '<path d="M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 00-3-3.87"/><path d="M16 3.13a4 4 0 010 7.75"/>' },
|
||||||
|
employees: { paths: '<path d="M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 00-3-3.87"/><path d="M16 3.13a4 4 0 010 7.75"/>' },
|
||||||
recruitment: { paths: '<circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><path d="M11 8v6"/><path d="M8 11h6"/>' },
|
recruitment: { paths: '<circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><path d="M11 8v6"/><path d="M8 11h6"/>' },
|
||||||
performance: { paths: '<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/>' },
|
performance: { paths: '<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/>' },
|
||||||
expenses: { paths: '<line x1="12" y1="1" x2="12" y2="23"/><path d="M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"/>' },
|
expenses: { paths: '<line x1="12" y1="1" x2="12" y2="23"/><path d="M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"/>' },
|
||||||
|
|
@ -194,6 +195,7 @@
|
||||||
"share management": { paths: '<circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"/><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"/>' },
|
"share management": { paths: '<circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"/><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"/>' },
|
||||||
subscription: { paths: '<path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/><polyline points="22 6 12 13 2 6"/>' },
|
subscription: { paths: '<path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/><polyline points="22 6 12 13 2 6"/>' },
|
||||||
crm: { paths: '<path d="M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"/><circle cx="12" cy="7" r="4"/>' },
|
crm: { paths: '<path d="M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"/><circle cx="12" cy="7" r="4"/>' },
|
||||||
|
employees: { paths: '<path d="M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"/><circle cx="12" cy="7" r="4"/>' },
|
||||||
support: { paths: '<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/>' },
|
support: { paths: '<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/>' },
|
||||||
_fallback: '<circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/>'
|
_fallback: '<circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/>'
|
||||||
}
|
}
|
||||||
|
|
@ -278,24 +280,6 @@
|
||||||
iconContainer.appendChild(parts.chrome);
|
iconContainer.appendChild(parts.chrome);
|
||||||
}
|
}
|
||||||
|
|
||||||
var DESKTOP_LABEL_OVERRIDES = {
|
|
||||||
"Frappe HR": "HR",
|
|
||||||
"ERPNext Settings": "Settings"
|
|
||||||
};
|
|
||||||
|
|
||||||
function renameDesktopLabels() {
|
|
||||||
Object.keys(DESKTOP_LABEL_OVERRIDES).forEach(function (id) {
|
|
||||||
var newLabel = DESKTOP_LABEL_OVERRIDES[id];
|
|
||||||
document.querySelectorAll('.desktop-icon[data-id="' + id + '"]').forEach(function (icon) {
|
|
||||||
var title = icon.querySelector(".icon-title");
|
|
||||||
if (title && title.textContent.trim() !== newLabel) {
|
|
||||||
title.textContent = newLabel;
|
|
||||||
title.setAttribute("data-original-title", newLabel);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function processIcons() {
|
function processIcons() {
|
||||||
document.querySelectorAll(
|
document.querySelectorAll(
|
||||||
".desktop-icon > .icon-container:not(.jey-chrome-done)"
|
".desktop-icon > .icon-container:not(.jey-chrome-done)"
|
||||||
|
|
@ -308,7 +292,6 @@
|
||||||
".desktop-icon > .icon-container.folder-icon:not(.jey-chrome-done)"
|
".desktop-icon > .icon-container.folder-icon:not(.jey-chrome-done)"
|
||||||
).forEach(wrapIcon);
|
).forEach(wrapIcon);
|
||||||
|
|
||||||
renameDesktopLabels();
|
|
||||||
staggerAnimations();
|
staggerAnimations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2007,118 +1990,6 @@
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
/* ==========================================================================
|
|
||||||
Rebrand: ERPNext → Jey ERP, Frappe → Framework (visible text only)
|
|
||||||
========================================================================== */
|
|
||||||
|
|
||||||
(function () {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var SKIP_TAGS = { SCRIPT: 1, STYLE: 1, NOSCRIPT: 1, IFRAME: 1, CANVAS: 1 };
|
|
||||||
|
|
||||||
/* Case-aware replacements: tries to preserve the surrounding case style */
|
|
||||||
function rebrandText(str) {
|
|
||||||
// ERPNext variants
|
|
||||||
str = str.replace(/ERPNext/g, "Jey ERP");
|
|
||||||
str = str.replace(/erpnext/gi, function (m) {
|
|
||||||
if (m === "ERPNEXT") return "JEY ERP";
|
|
||||||
return "Jey ERP";
|
|
||||||
});
|
|
||||||
// Frappe variants (but not inside URLs or identifiers)
|
|
||||||
str = str.replace(/Frapp[eé]/g, "Jey ERP");
|
|
||||||
str = str.replace(/frapp[eé]/gi, function (m) {
|
|
||||||
if (m.toUpperCase() === m) return "JEY ERP";
|
|
||||||
return "Jey ERP";
|
|
||||||
});
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
function needsRebrand(str) {
|
|
||||||
return /erpnext|frapp[eé]/i.test(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Walk text nodes inside an element */
|
|
||||||
function walkTextNodes(root) {
|
|
||||||
var walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, null, false);
|
|
||||||
var node;
|
|
||||||
while ((node = walker.nextNode())) {
|
|
||||||
if (SKIP_TAGS[node.parentNode.tagName]) continue;
|
|
||||||
var text = node.nodeValue;
|
|
||||||
if (needsRebrand(text)) {
|
|
||||||
node.nodeValue = rebrandText(text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Rebrand visible attributes: placeholder, title, alt */
|
|
||||||
function walkAttributes(root) {
|
|
||||||
var els = root.querySelectorAll("[placeholder], [title], [alt]");
|
|
||||||
for (var i = 0; i < els.length; i++) {
|
|
||||||
var el = els[i];
|
|
||||||
["placeholder", "title", "alt"].forEach(function (attr) {
|
|
||||||
var val = el.getAttribute(attr);
|
|
||||||
if (val && needsRebrand(val)) {
|
|
||||||
el.setAttribute(attr, rebrandText(val));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Rebrand the page title */
|
|
||||||
function rebrandTitle() {
|
|
||||||
if (needsRebrand(document.title)) {
|
|
||||||
document.title = rebrandText(document.title);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function processNode(root) {
|
|
||||||
walkTextNodes(root);
|
|
||||||
walkAttributes(root);
|
|
||||||
rebrandTitle();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initial pass */
|
|
||||||
function init() {
|
|
||||||
processNode(document.body);
|
|
||||||
rebrandTitle();
|
|
||||||
|
|
||||||
/* Watch for dynamically added content */
|
|
||||||
var observer = new MutationObserver(function (mutations) {
|
|
||||||
for (var i = 0; i < mutations.length; i++) {
|
|
||||||
var m = mutations[i];
|
|
||||||
for (var j = 0; j < m.addedNodes.length; j++) {
|
|
||||||
var node = m.addedNodes[j];
|
|
||||||
if (node.nodeType === 1 && !SKIP_TAGS[node.tagName]) {
|
|
||||||
processNode(node);
|
|
||||||
} else if (node.nodeType === 3 && node.parentNode && !SKIP_TAGS[node.parentNode.tagName] && needsRebrand(node.nodeValue)) {
|
|
||||||
node.nodeValue = rebrandText(node.nodeValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Handle direct text changes (e.g. frappe sets .textContent) */
|
|
||||||
if (m.type === "characterData" && m.target.nodeType === 3) {
|
|
||||||
if (m.target.parentNode && !SKIP_TAGS[m.target.parentNode.tagName] && needsRebrand(m.target.nodeValue)) {
|
|
||||||
m.target.nodeValue = rebrandText(m.target.nodeValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rebrandTitle();
|
|
||||||
});
|
|
||||||
|
|
||||||
observer.observe(document.body, {
|
|
||||||
childList: true,
|
|
||||||
subtree: true,
|
|
||||||
characterData: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (document.readyState === "loading") {
|
|
||||||
document.addEventListener("DOMContentLoaded", init);
|
|
||||||
} else {
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
|
|
||||||
/* ==========================================================================
|
/* ==========================================================================
|
||||||
Form Tabs — Re-trigger section cascade on tab switch
|
Form Tabs — Re-trigger section cascade on tab switch
|
||||||
========================================================================== */
|
========================================================================== */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue