Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show image dimensions again #211

Open
terrorist96 opened this issue Mar 22, 2020 · 4 comments
Open

Show image dimensions again #211

terrorist96 opened this issue Mar 22, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@terrorist96
Copy link

terrorist96 commented Mar 22, 2020

Is your feature request related to a problem? Please describe.
Google previously used to allow you to show the image dimensions in the Tools menu. That went away but you could still hover your mouse over each image to see the dimensions. Now that is gone too.

Describe the solution you'd like
Please add an option to show image sizes like before.

Describe alternatives you've considered
The only alternative now is to actually click on each individual image then hover your mouse over the image in the panel on the right.

Additional context
https://ww.9to5google.com/2020/02/25/google-images-dimensions/

@needforsuv
Copy link

Google Images Restore already shows the hover dimensions, but it includes other changes not wanted

I am not quite good enough to cut the bit out that's needed for it

@mikhoul
Copy link

mikhoul commented Apr 10, 2020

@needforsuv commented on 27 mars 2020 à 07:35 UTC−4:

Google Images Restore already shows the hover dimensions, but it includes other changes not wanted

I am not quite good enough to cut the bit out that's needed for it

Look here I've isolated this part of the extension:, my last comment explain how to do it: https://github.com/fanfare/googleimagesrestored/issues/49

Yhe only thing it does now is that it bring back image size by default so you don't have to hover the image and also it don't conflict with other extensions.

It's a dirty hack but it work fine.
googleimagesrestored-master.zip

Just rename the .zip to .CRX.

@bijij bijij added the enhancement New feature or request label Apr 24, 2020
@needforsuv
Copy link

I too have figured it out:

Main results:

// ==UserScript==
// @name        Google Images Size Labels
// @namespace   http://localhost
// @description Adds image size labels to broken google images
// @version     1.0
// @include     http*://*.google.tld/search*tbm=isch*
// @include     http*://*.google.tld/*imgres?*
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
// @grant    GM_addStyle
// ==/UserScript==


let gisversion = 1;

if ( document.querySelectorAll(`div[data-ri="0"]`).length > 0   && document.querySelectorAll(`[jscontroller="Q7Rsec"]`).length === 0 ) {
  gisversion = 2;
}

console.log(`frontend gisversion ${gisversion}`);

var jscontroller = "Q7Rsec";
try {
  jscontroller = document.querySelectorAll(`div[data-ri="0"]`)[0].getAttribute("jscontroller");
}
catch(e) {
  
}

// mutationobserver --

// new jscontroller elements to append size stats

let lastthumbcount = 0;

function propagatesizeinfo() {
  
  let jscontrollercount = document.querySelectorAll(`div[jscontroller="${jscontroller}"]`).length;
  if (jscontrollercount === lastthumbcount) {
    // nothing to do
    return;
  }
  else {
    lastthumbcount = document.querySelectorAll(`div[jscontroller="${jscontroller}"]`).length;
  }
  // loop through each that dont have it
  let notmarked = document.querySelectorAll(`div[jscontroller="${jscontroller}"]:not(.sizepropagated)`);
  for (let i=0;i<notmarked.length;i++) {
    try {
      notmarked[i].classList.add("sizepropagated");
      let gisow = notmarked[i].dataset.ow || 0;
      let gisoh = notmarked[i].dataset.oh || 0;
      notmarked[i].insertAdjacentHTML("beforeend", `<div class="gishoverinfo">${gisow} × ${gisoh}</div>`);
    }
    catch(e) {
      if (gisdebugmode) {
        console.error(e);
      }
    }
  }
  //console.log(notmarked)
}

propagatesizeinfo();

var observer = new MutationObserver(function(mutations) {
  setTimeout(()=>{propagatesizeinfo(),500});
  
});

observer.observe(document.getElementById("islrg"), {attributes: false, childList: true, characterData: false, subtree:true});


related results

// ==UserScript==
// @name        Related images Size (Oct 19)
// @namespace   http://localhost
// @description Adds image size to broken related images
// @version     1.0
// @include     http*://*.google.tld/search*tbm=isch*
// @include     http*://*.google.tld/*imgres?*
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
// @require  https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant    GM_addStyle
// ==/UserScript==


waitForKeyElements (".l7VXJc.pZqGvd", actionFunctiongisrelsize);

function actionFunctiongisrelsize () {
    var gisdebugmode = false;

  let notmarked = document.querySelectorAll(`div.isv-r.jdp5U:not(.sizepropagated)`);
  for (let i=0;i<notmarked.length;i++) {
    try {
      notmarked[i].classList.add("sizepropagated");
      let gisow = notmarked[i].dataset.ow || 0;
      let gisoh = notmarked[i].dataset.oh || 0;
      notmarked[i].insertAdjacentHTML("beforeend", `<div class="gishoverinfo">${gisow} × ${gisoh}</div>`);
    }
    catch(e) {
      if (gisdebugmode) {
        console.error(e);
      }
    }
  }
    
    

}


@needforsuv
Copy link

you could probably tidy that up so it is all internally contained

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants