From 4112501900848e4ffb617fb103483441ddeec825 Mon Sep 17 00:00:00 2001 From: Simon Date: Fri, 25 Aug 2023 18:47:43 +0700 Subject: [PATCH] rename channelSubButton --- extension/script.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/extension/script.js b/extension/script.js index 818be1e..6d4e4df 100644 --- a/extension/script.js +++ b/extension/script.js @@ -159,8 +159,8 @@ function buildChannelButton(channelContainer) { let channelHandle = getChannelHandle(channelContainer); let buttonDiv = buildChannelButtonDiv(); - let subLink = buildChannelSubLink(channelHandle); - buttonDiv.appendChild(subLink); + let channelSubButton = buildChannelSubButton(channelHandle); + buttonDiv.appendChild(channelSubButton); let spacer = buildSpacer(); buttonDiv.appendChild(spacer); @@ -199,27 +199,27 @@ function buildChannelButtonDiv() { return buttonDiv; } -function buildChannelSubLink(channelHandle) { - let subLink = document.createElement('span'); - subLink.innerText = 'Subscribe'; - subLink.title = `TA Subscribe: ${channelHandle}`; - subLink.setAttribute('data-id', channelHandle); - subLink.setAttribute('data-type', 'channel'); +function buildChannelSubButton(channelHandle) { + let channelSubButton = document.createElement('span'); + channelSubButton.innerText = 'Subscribe'; + channelSubButton.title = `TA Subscribe: ${channelHandle}`; + channelSubButton.setAttribute('data-id', channelHandle); + channelSubButton.setAttribute('data-type', 'channel'); - subLink.addEventListener('click', e => { + channelSubButton.addEventListener('click', e => { e.preventDefault(); console.log(`subscribe to: ${channelHandle}`); - sendUrl(channelHandle, 'subscribe', subLink); + sendUrl(channelHandle, 'subscribe', channelSubButton); }); - subLink.addEventListener('mouseover', () => { + channelSubButton.addEventListener('mouseover', () => { checkChannelSubscribed(channelHandle); }); - Object.assign(subLink.style, { + Object.assign(channelSubButton.style, { padding: '5px', cursor: 'pointer', }); - return subLink; + return channelSubButton; } function checkChannelSubscribed(channelHandle) {