https://quilljs.com/
Автор: wiki2_promos
Правильные настройки .htaccess для Next.js
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# Disable directory indexes and MultiViews Options -Indexes -MultiViews # Prevent mod_dir appending a slash to directory requests DirectorySlash Off RewriteEngine On # Rewrite /foo to /foo.html if it exists RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.html -f RewriteRule !\.\w{2,4}$ %{REQUEST_URI}.html [L] # Otherwise, rewrite /foo to /foo/index.html if it exists RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}/index.html -f RewriteRule !\.\w{2,4}$ %{REQUEST_URI}/index.html [L] # Handling 404 ErrorDocument 404 /404.html |
Что такое rel = noreferrer noopener и как этот тег влияет на SEO
https://cpa-ratings.ru/stati/chto-takoe-rel—noreferrer-noopener-i-kak-etot-teg-vliyaet-na-seo
Как добавить изображение в next.js ?
https://medium.com/nextjs/how-to-add-an-image-in-next-js-5c1065450e3a
Интеграция контактных форм с Telegram на WordPress
Всплывающее окно при уходе с сайта
https://webdevhelp.ru/solutions/vsplyvayushchee-okno-pri-ukhode-s-sayta/
Снег на сайте
https://embed.im/snow/
useState()
Если данные не планируются меняться или рендерится, то использовать useState() не нужно. Можно просто вывести данные в массив: const color = [«Зеленый», «Синий», «Красный»]
Пример склонения слов в javascript
https://realadmin.ru/coding/sklonenie-na-javascript.html
|
1 2 3 4 5 6 7 8 9 10 11 12 |
function declOfNum(n, text_forms) { n = Math.abs(n) % 100; var n1 = n % 10; if (n > 10 && n < 20) { return text_forms[2]; } if (n1 > 1 && n1 < 5) { return text_forms[1]; } if (n1 == 1) { return text_forms[0]; } return text_forms[2]; } declOfNum(1, ['минута', 'минуты', 'минут']); // вернёт — минута declOfNum(2, ['минута', 'минуты', 'минут']); // вернёт — минуты declOfNum(5, ['минута', 'минуты', 'минут']); // вернёт — минут |
YML для MODX revo и minishop2
https://about-cms.com/yml-dlya-modx-revo-i-minishop2.html
301 редирект с помощью .htaccess
https://modx-gu.ru/configs/301-redirekt
Скрипт Calltouch для отслеживания заявок с форм V_2
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
var AjaxForm = { initialize: function (afConfig) { if (!jQuery().ajaxForm) { document.write('<script src="' + afConfig['assetsUrl'] + 'js/lib/jquery.form.min.js"><\/script>'); } if (!jQuery().jGrowl) { document.write('<script src="' + afConfig['assetsUrl'] + 'js/lib/jquery.jgrowl.min.js"><\/script>'); } $(document).ready(function () { $.jGrowl.defaults.closerTemplate = '<div>[ ' + afConfig['closeMessage'] + ' ]</div>'; }); $(document).off('submit', afConfig['formSelector']).on('submit', afConfig['formSelector'], function (e) { $(this).ajaxSubmit({ dataType: 'json', data: {pageId: afConfig['pageId']}, url: afConfig['actionUrl'], beforeSerialize: function (form) { form.find(':submit').each(function () { if (!form.find('input[type="hidden"][name="' + $(this).attr('name') + '"]').length) { $(form).append( $('<input type="hidden">').attr({ name: $(this).attr('name'), value: $(this).attr('value') }) ); } }) }, beforeSubmit: function (fields, form) { //noinspection JSUnresolvedVariable if (typeof(afValidated) != 'undefined' && afValidated == false) { return false; } form.find('.error').html(''); form.find('.error').removeClass('error'); form.find('input,textarea,select,button').attr('disabled', true); return true; }, success: function (response, status, xhr, form) { form.find('input,textarea,select,button').attr('disabled', false); response.form = form; $(document).trigger('af_complete', response); if (!response.success) { AjaxForm.Message.error(response.message); if (response.data) { var key, value, focused; for (key in response.data) { if (response.data.hasOwnProperty(key)) { if (!focused) { form.find('[name="' + key + '"]').focus(); focused = true; } value = response.data[key]; form.find('.error_' + key).html(value).addClass('error'); form.find('[name="' + key + '"]').addClass('error'); } } } } else { /* send calltouch */ try { var fio = form.find('input[name*="name"]').val(); var phone = form.find('input[name*="phone"],input[name*="tel"]').val(); var mail = form.find('input[name*="email"]').val(); var comment = form.find('input[name*="comment"]').val(); var ct_site_id = '55755'; var sub = 'Заявка с ' + location.hostname; var ct_data = { fio: fio, phoneNumber: phone, email: mail, comment: comment, subject: sub, requestUrl: location.href, sessionId: window.call_value }; console.log(ct_data); if (!!phone || !!mail){ jQuery.ajax({ url: 'https://api.calltouch.ru/calls-service/RestAPI/requests/'+ct_site_id+'/register/', dataType: 'json', type: 'POST', data: ct_data, async: false }); } } catch(e) { console.log(e); } /* send calltouch */ AjaxForm.Message.success(response.message); form.find('.error').removeClass('error'); form[0].reset(); //noinspection JSUnresolvedVariable if (typeof(grecaptcha) != 'undefined') { //noinspection JSUnresolvedVariable grecaptcha.reset(); } } } }); e.preventDefault(); return false; }); $(document).on('keypress change', '.error', function () { var key = $(this).attr('name'); $(this).removeClass('error'); $('.error_' + key).html('').removeClass('error'); }); $(document).on('reset', afConfig['formSelector'], function () { $(this).find('.error').html(''); AjaxForm.Message.close(); }); } }; //noinspection JSUnusedGlobalSymbols AjaxForm.Message = { success: function (message, sticky) { if (message) { if (!sticky) { sticky = false; } $.jGrowl(message, {theme: 'af-message-success', sticky: sticky}); } }, error: function (message, sticky) { if (message) { if (!sticky) { sticky = false; } $.jGrowl(message, {theme: 'af-message-error', sticky: sticky}); } }, info: function (message, sticky) { if (message) { if (!sticky) { sticky = false; } $.jGrowl(message, {theme: 'af-message-info', sticky: sticky}); } }, close: function () { $.jGrowl('close'); }, }; |