await Promise.all([
'https://learn.javascript.ru/article/promise-chaining/one.js',
'https://learn.javascript.ru/article/promise-chaining/two.js',
'https://learn.javascript.ru/article/promise-chaining/three.js',
].map(loadScript));
one();
two();
three();
<VirtualHost *:80>
DocumentRoot /var/www/app1
ServerName app1.example.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/example
ServerName example.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/wildcard
ServerName other.example.com
ServerAlias *.example.com
</VirtualHost>
<body>
<div id="k"></div>
</body>
#k {
position: absolute;
width: 100%;
height: 100px;
bottom: 0;
background: green;
}
const object = document.querySelector('#k');
object.onmousedown = function(event) {
let shiftY = event.clientY - object.getBoundingClientRect().height;
object.style.zIndex = 1000;
document.body.append(object);
moveAt(event.pageY);
function moveAt(pageY) {
object.style.height = shiftY - pageY + 'px';
}
function onMouseMove(event) {
moveAt(event.pageY);
}
document.addEventListener('mousemove', onMouseMove);
object.onmouseup = function() {
document.removeEventListener('mousemove', onMouseMove);
object.onmouseup = null;
};
};
object.ondragstart = function() {
return false;
};
const chunked = (data, chunkSize) =>
data.reduce((acc, n, i) => (
(acc[i / chunkSize | 0] ??= []).push(n),
acc
), []);
// или
const chunked = (data, chunkSize) =>
data.reduce((acc, n, i) => (
(i % chunkSize) || acc.push([]),
acc.at(-1).push(n),
acc
), []);
console.log(chunked([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ], 3));
const chunked = (data, chunkSize, slice = data.slice) =>
Array.from(
{ length: Math.ceil(data.length / chunkSize) },
function(_, i) {
return this(i * chunkSize, (i + 1) * chunkSize);
},
(slice instanceof Function ? slice : [].slice).bind(data)
);
console.log(chunked([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ], 3));
console.log(chunked(document.querySelectorAll('img'), 5));
console.log(chunked('abcdefghij', 4)); // кусками, кстати, будут тоже строки
console.log(chunked('abcdefghij', 4, [].slice)); // а так - массивы
console.log(chunked($('img'), 5));
function* chunked(data, chunkSize) {
let chunk = [];
for (const n of data) {
if (chunk.push(n) === chunkSize) {
yield chunk;
chunk = [];
}
}
if (chunk.length) {
yield chunk;
}
}
console.log(Array.from(chunked([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ], 3)));
console.log([...chunked(document.querySelectorAll('img'), 5)]);
for (const n of chunked(Array(10).keys(), 4)) {
console.log(n);
}
Ctrl + Shit + P > Configure User Snippet > SCSS
scss.json
. И scope
уберите. <svg ...>
<path class="area" data-id="1" d="..." />
<path class="area" data-id="2" d="..." />
</svg>