mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Improve joined channels tracking in IV.
This commit is contained in:
parent
5c32423597
commit
782556495a
1 changed files with 19 additions and 3 deletions
|
@ -127,12 +127,17 @@ var IV = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
toggleChannelJoined: function (id, joined) {
|
toggleChannelJoined: function (id, joined) {
|
||||||
|
IV.channelsJoined['channel' + id] = joined;
|
||||||
|
IV.checkChannelButtons();
|
||||||
|
},
|
||||||
|
checkChannelButtons: function() {
|
||||||
const channels = document.getElementsByClassName('channel');
|
const channels = document.getElementsByClassName('channel');
|
||||||
const full = 'channel' + id;
|
|
||||||
for (var i = 0; i < channels.length; ++i) {
|
for (var i = 0; i < channels.length; ++i) {
|
||||||
const channel = channels[i];
|
const channel = channels[i];
|
||||||
if (String(channel.getAttribute('data-context')) === full) {
|
const full = String(channel.getAttribute('data-context'));
|
||||||
channel.classList.toggle('joined', joined);
|
const value = IV.channelsJoined[full];
|
||||||
|
if (value !== undefined) {
|
||||||
|
channel.classList.toggle('joined', value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -419,6 +424,15 @@ var IV = {
|
||||||
&& (fromEl.getAttribute('data-src')
|
&& (fromEl.getAttribute('data-src')
|
||||||
== toEl.getAttribute('data-src'))) {
|
== toEl.getAttribute('data-src'))) {
|
||||||
return false;
|
return false;
|
||||||
|
} else if (fromEl.tagName == 'SECTION'
|
||||||
|
&& fromEl.classList.contains('channel')
|
||||||
|
&& fromEl.hasAttribute('data-context')
|
||||||
|
&& toEl.tagName == 'SECTION'
|
||||||
|
&& toEl.classList.contains('channel')
|
||||||
|
&& toEl.hasAttribute('data-context')
|
||||||
|
&& (String(fromEl.getAttribute('data-context'))
|
||||||
|
== String(toEl.getAttribute('data-context')))) {
|
||||||
|
return false;
|
||||||
} else if (fromEl.classList.contains('loaded')) {
|
} else if (fromEl.classList.contains('loaded')) {
|
||||||
toEl.classList.add('loaded');
|
toEl.classList.add('loaded');
|
||||||
}
|
}
|
||||||
|
@ -573,6 +587,7 @@ var IV = {
|
||||||
} else {
|
} else {
|
||||||
IV.initMedia();
|
IV.initMedia();
|
||||||
}
|
}
|
||||||
|
IV.checkChannelButtons();
|
||||||
if (scroll === undefined) {
|
if (scroll === undefined) {
|
||||||
IV.jumpToHash(hash, true);
|
IV.jumpToHash(hash, true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -623,6 +638,7 @@ var IV = {
|
||||||
videosPlaying: {},
|
videosPlaying: {},
|
||||||
|
|
||||||
cache: {},
|
cache: {},
|
||||||
|
channelsJoined: {},
|
||||||
index: 0,
|
index: 0,
|
||||||
position: 0
|
position: 0
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue