Skip to content Skip to sidebar Skip to footer

Bookmarklet In Javascript To Toggle Gmail Conversation View

I want a bookmarklet to quickly toggle the Gmail conversation view on and off. Starting from @seahorsepip's solution, I have: javascript:window.location.href = 'https://mail.google

Solution 1:

You could simply add a condition to your bookmarklet, checking if

document.querySelector("div.AOtabletbodytr:nth-child(8) table:nth-of-type(2) input").checked

isn't null:

window.location.href = "https://mail.google.com" + window.location.pathname + "#settings/general";
sBase = "div.AO table tbody tr:nth-child(8) table:nth-of-type(";
sOn = sBase + "1) input";
sOff = sBase + "2) input";

setTimeout(function(){
    if (document.querySelector(sOff).checked)
        document.querySelector(sOn).click();
    elsedocument.querySelector(sOff).click();
    document.querySelector("[guidedhelpid=save_changes_button]").click();
}, 1000);

Giving:

javascript:window.location.href="https://mail.google.com"+window.location.pathname+"#settings/general";sBase="div.AO table tbody tr:nth-child(8) table:nth-of-type(";sOn=sBase+"1) input";sOff=sBase+"2) input";setTimeout(function(){if(document.querySelector(sOff).checked) document.querySelector(sOn).click();elsedocument.querySelector(sOff).click();document.querySelector("[guidedhelpid=save_changes_button]").click()},1000)

Post a Comment for "Bookmarklet In Javascript To Toggle Gmail Conversation View"