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

371 lines
19 KiB
PHP
Raw Permalink 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.

<?php $v = 82;
?>
<script>
window.rendered = false;
var assets = new Array(
{
'elem': 'link',
'type': 'text/css',
'rel': 'stylesheet',
'href': 'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap&subset=cyrillic'
},
{
'elem': 'link',
'type': 'text/css',
'rel': 'stylesheet',
'href': '<?php echo get_stylesheet_directory_uri(); ?>/assets/css/app.css?v=<?php echo $v ?>'
},
{
'elem': 'link',
'type': 'text/css',
'rel': 'stylesheet',
'href': '<?php echo get_stylesheet_directory_uri(); ?>/assets/css/app-desktop.css?v=<?php echo $v ?>'
},
{
'elem': 'link',
'type': 'text/css',
'rel': 'stylesheet',
'href': '<?php echo get_stylesheet_directory_uri(); ?>/assets/css/app-mobile.css?v=<?php echo $v ?>'
}
);
function loadScript(src) {
return new Promise(function(resolve, reject) {
let script = document.createElement('script');
script.src = src;
script.onload = () => resolve(script);
document.body.append(script);
});
}
var MarrayJS = [
<?php if($_SERVER['HTTP_SIDE'] === 'gprofile'): ?>
'https://securepubads.g.doubleclick.net/tag/js/gpt.js',
<?php else: ?>
'https://yandex.ru/ads/system/context.js',
<?php endif; ?>
//'<?= get_template_directory_uri() ?>/assets/js/null.js?v=<?php echo $v ?>',
'<?= get_template_directory_uri() ?>/assets/js/app.js?v=<?php echo $v ?>',
'',
//'/wp-content/plugins/ajax-load-more/core/dist/js/ajax-load-more.min.js?ver=5.3.7',
'https://player.panda.video/loadCluster.js',
'https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js',
'https://www.gstatic.com/firebasejs/6.3.3/firebase-app.js',
'https://www.gstatic.com/firebasejs/6.3.3/firebase-messaging.js',
'https://cdn.profile.ru/wp-content/plugins/ajax-load-more/core/dist/js/ajax-load-more.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/tiny-slider/2.9.2/min/tiny-slider.js'
];
if (navigator.userAgent.includes("iPhone")) {
MarrayJS[0] = '<?= get_template_directory_uri() ?>/assets/js/null.js?v=<?php echo $v ?>';
}
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){
//console.log(asset);
elem = document.createElement(asset.elem);
for(let attr in asset){
elem.setAttribute(attr, asset[attr]);
}
document.head.insertBefore(elem, document.getElementsByTagName('title')[0]);
}
loadScript(MarrayJS[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
});
var sc_smi2_94893 = document.createElement('script'); sc_smi2_94893.type = 'text/javascript'; sc_smi2_94893.async = true;
sc_smi2_94893.src = '//smi2.ru/data/js/94893.js'; sc_smi2_94893.charset = 'utf-8';
var s_smi2_94893 = document.getElementsByTagName('script')[0]; s_smi2_94893.parentNode.insertBefore(sc_smi2_94893, s_smi2_94893);
var sc_smi2_98472 = document.createElement('script'); sc_smi2_98472.type = 'text/javascript'; sc_smi2_98472.async = true;
sc_smi2_98472.src = '//smi2.ru/data/js/94893.js'; sc_smi2_98472.charset = 'utf-8';
var s_smi2_98472 = document.getElementsByTagName('script')[0]; s_smi2_98472.parentNode.insertBefore(sc_smi2_98472, s_smi2_98472);
let rmEl = document.querySelector('.read-more-wrap span');
if(rmEl !== null){
rmEl.addEventListener('click', function(){
document.querySelector('.micromarking').setAttribute('class', document.querySelector('.micromarking').getAttribute('class')+' full');
document.querySelector('.read-more-wrap').setAttribute('style', 'display:none;');
});
}
return loadScript(MarrayJS[0]);
})
.then(function(script) {
<?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; ?>
<?php if( has_tag(8023, get_queried_object_id()) ): ?>
var attention = JSON.parse('<?php echo json_encode(array("18+<br/><br/>Чрезмерное употребление алкоголя вредит вашему здоровью"))?>');
jQuery('.micromarking').prepend(
jQuery('<p>')
.addClass('attention')
.append(
jQuery('<li>')
.html(
attention[0]
)
)
);
<?php endif; ?>
jQuery(document).on('DOMNodeInserted', 'body', function() {
jQuery("img[data-src]").lazyload({
effect: 'fadeIn'
});
});
jQuery(".lazyload").lazyload({
effect: 'fadeIn'
});
<?php if(is_single()): ?>
readanother();
<?php endif; ?>
////console.log('loading '+MarrayJS[2]);
<?php if(wp_is_mobile() && is_single()): ?>
return loadScript(MarrayJS[7]);
<?php endif; ?>
return true;
})
.then(function(script) {
//return loadScript(MarrayJS[3]);
})
.then(function(script) {
//loadCluster('panda_div_<?php echo get_queried_object_id() ?>', '<?php echo get_permalink(get_queried_object_id()); ?>', function (isSuccess, divId) {//console.log('PandaVideo returns '+isSuccess);return;});
return loadScript(MarrayJS[4]);
})
<?php if(1==2 && in_array(get_post_type(get_queried_object_id()), array('anew', 'yellow')) && is_single() && !has_tag(7840, get_queried_object_id())): ?>
.then(function(script) {
(function($){
<?php if(filter_input(INPUT_GET, 'utm_from') == 'telegram'): ?>
setCookie('_profile_telegram_popup', 1, {secure: true, 'max-age': 60*60*24*1000});
<?php else: ?>
setTimeout(function() {
if ((getCookie('_profile_telegram_popup') != 1 && (Math.round((new Date()).getTime() / 1000) - getCookie('_profile_telegram_popup')) > 60 * 60 * 24) || (typeof getCookie('_profile_telegram_popup')) == 'undefined') {
$('#telegramModal').modal('show');
setCookie('_profile_telegram_popup', 1, {secure: true, 'max-age': 3*60*60*24*1000});
}
}, 10000);
<?php endif; ?>
})(jQuery);
return true;
})
<?php endif; ?>
<?php if(get_post_type(get_queried_object_id()) == 'profile_article'): ?>
.then(function(script) {
(function($){
/*setTimeout(function(){
<?php if(wp_is_mobile()): ?>
if ( (getCookie('_profile_subscribe_popup') != 1 && (Math.round((new Date()).getTime() / 1000) - getCookie('_profile_subscribe_popup')) > 60*60*24) || ( typeof getCookie('_profile_subscribe_popup')) == 'undefined'){
setCookie('_profile_subscribe_popup', 1, {secure: true, 'max-age': 31536000});
$('#subscribeModal').modal('show');
}
<?php else: ?>
if ( (getCookie('_profile_subscribe_popup') != 1 && (Math.round((new Date()).getTime() / 1000) - getCookie('_profile_subscribe_popup')) > 60*60*24) || ( typeof getCookie('_profile_subscribe_popup')) == 'undefined'){
setCookie('_profile_subscribe_popup', 1, {secure: true, 'max-age': 31536000});
$('#subscribeModal').modal('show');
}
<?php endif; ?>
},15000);
$('.subscribe-form').submit(function(e) {
var $form = $(this);
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),
success: function(data){
$('#subscribeModal').modal('hide');
alert(data);
setCookie('_profile_subscribe_popup', 1, {secure: true, 'max-age': 31536000});
}
});
e.preventDefault();
});
$('#subscribeModal').on('hidden.bs.modal', function (e) {
//console.log('--'+getCookie('_profile_subscribe_popup')+'--');
if (getCookie('_profile_subscribe_popup') != 1) {
//console.log('--'+getCookie('_profile_subscribe_popup')+'--');
setCookie('_profile_subscribe_popup', Math.round((new Date()).getTime() / 1000), {secure: true, 'max-age': 31536000});
}
});*/
$('.read-more-wrap span').click(function(){
$('.micromarking').addClass('full');
$(this).parent().hide();
});
})(jQuery);
return true;
})
<?php endif; ?>
.then(function(script){
<?php global $chance_mobile_partners; ?>
<?php if($chance_mobile_partners == 'smi2-mobile' && is_single() && in_array(get_post_type(get_queried_object_id()), array('anew', 'yellow'))): ?>
window.smi2_<?php echo get_queried_object_id(); ?> = false;
if (window.smi2_<?php echo get_queried_object_id(); ?> === false){
window.smi2_<?php echo get_queried_object_id(); ?> = true;
var sc = document.createElement('script'); sc.type = 'text/javascript'; sc.async = true;
sc.src = '//smi2.ru/data/js/93628.js'; sc.charset = 'utf-8';
sc.setAttribute('defer', 'defer');
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(sc, s);
}
<?php endif; ?>
<?php if($chance_mobile_partners == 'pulse-mobile' && is_single(get_queried_object_id()) && get_post_type(get_queried_object_id()) == 'profile_article'): ?>
var sc = document.createElement('script');
sc.setAttribute('defer', 'defer');
sc.src = 'https://static.pulse.mail.ru/pulse-widget.js';
window.pulse_<?php echo get_queried_object_id(); ?> = false;
if (window.pulse_<?php echo get_queried_object_id(); ?> === false){
window.pulse_<?php echo get_queried_object_id(); ?> = true;
document.getElementById('pulse-<?php echo get_queried_object_id(); ?>').appendChild(sc);
}
<?php endif; ?>
return true;
})
<?php if( get_post_gallery( get_queried_object_id() ) ): ?>
.then(function(){
let script = document.createElement('script');
script.src = MarrayJS[8];
document.body.append(script);
script.onload = function() {
window.slider = tns({
"items": 1,
"controls": true,
"nav": false,
"container": "#gallery",
"speed": 400,
"autoHeight": true,
"preventScrollOnTouch": "auto"
});
//console.log("Slider Initiated");
window.slider.events.on("indexChanged", function(){
history.pushState(null, document.title, window.slider.getInfo().slideItems[window.slider.getInfo().index].getAttribute("data-url"));
window.slider.updateSliderHeight();
gtag("config", "UA-50205759-1", {"page_path": window.location.href.replace("https://profile.ru","")});
ym(24504371, "hit", window.location.href, {"title" : document.title});
updateLiveInternetCounter();
});
window.addEventListener("touchstart", function(){
if(window.sliderInitiated){
return;
}
if(document.querySelectorAll(".tns-controls").length == 0){
window.slider.rebuild();
return;
}
window.sliderInitiated = true;
return;
});
}
return true;
})
<?php endif; ?>
}
});
</script>
<style>
.attention {
}
#readanother {
padding:0 10px 0 10px;
}
#readanother h6 {
font-family: 'Roboto';
font-size: 14px;
line-height: 1;
color: #B51D1D;
text-transform: uppercase;
margin:0 0 12px 0;
}
.attention li {
list-style:none;
border-left:2px solid #B51D1D;
margin:0 0 8px 0;
padding:0 0 0 8px;
line-height:1.2;
font-size: 12px;
font-style: italic;
}
#readanother li {
list-style:none;
border-left:6px solid #B51D1D;
margin:0 0 20px 0;
padding:0 0 0 10px;
line-height:0;
}
#readanother li a {
font-family: 'Roboto';
font-weight: bold;
font-size: 14px;
line-height: 1.2;
color: #000000;
text-decoration: none;
}
#readanother li span {
font-family: 'Roboto';
font-size: 14px;
line-height: 1.2;
color: #000000;
text-decoration: none;
}
</style>
<?php if(is_home() && wp_is_mobile()): ?>
<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; ?>