[GM] Google Books OverlayRemover (RightClick+SaveImage) (listed) 03.09.2019 10:19:36 (54 lines) [Edit] [Raw] [View]

// ==UserScript== // @name Google Books OverlayRemover (RightClick+SaveImage) // @version 1 // @grant none // @include ://books.google./* // ==/UserScript==

let scannerSuccess = false;

let counter = document.createElement("DIV"); counter.innerText = "0"; counter.style = "position: absolute; bottom: 0; left: 0; background: #ffffff; padding: 0 5px; border-top: 1px solid #e0e0e0; border-right: 1px solid #e0e0e0; border-top-right-radius: 5px;";

let scanInterval = setInterval(function(){ var pageDisplays = document.getElementsByClassName("pageImageDisplay");

if(pageDisplays.length > 0) {

if(scannerSuccess == false){
  let searchHeader = document.getElementById("gb");
  if(searchHeader != null && searchHeader.children.length > 0){
    searchHeader.children[0].style.background = "#d0f1d0";
  }
  document.body.appendChild(counter);
  scannerSuccess = true;
}

for (let i = 0; i < pageDisplays.length; i++) {
  let page = pageDisplays[i];
  let views = page.children;
  let pageModified = false;
  for (let j = 0; j < views.length; j++) {
    let view = views[j];
    if(view.tagName.toLowerCase() != "div")
      continue;
    if(view.modified === true)
      continue;
    if (view.style.width != null && parseInt(view.style.width) > 1) {
      if (view.children.length == 0 || view.children[0].tagName.toLowerCase() != "img") {
        view.style.display = "none";
        view.modified = true;
        pageModified = true;
      }
    }
  }
  if(pageModified){
    counter.innerText = parseInt(counter.innerText) + 1;
  }
}
}

}, 500); console.log("Scanner running (interval id:" + scanInterval + ")");