Skip to content

Instantly share code, notes, and snippets.

@andrei99
Last active January 31, 2019 08:52
Show Gist options
  • Save andrei99/e0665cede4db71a0a092fd8b2fe5a4b1 to your computer and use it in GitHub Desktop.
Save andrei99/e0665cede4db71a0a092fd8b2fe5a4b1 to your computer and use it in GitHub Desktop.
Custom items
//footer
<?// cookie to site ?>
<? if (!isset($_COOKIE['cookieSite'])): ?>
<? $APPLICATION->IncludeFile(
'/include_area/cookie_site.php',
array(),
array('MODE' => 'php')
); ?>
<? endif; ?>
//cookie_site.php
<? require($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php');
setcookie("cookieSite", "1", time() + 3600000, '/'); ?>
<div class="wrap_cookie_site">
<p>Мы используем файлы «cookie» для функционирования сайта. Продолжая навигацию по сайту, вы косвенно предоставляете
свое согласие на использование файлов cookie на этом веб-сайте
</p>
<a href="#" class="link_cookie_site">Ок</a>
</div>
<script type="application/javascript">
$(document).ready(function () {
$('body').on('click', 'a.link_cookie_site', function () {
$('.wrap_cookie_site').remove();
return false;
});
});
</script>
//css
/*popup cookies --- start*/
.wrap_cookie_site{
position: fixed;
max-width: 840px;
left: 50%;
bottom: 20px;
margin-left: -420px;
z-index: 999;
padding: 15px 40px;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
background: #fff;
box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.4);
}
.wrap_cookie_site:after{
content: '.';
clear: both;
height: 0;
visibility: hidden;
display: block;
}
.wrap_cookie_site > p{
float: left;
width: calc(100% - 120px);
font-size: 13px;
color: #4d4d4d;
}
.wrap_cookie_site > a{
font-size: 16px;
color: #4d4d4d;
display: block;
text-align: center;
width: 70px;
border: 1px solid #7c7c7c;
border-radius: 3px;
background: #fff;
float: right;
text-decoration: none;
padding: 6px 0;
}
.wrap_cookie_site > a:hover{
opacity: 0.9;
}
@media screen and (max-width: 991px) {
.wrap_cookie_site{
max-width: 90%;
top: 5%;
left: 5%;
padding: 15px 15px 15px;
}
.wrap_cookie_site > p{
float: none;
width: 100%;
margin-bottom:15px;
}
.wrap_cookie_site > a{
float: none;
margin: 0 auto;
display: block;
width: 70px;
}
}
/*popup cookies --- end*/
//Open Graph result
$this->__component->SetResultCacheKeys(array(
"NAME",
"PREVIEW_TEXT",
"DETAIL_PICTURE",
"DETAIL_PAGE_URL"
));
//Open Graph epilog
use Bitrix\Main\Page\Asset;
if($arResult):
Asset::getInstance()->addString('<meta property="og:image" content="https://' . $_SERVER['SERVER_NAME'] . $arResult['DETAIL_PICTURE']['SRC'] . '"/>');
Asset::getInstance()->addString('<meta property="og:url" content= "https://'. $_SERVER['SERVER_NAME'] . $arResult['DETAIL_PAGE_URL'] . '"/>');
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment