:חח -
:חחח -
:חחחח -
:אני ישן -
:קריצה -
:עצוב -
:שמח -
:תודה -
כוכב-
:לב- 
// ==UserScript==
// @name בני ברק - מחליף מילים לאימוג'י
// @namespace http://tampermonkey.net/
// @version 1.1
// @description מחליף מילים וביטויים נפוצים לאימוג'ים באתר bnebrak.com
// @author You
// @match https://bnebrak.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// מילון ההחלפות - מסודר מהארוך לקצר כדי למנוע כפילויות בהחלפת ה-"חחח"
const replacements = [
{ search: 'חחחח', replace: '😂' },
{ search: 'חחח', replace: '😄' },
{ search: 'חח', replace: '😊' },
{ search: 'אני ישן', replace: '😴' },
{ search: 'קריצה', replace: '😉' },
{ search: ':עצוב', replace: '😞' },
{ search: ':שמח', replace: '🙂' },
{ search: ':תודה', replace: '👍' },
{ search: 'כוכב', replace: '⭐' },
{ search: ':לב', replace: '❤' }
];
// פונקציה שמבצעת את ההחלפה על צומת טקסט בודד
function replaceText(node) {
if (node.nodeType === Node.TEXT_NODE) {
let text = node.nodeValue;
let changed = false;
for (const item of replacements) {
// שימוש ב-Regex כדי להחליף את כל המופעים של המילה
const regex = new RegExp(item.search, 'g');
if (text.includes(item.search)) {
text = text.replace(regex, item.replace);
changed = true;
}
}
if (changed) {
node.nodeValue = text;
}
} else {
// דילוג על אלמנטים של קלט (כמו תיבות טקסט) כדי לא להרוס בזמן הקלדה
if (node.nodeName === 'INPUT' || node.nodeName === 'TEXTAREA' || node.isContentEditable) {
return;
}
for (let i = 0; i < node.childNodes.length; i++) {
replaceText(node.childNodes[i]);
}
}
}
// הרצה ראשונית על כל העמוד
replaceText(document.body);
// האזנה לשינויים דינמיים בעמוד (טעינת פוסטים חדשים, תגובות וכו')
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
mutation.addedNodes.forEach((node) => {
replaceText(node);
});
});
});
observer.observe(document.body, {
childList: true,
subtree: true
});
})();



