document.addEventListener('DOMContentLoaded', function(){
function forceRegisteredEmoji(){
const emojiIcons=document.querySelectorAll('.dn-category-icon');
emojiIcons.forEach(icon=> {
const emojiImages=Array.from(icon.querySelectorAll('img.emoji'));
const imgReplacements=emojiImages.map(function(img){
return { node: img, altText: img.getAttribute('alt') };}).filter(function(r){ return r.altText; });
var textNodeInfos=[];
var nodes=Array.from(icon.childNodes);
nodes.forEach(function(node){
if(node.nodeType===Node.TEXT_NODE&&node.textContent&&node.textContent.trim()){
textNodeInfos.push({ node: node, text: node.textContent });
}});
imgReplacements.forEach(function(r){
var textNode=document.createTextNode(r.altText);
r.node.parentNode.replaceChild(textNode, r.node);
});
icon.style.setProperty('font-family', "'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Android Emoji', 'EmojiSymbols', 'EmojiOne Mozilla', 'Twemoji Mozilla', 'Segoe UI Symbol', sans-serif", 'important');
icon.style.setProperty('font-display', 'block', 'important');
icon.style.setProperty('font-variant-emoji', 'emoji', 'important');
icon.style.setProperty('-webkit-font-feature-settings', '"liga" 1, "kern" 1', 'important');
icon.style.setProperty('font-feature-settings', '"liga" 1, "kern" 1', 'important');
icon.style.setProperty('text-rendering', 'optimizeLegibility', 'important');
icon.style.setProperty('-webkit-font-smoothing', 'subpixel-antialiased', 'important');
icon.style.setProperty('-moz-osx-font-smoothing', 'auto', 'important');
icon.style.setProperty('filter', 'none', 'important');
icon.style.setProperty('opacity', '1', 'important');
icon.style.setProperty('color', 'inherit', 'important');
icon.style.setProperty('font-variant-ligatures', 'normal', 'important');
icon.style.setProperty('font-kerning', 'normal', 'important');
icon.style.setProperty('font-optical-sizing', 'auto', 'important');
icon.style.setProperty('font-synthesis', 'none', 'important');
icon.style.setProperty('font-variation-settings', 'normal', 'important');
textNodeInfos.forEach(function(info){
var span=document.createElement('span');
span.style.setProperty('font-family', "'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Android Emoji', sans-serif", 'important');
span.style.setProperty('font-display', 'block', 'important');
span.style.setProperty('font-variant-emoji', 'emoji', 'important');
span.style.setProperty('-webkit-font-smoothing', 'subpixel-antialiased', 'important');
span.style.setProperty('-moz-osx-font-smoothing', 'auto', 'important');
span.style.setProperty('text-rendering', 'optimizeLegibility', 'important');
span.style.setProperty('display', 'inline-block', 'important');
span.style.setProperty('font-variant-ligatures', 'normal', 'important');
span.style.setProperty('font-kerning', 'normal', 'important');
span.style.setProperty('font-synthesis', 'none', 'important');
span.textContent=info.text;
span.setAttribute('data-original-emoji', info.text);
info.node.parentNode.replaceChild(span, info.node);
});
});
}
if(typeof requestAnimationFrame!=='undefined'){
requestAnimationFrame(function(){ forceRegisteredEmoji(); });
}else{
forceRegisteredEmoji();
}
setTimeout(forceRegisteredEmoji, 200);
var emojiDebounceTimer;
function debouncedForceEmoji(){
if(emojiDebounceTimer) clearTimeout(emojiDebounceTimer);
emojiDebounceTimer=setTimeout(function(){
emojiDebounceTimer=null;
if(typeof requestAnimationFrame!=='undefined'){
requestAnimationFrame(function(){ forceRegisteredEmoji(); });
}else{
forceRegisteredEmoji();
}}, 150);
}
const observer=new MutationObserver(function(mutations){
var needsRun=false;
mutations.forEach(function(mutation){
if(mutation.type==='childList'&&mutation.addedNodes.length){
for (var i=0; i < mutation.addedNodes.length; i++){
var node=mutation.addedNodes[i];
if(node.nodeType===1){
if(node.classList&&node.classList.contains('dn-category-icon')){
needsRun=true;
break;
}
if(node.querySelector&&node.querySelector('.dn-category-icon')){
needsRun=true;
break;
}}
}}
});
if(needsRun) debouncedForceEmoji();
});
observer.observe(document.body, {
childList: true,
subtree: true
});
function runAfterLoad(){
if(typeof requestAnimationFrame!=='undefined'){
requestAnimationFrame(function(){ forceRegisteredEmoji(); });
}else{
forceRegisteredEmoji();
}}
window.addEventListener('load', runAfterLoad);
if(document.fonts&&document.fonts.ready){
document.fonts.ready.then(runAfterLoad);
}
function moveBusinessItemsToContainer(){
var businessList=document.querySelector('.dn-business-list');
if(!businessList){
return;
}
var orphanItems=[];
var bodyItems=document.querySelectorAll('body > .dn-business-item');
bodyItems.forEach(function(item){
if(item&&!businessList.contains(item)){
orphanItems.push(item);
}});
var wrapperItems=document.querySelectorAll('.page-wrapper > .dn-business-item');
wrapperItems.forEach(function(item){
if(item&&!businessList.contains(item)){
orphanItems.push(item);
}});
var containerItems=document.querySelectorAll('.page-inner-container > .dn-business-item');
containerItems.forEach(function(item){
if(item&&!businessList.contains(item)){
orphanItems.push(item);
}});
var innerItems=document.querySelectorAll('.page-inner > .dn-business-item');
innerItems.forEach(function(item){
if(item&&!businessList.contains(item)){
orphanItems.push(item);
}});
orphanItems.forEach(function(item){
if(item&&item.parentNode&&businessList){
businessList.appendChild(item);
}});
}
function removeViewToggle(){
var selectors=[
'.dn-business-view-toggle',
'.dn-view-toggle',
'.dn-view-btn',
'.dn-view-card',
'.dn-view-list',
'[class*="view-toggle"]',
'[class*="view-btn"]'
];
selectors.forEach(function(selector){
try {
var elements=document.querySelectorAll(selector);
elements.forEach(function(el){
if(el&&el.parentNode){
el.remove();
}});
} catch(e){}});
}
removeViewToggle();
moveBusinessItemsToContainer();
document.addEventListener('DOMContentLoaded', function(){
removeViewToggle();
moveBusinessItemsToContainer();
setTimeout(function(){
moveBusinessItemsToContainer();
}, 100);
});
var businessObserver=new MutationObserver(function(mutations){
var needsCleanup=false;
mutations.forEach(function(mutation){
mutation.addedNodes.forEach(function(node){
if(node.nodeType===1){
if(node.classList){
var classes=Array.from(node.classList);
if(classes.some(function(c){ return c.indexOf('view-toggle')!==-1||c.indexOf('view-btn')!==-1; })){
needsCleanup=true;
}}
if(node.querySelector&&node.querySelector('.dn-business-view-toggle, .dn-view-toggle, .dn-view-btn')){
needsCleanup=true;
}}
});
});
if(needsCleanup){
setTimeout(removeViewToggle, 0);
}
var hasNewItems=false;
mutations.forEach(function(mutation){
mutation.addedNodes.forEach(function(node){
if(node.nodeType===1&&node.classList&&node.classList.contains('dn-business-item')){
hasNewItems=true;
}
if(node.querySelector&&node.querySelector('.dn-business-item')){
hasNewItems=true;
}});
});
if(hasNewItems){
setTimeout(moveBusinessItemsToContainer, 0);
}});
if(document.body){
businessObserver.observe(document.body, {
childList: true,
subtree: true
});
}else{
document.addEventListener('DOMContentLoaded', function(){
businessObserver.observe(document.body, {
childList: true,
subtree: true
});
});
}});