Skip to content

Instantly share code, notes, and snippets.

@NI57721
Last active January 31, 2023 05:06
Show Gist options
  • Save NI57721/4b3318b21df2f9bc33b1cd0d36fb7c53 to your computer and use it in GitHub Desktop.
Save NI57721/4b3318b21df2f9bc33b1cd0d36fb7c53 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Clickable list items
// @namespace http://tampermonkey.net/
// @version 0.1
// @description make rooms clickable.
// @author NI57721
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
const addButtonAttribute = () => {
const btnClass = "vimium_button";
const itemList = document.querySelectorAll("[class*=item]");
let isChildrenClickable = false;
Array.from(itemList).forEach(element => {
const children = element.children;
Array.from(children).forEach(child => {
const grandchildren = child.children;
Array.from(grandchildren).forEach(grandchild => {
grandchild.classList.add(btnClass)
isChildrenClickable = true;
});
if(!isChildrenClickable)
child.classList.add(btnClass);
isChildrenClickable = true;
});
if(!isChildrenClickable)
element.classList.add(btnClass);
isChildrenClickable = true;
});
};
document.addEventListener('keydown', addButtonAttribute, true);
document.addEventListener('click', addButtonAttribute);
window.onload = () => {setTimeout(addButtonAttribute, 5000);};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment