Skip to content

Instantly share code, notes, and snippets.

@ahgood
Created January 13, 2020 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahgood/a2c293678ad22af7284c404e551ac63f to your computer and use it in GitHub Desktop.
Save ahgood/a2c293678ad22af7284c404e551ac63f to your computer and use it in GitHub Desktop.
Goolge Actions Simulator Helper
// step 1, edit the code:
document.querySelector('.f8r-title').append('🎩');
setInterval(() => {
const cards = document.querySelectorAll("MD-CARD-CONTENT");
cards.forEach((card) => {
if (card.querySelector("img") === null && card.querySelector("a.say") === null) {
const sayTag = document.createElement("a");
sayTag.className = "say";
sayTag.textContent = "Say";
sayTag.style.cssText = "display: inline-block; margin-right: 10px; color: #999; text-decoration: none;";
card.prepend(sayTag);
}
});
}, 100);
document.addEventListener("click", function (e) {
e.preventDefault();
if (e.target.className === "say") {
const input = document.querySelector("#query-input");
input.value = e.target.nextElementSibling.textContent.trim();
input.focus();
}
});
/*
step 2: minify the code:https://javascript-minifier.com/
step 3: replace <minified_code> with minified code below and copy:
javascript:<minified_code>void(0);
step 4: create bookmark in browser, replace "URL/Address" with the code you, "Name": Gsimulator Helper, or whatever name you want.
Here is a ready to use code:
Gsimulator Helper
javascript:document.querySelector(".f8r-title").append("🎩"),setInterval(()=>{document.querySelectorAll("MD-CARD-CONTENT").forEach(e=>{if(null===e.querySelector("img")&&null===e.querySelector("a.say")){const t=document.createElement("a");t.className="say",t.textContent="Say",t.style.cssText="display: inline-block; margin-right: 10px; color: #999; text-decoration: none;",e.prepend(t)}})},100),document.addEventListener("click",function(e){if(e.preventDefault(),"say"===e.target.className){const t=document.querySelector("#query-input");t.value=e.target.nextElementSibling.textContent.trim(),t.focus()}});void(0);
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment