var keys = Object.keys(arCartElements);
keys.forEach(function(elementId) {
var element = arCartElements[elementId];
console.log(element);
});
document.querySelectorAll('#price_block .change_model_iphone .item label')[0].getAttribute('for')
document.querySelectorAll('#price_block .change_model_iphone .item label').forEach((item) => console.log(item.getAttribute('for')));
<div><p><span id="phone">+7 (915) 111 11 11</span> <br>Забронировал тариф</p></div>
function replacePhone()
{
let phone = '+7 (9xx) xxx xx xx';
let numberCount = phone.split('x').length;
for (let i = 1; i < numberCount; i++) {
phone = phone.replace('x', Math.round(-0.5 + Math.random() * 10));
}
let phonePlace = document.getElementById('phone');
if (phonePlace) {
phonePlace.innerText = phone;
}
setTimeout(replacePhone, 2000);
}
document.addEventListener('DOMContentLoaded', replacePhone);
$USER->GetLogin()
$arResult['FORM_TYPE'] == "login"
, тогда показываем кнопку Войти$arResult['FORM_TYPE'] == "logout"
, показываем $arResult['USER_NAME'] или $arResult['USER_LOGIN'] AddEventHandler('main', 'OnBeforeUserUpdate', ['Kudis', 'checkLogin']);
AddEventHandler('main', 'OnBeforeUserAdd', ['Kudis', 'checkLogin']);
class Kudis
{
public static function checkLogin($arFields)
{
if (strlen($arFields['LOGIN']) < 10)
{
$GLOBALS['APPLICATION']->ThrowException('Слишком короткий логин!');
return false;
}
return true;
}
}
array(
"CONDITION" => "#^/service/.+?/([^\/]+)/#",
"RULE" => "PERSON_ID=\$1",
"ID" => "",
"PATH" => "/service/index.php",
),
UPDATE `имя базы`.`b_iblock_element` t SET t.`ACTIVE` = 'Y' WHERE t.`ID` = id_элемента
AddEventHandler("main", "OnBeforeUserUpdate", Array("Kudis", "picHandler"));
AddEventHandler("main", "OnBeforeUserAdd", Array("Kudis", "picHandler"));
define("MAX_WIDTH", 10);
define("MAX_HEIGHT", 10);
class Kudis
{
function picHandler(&$arFields)
{
if (is_array($arFields['UF_USERPIC']) && !empty($arFields['UF_USERPIC'])) {
$fileSize = CFile::GetImageSize ($arFields['UF_USERPIC']['tmp_name']);
if ($fileSize[0] > MAX_WIDTH || $fileSize[1] > MAX_HEIGHT) {
global $APPLICATION;
$APPLICATION->throwException('Максимальный размер картинки для Вас: ' . MAX_WIDTH . 'x' . MAX_HEIGHT);
return false;
}
}
}
}
array(
"CONDITION" => "#^/catalog/(\\d+)/(\\d+)/id(\\d+)/[^\/]*$#",
"RULE" => "SECTION_ID=\$1&SUBSECTION_ID=\$2&ELEMENT_ID=\$3",
"ID" => "galament:shop",
"PATH" => "/catalog/index.php",
),
if(isset($arVariables["action"]) && in_array($arVariables["action"], $arCompareCommands))
$componentPage = "compare";
elseif(isset($arVariables["ELEMENT_ID"]) && intval($arVariables["ELEMENT_ID"]) > 0)
$componentPage = "element";
elseif(isset($arVariables["ELEMENT_CODE"]) && strlen($arVariables["ELEMENT_CODE"]) > 0)
$componentPage = "element";
elseif(isset($arVariables["SECTION_ID"]) && intval($arVariables["SECTION_ID"]) > 0)
$componentPage = "section";
elseif(isset($arVariables["SECTION_CODE"]) && strlen($arVariables["SECTION_CODE"]) > 0)
$componentPage = "section";
elseif(isset($_REQUEST["q"]))
$componentPage = "search";
else
$componentPage = "sections";
$this->IncludeComponentTemplate($componentPage);
$user_id = 2;
$arGroups_db = CUser::GetUserGroupList( $user_id );
$aimGroupId = 4; //id группы, куда добавляем
$aimGroupLastDate = '09.05.2018 23:59:59'; // дата, которая нужна, если из какой-то переменной в timestamp, то используйте ConvertTimeStamp($var, "FULL"), она приведёт формат к текущему формату базы битрикса
$aimGroupUpdated = false;
while ($arGroup = $arGroups_db->Fetch()){
if ($arGroup['GROUP_ID'] == $aimGroupId) {
$arGroup['DATE_ACTIVE_TO'] = $aimGroupLastDate;
$aimGroupUpdated = true;
}
$arGroups[] = $arGroup;
}
if (!$aimGroupUpdated) {
$arGroups[] = [
'GROUP_ID' => $aimGroupId,
'DATE_ACTIVE_FROM' => ConvertTimeStamp(time(), "FULL"),
'DATE_ACTIVE_TO' => $aimGroupLastDate
];
}
CUser::SetUserGroup($user_id, $arGroups);
высокая из всех по ID- это, имеющая максимальный id, тогда для пользователя с $id = 1:
$obGroups = CUser::GetUserGroupList(1);
$maxGroupId = 0;
while ($arGroup = $obGroups->Fetch()) {
if ($maxGroupId < $arGroup['GROUP_ID']) {
$maxGroupId = $arGroup['GROUP_ID'];
}
}
$obMaxGroup = CGroup::GetByID($maxGroupId);
if ($arMaxGroup = $obMaxGroup->Fetch()) {
var_dump($arMaxGroup);
}
$('.game_start').after($('.game_comp'));
var arrBLocks = $('.game_block');
arrBLocks.each(function(key, item){
var start = $(item).find('.game_start');
var comp = $(item).find('.game_comp');
start.after(comp);
});
$('.game_block').each(function(i, item) {
$(item).find('.game_start').after($(item).find('.game_comp'));
})
$(function () {
$(".js-form__input--tel").inputmask("mask", {"mask": "+7 (999) 999-9999"});
});
$(function () {
$('.js-form__input--tel').inputmask({
mask: "+7 (X99) 999-9999",
definitions: {
'X': {
validator: "9",
placeholder: "9"
}
}
});
});
var z;
(z = $(".js-form__input--tel")).on("keydown", function (t) {
var a = t.keyCode;
if ("+7 (___) ___-____" === z.val() && (104 === a || 103 === a || 55 === a || 56 === a)) return !1
});