|
Ok!
|
|
|
Ok!
|
---|---|---|---|---|
30 | <script> $(document).ready(function () { var elts = $('.resource-children-item'); var div = "<div id='pagination'>"; window.m = Math.floor(elts.length/10); for(var i=1; i<=window.m;i++){ if(i==1){ div = div + "<a class='prev inactive'>← Предыдущая</a>"; } div = div + "<a class='pag-a' data-p='" + i + "'>" + i + "</a>"; } div = div + "<a class=next>Следующая →</a></div>"; $('.resource-view').append(div); $(".pag-a").eq(0).addClass("active"); var act = $(".pag-a.active").attr("data-p"); $('.block_' + act).addClass('active'); $(".pag-a").click(function(){ var act = $(this).text(); $('.resource-children-item, .pag-a').removeClass('active'); $('.block_' + act).addClass('active'); $(this).addClass('active'); $('.prev, .next').removeClass('inactive'); if(act == 1){ $('.prev').addClass('inactive'); } if(act == window.m){ $('.next').addClass('inactive'); } }); $(".next").click(function() { var ind = parseInt($(".pag-a.active").text()); $('.resource-children-item, .pag-a').removeClass('active'); $('.block_' + (ind + 1)).addClass('active'); $(".pag-a").eq(ind).addClass('active'); $('.prev, .next').removeClass('inactive'); if(ind == parseInt(window.m)-1){ $('.next').addClass('inactive'); } }); $(".prev").click(function(){ var ind = parseInt($(".pag-a.active").text()); $('.resource-children-item, .pag-a').removeClass('active'); $('.block_' + (ind - 1)).addClass('active'); $(".pag-a").eq(ind - 2).addClass('active'); $('.prev, .next').removeClass('inactive'); if(ind == 2){ $('.prev').addClass('inactive'); } }); }) $(document).keydown(function(e) { var ind = parseInt($(".pag-a.active").text()); console.log(e.keyCode + ',' + window.m + "," + ind ); if(e.keyCode == 39 && ind < window.m){ $('.resource-children-item, .pag-a').removeClass('active'); $('.block_' + (ind + 1)).addClass('active'); $(".pag-a").eq(ind).addClass('active'); $('.prev, .next').removeClass('inactive'); if(ind == parseInt(window.m)-1){ $('.next').addClass('inactive'); } } if(e.keyCode == 37 && ind > 1){ $('.resource-children-item, .pag-a').removeClass('active'); $('.block_' + (ind - 1)).addClass('active'); $(".pag-a").eq(ind - 2).addClass('active'); $('.prev, .next').removeClass('inactive'); if(ind == 2){ $('.prev').addClass('inactive'); } } }); </script> | пагинация, стрелки, pagination | 1290 | Пагинация jQuery со стрелками влево, вправо |
43 | $file = CFile::ResizeImageGet($uInfo['PERSONAL_PHOTO'], array('width'=>150, 'height'=>150), BX_RESIZE_IMAGE_PROPORTIONAL, true); | cache, resize, cfile | 1290 | Resize Image Get. Получить массив файла по ID |
148 | $arFilter = Array("IBLOCK_ID"=>GOODS, "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y", "=PROPERTY_CML2_ARTIKUL_VALUE"=>$p_title); | bitrix filter value, filter bx, value | 1290 | Свойство элемента в Битрикс фильтре |
207 | $posts = get_posts ("category=11&orderby=date&numberposts=5"); if ($posts) : $i=1; foreach ($posts as $post) : setup_postdata ($post); $i++; endforeach; endif; | get_posts, wp | 1290 | Получить посты по запросу из Вордпресс |
245 | https://drive.google.com/uc?export=download&id=1Nzl05CwW6NOwqTZsj1uOhmj52zLTk4Vv | видео, загрузить, гугл диск | 1290 | Ссылка для воспроизведения видео с гугл-диска. Загрузить файл на Диск, предоставить доступ по ссылке, из ссылки взять id и здесь заменить |
65 | br{content:' ';} br:after{content:' ';} | br, пробел, абзац, новая строка | 1270 | CSS заменить тег <br> пробелами. Собрать строку из абзацев. |
18 | Use the "update-ping" mechanism to permanently remove content from the Google AMP Cache after the content has been removed from its origin. For example, to purge content formerly served at https://cdn.ampproject.org/i/s/example.com/favicon.ico, send an update ping request to: https://cdn.ampproject.org/update-ping/i/s/example.com/favicon.ico. Cached content that no longer exists will eventually get removed from the cache; it's just faster to use "update-ping". Google's Remove AMP content "documentation" | amp, удалить, гугл сео | 1234 | Убрать AMP описание удаленной страницы из Гугла |
38 | var thisPageName = $('html').find('title').text(); var addrString = document.URL.split('/').splice(-2,1).toString() var reach = "yaCounter48115721.reachGoal('" + addrString + "'); return true;"; $('form.wpcf7-form').append('<input type="hidden" name="pageUrlFrom" value="' + document.URL + '"/>'); $('form.wpcf7-form').append('<input type="hidden" name="pageNameFrom" value="' + thisPageName + '"/>'); $('form.wpcf7-form').find('input[type="submit"]').attr('onclick', reach); | цель, метрика, добавить цели | 1234 | Яваскрипт, jQuery код добавки события reachGoal в форму сайта с учетом адреса страницы |
89 | $post = get_post(); $t = strtotime($post->post_modified_gmt); $str = 'Last-Modified: '.gmdate('D, d M Y H:i:s', $t).' GMT'; header('Last-Modified: '.gmdate('D, d M Y H:i:s', $t).' GMT'); | daremodified, wp, php | 1200 | WP date modified php file |
218 | function loadScript(url, callback) { const element = document.createElement("script"); element.type = "text/javascript"; element.src = url; element.onload = callback; document.body.appendChild(element); } loadScript("js/common.js", () => { loadScript("<https://cdn.jsdelivr.net/npm/[email protected]/build/global/luxon.min.js>", () => { console.log("timer.js ") }) }) | loadscript, js | 1200 | Скрипт чтоб загрузить другой скрипт |
77 | <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-115977538-1"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-115977538-1'); </script> | gtag, google tagmanager | 1090 | Google Tag Manager |
88 | document.addEventListener("DOMContentLoaded", function(event) { var cl = document.getElementById('#all_otz'); cl.onclick = function(ev) { var post = {}; post['num_otz'] = 20; post['ajax'] = 'y'; node = BX('video_feed_block'); if (!!node) { BX.ajax.post( 'https://www.brtclinic.ru/index.php', post, function (data) { var el = data.getElementById('video_feed_block'); node.innerHTML = el.innerHTML(); } ); } } }); | битрикс, битрикс аякс | 1090 | Битрикс функция вместо jQuery ajax |
115 | RewriteCond %{REQUEST_URI} !^/(catalog/special/action) RewriteCond %{REQUEST_URI} !^/(catalog/special/hit) RewriteCond %{REQUEST_URI} !^/(catalog/special/new) RewriteCond %{REQUEST_URI} ^/catalog/special/(.*)/ RewriteRule ^.*$ /404.php [L] | 404, редирект | 1090 | Редирект на 404 всех из списка кроме указанных |
132 | <body class="<?=array_splice(explode('/', htmlspecialchars($_SERVER['PHP_SELF'])),-2,1)[0]?>"> | класс, класс для body | 1090 | Присвоить тегу body class с названием текущей папки в адресе страницы |
14 | (in_array($r[1] % 10, array(2, 3, 4)) && $r[1] < 10 ) ? "отзыва" : ($r[1] == 1 ? "отзыв" : "отзывов") | человека, человек | 1050 | PHP выражение для вывода "человека или человек" в зависимости от цифры |
16 | function getCoordinates($address){ $address = urlencode($address); $url = "http://maps.google.com/maps/api/geocode/json?sensor=false&address=" . $address; $response = file_get_contents($url); $json = json_decode($response,true); $lat = $json['results'][0]['geometry']['location']['lat']; $lng = $json['results'][0]['geometry']['location']['lng']; return array($lat, $lng); } | координаты, гугл, php | 1050 | Функция получения координат через Гугл на php |
10 | require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php"); | битрикс пролог, prolog_before | 1040 | Подключение пролога вместо вывода шапки Битрикс |
27 | <?php function Escape_win ($path) { $path = strtoupper ($path); return strtr($path, array("U0430"=>"а", "U0431"=>"б", "U0432"=>"в", "U0433"=>"г", "U0434"=>"д", "U0435"=>"е", "U0451"=>"ё", "U0436"=>"ж", "U0437"=>"з", "U0438"=>"и", "U0439"=>"й", "U043A"=>"к", "U043B"=>"л", "U043C"=>"м", "U043D"=>"н", "U043E"=>"о", "U043F"=>"п", "U0440"=>"р", "U0441"=>"с", "U0442"=>"т", "U0443"=>"у", "U0444"=>"ф", "U0445"=>"х", "U0446"=>"ц", "U0447"=>"ч", "U0448"=>"ш", "U0449"=>"щ", "U044A"=>"ъ", "U044B"=>"ы", "U044C"=>"ь", "U044D"=>"э", "U044E"=>"ю", "U044F"=>"я", "U0410"=>"А", "U0411"=>"Б", "U0412"=>"В", "U0413"=>"Г", "U0414"=>"Д", "U0415"=>"Е", "U0401"=>"Ё", "U0416"=>"Ж", "U0417"=>"З", "U0418"=>"И", "U0419"=>"Й", "U041A"=>"К", "U041B"=>"Л", "U041C"=>"М", "U041D"=>"Н", "U041E"=>"О", "U041F"=>"П", "U0420"=>"Р", "U0421"=>"С", "U0422"=>"Т", "U0423"=>"У", "U0424"=>"Ф", "U0425"=>"Х", "U0426"=>"Ц", "U0427"=>"Ч", "U0428"=>"Ш", "U0429"=>"Щ", "U042A"=>"Ъ", "U042B"=>"Ы", "U042C"=>"Ь", "U042D"=>"Э", "U042E"=>"Ю", "U042F"=>"Я")); } $str = "u0430u043fu044bu0443u043au0435u043f "; print Escape_win ($str); ?> | json, decode | 1030 | Преобразовать в русскоязычные символы |
36 | div.wpcf7 .screen-reader-response { color: black!important; background: white; padding: 3em; border: 1px solid rgba(1,1,1,.1); margin: 2em; box-sizing: border-box; width: 500px; position: absolute; } | pre, php | 1004 | PRE php |
61 | <img src="image.svg" onerror="this.onerror=null; this.src='image.png'"> | ошибка картинки, ошибка изображений | 1004 | Обработка ошибки при загрузке изображений |