Skip to content

Instantly share code, notes, and snippets.

View ArtemSites's full-sized avatar

Artem Kuznecov ArtemSites

View GitHub Profile
@ArtemSites
ArtemSites / script.js
Created September 25, 2019 08:51
Выключить переход по ссылкам если равны '#'
$(document).ready(function () {
let arA = document.querySelectorAll('a');
arA.forEach(element => {
if (element.getAttribute('href') === '#') {
element.addEventListener('click', function (e) {
e.preventDefault();
});
}
});
@ArtemSites
ArtemSites / gulpfile.js
Created October 4, 2019 10:27 — forked from LoyEgor/gulpfile.js
best image compression settings (gulp-imagemin)
// install
// npm i gulp-cache gulp-imagemin imagemin-pngquant imagemin-zopfli imagemin-mozjpeg imagemin-giflossy -f
// node node_modules/jpegtran-bin/lib/install.js
// node node_modules/gifsicle/lib/install.js
// node node_modules/zopflipng-bin/lib/install.js
// node node_modules/mozjpeg/lib/install.js
// node node_modules/giflossy/lib/install.js
// node node_modules/pngquant-bin/lib/install.js
@ArtemSites
ArtemSites / _bu.css
Last active October 8, 2019 09:05
Пожалуйста обновите ваш браузер
.buorg {
background-color: rgba(0,0,0,1)!important;
color: white!important;
border-bottom: 1px solid white!important;
}
.buorg #buorgul {
background: #3266CC;
}
@ArtemSites
ArtemSites / script.js
Created October 25, 2019 11:36
Очистка хеша из url при перезагрузке
/**
* Очистка хеша из url при перезагрузке:
*/
var loc = window.location.href,
index = loc.indexOf('#');
if (index > 0) {
window.location = loc.substring(0, index);
}
@ArtemSites
ArtemSites / init.php
Created October 25, 2019 15:03
Bitrix отдача 404.php при 404 ошибке.
AddEventHandler('main', 'OnEpilog', '_Check404Error', 1);
function _Check404Error(){
if (defined('ERROR_404') && ERROR_404 == 'Y') {
global $APPLICATION;
$APPLICATION->RestartBuffer();
include $_SERVER['DOCUMENT_ROOT'] . SITE_TEMPLATE_PATH . '/header.php';
include $_SERVER['DOCUMENT_ROOT'] . '/404.php';
include $_SERVER['DOCUMENT_ROOT'] . SITE_TEMPLATE_PATH . '/footer.php';
}
}
@ArtemSites
ArtemSites / init.php
Created October 25, 2019 15:03
Bitrix отдача 404.php при 404 ошибке.
//local/php_interface/init.php
AddEventHandler('main', 'OnEpilog', '_Check404Error', 1);
function _Check404Error(){
if (defined('ERROR_404') && ERROR_404 == 'Y') {
global $APPLICATION;
$APPLICATION->RestartBuffer();
include $_SERVER['DOCUMENT_ROOT'] . SITE_TEMPLATE_PATH . '/header.php';
include $_SERVER['DOCUMENT_ROOT'] . '/404.php';
include $_SERVER['DOCUMENT_ROOT'] . SITE_TEMPLATE_PATH . '/footer.php';
}
@ArtemSites
ArtemSites / result_modifier.php
Last active October 25, 2019 17:01 — forked from kvalexandr/Bitrix Next and Prev news.detail
Bitrix next and prev elements of news.detail. Следующий и предыдущий элемент в news.detail.
В result_modifier.php шаблона вставляем:
<?
/**
* Находим предыдущий и следующий элемент портфолио.
*/
// сортировку берем из параметров компонента
$arSort = array(
$arParams["SORT_BY1"] => $arParams["SORT_ORDER1"],
$arParams["SORT_BY2"] => $arParams["SORT_ORDER2"],
@ArtemSites
ArtemSites / index.html
Created November 11, 2019 12:24
Плёнки на секции и плавное скольжение по ним.
<nav class="marketing-header__nav">
<a href="#section-01" class="marketing-header__nav-item">btn</a>
<!-- /.marketing-header__nav-item -->
</nav>
<div id="section-01" class="productdev-unit">
<div class="pellicle o-08"><a href="#section-01" class="pellicle__btn-down o-09">btn</a></div>
@ArtemSites
ArtemSites / index.php
Last active March 6, 2020 09:21
Вывод элементов инфоблока в вёрстку.
<?php
$arSelect = array("ID", "NAME", "PREVIEW_PICTURE", "PREVIEW_TEXT", "DETAIL_TEXT", "PROPERTY_MAP_X", "PROPERTY_MAP_Y");
$arFilter = array("IBLOCK_ID" => 11, "ACTIVE" => "Y");
if (CModule::IncludeModule("iblock")) {
$res = CIBlockElement::GetList(array(), $arFilter, false, array("nPageSize" => 50), $arSelect);
while ($ob = $res->GetNextElement()) {
$arFields = $ob->GetFields();
var_dump($arFields);
}
}
@ArtemSites
ArtemSites / index.html
Last active November 20, 2019 12:37
svg интерактивные области
<!DOCTYPE html>
<html>
<head>
<title>Parcel Sandbox</title>
<meta charset="UTF-8" />
<script
src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"
crossorigin="anonymous"
></script>
<script src="https://unpkg.com/popper.js@1"></script>