mirror of
https://github.com/tubearchivist/browser-extension.git
synced 2025-07-13 04:28:17 +00:00
Compare commits
No commits in common. "976fefbf893a06c9b87337d9c30c1fe4dd348f1a" and "540600731595bcd9f4a8d3878d17f7e33b2cca1d" have entirely different histories.
976fefbf89
...
5406007315
@ -146,7 +146,25 @@ function ensureTALinks() {
|
|||||||
|
|
||||||
// fix positioning of #owner div to fit new button
|
// fix positioning of #owner div to fit new button
|
||||||
function adjustOwner(channelContainer) {
|
function adjustOwner(channelContainer) {
|
||||||
return channelContainer.querySelector('#buttons') || 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildChannelButton(channelContainer) {
|
function buildChannelButton(channelContainer) {
|
||||||
@ -179,6 +197,7 @@ function getChannelHandle(channelContainer) {
|
|||||||
function buildChannelButtonDiv() {
|
function buildChannelButtonDiv() {
|
||||||
let buttonDiv = document.createElement('div');
|
let buttonDiv = document.createElement('div');
|
||||||
buttonDiv.classList.add('ta-channel-button');
|
buttonDiv.classList.add('ta-channel-button');
|
||||||
|
|
||||||
Object.assign(buttonDiv.style, {
|
Object.assign(buttonDiv.style, {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
@ -186,8 +205,8 @@ function buildChannelButtonDiv() {
|
|||||||
color: '#fff',
|
color: '#fff',
|
||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
padding: '5px',
|
padding: '5px',
|
||||||
'margin-left': '8px',
|
margin: '5px',
|
||||||
borderRadius: '18px',
|
borderRadius: '8px',
|
||||||
});
|
});
|
||||||
return buttonDiv;
|
return buttonDiv;
|
||||||
}
|
}
|
||||||
@ -289,7 +308,6 @@ function getTitleContainers() {
|
|||||||
|
|
||||||
function buildVideoButton(titleContainer) {
|
function buildVideoButton(titleContainer) {
|
||||||
let href = getNearestLink(titleContainer);
|
let href = getNearestLink(titleContainer);
|
||||||
if (!href) return;
|
|
||||||
const dlButton = document.createElement('a');
|
const dlButton = document.createElement('a');
|
||||||
dlButton.classList.add('ta-button');
|
dlButton.classList.add('ta-button');
|
||||||
dlButton.href = '#';
|
dlButton.href = '#';
|
||||||
@ -391,8 +409,7 @@ function checkVideoExists(taButton) {
|
|||||||
}
|
}
|
||||||
function handleError() {
|
function handleError() {
|
||||||
buttonError(taButton);
|
buttonError(taButton);
|
||||||
let videoId = taButton.dataset.id;
|
console.log('error');
|
||||||
console.log(`error: failed to get info from TA for video ${videoId}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let videoId = taButton.dataset.id;
|
let videoId = taButton.dataset.id;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user