|
|
|
@ -146,25 +146,7 @@ function ensureTALinks() {
|
|
|
|
|
|
|
|
|
|
// fix positioning of #owner div to fit new button
|
|
|
|
|
function adjustOwner(channelContainer) {
|
|
|
|
|
let sponsorButton = channelContainer.querySelector('#sponsor-button');
|
|
|
|
|
if (sponsorButton === null) {
|
|
|
|
|
return channelContainer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let variableMinWidth;
|
|
|
|
|
if (sponsorButton.hasChildNodes()) {
|
|
|
|
|
variableMinWidth = '140px';
|
|
|
|
|
} else {
|
|
|
|
|
variableMinWidth = '45px';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Object.assign(channelContainer.firstElementChild.style, {
|
|
|
|
|
minWidth: variableMinWidth,
|
|
|
|
|
});
|
|
|
|
|
Object.assign(channelContainer.style, {
|
|
|
|
|
minWidth: 'calc(40% + 50px)',
|
|
|
|
|
});
|
|
|
|
|
return channelContainer;
|
|
|
|
|
return channelContainer.querySelector('#buttons') || channelContainer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function buildChannelButton(channelContainer) {
|
|
|
|
@ -197,7 +179,6 @@ function getChannelHandle(channelContainer) {
|
|
|
|
|
function buildChannelButtonDiv() {
|
|
|
|
|
let buttonDiv = document.createElement('div');
|
|
|
|
|
buttonDiv.classList.add('ta-channel-button');
|
|
|
|
|
|
|
|
|
|
Object.assign(buttonDiv.style, {
|
|
|
|
|
display: 'flex',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
@ -205,8 +186,8 @@ function buildChannelButtonDiv() {
|
|
|
|
|
color: '#fff',
|
|
|
|
|
fontSize: '14px',
|
|
|
|
|
padding: '5px',
|
|
|
|
|
margin: '5px',
|
|
|
|
|
borderRadius: '8px',
|
|
|
|
|
'margin-left': '8px',
|
|
|
|
|
borderRadius: '18px',
|
|
|
|
|
});
|
|
|
|
|
return buttonDiv;
|
|
|
|
|
}
|
|
|
|
@ -308,6 +289,7 @@ function getTitleContainers() {
|
|
|
|
|
|
|
|
|
|
function buildVideoButton(titleContainer) {
|
|
|
|
|
let href = getNearestLink(titleContainer);
|
|
|
|
|
if (!href) return;
|
|
|
|
|
const dlButton = document.createElement('a');
|
|
|
|
|
dlButton.classList.add('ta-button');
|
|
|
|
|
dlButton.href = '#';
|
|
|
|
@ -409,7 +391,8 @@ function checkVideoExists(taButton) {
|
|
|
|
|
}
|
|
|
|
|
function handleError() {
|
|
|
|
|
buttonError(taButton);
|
|
|
|
|
console.log('error');
|
|
|
|
|
let videoId = taButton.dataset.id;
|
|
|
|
|
console.log(`error: failed to get info from TA for video ${videoId}`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let videoId = taButton.dataset.id;
|
|
|
|
|