/* Add custom JS code below */
(function(){
if(!document.body.classList.contains('product-single')) return;
var ar = document.documentElement.lang.includes('ar') || document.documentElement.dir === 'rtl' || location.pathname.includes('/ar');
document.head.insertAdjacentHTML('beforeend',`
`);
function wrap(el,title){
if(!el || el.closest('.tr2-content')) return null;
el.style.setProperty('display','block','important');
el.querySelectorAll('.article').forEach(function(a){
a.style.setProperty('max-height','none','important');
a.style.setProperty('overflow','visible','important');
});
var acc = document.createElement('div');
acc.className = 'tr2-acc ' + (ar ? 'tr2-ar' : 'tr2-en');
acc.innerHTML = '
'+title+'
';
el.parentNode.insertBefore(acc,el);
acc.querySelector('.tr2-content').appendChild(el);
acc.querySelector('.tr2-title').onclick = function(){
acc.classList.toggle('open');
};
return acc;
}
function emptyAcc(title, afterAcc){
if(document.querySelector('.tr2-features')) return;
var acc = document.createElement('div');
acc.className = 'tr2-acc tr2-features ' + (ar ? 'tr2-ar' : 'tr2-en');
acc.innerHTML = ''+title+'
';
acc.querySelector('.tr2-title').onclick = function(){
acc.classList.toggle('open');
};
afterAcc.parentNode.insertBefore(acc, afterAcc.nextSibling);
}
function run(){
wrap(document.querySelector('.product__description'), ar ? 'وصف المنتج' : 'Product Description');
var sizesAcc = wrap(
document.querySelector('salla-product-options.s-product-options-wrapper, salla-product-options[product-id]'),
ar ? 'مقاسات المنتج' : 'Product Sizes'
);
if(sizesAcc){
emptyAcc(ar ? 'مميزات المتجر' : 'Store Features', sizesAcc);
}
}
function start(){
run();
var obs = new MutationObserver(run);
obs.observe(document.body,{childList:true,subtree:true});
}
document.readyState === 'loading'
? document.addEventListener('DOMContentLoaded',start)
: start();
})();
document.addEventListener("DOMContentLoaded", function () {
const footer = document.querySelector(".store-footer.art-store-footer");
const badge = footer?.querySelector(".s-trust-badges-wrapper");
const copyright = footer?.querySelector(".copyright-text");
const copyrightText = copyright?.querySelector("p");
if (footer && badge && copyright && copyrightText) {
copyright.insertBefore(badge, copyrightText);
}
});