<ul id="q1" class="cards"></ul>
const vkGetData = {
getUser: function() {
return $.ajax({ url:'https://api.vk.com/method/users.get',
data:{"uid": 1},
dataType: 'jsonp'})
.then((data)=> {return data.response;})
.then((data)=>{return `Имя: ${data[0].first_name} Фамилия: ${data[0].last_name}`;});
}
};
vkGetData.getUser().done((arr)=> {$('#q1').text(arr);});
function getData() {
const url = 'https://mcapi.ca/query/play.minesuperior.com/info';
const response = UrlFetchApp.fetch(url, {'muteHttpExceptions': true});
var params = JSON.parse(response.getContentText());
var d = new Date();
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var n =sheet.getRange("A1").getValue()+2;
sheet.getRange("A"+n).setValue(d);
sheet.getRange("B"+n).setValue(params.players.online);
sheet.getRange("A1").setValue(n-1);
}
var res = [{
Channel: 3,
file_name: "1111",
id: 1,
time_start: "1111",
time_end: "1111",
}, {
Channel: 2,
file_name: "2222",
id: 2,
time_start: "2222",
time_end: "2222",
}, {
Channel: 2,
file_name: "3333",
id: 3,
time_start: "3333",
time_end: "3333",
}];
var groupedData = _.groupBy(res, function(d){return d. Channel});
console.log(groupedData);
arr = Array.from({ length: 10 }, (v, k) => k);
function timeout(val){
return new Promise((resolve, reject)=>{
setTimeout(()=>{
console.log(val);
resolve();
}, 1000 * Math.random());
});
}
(async () => {
for (const val of arr) {
await timeout(val);
}
console.log('Расчет окончен');
})();
<canvas id="myCanvas" width="560" height="560" style="border:2px solid #d3d3d3;"></canvas>
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
for(i=0;i<8;i++){
for(j=0;j<8;j++){
ctx.moveTo(0,70*j);
ctx.lineTo(560,70*j);
ctx.stroke();
ctx.moveTo(70*i,0);
ctx.lineTo(70*i,560);
ctx.stroke();
var left = 0;
for(var a=0;a<8;a++) {
for(var b=0; b<8;b+=2) {
startX = b * 70;
if(a%2==0) startX = (b+1) * 70;
ctx.fillRect(startX + left,(a*70) ,70,70);
}}
}}
var mylist = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'];
var newArray = mylist.map(()=>{
return mylist.splice(0,2);
});
console.log(newArray);
function nextElement() {
document.getElementById('test').appendChild(genButtons(newArray[myIndex++%newArray.length]));
};
var mylist = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'];
var myIndex = 0;
var newArray = mylist.map(()=>{
return mylist.splice(0,2);
});
function genButtons(a) {
for (var x = 0; x < a.length; x++) {
var btn = document.createElement('input')
btn.id = 'b' + x;
btn.value = a[x];
btn.type = 'button';
btn.onclick = function() { // Note this is a function
nextElement();
};
document.getElementById('test').appendChild(btn);
}
}
genButtons(newArray[myIndex]);
function nextElement() {
myIndex ++;
genButtons(newArray[myIndex]);
};
var classDeptch = 1; // так как var item в этой переменной находится <li data-depth="1" >4</li> оно равно одному
$( "li" ).each(function() {
var item = $( this );
if(classDeptch >0){
var siblingItemDepht = classDeptch--;
var parent=item.siblings().data( "data-depth", siblingItemDepht )[0];
console.log(parent);
}
});
font-family: "Helvetica Neue", "Calibri Light", Roboto, sans-serif;
<video width="400" controls>
<source src="mov_bbb.mp4" id="video_here">
Your browser does not support HTML5 video.
</video>
<input type="file" name="file[]" class="file_multi_video" accept="video/*">
$(document).on("change", ".file_multi_video", function(evt) {
var $source = $('#video_here');
$source[0].src = URL.createObjectURL(this.files[0]);
$source.parent()[0].load();
});
<ul id="q1" class="cards"></ul>
function GoodsView (obj) {
return `<li class="cards_item">
<div class="card">
<div class="card_image">
<img src="${obj.thumb_photo}" />
</div>
<div class="card_content">
<h2 class="card_heading">${obj.title}</h2>
<p> Цена : ${obj.price.text} <br>
${obj.description}</p>
<a href="#" class="card_button">Button</a>
</div>
</div>
</li>`
}
const vkGetData = {
goods: function() {
return $.ajax({
url:'https://api.vk.com/method/market.get?owner_id=-81454608&access_token=???????&v=5.59',
dataType: 'jsonp'})
.then((data)=> {
console.log(data)
return data.response.items;
})
.then((data)=>{
let listGoods = '';
data.forEach((item) => {
listGoods += GoodsView(item);
})
return listGoods;
});
}
};
vkGetData.goods().done((arr)=> {
$('#q1').append(arr)
});