* @param {string} recid – recid of current block
1614 * @param {object} obj – object with data which came from the backend 1615 * @param {object} obj_posts – object with posts in current feed 1616 * @param {object} opts – object with feed settings 1618function t_feed_initPopup(recid, obj, obj_posts, opts) { 1619 var rec = document.querySelector('#rec' + recid); 1620 var feed = rec.querySelector('.js-feed'); 1621 var gridType = feed.getAttribute('data-feed-grid-type'); 1622 var currentUrl = window.location.href; 1624 // TODO: избавиться от добавления #postpopup – old 1625 var popupTriggers = rec.querySelectorAll('[href^="#postpopup"]'); 1626 // popupTrigger.unbind(); //? – old 1628 // Replace #postpopup to absolute link 1629 Array.prototype.forEach.call(popupTriggers, function (trigger) { 1630 var parent = trigger.closest('.t-feed__post'); 1631 var uid = parent.getAttribute('data-post-uid'); 1632 var post = obj_posts[recid][uid]; 1633 if (post !== undefined) { 1634 trigger.setAttribute('href', post.url); 1636 t_feed__addAttributesForAccessibility(post); 1639 Array.prototype.forEach.call(popupTriggers, function (trigger) { 1640 trigger.addEventListener('click', function (e) { 1643 if (gridType === 'side-panel') { 1644 feed.classList.add('t946__feed-container_expanded'); 1647 var postItem = trigger.closest('.js-feed-post'); 1648 var lid_post = postItem.getAttribute('data-post-uid'); 1649 var post = obj_posts[recid][lid_post]; 1651 var ctrlKey = e.ctrlKey; 1652 var cmdKey = e.metaKey && navigator.platform.indexOf('Mac') !== -1; 1653 if (ctrlKey || cmdKey) { 1654 window.open(post.url); 1658 if ((obj.header || obj.footer) && obj.disablepopup) { 1659 location.href = post.url; 1661 t_feed_workPostPopup(recid, obj, post, lid_post, opts); 1667 document.addEventListener('keydown', function (e) { 1668 if (e.keyCode === 27) { 1669 t_feed_closePopup(recid, opts, currentUrl); 1675 * Ready to show popup 1676 * @param {string} recid – recid of current block 1677 * @param {object} obj – object with data which came from the backend 1678 * @param {object} post – JSON with data for post 1679 * @param {string} lid_post – parent post uid 1680 * @param {object} opts – object with feed settings 1682function t_feed_workPostPopup(recid, obj, post, lid_post, opts) { 1683 var rec = document.querySelector('#rec' + recid); 1684 var feed = rec.querySelector('.js-feed'); 1685 if (typeof window.tFeedPosts[recid] !== 'undefined') { 1686 window.tFeedPosts[recid]['title'] = document.title; 1689 if (opts.popup_opts.isShare) { 1690 var script = document.createElement('script'); 1691 script.src = 'https://static.tildacdn.' + t_feed__getRootZone() + '/js/ya-share.js'; 1692 script.async = true; 1693 document.body.appendChild(script); 1695 feed.insertAdjacentHTML('beforeend', t_feed_drawWholePostPopup(obj, post, opts, lid_post, recid)); 1697 var code = obj.code; 1698 if (code != '' && code != null && code.indexOf('VK') !== -1 && post.disablecomments != 1) { 1699 t_feed_loadCommentsVkWidget(feed);