Hackerrank new templates in sandbox. updated a bunch of williams-sonoma stuff. GSU backup.
This commit is contained in:
@ -21,3 +21,43 @@
|
||||
{% include "courses_catalog" %}
|
||||
</main>
|
||||
{% include "footer" %}
|
||||
|
||||
<script>
|
||||
function clickDropdownMenu() {
|
||||
const dropdownMenu = document.getElementsByClassName('dropdown-menu')[0]
|
||||
|
||||
const event = new MouseEvent('click', {
|
||||
view: window,
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
});
|
||||
|
||||
dropdownMenu.dispatchEvent(event);
|
||||
console.log('clicked')
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
const choices = document.querySelectorAll('.choices__item.choices__item--choice.choices__item--selectable')
|
||||
|
||||
const targetNode = document.getElementsByClassName('choices__list')[2];
|
||||
const config = { attributes: true, childList: true, subtree: true };
|
||||
const callback = (mutationList, observer) => {
|
||||
var updated_choices = document.querySelectorAll('.choices__item.choices__item--choice.choices__item--selectable')
|
||||
for (const mutation of mutationList) {
|
||||
Array.from(updated_choices).forEach((choice) => {
|
||||
choice.addEventListener("mousedown", clickDropdownMenu);
|
||||
})
|
||||
}
|
||||
};
|
||||
const observer = new MutationObserver(callback);
|
||||
|
||||
Array.from(choices).forEach((choice) => {
|
||||
choice.addEventListener("mousedown", clickDropdownMenu);
|
||||
})
|
||||
observer.observe(targetNode, config);
|
||||
});
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user