Files
profile/footer-new.php
Andrey Kuvshinov 8fc8cbae32 add files
2025-07-09 21:21:17 +03:00

374 lines
16 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

</div>
</main>
<?php wp_footer(); ?>
<?php if(!is_home()){the_widget('profileNewsWidget');} ?>
<?php if(is_single()): ?>
<?php
global $wpdb;
if(has_tag(103565, get_queried_object_id())){
$featured = $wpdb->get_results("select id from wp_posts where post_type in ('anew', 'yellow') and id != ".get_queried_object_id()." and post_status = 'publish' and id not in (SELECT post_id FROM wp_postmeta WHERE meta_key = '_hide_on_website' AND meta_value = '1' ) and id not in (SELECT post_id FROM wp_postmeta WHERE meta_key = '_only_link_access' AND meta_value = '1' ) and id in (SELECT object_id FROM wp_term_relationships WHERE term_taxonomy_id = 103565 ) order by post_date desc limit 15", OBJECT);
}else{
$ppc = (int) get_post_primary_category_id(get_queried_object_id());
if($ppc == 8529){
$ppc = 103464;
}
$featured = $wpdb->get_results("select id from wp_posts where post_type in ('anew', 'yellow') and id != " . get_queried_object_id() . " and post_status = 'publish' and id not in (SELECT post_id FROM wp_postmeta WHERE meta_key = '_hide_on_website' AND meta_value = '1' ) and id not in (SELECT post_id FROM wp_postmeta WHERE meta_key = '_only_link_access' AND meta_value = '1' ) and id not in (SELECT object_id FROM wp_term_relationships WHERE term_taxonomy_id = 103565 ) and id in (SELECT object_id FROM wp_term_relationships WHERE term_taxonomy_id = " . $ppc . ") order by post_date desc limit 15", OBJECT);
}
$posts = array();
foreach ($featured as $item){
$post = new stdClass();
$post->id = $item->id;
$post->title = htmlspecialchars(get_the_title($item->id));
$post->link = get_permalink($item->id);
array_push($posts, $post);
}
?>
<?php endif; ?>
<!-- [Cell promo] -->
<input id="promo-1" class="cell__promo__chkbx" type="checkbox" />
<div class="cell__promo d-md-none ">
<label class="cell__promo__close" for="promo-1">
<span></span>
</label>
<div class="cell__promo__body">
<a class="d-flex justify-content-between cell__promo__link d-none" href="https://profile.ru/tag/military-donbass/">
<div class="cell_promo__bg">
<div class="cell__promo__text">
<strong>Горячие новости</strong>
<span>Спецоперация России в Донбассе</span>
</div>
</div>
</a>
<div>
<?php if((int)get_option('show_ad') == 1): ?>
<!--montemedia-->
<!--Площадка: profile.ru / mobile / mobile top-->
<!--Категория: <не задана>-->
<!--Тип баннера: Перетяжка 100%-->
<div id="adfox_163361795989236806"></div>
<script>
window.yaContextCb.push(()=>{
Ya.adfoxCode.create({
ownerId: 242477,
containerId: 'adfox_163361795989236806',
params: {
p1: 'cmatl',
p2: 'y'
}
})
})
</script>
<?php endif; ?>
</div>
</div>
</div>
<script>
function loadScript(src) {
return new Promise(function(resolve, reject) {
let script = document.createElement('script');
script.src = src;
script.onload = () => resolve(script);
document.head.append(script);
});
}
function in_array(needle, haystack, strict) {
var found = false, key, strict = !!strict;
for (key in haystack) {
if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
found = true;
break;
}
}
return found;
}
function offset(el) {
if(el === undefined){
return false;
}
var rect = el.getBoundingClientRect(),
scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,
scrollTop = window.pageYOffset || document.documentElement.scrollTop;
return { top: rect.top + scrollTop, left: rect.left + scrollLeft }
}
function sharePopUp(id){
return;
let cookie = getCookie('_profile_share_ids');
cookie = (typeof cookie == 'undefined') ? new Array() : JSON.parse(cookie);
if (!in_array(id,cookie)){
jQuery('#shareModal')
.on('shown.bs.modal', function(e){
jQuery('body').removeClass('modal-open').removeAttr('style');
})
.on('click', '.ya-share2__link', function(e){
jQuery('#shareModal').modal('hide')
});
jQuery('#shareModal').modal('show');
cookie.push(id);
setCookie('_profile_share_ids', JSON.stringify(cookie), {secure: true, 'max-age': 31536000});
}
}
function getCookie(name) {
let matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
));
return matches ? decodeURIComponent(matches[1]) : "";
}
function onlyUnique(value, index, self) {
return (self.indexOf(value) === index && value == parseInt(value, 10));
}
function setCookie(name, value, options = {}) {
options = {
path: '/',
expires: 0
};
if (options.expires.toUTCString) {
options.expires = options.expires.toUTCString();
}
let updatedCookie = encodeURIComponent(name) + "=" + encodeURIComponent(value);
for (let optionKey in options) {
updatedCookie += "; " + optionKey;
let optionValue = options[optionKey];
if (optionValue !== true) {
updatedCookie += "=" + optionValue;
}
}
document.cookie = updatedCookie;
}
function readanother() {
var readanother = '<?php echo json_encode($posts); ?>';
var readanotherlimit = 3;
if(readanother == 0 || jQuery('#readanother').length == 0){
return false;
}
jQuery('#readanother').removeClass('d-none');
jQuery('#readanother').append(
jQuery('<h6/>')
.html('Читайте также:')
);
let items = JSON.parse(readanother);
let visited_items = getCookie('visited').split(',').filter(onlyUnique);
var i = 0 ;
items.forEach(function (item, index) {
if(visited_items.indexOf(item.id) >= 0){
return;
}
i++;
if(i <= readanotherlimit) {
jQuery('#readanother').append(
jQuery('<li/>')
.append(
jQuery('<a/>')
.attr('target', '_self')
.attr('href', item.link + '?utm_from=readmore')
.html(item.title)
)
)
}
});
if(i <= readanotherlimit) {
items.forEach(function (item, index) {
i++;
if(i <= readanotherlimit) {
jQuery('#readanother').append(
jQuery('<li/>')
.append(
jQuery('<a/>')
.attr('target', '_self')
.attr('href', item.link + '?utm_from=readmore')
.html(item.title)
)
)
}
});
}
}
(function() {
let prevPos = 0, currPos = 0;
let ticking = false;
let timeout = 0;
let element = document.querySelector('.cell__promo');
let closePromoLabel = document.querySelector('.cell__promo__close');
function doScroll(curr, prev) {
if (curr > prev && prev > 50 && !element.classList.contains('open')) {
element.classList.add('open');
timeout = setTimeout(function () {
element.classList.add('show');
clearTimeout(timeout);
}, 1000);
}
}
closePromoLabel.addEventListener('click', function(e) {
if (!element.classList.contains('once')) {
e.preventDefault();
element.classList.add('once');
}
}, false);
window.addEventListener('scroll', function(e) {
currPos = window.scrollY;
if (!ticking) {
window.requestAnimationFrame(function() {
doScroll(currPos, prevPos);
ticking = false;
prevPos = currPos;
});
ticking = true;
}
});
}());
function checkVisible(elm) {
var rect = elm.getBoundingClientRect();
var viewHeight = Math.max(document.documentElement.clientHeight, window.innerHeight);
return !(rect.bottom < 0 || rect.top - viewHeight >= 0);
}
</script>
<?php $v = 10; ?>
<script>
window.rendered = false;
var assets = [
'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap&subset=cyrillic',
'<?php echo get_stylesheet_directory_uri(); ?>/assets/css/app.css?v=<?php echo $v ?>',
'<?php echo get_stylesheet_directory_uri(); ?>/assets/css/app-desktop.css?v=<?php echo $v ?>',
'<?php echo get_stylesheet_directory_uri(); ?>/assets/css/app-mobile.css?v=<?php echo $v ?>',
'<?php echo get_stylesheet_directory_uri(); ?>/assets/css/app-mobile-new.css?v=<?php echo $v ?>'
];
<?php if((int)get_option('show_ad') == 1): ?>
var arrayJS = [
'https://yandex.ru/ads/system/context.js',
'/wp-content/themes/profile/assets/js/app.js?v=<?php echo $v ?>',
'https://profile.ru/wp-content/plugins/ajax-load-more/core/dist/js/ajax-load-more.min.js',
];
<?php else: ?>
var arrayJS = [
'/wp-content/themes/profile/assets/js/null.js?v=<?php echo $v ?>',
'/wp-content/themes/profile/assets/js/app.js?v=<?php echo $v ?>',
'https://profile.ru/wp-content/plugins/ajax-load-more/core/dist/js/ajax-load-more.min.js',
];
<?php endif; ?>
window.addEventListener('scroll', function(e) {
if(!window.rendered){
window.rendered = true;
let elem;
if (typeof banned !== "undefined" && document.querySelectorAll('.micromarking').length != 0) {
banned();
}
for(let asset of assets){
let link = document.createElement('link');
link.setAttribute('type', 'text/css');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('href', asset);
document.head.appendChild(link);
}
loadScript(arrayJS[1])
.then(function(script) {
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
(window, document, "script", "https://cdn.jsdelivr.net/npm/yandex-metrica-watch/tag.js", "ym");
ym(24504371, "init", {
clickmap:true,
trackLinks:true,
accurateTrackBounce:true
});
jQuery("img[data-src]").lazyload({
effect: 'fadeIn'
});
<?php if(is_single()): ?>
readanother();
<?php endif; ?>
return loadScript(arrayJS[2]);
})
.then(function(script) {
return loadScript(arrayJS[0]);
})
.then(function(script) {
let alm_btn = document.querySelector('.alm-load-more-btn');
window.addEventListener('touchend', function(e) {
let lastItem = [...document.querySelectorAll('.alm-single-post')].pop();
if(checkVisible(lastItem) && alm_btn.getAttribute('data-loading') != "1"){
alm_btn.click();
alm_btn.setAttribute('data-loading', '1');
}
});
<?php if(get_post_primary_category_id(get_queried_object_id()) == 3358 || has_tag(17542, get_queried_object_id()) || has_tag(52905, get_queried_object_id())): ?>
var attention = JSON.parse('<?php echo json_encode(array("Информация носит ознакомительный характер, необходимо проконсультироваться со специалистом/врачом"))?>');
jQuery('.micromarking').prepend(
jQuery('<p>')
.addClass('attention')
.append(
jQuery('<li>')
.html(
attention[0]
)
)
);
<?php endif; ?>
<?php if( has_tag(102535, get_queried_object_id()) ): ?>
var attention = JSON.parse('<?php echo json_encode(array("Предупреждение об ограничении ответственности: Все приведенные прогнозы носят оценочный характер, прогнозируемая доходность не гарантирует действительной доходности в процессе вашей инвестиционной деятельности. Любые решения, основанные на опубликованной информации, вы принимаете на свой риск."))?>');
jQuery('.micromarking').prepend(
jQuery('<p>')
.addClass('attention')
.append(
jQuery('<li>')
.html(
attention[0]
)
)
);
<?php endif; ?>
})
}
});
</script>
<?php if(is_home()): ?>
<style>
@media (max-width: 576px) {
.news__body, .news__body > div, #tab-news > div > div > div.scrollbar-macosx.js-scrollbar.scroll-content {
height: auto !important;
max-height: 10000px !important;
}
body > header > div.container-fluid.clearfix > div:nth-child(2) > div.col-12.col-md-4.col-lg-5.col-xl-6 > div > div.d-block.d-md-none > a {
display: none !important;
}
body > main > div > div > div:nth-child(1) > div > div {
margin-bottom: 2em;
}
}
</style>
<?php endif; ?>
</body>
</html>