{
    "version": "https:\/\/jsonfeed.org\/version\/1",
    "title": "Блог Чуденкова Алексея",
    "home_page_url": "https:\/\/blog.chudenkov.ru\/",
    "feed_url": "https:\/\/blog.chudenkov.ru\/rss\/",
    "icon": "https:\/\/blog.chudenkov.ru\/user\/userpic@2x.jpg",
    "author": {
        "name": "Чуденков Алексей",
        "url": "https:\/\/blog.chudenkov.ru\/",
        "avatar": "https:\/\/blog.chudenkov.ru\/user\/userpic@2x.jpg"
    },
    "items": [
        {
            "id": "84",
            "url": "https:\/\/blog.chudenkov.ru\/all\/dax-ispolzuem-switch-esli-dannye-soderzhat-iskomoe-znachenie\/",
            "title": "DAX: Используем SWITCH, если данные содержат искомое значение",
            "content_html": "<p>Создаем столбец и с помощью свитча заполняем таблицу данными, в которых есть искомые значения.<\/p>\n<pre class=\"e2-text-code\"><code>Type = \r\nIF([CPU] = &quot;&quot;, &quot;&quot;, (\r\nSWITCH (\r\nTRUE (),\r\nISERROR(FIND(&quot;ES&quot;,[Название])) &lt;&gt; TRUE (), &quot;ES&quot;,\r\nISERROR(FIND(&quot;QS&quot;, [Название])) &lt;&gt; TRUE (), &quot;QS&quot;\r\n, &quot;Release&quot;)\r\n))<\/code><\/pre><div class=\"e2-text-picture\">\n<img src=\"https:\/\/blog.chudenkov.ru\/pictures\/Screenshot_8.png\" width=\"479\" height=\"210\" alt=\"\" \/>\n<\/div>\n",
            "date_published": "2022-07-06T15:15:40+03:00",
            "date_modified": "2022-07-06T15:15:38+03:00",
            "image": "https:\/\/blog.chudenkov.ru\/pictures\/Screenshot_8.png",
            "_date_published_rfc2822": "Wed, 06 Jul 2022 15:15:40 +0300",
            "_rss_guid_is_permalink": "false",
            "_rss_guid": "84",
            "_e2_data": {
                "is_favourite": false,
                "links_required": [
                    "system\/library\/highlight\/highlight.js",
                    "system\/library\/highlight\/highlight.css"
                ],
                "og_images": [
                    "https:\/\/blog.chudenkov.ru\/pictures\/Screenshot_8.png"
                ]
            }
        },
        {
            "id": "82",
            "url": "https:\/\/blog.chudenkov.ru\/all\/izbavlyaemsya-ot-problem-v-pagespeed-insights\/",
            "title": "Избавляемся от проблем в PageSpeed Insights",
            "content_html": "<p>Для этого нам поможет простой скрипт, который будет отдавать роботу PageSpeed Insights пустые результаты, вместо реальных. Вот стоит у вас счётчик Метрики или Аналитикс, из-за которых занижаются показатели. Влиять на код счётчика вы не можете. Что делать?<\/p>\n<pre class=\"e2-text-code\"><code>&lt;? if(strpos($_SERVER['HTTP_USER_AGENT'],'Chrome-Lighthouse')):?&gt;\r\n&lt;? else: ?&gt;\r\n\/\/ your code here \r\n&lt;? endif; ?&gt;<\/code><\/pre>",
            "date_published": "2021-09-09T15:10:03+03:00",
            "date_modified": "2021-09-09T15:09:57+03:00",
            "_date_published_rfc2822": "Thu, 09 Sep 2021 15:10:03 +0300",
            "_rss_guid_is_permalink": "false",
            "_rss_guid": "82",
            "_e2_data": {
                "is_favourite": false,
                "links_required": [
                    "system\/library\/highlight\/highlight.js",
                    "system\/library\/highlight\/highlight.css"
                ],
                "og_images": []
            }
        },
        {
            "id": "79",
            "url": "https:\/\/blog.chudenkov.ru\/all\/vodyanoy-znak-1s-bitriks\/",
            "title": "Водяной знак 1С-Битрикс",
            "content_html": "<p>Задача: добавить watermark на товары импортируемые из 1С.<br \/>\nОткроем result_modifier.php в catalog.element, catalog.sections и добавим функцию:<\/p>\n<pre class=\"e2-text-code\"><code>$arWatermark = Array(\r\n\tarray(\r\n\t\t&quot;name&quot; =&gt; &quot;watermark&quot;, \r\n\t\t&quot;position&quot; =&gt; &quot;center&quot;, \r\n\t\t&quot;size&quot; =&gt; &quot;real&quot;, \r\n\t\t&quot;type&quot; =&gt; &quot;image&quot;, \r\n\t\t&quot;alpha_level&quot; =&gt; 50,\r\n\t\t&quot;file&quot; =&gt; $_SERVER['DOCUMENT_ROOT'].&quot;\/img\/watermark.png&quot;\r\n\t)\r\n);<\/code><\/pre><p>Теперь при вызове функции ResizeImageGet нужно добавить наш водяной знак:<\/p>\n<pre class=\"e2-text-code\"><code>if ($arResult['DETAIL_PICTURE']['SRC']) {\r\n$big_file = CFile::ResizeImageGet($arResult['DETAIL_PICTURE']['ID'], array('width' =&gt; 2000, 'height' =&gt; 2000), BX_RESIZE_IMAGE_PROPORTIONAL, true, $arWatermark);\r\n$arResult['DETAIL_PICTURE']['SRC'] = $big_file['src'];<\/code><\/pre>",
            "date_published": "2020-06-22T17:26:25+03:00",
            "date_modified": "2020-06-22T17:26:20+03:00",
            "_date_published_rfc2822": "Mon, 22 Jun 2020 17:26:25 +0300",
            "_rss_guid_is_permalink": "false",
            "_rss_guid": "79",
            "_e2_data": {
                "is_favourite": false,
                "links_required": [
                    "system\/library\/highlight\/highlight.js",
                    "system\/library\/highlight\/highlight.css",
                    "system\/library\/highlight\/highlight.js",
                    "system\/library\/highlight\/highlight.css"
                ],
                "og_images": []
            }
        },
        {
            "id": "77",
            "url": "https:\/\/blog.chudenkov.ru\/all\/js-risuem-logotip\/",
            "title": "JS: Рисуем логотип",
            "content_html": "<p>Я бродил по Codepen в поисках интересных решений для анимаций форм и объектов на CSS и наткнулся на клёвую реализацию анимации SVG логотипа. Принцип прост — указываем для каждого элемента path в SVG класс и он будет анимирован. Можно на прелоадер поставить, будет эффектно.<\/p>\n<p class=\"codepen\" data-height=\"377\" data-theme-id=\"light\" data-default-tab=\"html,result\" data-user=\"alexey-chudenkov\" data-slug-hash=\"KKpqKwd\" style=\"height: 377px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;\" data-pen-title=\"Animated SVG Logo\">\r\n  <span>See the Pen <a href=\"https:\/\/codepen.io\/alexey-chudenkov\/pen\/KKpqKwd\">\r\n  Animated SVG Logo<\/a> by Alexey  Chudenkov (<a href=\"https:\/\/codepen.io\/alexey-chudenkov\">@alexey-chudenkov<\/a>)\r\n  on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/span>\r\n<\/p>\n<script async src=\"https:\/\/static.codepen.io\/assets\/embed\/ei.js\"><\/script>\n",
            "date_published": "2020-02-29T11:50:49+03:00",
            "date_modified": "2020-02-29T13:22:48+03:00",
            "_date_published_rfc2822": "Sat, 29 Feb 2020 11:50:49 +0300",
            "_rss_guid_is_permalink": "false",
            "_rss_guid": "77",
            "_e2_data": {
                "is_favourite": false,
                "links_required": [],
                "og_images": []
            }
        },
        {
            "id": "76",
            "url": "https:\/\/blog.chudenkov.ru\/all\/php-vyvodim-tolko-pervy-abzac-predlozheniya\/",
            "title": "PHP: Выводим только первый абзац предложения",
            "content_html": "<p>Иногда очень удобно выводить в разметке Open Graph самый первый абзац текста.<\/p>\n<pre class=\"e2-text-code\"><code>$og_description = substr($content[&quot;text&quot;],0, strpos($content[&quot;text&quot;],'&lt;\/p&gt;')-1 );<\/code><\/pre>",
            "date_published": "2020-02-15T11:15:32+03:00",
            "date_modified": "2020-02-15T11:15:28+03:00",
            "_date_published_rfc2822": "Sat, 15 Feb 2020 11:15:32 +0300",
            "_rss_guid_is_permalink": "false",
            "_rss_guid": "76",
            "_e2_data": {
                "is_favourite": false,
                "links_required": [
                    "system\/library\/highlight\/highlight.js",
                    "system\/library\/highlight\/highlight.css"
                ],
                "og_images": []
            }
        },
        {
            "id": "75",
            "url": "https:\/\/blog.chudenkov.ru\/all\/jquery-zapretit-vvodit-probely-v-e-mail\/",
            "title": "jQuery: запретить вводить пробелы в E-Mail",
            "content_html": "<p>Защита от дурака, который может скопировать и вставить почту с пробелами или хуже того ещё и написать её с пробелами.<\/p>\n<pre class=\"e2-text-code\"><code>$(&quot;#input_Id&quot;).change(function()\r\n     $(this).val($(this).val().replace(\/ +\/g, ''))\r\n});<\/code><\/pre>",
            "date_published": "2020-02-10T14:05:01+03:00",
            "date_modified": "2020-02-10T14:05:21+03:00",
            "_date_published_rfc2822": "Mon, 10 Feb 2020 14:05:01 +0300",
            "_rss_guid_is_permalink": "false",
            "_rss_guid": "75",
            "_e2_data": {
                "is_favourite": false,
                "links_required": [
                    "system\/library\/highlight\/highlight.js",
                    "system\/library\/highlight\/highlight.css"
                ],
                "og_images": []
            }
        },
        {
            "id": "74",
            "url": "https:\/\/blog.chudenkov.ru\/all\/css3-simplest-preloader-with-your-logo\/",
            "title": "CSS3: Simplest preloader with your logo",
            "content_html": "<p>Написал простейший прелоадер для предварительной загрузки страниц вашего сайта. Работает на чистом CSS, скрипты используются только для того чтобы после загрузки скрыть прелоадер.<\/p>\n<p class=\"codepen\" data-height=\"400\" data-theme-id=\"light\" data-default-tab=\"html,result\" data-user=\"alexey-chudenkov\" data-slug-hash=\"wvaBRqy\" style=\"height: 265px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;\" data-pen-title=\"Simple preloader with your logo\">\r\n  <span>See the Pen <a href=\"https:\/\/codepen.io\/alexey-chudenkov\/pen\/wvaBRqy\">\r\n  Simple preloader with your logo<\/a> by Alexey  Chudenkov (<a href=\"https:\/\/codepen.io\/alexey-chudenkov\">@alexey-chudenkov<\/a>)\r\n  on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/span>\r\n<\/p>\n<script async src=\"https:\/\/static.codepen.io\/assets\/embed\/ei.js\"><\/script>\n<p>Чтобы заработало, надо в тег body добавить:<\/p>\n<pre class=\"e2-text-code\"><code>onload=&quot;preloader()&quot;<\/code><\/pre>",
            "date_published": "2020-02-09T17:18:19+03:00",
            "date_modified": "2020-02-09T17:20:39+03:00",
            "_date_published_rfc2822": "Sun, 09 Feb 2020 17:18:19 +0300",
            "_rss_guid_is_permalink": "false",
            "_rss_guid": "74",
            "_e2_data": {
                "is_favourite": false,
                "links_required": [
                    "system\/library\/highlight\/highlight.js",
                    "system\/library\/highlight\/highlight.css"
                ],
                "og_images": []
            }
        },
        {
            "id": "73",
            "url": "https:\/\/blog.chudenkov.ru\/all\/php-povernut-vse-izobrazheniya-v-papke\/",
            "title": "PHP: повернуть все изображения в папке",
            "content_html": "<p>Возникла потребность сменить ориентацию у 5 гигабайт фотографий с тканями. Так как понятия «небо» и «земля» в этом случае отсутствуют, написал скрипт на PHP, который анализирует ширину и высоту всех изображений в папке, и в случае портретной ориентации, происходит поворот изображения на 90 градусов.<\/p>\n<p>В корне сайта создадим файлик с таким содержимым:<\/p>\n<pre class=\"e2-text-code\"><code>&lt;?php\r\n$pathto = getcwd(); \/\/ узнаём текущую директорию файла\r\n$dir = $pathto . 'путь к папке с файлами'; \/\/ от корня сайта\r\n$f = scandir($dir); \/\/ получаем все файлы в папке\r\n\r\nforeach ($f as $file){\r\n    if(preg_match('\/\\.(jpg)\/', $file)) \/\/ проверяем расширение на JPG\r\n        {\r\n        $filename = $dir.$file; \/\/ формируем полный путь к изображению\r\n        $size = getimagesize($filename); \/\/ получаем размеры изображения\r\n        $width = $size[0]; \/\/ записываем значение ширины в переменную \r\n        $height = $size[1]; \/\/ записываем значение высоты в переменную\r\n        \r\n        if ($height &gt; $width) { \/\/ проверяем изображение на портретную ориентацию\r\n            $img = imagecreatefromjpeg($filename); \/\/ создадим новое изображение\r\n            $new_image = $dir.'\/rotated\/'.$file; \/\/ укажем название для будущего файла и его расположение\r\n            $imgRotated = imagerotate($img, 90, 0); \/\/ повернём изображение на 90 градусов\r\n            imagejpeg($imgRotated, $new_image, 90); \/\/ сохраним изображение\r\n        }\r\n    }\r\n}\r\n?&gt;<\/code><\/pre><p>Всё.<\/p>\n<p>P.S. У меня подвисал скрипт, даже писал 504 Bad Gateway Timeout, но все изображения в итоге перевернул.<\/p>\n",
            "date_published": "2020-02-04T23:36:28+03:00",
            "date_modified": "2020-02-04T23:36:24+03:00",
            "_date_published_rfc2822": "Tue, 04 Feb 2020 23:36:28 +0300",
            "_rss_guid_is_permalink": "false",
            "_rss_guid": "73",
            "_e2_data": {
                "is_favourite": false,
                "links_required": [
                    "system\/library\/highlight\/highlight.js",
                    "system\/library\/highlight\/highlight.css"
                ],
                "og_images": []
            }
        },
        {
            "id": "72",
            "url": "https:\/\/blog.chudenkov.ru\/all\/css3-samaya-prostaya-animaciya-knopki\/",
            "title": "CSS3: самая простая анимация кнопки при наведении",
            "content_html": "<p class=\"codepen\" data-height=\"506\" data-theme-id=\"light\" data-default-tab=\"css,result\" data-user=\"alexey-chudenkov\" data-slug-hash=\"VwYoKgV\" style=\"height: 506px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;\" data-pen-title=\"Button Fill Left to Right\">\r\n  <span>See the Pen <a href=\"https:\/\/codepen.io\/alexey-chudenkov\/pen\/VwYoKgV\">\r\n  Button Fill Left to Right<\/a> by Alexey  Chudenkov (<a href=\"https:\/\/codepen.io\/alexey-chudenkov\">@alexey-chudenkov<\/a>)\r\n  on <a href=\"https:\/\/codepen.io\">CodePen<\/a>.<\/span>\r\n<\/p>\n<script async src=\"https:\/\/static.codepen.io\/assets\/embed\/ei.js\"><\/script>\n",
            "date_published": "2020-02-02T11:50:15+03:00",
            "date_modified": "2020-02-05T23:47:47+03:00",
            "_date_published_rfc2822": "Sun, 02 Feb 2020 11:50:15 +0300",
            "_rss_guid_is_permalink": "false",
            "_rss_guid": "72",
            "_e2_data": {
                "is_favourite": false,
                "links_required": [],
                "og_images": []
            }
        },
        {
            "id": "71",
            "url": "https:\/\/blog.chudenkov.ru\/all\/shopify-add-quantity-button-to-cart\/",
            "title": "Shopify: add quantity button to cart",
            "content_html": "<p>Добавить в cart-template.liquid<\/p>\n<pre class=\"e2-text-code\"><code>&lt;input type='button' value='-' class='qtyminus' field='updates_{{ item.id }}' \/&gt;\r\n&lt;input type=&quot;number&quot; name=&quot;updates[]&quot; id=&quot;updates_{{ item.id }}&quot; class=&quot;quantity&quot; value=&quot;{{ item.quantity }}&quot; \/&gt;\r\n&lt;input type='button' value='+' class='qtyplus' field='updates_{{ item.id }}' \/&gt;<\/code><\/pre><p>Добавить в Assets cart.js и его содержание:<\/p>\n<pre class=\"e2-text-code\"><code>jQuery(document).ready(function(){\r\n    $('.qtyplus').click(function(e){\r\n        e.preventDefault();\r\n        fieldName = $(this).attr('field');\r\n        var currentVal = parseInt($('input[id='+fieldName+']').val());\r\n        if (!isNaN(currentVal)) {\r\n            $('input[id='+fieldName+']').val(currentVal + 1);\r\n        } else {\r\n            $('input[id='+fieldName+']').val(0);\r\n        }\r\n    });\r\n    $(&quot;.qtyminus&quot;).click(function(e) {\r\n        e.preventDefault();\r\n        fieldName = $(this).attr('field');\r\n        var currentVal = parseInt($('input[id='+fieldName+']').val());\r\n        if (!isNaN(currentVal) &amp;&amp; currentVal &gt; 0) {\r\n            $('input[id='+fieldName+']').val(currentVal - 1);\r\n        } else {\r\n            $('input[id='+fieldName+']').val(0);\r\n        }\r\n    });\r\n});<\/code><\/pre><p>Не забыть подключить JS с условием если вы находитесь на странице корзины, чтобы не перегружать сайт лишними скриптами.<\/p>\n",
            "date_published": "2020-02-01T13:35:31+03:00",
            "date_modified": "2020-02-01T13:35:26+03:00",
            "_date_published_rfc2822": "Sat, 01 Feb 2020 13:35:31 +0300",
            "_rss_guid_is_permalink": "false",
            "_rss_guid": "71",
            "_e2_data": {
                "is_favourite": false,
                "links_required": [
                    "system\/library\/highlight\/highlight.js",
                    "system\/library\/highlight\/highlight.css",
                    "system\/library\/highlight\/highlight.js",
                    "system\/library\/highlight\/highlight.css"
                ],
                "og_images": []
            }
        }
    ],
    "_e2_version": 3365,
    "_e2_ua_string": "E2 (v3365; Aegea)"
}