2101*/2102function t_feed_addPostPopupArrowTop(popup, arrowTop) {2103var isShow = arrowTop.classList.contains('t-feed__post-popup__arrow-top_show');2104if (popup.scrollTop > 300) {2105if (!isShow) {2106arrowTop.classList.add('t-feed__post-popup__arrow-top_show');2107}2108} else if (isShow) {2109arrowTop.classList.remove('t-feed__post-popup__arrow-top_show');2110}2111}2112
/** * 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'); 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'); var indexToRemove = currentUrl.indexOf('/tpost/'); if (/iPhone|iPad|iPod/i.test(navigator.userAgent) && indexToRemove < 0) { indexToRemove = currentUrl.indexOf('/tpost/'); if (indexToRemove < 0) { indexToRemove = currentUrl.indexOf('%2Ftpost%2F'); } } if (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 * @param {object} obj – object with data which came from the backend * @param {object} post – JSON with data for post */function t_feed_changeURL(obj, post) { var curUrl = window.location.href;