Greasy Fork is available in English.

Replace eBay description iframe with xmlhttpRequest

Removes the iframe under "Item description from the seller" and Replaces it with html from xmlhttpRequest

  1. // ==UserScript==
  2. // @name Replace eBay description iframe with xmlhttpRequest
  3. // @namespace dd
  4. // @match https://www.ebay.com/itm/*
  5. // @grant GM_xmlhttpRequest
  6. // @version 1.0
  7. // @author DD3R
  8. // @license MIT
  9. // @description Removes the iframe under "Item description from the seller" and Replaces it with html from xmlhttpRequest
  10. // ==/UserScript==
  11.  
  12. let iframe = document.querySelector("#desc_ifr");
  13.  
  14. let descriptionDiv = document.createElement("div");
  15. descriptionDiv.id = "itemDescription";
  16. descriptionDiv.setAttribute("original-url", iframe.src);
  17.  
  18. GM_xmlhttpRequest({
  19. method: 'GET',
  20. url: iframe.src,
  21. onload: function (response) {
  22. if (response.status >= 200 && response.status < 400) {
  23. let htmlString = response.responseText;
  24. let parser = new DOMParser();
  25. let doc = parser.parseFromString(htmlString, 'text/html');
  26. descriptionDiv.innerHTML = doc.documentElement.querySelector(".x-item-description-child").outerHTML;
  27. } else {
  28. console.error('Failed to fetch the document');
  29. }
  30. },
  31. onerror: function (error) {
  32. console.error('Error fetching the document:', error);
  33. }
  34. });
  35.  
  36. iframe.parentNode.replaceChild(descriptionDiv, iframe);