function copyToClipboard(text) {
let span = document.createElement('span');
span.style.position = 'absolute';
span.style.top = 0;
span.style.zIndex = -999;
span.style.opacity = 0;
span.style.color = 'initial';
span.style.fontSize = 'initial';
span.style.whiteSpace = 'pre';
span.appendChild(
document.createTextNode(text)
);
document.body.appendChild(span);
let range = document.createRange();
let selection = window.getSelection();
selection.removeAllRanges();
range.selectNode(span);
selection.addRange(range);
let success;
try {
success = document.execCommand('copy');
} catch(e) {
success = false;
}
selection.removeAllRanges();
document.body.removeChild(span);
return success;
}
$('.btn_1').click(function(){
// этот код будет выполняться каждый раз когда ты будешь кликать по кнопке1
$('.btn_2').click(function(){
console.log('нажата кнопка 2');
});
});
$('.btn_1').click(function(){
console.log('нажата кнопка 1');
});
$('.btn_2').click(function(){
console.log('нажата кнопка 2');
});
async CheckEmailForBusy(email: any) {
try {
const res = await this.UserRepository.count({
where: {email: email.toString()}
});
if (res > 0) {
return '{"status": "200","Message": "This email is busy"}';
}
else {
return '{"status": "200", "Message": "kk"}';
}
} catch (err) {
console.log(err);
return `{"text": "${err}"}`;
}
}
public CheckEmailForBusy(email: any) {
return new Promise((res, rej) => {
this.UserRepository.count({
where: {email: email.toString()}
}).then( (Res) => {
if (Res > 0) {
return res('{"status": "200","Message": "This email is busy"}');
}
else {
return res('{"status": "200", "Message": "kk"}');
}
}).catch(err => {
return rej(`{"text": "${err}"}`);
})
});
<script type="text/javascript" src="https://vk.com/js/api/openapi.js?169"></script>
<div class="col-lg-6 text-left">
<div id="vk_post_-206998906_533"> </div>
<script type="text/javascript">
setTimeout(() => {
VK.Widgets.Post("vk_post_-206998906_533", -206998906, 533, 'DsVRe3o1nQ-Y7jbVx0xuHnnwvss');
}, 0);
</script>
</div>
<div class="col-lg-6 text-left">
<div id="vk_post_-206998906_534"></div>
<script type="text/javascript">
setTimeout(() => {
VK.Widgets.Post("vk_post_-206998906_534", -206998906, 534, 'AimpCfLFhD2WjDrFGTERqeTD5Cg');
}, 5000);
</script>
</div>
json.data.reduce((acc, c) => {
if (c.stars !== 3) return acc;
acc += c.stars;
return acc;
}, 0); // 6
test.data.reduce((acc, c) => c.stars !== 3 ? acc : acc + c.stars, 0); // 6
function hasScrolled() {
var st = jQuery(this).scrollTop();
if (st === 0) return jQuery('#myHeader').removeClass('nav-down').removeClass('nav-up');
//.
//.
//.
const express = require('express');
const jsonParser = express.json();
module.exports.register = [jsonParser, function (req, res) {
if (!req.body) return res.sendStatus(400);
console.log(req.body);
res.json(
{
serverErr: '',
fieldsErr: {
username: 'Тест',
}
}
);
})]
const express = require('express');
const router = express.Router();
const controller = require('../controllers/regController');
router.post('/', controller.register)
module.exports = router;
SELECT * FROM [Products]
LEFT JOIN [Suppliers] ON Suppliers.SupplierID = Products.SupplierID
WHERE ProductID >=64 OR SupplierName="Tokyo Traders"
function already_vote(post_id, callback){
$.ajax({ <options> })
.done(function(response){
if(response.already_vote == 1){
return callback(true);
}
return callback(false);
})
.fail(function(xhr){
console.log(xhr);
});
}
$('.post-like').click(function(){
const item_id = $(this).parents('.item').attr('id');
already_vote(item_id, function(isVoted) {
if(isVoted){
//...
}
else {
//...
}
});
});
function already_vote(post_id, callback){
return new Promise(res => {
$.ajax({ <options> })
.done(function(response){
if(response.already_vote == 1){
return res(true);
}
return res(false);
})
});
}
$('.post-like').click(async function(){
const item_id = $(this).parents('.item').attr('id');
const isVoted = await already_vote(item_id);
if(isVoted){
//...
}
else {
//...
}
});
const data = JSON.parse(event.data);
for (let block of data.blocks) {
// перебираем блоки
// сортируем транзакции по дате
// замени "a" с "b" если нужна сортировка в другую сторону
block.transactions.sort((a, b) => Number(a.unixTimestamp) - Number(b.unixTimestamp))
for (let transaction of block.transactions) {
incomingOut += '<tr>';
incomingOut += '<td width="50">';
incomingOut += '<img src="static/image/' + transaction.currency + '.png">';
// и так далее
}
}
$('.incoming .content table').html(incomingOut);