(☞ຈل͜ຈ)☞ Главная  Статьи  Загрузчик Домой

Ok!
Ok!
255
class Foo extends \stdClass
// to fix Deprecated: Creation of dynamic property
php, deprecation, dynamic650Исправление ошибки создания динамически свойства в php8.2
201
function send(onError, onSuccess, url, method = 'GET', data = null, headers = [], timeout = 60000) {
  let xhr;

  if (window.XMLHttpRequest) {
      // Chrome, Mozilla, Opera, Safari
      xhr = new XMLHttpRequest();
  }  else if (window.ActiveXObject) { 
      // Internet Explorer
      xhr = new ActiveXObject("Microsoft.XMLHTTP");
  }

  xhr.open(method, url, true);


  headers.forEach((header) => {
      xhr.setRequestHeader(header.key, header.value);
  })
  

  xhr.timeout = timeout;

  xhr.onreadystatechange = function () {
      if (xhr.readyState === 4) {
      if(xhr.status >= 400) {
          onError(xhr.statusText)
      } else {
          onSuccess(xhr.responseText)
      }
      }
  }

  xhr.send(data);
}
xhr, request, XMLHttpRequest, JS12090XMLHttpRequest обернутый в функцию
104
width: expression(((document.documentElement.clientWidth || document.body.clientWidth) < 1050)? "1050px" : "100%");
expression, css690Применение expression в css
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, php1004PRE php
19
К картинкам 
<img src="/img/eyes-l.jpg" srcset="/img/eyes-m.jpg 1x, /img/eyes.jpg 2x" alt="Глаза" height="375" width="500" data-p="/img/eyes.jpg">
<a href="#" rel="prefetch">Ссылка</a>
srcset, prefetch100srcset для изображений, предпросмотр для ссылок
17
if($arParams["PREVIEW_TRUNCATE_LEN"] > 0 && strlen($arItem["PREVIEW_TEXT"])>5)
            $arItem["PREVIEW_TEXT"] = $obParser->html_cut($arItem["PREVIEW_TEXT"], $arParams["PREVIEW_TRUNCATE_LEN"]);
truncate, bitrix, prewiew text400Функция Битрикс для обрезки превью текста, если обрезка автоматически не работает