rename channelSubButton

This commit is contained in:
Simon 2023-08-25 18:47:43 +07:00
parent 114548d362
commit 4112501900
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
1 changed files with 13 additions and 13 deletions

View File

@ -159,8 +159,8 @@ function buildChannelButton(channelContainer) {
let channelHandle = getChannelHandle(channelContainer); let channelHandle = getChannelHandle(channelContainer);
let buttonDiv = buildChannelButtonDiv(); let buttonDiv = buildChannelButtonDiv();
let subLink = buildChannelSubLink(channelHandle); let channelSubButton = buildChannelSubButton(channelHandle);
buttonDiv.appendChild(subLink); buttonDiv.appendChild(channelSubButton);
let spacer = buildSpacer(); let spacer = buildSpacer();
buttonDiv.appendChild(spacer); buttonDiv.appendChild(spacer);
@ -199,27 +199,27 @@ function buildChannelButtonDiv() {
return buttonDiv; return buttonDiv;
} }
function buildChannelSubLink(channelHandle) { function buildChannelSubButton(channelHandle) {
let subLink = document.createElement('span'); let channelSubButton = document.createElement('span');
subLink.innerText = 'Subscribe'; channelSubButton.innerText = 'Subscribe';
subLink.title = `TA Subscribe: ${channelHandle}`; channelSubButton.title = `TA Subscribe: ${channelHandle}`;
subLink.setAttribute('data-id', channelHandle); channelSubButton.setAttribute('data-id', channelHandle);
subLink.setAttribute('data-type', 'channel'); channelSubButton.setAttribute('data-type', 'channel');
subLink.addEventListener('click', e => { channelSubButton.addEventListener('click', e => {
e.preventDefault(); e.preventDefault();
console.log(`subscribe to: ${channelHandle}`); console.log(`subscribe to: ${channelHandle}`);
sendUrl(channelHandle, 'subscribe', subLink); sendUrl(channelHandle, 'subscribe', channelSubButton);
}); });
subLink.addEventListener('mouseover', () => { channelSubButton.addEventListener('mouseover', () => {
checkChannelSubscribed(channelHandle); checkChannelSubscribed(channelHandle);
}); });
Object.assign(subLink.style, { Object.assign(channelSubButton.style, {
padding: '5px', padding: '5px',
cursor: 'pointer', cursor: 'pointer',
}); });
return subLink; return channelSubButton;
} }
function checkChannelSubscribed(channelHandle) { function checkChannelSubscribed(channelHandle) {