Ebay-Kleinanzeigen Enlarged search results image on hover

Adds a hoverfunction to the search results list that enlarges the main Item image

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Ebay-Kleinanzeigen Enlarged search results image on hover
// @name:de      Ebay-Kleinanzeigen Bildervorschau in den Suchergebnissen per mouse over
// @description  Adds a hoverfunction to the search results list that enlarges the main Item image
// @description:de Ebay-Kleinanzeigen Bildervorschau in den Suchergebnissen 
// @version      0.12
// @grant        none
// @icon         http://www.google.com/s2/favicons?domain=www.ebay-kleinanzeigen.de
// @license      MIT
// @include      https://www.ebay-kleinanzeigen.de/*

// @namespace https://greasyfork.org/users/740728
// ==/UserScript==

(function () {

  function addGlobalStyle(css) {
      var head, style;
      head = document.getElementsByTagName('head')[0];
      if (!head) { return; }
      style = document.createElement('style');
      style.type = 'text/css';
      style.innerHTML = css;
      head.appendChild(style);
  }  

  addGlobalStyle('.srpimagebox:hover + .preview { display:block; ! important; }');
  addGlobalStyle('.preview{display:none;height:400px;position:absolute;left:120px;top:0px;z-index:999;}');
    
var elements = document.querySelectorAll('.srpimagebox:not(.is-nopic)');
  elements.forEach(function(element, index) {
      item_img_url = element.getAttribute("data-imgsrcretina");
      item_img = item_img_url.substring(0,item_img_url.length-9) + "59.JPG";
      var img = document.createElement("img");
      img.setAttribute('src', item_img);
      img.setAttribute('class', "preview");
      var el = element.insertAdjacentElement("afterend",img);
  });  
  

})();