44 lines
1.7 KiB
JavaScript
44 lines
1.7 KiB
JavaScript
function selectGroupByType() {
|
|
const intervalId = setInterval(() => {
|
|
const dropdown = document.querySelector('[aria-label="Group by"]');
|
|
if (dropdown) {
|
|
console.log('Dropdown gefunden');
|
|
dropdown.click();
|
|
setTimeout(() => {
|
|
const dropdownItems = document.querySelectorAll('.dropdown-item');
|
|
if (dropdownItems.length > 0) {
|
|
console.log('Dropdown-Items gefunden:', dropdownItems.length);
|
|
const typeOption = Array.from(dropdownItems)
|
|
.find(item => item.innerText && item.innerText.includes('Resource type'));
|
|
if (typeOption) {
|
|
console.log('Resource type Option gefunden');
|
|
typeOption.click();
|
|
clearInterval(intervalId); // Stop the interval once the option is selected
|
|
} else {
|
|
console.log('Resource type Option nicht gefunden');
|
|
}
|
|
} else {
|
|
console.log('Keine Dropdown-Items gefunden');
|
|
}
|
|
}, 2000); // Wait for the dropdown to expand
|
|
} else {
|
|
console.log('Dropdown nicht gefunden');
|
|
}
|
|
}, 2000); // Check every 2 seconds
|
|
}
|
|
|
|
// Run the function when the page is fully loaded
|
|
window.addEventListener('load', () => {
|
|
setTimeout(selectGroupByType, 3000); // Wait for 3 seconds
|
|
});
|
|
|
|
// Observe DOM changes in case the dropdown loads later
|
|
const observer = new MutationObserver(() => {
|
|
selectGroupByType();
|
|
});
|
|
|
|
observer.observe(document.body, {
|
|
childList: true,
|
|
subtree: true
|
|
});
|