This site uses cookies to deliver the best possible experience. Learn more.

How to add a "like" keyboard shortcut

There used to be a feature on the site that allowed you to like a photo by pressing the L button on your keyboard. Here's a quick javascript snippet to restore that functionality:

document.addEventListener("keypress", function(e) {
    if (e.keyCode == 108) { // Pressed L
        var love_links = document.getElementsByClassName("lightbox__footer-like");
        if (love_links.length) {
            var evt = document.createEvent("HTMLEvents");
            evt.initEvent("click", true, true );
            love_links[0].dispatchEvent(evt);
        }
    }
});

To run the code whenever tookapic is loaded, use a browser extension (such as Custom JavaScript for Websites for Chrome) that will run custom javascript on websites.

4 comments

Paweł Kadysz Thanks for pointing that out. We'l bring that back in one of the future update.

Paweł Kadysz Actually. It should be working now :P

Marcin Chęciński That's actually good to know. Instead of searching for the heart we can enjoy looking at the pics for few more seconds.

Ian Prince Yes good to know! Would be cool if there were next/previous keyboard shortcuts after navigating to a photo on tookapic.com ;)