לאחר שראיתי את הפוסט הזה, ולמען האמת, גם לי זה הציק...
אז שיפרתי (אני... GPT!) את הסקריפט בTampermonkey שהוא גם יתקן את העיצוב שנהרס בגלל הRTL...
אז הנה לכם הקוד הכולל את שני הפונקציות 👇
// ==UserScript==
// @name תרגום סטטוסים + תיקון עיצוב Mailtrack בג'ימייל
// @namespace http://tampermonkey.net/
// @version 2.0
// @description מתרגם טולטיפים של Mailtrack לעברית, מתקן עיצוב כפתור "אימייל חדש" לפי כיוון השפה
// @author יוסף אלחנן@
// @match https://mail.google.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// --- חלק 1: תרגום טולטיפים ---
const translations = {
"Your last email was read": "המייל האחרון שלך נקרא",
"read your email": "קרא את המייל שלך",
"hours ago": "לפני שעות",
"Hasn't read your last email yet": "עדיין לא קרא את המייל האחרון שלך",
"Email not tracked": "מייל לא במעקב",
"read your last email": "קרא את המייל האחרון שלך",
"day ago": "לפני יום",
"days ago": "לפני ימים",
"times": "פעמים",
"First read": "קריאה ראשונה",
"day after you sent it": "יום אחרי ששלחת אותו",
"days after you sent it": "ימים אחרי ששלחת אותו",
"The open status of this message may be unreliable": "סטטוס הפתיחה של הודעה זו עשוי להיות לא אמין",
"It's possible that email service provider doesn't allow email tracking": "ייתכן שספק שירותי הדוא\"ל לא מאפשר מעקב אחר דוא\"ל",
"The open status of this message may be unreliable. It's possible that email service provider doesn't allow email tracking": "סטטוס הפתיחה של הודעה זו עשוי להיות לא אמין. ייתכן שספק שירותי הדוא\"ל לא מאפשר מעקב אחר דוא\"ל",
"minutes after you sent it": "דקות אחרי ששלחת אותו",
"First read hours after you sent it": "קריאה ראשונה שעות אחרי ששלחת אותו",
"First read less than a minute after you sent it": "קריאה ראשונה פחות מדקה אחרי ששלחת אותו",
"minutes ago": "לפני דקות"
};
function translateText(text) {
let translated = text;
for (let pattern in translations) {
const regex = new RegExp(pattern, 'gi');
translated = translated.replace(regex, translations[pattern]);
}
return translated;
}
function processTextNodes(element) {
element.childNodes.forEach(node => {
if (node.nodeType === Node.TEXT_NODE) {
const text = node.textContent.trim();
if (text && text !== "See full tracking history") {
const translated = translateText(text);
if (translated !== text) {
node.textContent = translated;
}
}
} else if (node.nodeType === Node.ELEMENT_NODE) {
processTextNodes(node);
}
});
}
function updateTooltips() {
document.querySelectorAll('[role="tooltip"]').forEach(tooltip => {
const textOnly = tooltip.textContent.trim();
if (textOnly && textOnly !== "See full tracking history") {
const translatedText = translateText(textOnly);
if (translatedText !== textOnly) {
if (textOnly in translations) {
tooltip.textContent = translatedText;
} else {
processTextNodes(tooltip);
}
}
}
});
}
// --- חלק 2: תיקון עיצוב כפתורים ---
function fixButtonCorners() {
const composeButton = document.querySelector('.ms-compose-button');
const actionsButton = document.querySelector('.ms-compose-button-actions-container');
if (composeButton && actionsButton) {
const isRTL = document.documentElement.getAttribute('dir') === 'rtl';
if (isRTL) {
composeButton.style.borderTopLeftRadius = '0';
composeButton.style.borderBottomLeftRadius = '0';
composeButton.style.borderTopRightRadius = '16px';
composeButton.style.borderBottomRightRadius = '16px';
actionsButton.style.borderTopLeftRadius = '16px';
actionsButton.style.borderBottomLeftRadius = '16px';
actionsButton.style.borderTopRightRadius = '0';
actionsButton.style.borderBottomRightRadius = '0';
} else {
composeButton.style.borderTopRightRadius = '0';
composeButton.style.borderBottomRightRadius = '0';
composeButton.style.borderTopLeftRadius = '16px';
composeButton.style.borderBottomLeftRadius = '16px';
actionsButton.style.borderTopRightRadius = '16px';
actionsButton.style.borderBottomRightRadius = '16px';
actionsButton.style.borderTopLeftRadius = '0';
actionsButton.style.borderBottomLeftRadius = '0';
}
}
}
// --- ניטור שינויים בדף ---
const observer = new MutationObserver(() => {
updateTooltips();
fixButtonCorners();
});
observer.observe(document.body, { childList: true, subtree: true });
window.addEventListener('load', () => {
updateTooltips();
fixButtonCorners();
});
setInterval(() => {
updateTooltips();
fixButtonCorners();
}, 1000);
})();