<div class="filter" data-id="1">
<div class="filter-block" data-target="1">
<div class="filter" data-id="2">
<div class="filter-block" data-target="2">
<div class="filter" data-id="3">
<div class="filter-block" data-target="3">
$(document).on('click', function(e) {
let $f = $(e.target).closest(".filter");
if ($f.length) {
let id = $f.data('id');
$('.filter-block:not([data-target="'+id+'"])').hide();
}
e.stopPropagation();
});
allowDropdown
, чтобы отключить штатный выпадающий списокsetCountry()
, чтобы установить страну, которую вы выберете в отдельном выпадающем спискеshowFlag
const info = {
title: 'Hello!!!',
graduatesCount: 2000,
areYouChampion: true,
technologies: ['Front', 'Back', 'Devops']
}
let techSelect = document.createElement('select');
for (let i = 0; i < info.technologies.length; i++) {
let render = document.createElement('option');
render.append(info.technologies[i]);
techSelect.append(render);
}
document.body.append(techSelect);
let techSelect = document.createElement('select');
for (let i in info.technologies) {
let render = document.createElement('option');
render.append(info.technologies[i]);
techSelect.append(render);
}
document.body.append(techSelect);
let techSelect = document.createElement('select');
for (let i of info.technologies) {
let render = document.createElement('option');
render.append(i);
techSelect.append(render);
}
document.body.append(techSelect);
let techSelect = document.createElement('select');
info.technologies.forEach(i => {
let render = document.createElement('option');
render.append(i);
techSelect.append(render);
});
document.body.append(techSelect);
let techSelect = document.createElement('select');
techSelect.append(info.technologies.reduce((acc, i) => acc+`<option>${i}</option>`, ''));
document.body.append(techSelect);
// Сначала, как обычно сортируем по статусу
if (a.status > b.status) return 1;
if (a.status < b.status) return -1;
// Потом, если статусы равны, - по дате
if (a.date > b.date) return 1;
if (a.date < b.date) return -1;
return 0;
arr.sort((a,b) => {
if (a.status === b.status) {
if (a.date === b.date) return 0;
return a.date > b.date ? 1 : -1;
}
return a.status > b.status ? 1 : -1;
})
class GeoIp
{
private \SxGeo $sxGeo;
public function __construct()
{
$this->sxGeo = new \SxGeo(Storage::disk('local')->path('sxgeo/SxGeo.dat'));
}
public function getDetectedCountry($ip = null)
{
if (!$ip) {
$ip = real_ip();
}
$countryCode = strtolower($this->sxGeo->getCountry($ip)) ?: 'ru';
return Country::find($countryCode);
}
}
Какие конструкции использовать, что бы изменить порядок в массиве