window.addEventListener('load', async () => {
var data1 = await $.getJSON('https://json файл разные');
console.log('Получены данные:', data1);
$(".mypanel").html(data1.hls);
var A = ',{"get":"';
var B = '",';
var C = '"img":"';
var D = '"}';
var master = [A,data1.hls,B,C,D];
var data2 = await $.post('zapros2.php', {name1: master});
console.log('Получены еще данные:', data2);
});
const sum = data =>
Array.isArray(data)
? data.reduce((acc, n) => acc + sum(n), 0)
: (+data || 0);
function sum(data) {
let result = 0;
for (const stack = [ data ]; stack.length;) {
const n = stack.pop();
if (n instanceof Array) {
stack.push(...n);
} else {
result += +n || 0;
}
}
return result;
}
true
, '0xBB'
, { valueOf: () => 666 }
и т.д.<body>
<p class="text">Lorem ipsum dolor, sit amet consectetur adipisicing elit. Consequuntur laudantium commodi corporis, sunt repellendus impedit quo veritatis reiciendis. Deleniti sequi cumque id animi cupiditate, cum maiores eaque minus maxime itaque.</p>
</body>
<script>
let text = document.querySelector('.text')
text.innerHTML = text.innerHTML.slice(0, 16) + "..."
</script>
data: () => ({
maxlen: 10,
items: [
'hello, world!!',
'fuck the world',
'fuck everything',
'1234567890',
'Lorem ipsum dolor sit amet, consectetur adipiscing elit,',
],
}),
methods: {
short1: (str, maxlen) => str.length <= maxlen ? str : str.slice(0, maxlen) + '...',
short2: (str, maxlen) => str.substring(0, maxlen) + (str.charAt(maxlen) && '...'),
short3: (str, maxlen) => str.replace(RegExp(`(.{${maxlen}}).+`), '$1...'),
short4: (str, maxlen) => str.replace(RegExp(`(?<=.{${maxlen}}).+`), '...'),
},
<input type="range" min="1" max="20" v-model="maxlen">
<span>{{ maxlen }}</span>
<div v-for="n in items">
<div v-text="short1(n, maxlen)"></div>
<div v-html="short2(n, maxlen)"></div>
<div :text-content.prop="short3(n, maxlen)"></div>
<div>{{ short4(n, maxlen) }}</div>
</div>
canvas.addEventListener("mouseenter", () => {
pluginInstance.setReverse(false).play();
});
canvas.addEventListener("mouseleave", () => {
pluginInstance.setReverse(true).play();
});