- Oct 9, 2002
- 28,298
- 1,236
- 136
I've recently started using Gmail to handle my work email because I need to be able to filter and sort messages with labels and sub-labels in order to manage everything.
I see the "Invite to Gmail" link almost every time I reply to someone, and I think it might get clicked accidentally someday. Using the Chrome "Inspect Element" option, I see there's a <span> with an ID of "link_invite" and has the "Invite to Gmail" option within the <span> tags. I wrote a script that, I think, should hide the span:
I've only tried this script with Google Chrome. For some reason, it doesn't work. If you are a userscript guru, can you tell me why this doesn't seem to have any effect?
Thanks!
[edit]
I'm guessing the "span" object doesn't exist when the script is run on page load, but is created sometime after the page loads. I guess I need to make it so my script adds an event handler to be executed any time an object is added to the page. When an object with ID "link_invite" is added to the page, it's visibility would be suppressed.
I'll probably fail at figuring this out on my own, but I'll try...
I see the "Invite to Gmail" link almost every time I reply to someone, and I think it might get clicked accidentally someday. Using the Chrome "Inspect Element" option, I see there's a <span> with an ID of "link_invite" and has the "Invite to Gmail" option within the <span> tags. I wrote a script that, I think, should hide the span:
Code:
// ==UserScript==
// @include https://*.google.com/*
// ==/UserScript==
document.getElementById("link_invite").style = "display:none";
I've only tried this script with Google Chrome. For some reason, it doesn't work. If you are a userscript guru, can you tell me why this doesn't seem to have any effect?
Thanks!
[edit]
I'm guessing the "span" object doesn't exist when the script is run on page load, but is created sometime after the page loads. I guess I need to make it so my script adds an event handler to be executed any time an object is added to the page. When an object with ID "link_invite" is added to the page, it's visibility would be suppressed.
I'll probably fail at figuring this out on my own, but I'll try...
Last edited:
