<select data-prop="type">
<option hidden></option>
<option value="type1">hello, world!!</option>
<option value="type2">fuck the world</option>
<option value="type3">fuck everything</option>
</select>
<br>
<input placeholder="name1" data-prop="name">
<input placeholder="name2" data-prop="name">
<input placeholder="name3" data-prop="name">
<br>
<input placeholder="url1" data-prop="url">
<input placeholder="url2" data-prop="url">
<input placeholder="url3" data-prop="url">
<br>
<input class="value" disabled>
<input class="value" disabled>
<input class="value" disabled>
const getValues = prop =>
Array.from(document.querySelectorAll(`[data-prop="${prop}"]`), n => n.value);
document.addEventListener('input', e => {
if (!e.target.dataset.prop) {
return;
}
const type = getValues('type')[0];
const names = getValues('name');
const urls = getValues('url');
document.querySelectorAll('.value').forEach((n, i) => {
n.name = n.value = `xxx[${type}][${names[i]}][${urls[i]}]`;
});
});
.accordion__grandchild__item
, а переключаете видимость у родительских элементов - .accordion__grandchild__group
. Надо как-то устранить это печальное несоответствие. $('.scheme-wrap polygon').click(function() {
$(`.scheme-wrap__item[data-id="${this.dataset.id}"] .scheme-wrap__popup`).show();
});
.scheme-wrap__popup.visible {
display: block;
}
document.querySelectorAll('.scheme-wrap polygon').forEach(n => {
n.addEventListener('click', onClick);
});
function onClick({ currentTarget: { dataset: { id } } }) {
const selector = `.scheme-wrap__item[data-id="${id}"] .scheme-wrap__popup`;
const popup = document.querySelector(selector);
if (popup) {
popup.classList.add('visible');
}
}
.hover {
opacity: 0.5;
}
const map = document.querySelector('.map svg');
map.addEventListener('mouseover', onHover);
map.addEventListener('mouseout', onHover);
function onHover({ target: t }) {
this.querySelectorAll('.hover-effect').forEach(n => {
n.classList.toggle('hover', n !== t && this !== t);
});
}
$('.away-players').text(function(i, text) {
return $('.subs-players td:even')
.get()
.map(n => $(n).text().split(', '))
.reduce((text, n) => text.replace(n[1], `(${n.join(' ')})`), text);
});
$('селектор контейнеров пар слайдеров').each(function() {
$('.slider-for', this).slick({
...
asNavFor: $('.slider-nav', this),
});
$('.slider-nav', this).slick({
...
asNavFor: $('.slider-for', this),
});
});
Object.keys(obj).forEach(n => n !== key && delete obj[n]);
obj = { [key]: obj[key] };
const deleteKeys = (obj, except) =>
Object.keys(obj).forEach(n => except.includes(n) || delete obj[n]);
const obj = { a: 1, b: 2, c: 3, d: 4 };
deleteKeys(obj, [ 'a' ]);
console.log(obj); // {a: 1}
const pick = (obj, keys) =>
Object.fromEntries(keys.map(n => [ n, obj[n] ]));
const obj = { a: 1, b: 2, c: 3, d: 4 };
console.log(pick(obj, [ 'a', 'd' ])); // {a: 1, d: 4}
preg_match_all('/\b[а-яё]+\b/ui', $str, $cyrillic);
preg_match_all('/\b[a-z]+\b/i', $str, $latin);
if (item.innerText === currentPage) {
item.innerText == currentPage
+item.innerText === currentPage
state.sec
.//==
//== Axios: create instance
//== ======================================= ==//
Vue.use(VueAxiosBridge, axios.create({
baseURL : '/api',
timeout : 0,
responseType : 'json',
responseEncoding: 'utf8',
headers : {
'X-Requested-With': 'XMLHttpRequest',
},
// Reject only if the status code is greater than or equal to 500
validateStatus: status => status < 500,
}));
Vue.axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
responseType : 'json',
.