2201shareWrapper.classList.remove('t-feed__share_open');2202}, 750);2203});2204}2205}22062207/**2208* Show arrow in popup if back to top button setting is on2209* @param {HTMLElement} popup – current popup2210* @param {HTMLElement} arrowTop – arrow top element2211*/2212function t_feed_addPostPopupArrowTop(popup, arrowTop) {
var isShow = arrowTop.classList.contains('t-feed__post-popup__arrow-top_show'); if (popup.scrollTop > 300) { if (!isShow) { arrowTop.classList.add('t-feed__post-popup__arrow-top_show'); } } else if (isShow) { arrowTop.classList.remove('t-feed__post-popup__arrow-top_show'); }}/** * Send information about views in the admin panel * @param {HTMLElement} popup – current popup */function t_feed_getCountOfViews(popup) { // TODO: trick for snippet if (window.jQuery && popup instanceof jQuery) { popup = document.querySelector('.t-feed__post-popup'); } var apiUrl = 'https://' + window.t_feeds_endpoint + '/api/setpostviewed/'; setTimeout(function () { var request = new XMLHttpRequest(); request.open('GET', apiUrl + '?' + 'postuid=' + popup.getAttribute('data-feed-popup-postuid'), true); request.timeout = 1000 * 25; request.onload = function () {}; request.onerror = function () { console.log(request.response); }; request.send(); }, 3000);}function t_feed_closePopup(recid, opts, currentUrl) { var rec = document.querySelector('#rec' + recid); var feeds = rec.querySelector('.js-feed') || rec; if (!feeds) return; var popup = document.querySelector('.t-feed__post-popup.t-popup'); var gridType = feeds.getAttribute('data-feed-grid-type'); if (!popup) { return; } if (gridType === 'side-panel') { feeds.classList.remove('t946__feed-container_expanded'); } document.body.classList.remove('t-body_popupshowed'); popup.classList.remove('t-popup_show'); if (window.tFeedPosts && window.tFeedPosts[recid] && window.tFeedPosts[recid]['title']) { document.title = window.tFeedPosts[recid]['title']; } if (shareScript && opts.popup_opts.isShare) { var shareScript = document.querySelector( 'script[src^="https://static.tildacdn.' + t_feed__getRootZone() + '/js/ya-share.js"]' ); if (shareScript.parentNode !== null) { shareScript.parentNode.removeChild(shareScript); } } setTimeout(function () { popup.scrollTop = 0; if (popup && !popup.classList.contains('t-popup_show') && popup.parentNode !== null) { popup.parentNode.removeChild(popup); } if (window.history.state !== null) { window.history.pushState(null, null, currentUrl); } }, 300); if (currentUrl.indexOf('#!') != -1) { var popup = document.querySelector('.t-feed__post-popup'); if (popup) { var closestFeeds = popup.closest('.js-feed'); t_feed_scrollToFeed(closestFeeds); } } t_feed__addFocusOnTriggerButton();}/** * Change url for current post in popup