Log in/out of Gmail chat programmatically, clicking Gmail's span "links"
Posted
by endolith
on Stack Overflow
See other posts from Stack Overflow
or by endolith
Published on 2009-07-23T16:53:36Z
Indexed on
2010/03/14
3:25 UTC
Read the original article
Hit count: 820
At work, I use Gmail's chat, since it's encrypted and logs chats without installing or saving anything to the hard drive. At home, I use Pidgin. When I log into GMail at home, I have to log out of chat, or messages will end up in the wrong place. When I log into GMail at work, I have to log back in to chat.
In other words, when I start Firefox at home, I want Gmail's chat disabled automatically. When I start Firefox at work, I want Gmail's chat enabled automatically.
Is there a way to use a Greasemonkey script or similar to force logging in and logging out on specific machines? It would seem simple enough; just follow a URL or simulate clicking a link. Unfortunately, Gmail doesn't use actual links.
While logged out:
<span tabindex="0" role="link" action="si" class="az9OKd">Sign into chat</span>
While logged in, in drop-down menu:
<div tabindex="-1" id=":1mj" role="menuitem" class="oA" value="si"><div class="uQ c6"/>Sign into chat</div>
<div tabindex="-1" id=":8f" role="menuitem" class="oA" value="sia"><div class="uQ c5"/>Sign into AIM®</div>
<div tabindex="-1" id=":8e" role="menuitem" class="oA" value="so"><div class="uQ df"/>Sign out of chat</div>
At bottom of page:
<span id=":im" class="l8 ou" tabindex="0" role="link">turn off chat</span>
<span id=":im" class="l8 ou" tabindex="0" role="link">turn on chat</span>
Anyone know how to "click" these non-links with JavaScript or access their functions? I would imagine that "so" means "sign out", "si" means "sign in", and "sia" means "sign in AIM". Can I somehow call these actions directly?
Is there some other alternative for disabling chat?
© Stack Overflow or respective owner