Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/burlakastudio.realcommenter/ |
Upload File : |
;(function () { let selectors = { box: '.more_from_user', boxHeader: '.mfu_header', boxFooter: '.mfu_footer', commentRow: '.mfu_body ul li', }; function getSelector (lookingFor) { if (!lookingFor || !selectors[lookingFor]) { return ''; } return selectors[lookingFor]; } function scanAndInit () { let infoList = document.querySelectorAll( getSelector('box') //+ ':not([data-inited])' ); infoList.forEach(box => { initBoxActiveX(box); }); } // Let's scope out window.realcommenterMoreFromUserScanAndInit = scanAndInit; function initBoxActiveX (box) { if (!box || typeof box.querySelector === 'undefined') { return; } let closer = box.querySelector( getSelector('boxHeader') + ' del:not([data-inited])' ); if (closer) { closer.addEventListener('click', function (box) { box.parentNode.removeChild(box); }.bind(this, box)); closer.setAttribute('data-inited', '1'); } let commentsList = box.querySelectorAll( getSelector('commentRow') + ':not([data-inited])' ); commentsList.forEach(comment => { let del = comment.querySelector('del'); if (!del) { comment.parentNode.removeChild(comment); return; } del.addEventListener('click', delModeSwitch.bind(del, comment, box)); comment.setAttribute('data-inited', '1'); }); box.setAttribute('data-inited', '1'); } function delModeSwitch (comment, box) { comment.classList.toggle('_selected'); applyDelBtnSync(box); } function applyDelBtnSync (box) { let footer = box.querySelector( getSelector('boxFooter') ); if (!footer) { return; } let selectedList = getMarkedToDel(box); let applyObj = footer.querySelector('button'); if (selectedList.length) { if (!applyObj) { let applyObj = document.createElement('button'); applyObj.innerHTML = footer.getAttribute('data-button-label'); footer.appendChild(applyObj); applyObj.addEventListener('click', collectToDelAndPush.bind(applyObj, box)); } } else { if (applyObj) { applyObj.parentNode.removeChild(applyObj); } } } function collectToDelAndPush (box) { let selectedList = getMarkedToDel(box); if (!selectedList.length) { return; } selectedList.reduce = [].reduce; let idList = selectedList.reduce((result, curr) => { result.push(curr.getAttribute('data-comment-id')); return result; }, []); realcommenter_ajaxion.bind(this, { url: '/bitrix/admin/burlakastudio.realcommenter.talk_tree.php', onsuccess: function (result) { if (result.ERROR && Object.keys(result.ERROR).length) { console.log('ERROR'); console.log(result); return; } // We should reread out list // this - our box // find admin tool and push it again! =) if (result.ACTION_RESULT) { let box = this; if (box && typeof box.querySelector !== 'undefined') { let parentComment = realcommenter_get_closest_comment(box); if (parentComment) { let adminTool = parentComment.querySelector( realcommenter_get_selector('admin_tools') + ' ' + realcommenter_get_selector('admin_fly_cloud') + ' [data-action="MORE_FROM"]' ); if (adminTool) { adminTool.click(); } } } } }.bind(box), data: { request_type: 'DELETE_MULTIPLE', comment_id: idList } })(); } function getMarkedToDel (box) { return box.querySelectorAll( getSelector('commentRow') + '._selected' ); } })();