Inserts DuckDuckGo images tab into Brave search
< Rückmeldungen auf DuckDuckGo Images for Brave search
Amended your code to remove the original images button so there aren't two:(function insertDuckImagesMenu() { // Find the
i have updated it, Brave now has its own image search page, so i let it stay to have two options
Anmelden um eine Antwort zu senden.
Amended your code to remove the original images button so there aren't two:
(function insertDuckImagesMenu() {
// Find the
const tabImages = document.getElementById('tab-images');
// Get the element within the
const tabImagesLink = tabImages.querySelector('a');
// Get the current href attribute value
let href = tabImagesLink.getAttribute('href');
// Extract the search query from the href
const queryStart = href.indexOf('q=') + 2;
const queryEnd = href.indexOf('%21');
const searchQuery = href.substring(queryStart, queryEnd);
// Generate the new URL
const newURL = 'https://duckduckgo.com/?q=' + searchQuery + '&iax=images&ia=images';
// Create a new
const newLiElement = document.createElement('li');
newLiElement.setAttribute('class', 'ext-tab');
// Create a new element
const newLink = document.createElement('a');
newLink.setAttribute('href', newURL);
newLink.setAttribute('target', '_blank');
// Create the icon element
const iconWrapper = document.createElement('span');
iconWrapper.setAttribute('class', 'icon-wrapper');
const iconSVG = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
iconSVG.setAttribute('class', 'icon');
iconSVG.setAttribute('width', '17');
iconSVG.setAttribute('height', '17');
iconSVG.setAttribute('viewBox', '0 0 17 17');
iconSVG.innerHTML =
'';
// Append the icon element to the new element
iconWrapper.appendChild(iconSVG);
newLink.appendChild(iconWrapper);
// Create the text element
const textSpan = document.createElement('span');
textSpan.textContent = 'Images';
// Append the text element to the new element
newLink.appendChild(textSpan);
// Append the new element to the new
newLiElement.appendChild(newLink);
// Insert the new
tabImages.parentNode.insertBefore(newLiElement, tabImages);
// Remove the existing element
tabImagesLink.parentNode.removeChild(tabImagesLink);
})();
(function removeFallbackControl() {
// Find the element with the specified class
const fallbackControl = document.querySelector('.fallback-control.svelte-3a4v4j');
// Check if the element exists
if (fallbackControl) {
// Remove the element
fallbackControl.parentNode.removeChild(fallbackControl);
}
})();
(function removeProviderInfo() {
// Find the
const providerInfo = document.getElementById('tab-images');
// Remove the
providerInfo.parentNode.removeChild(providerInfo);
})();