@Pipe({
name: 'armDate'
})
export class ArmDatePipe implements PipeTransform {
transform(date): any {
let myvar = new Date(date);
if(myvar instanceof Date && myvar.getMonth()){
return date;
}
return date;
}
}
}
<button data-fullscreen>В полный экран</button>
document.addEventListener('click', function (event) {
// Игнорируем клики, которые не относятся к нашей кнопке
if (!event.target.hasAttribute('data-fullscreen')) return;
// Если уже в полном, выйти
// Иначе, снова открыть полный экран
if (document.fullscreenElement) {
document.exitFullscreen();
} else {
document.documentElement.requestFullscreen();
}
}, false);
let tab1 = document.querySelector('#tab1');
let tab2 = document.querySelector('#tab2');
let tab3 = document.querySelector('#tab3');
let clearAll = function(){
[].forEach.call(document.getElementsByClassName('tab__btn'),(el) => {
el.classList.remove('active');
});
tab1.classList.remove('active');
tab2.classList.remove('active');
tab3.classList.remove('active');
}
let london = document.querySelector('#london').onclick = function () {
clearAll();
this.classList.toggle('active');
tab1.classList.toggle('active');
}
let tokyo = document.querySelector('#tokyo').onclick = function () {
clearAll();
this.classList.toggle('active');
tab2.classList.toggle('active');
}
let paris = document.querySelector('#paris').onclick = function () {
clearAll();
this.classList.toggle('active');
tab3.classList.toggle('active');
}
const comments = {"reviews": [
{
"id": 1,
"children": [
{
"id": 2,
"children": [
{
"id": 3,
"children": [
{
"id": 4,
"children": [],
"user": {
"id": 1,
"username": "Admin",
"avatar": "http://127.0.0.1:8000/media/developers/default.jpg"
},
"text": "Ch - 3",
"uploaded_time": "2020-07-30T12:24:52.414582+03:00",
"parent": 3
}
],
"user": {
"id": 1,
"username": "Admin",
"avatar": "http://127.0.0.1:8000/media/developers/default.jpg"
},
"text": "Ch - 2",
"uploaded_time": "2020-07-28T18:20:39.887167+03:00",
"parent": 2
}
],
"user": {
"id": 1,
"username": "Admin",
"avatar": "http://127.0.0.1:8000/media/developers/default.jpg"
},
"text": "Ch - 1",
"uploaded_time": "2020-07-28T18:20:21.004694+03:00",
"parent": 1
}
],
"user": {
"id": 1,
"username": "Admin",
"avatar": "http://127.0.0.1:8000/media/developers/default.jpg"
},
"text": "Text",
"uploaded_time": "2020-07-28T18:19:22.644345+03:00",
"parent": null
}
],}
function countComments(obj){
let total = 0;
count(obj);
function count(obj){
for(let i in obj){
if(obj[i].hasOwnProperty('children')){
count(obj[i].children);
}
total++;
}
}
return total;
}
let total = countComments(comments.reviews);
console.log('Всего комментов: '+ total);
$params = [
"AED" => 3.672949,
"AFN" => 77.000295,
"ALL" => 105.049378,
"AMD" => 481.616228,
"ANG" => 1.795133,
"AOA" => 596.7,
"ARS" => 73.93
];
public function saveCurrency($params) {
foreach($params as $k=>$v){
$this->setAttribute('name', $k);
$this->setAttribute('course', $v);
$this->save();
}
}
$('#livechat_mobile').on('click', function(){
let button = document.querySelectorAll('.ya-chat-button')[0];
button.dispatchEvent(new Event('click'));
});