o9s
is a microblog
home archives search feed blogroll


Re-Add The View Image Button On Google Image

Google Image removed the View Image” button recently.

The intention seems to be either stopping people from taking an image altogether or driving them through to the website where the image is found, so that the website can serve ads and get revenue and so people are more likely to see any associated copyright information. That’s great news for publishers, but it’s an annoying additional step for someone trying to find a picture.”

- Jacob Kastrenakes on The Verge

Here’s a tamperscript to re-add it. The instructions below are for Firefox.

  1. Install the Tampermonkey Firefox add-on.
  2. Click on Tampermonkey’s icon in the top right corner and click on Create new script…”.
  3. Copy the code below in the editor.
// ==UserScript==
// @name         Google View Image Button
// @version      0.1
// @description  brings back view image button
// @author       msc
// @include      /^https?:\/\/(www\.)?google\..*?\/search.*?tbm=isch.*?$/
// ==/UserScript==

window.onload = (e) => {
  var lists = document.getElementsByClassName("irc_but_r");
  for ( var i = 0; i < lists.length; i++ )
  {
    var list = document.getElementsByClassName("irc_but_r")[i].children[0].children[0];
    var clone = list.children[2].cloneNode(true);

    var link = clone.children[0];
    link.children[0].textContent = "View Image";
    link.removeAttribute("jsaction");
    link.removeAttribute("jsl");
    link.removeAttribute("data-ved");
    link.removeAttribute("role");
    link.removeAttribute("data-rtid");

    link.href = "javascript:(function(){window.open(document.getElementsByClassName('irc_mi')["+i+"].src,'_blank');})();";

    list.insertBefore(clone, list.children[1]);
  }
};
  1. Go to File and click on Save.

Thanks to MSC for the script.

Posted on 2018-03-14   #javascript  






← Next post    ·    Previous post →