JavaScript Ninja - eBay Page Fix - Cleanup And Main Description

Posted at

eBay sellers place a lot of junk-links for their store,
and one single description area which is usually hard to read, or scroll due to eBay's problematic page layout.

icompile.eladkarako.com_ebay_description_fix_2

Here is some code to fix those stuff..
I've even added a bookmarklet... :]





icompile.eladkarako.com_ebay_description_fix_1

after:
icompile.eladkarako.com_ebay_description_fix_3

A huge security plus: the seller can not run malicious code on your eBay account anymore,
the description page is running using a new HTML5 property called sandbox, in which, scripts and other access stuff are blocked by default.
nothing but text! safe!

(function(window, document, ebaydesc_src, pinpoint, pinpoint_parent, new_iframe){
"use strict";

/* remove all shit other than official description */
while(null !== pinpoint.nextElementSibling){
pinpoint_parent.removeChild( pinpoint.nextElementSibling );
}

/* shit removed */

/* add new description-iframe */
pinpoint_parent.appendChild(new_iframe);
setTimeout(function(){
new_iframe.src = ebaydesc_src;
},100);

}(
top
, top.document
, top.document.querySelector('iframe[src*="ebaydesc"]:not([new_iframe])').src
, document.querySelector('.itemAttr')
, document.querySelector('.itemAttr').parentElement
, (function(tmp){
tmp = document.createElement("div");
/*
    tmp.innerHTML = '<iframe new_iframe allowfullscreen="true" frameborder="0" marginheight="0" marginwidth="0" referrerpolicy="unsafe-url" scrolling="yes" sandbox="allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation" seamless="false" style="width:100%;height:1200px;border:1px solid gray;" src="about:blank"></iframe>';
    */
tmp.innerHTML = '<iframe new_iframe allowfullscreen="true" frameborder="0" marginheight="0" marginwidth="0" referrerpolicy="no-referrer" scrolling="yes" sandbox="" seamless="false" style="width:100%;height:1200px;border:1px solid gray;" src="about:blank"></iframe>';
return tmp.querySelector("iframe").cloneNode(true);
}())
));


bookmarklet:
javascript:(function(window,document,ebaydesc_src,pinpoint,pinpoint_parent,new_iframe){while(null!==pinpoint.nextElementSibling)pinpoint_parent.removeChild(pinpoint.nextElementSibling);pinpoint_parent.appendChild(new_iframe);setTimeout(function(){new_iframe.src=ebaydesc_src},100)})(top,top.document,top.document.querySelector('iframe[src*="ebaydesc"]:not([new_iframe])').src,document.querySelector(".itemAttr"),document.querySelector(".itemAttr").parentElement,function(tmp){tmp=document.createElement("div");tmp.innerHTML='<iframe new_iframe allowfullscreen="true" frameborder="0" marginheight="0" marginwidth="0" referrerpolicy="no-referrer" scrolling="yes" sandbox="" seamless="false" style="width:100%;height:1200px;border:1px solid gray;" src="about:blank"></iframe>';return tmp.querySelector("iframe").cloneNode(true)}());





another iteration of the code adds the description frame a bit below the original placement, in-favor of a much more-clear and wide viewable area, with not much of the original layout compromised.

icompile.eladkarako.com_ebay_description_fix__2_1


icompile.eladkarako.com_ebay_description_fix__2_2

(function(window, document, ebaydesc_src, pinpoint, pinpoint_parent, new_iframe, footer){
"use strict";

/* remove all shit other than official description */
while(null !== pinpoint.nextElementSibling){
pinpoint_parent.removeChild( pinpoint.nextElementSibling );
}

/* shit removed */

/* add new description-iframe */

/*
  option #1 - just add it in same (sort of) placement.
  pinpoint_parent.appendChild(new_iframe);
  */
/*
  option #2 - a little bit below the layout enables a much larger width.
  */
footer.insertBefore(new_iframe, footer.firstChild);
new_iframe.style.display = "none";
new_iframe.onload = function(){
setTimeout(function(){
new_iframe.style.display = "block";
}, 100);
};

new_iframe.src = ebaydesc_src;

}(
top
, top.document
, top.document.querySelector('iframe[src*="ebaydesc"]:not([new_iframe])').src
, document.querySelector('.itemAttr')
, document.querySelector('.itemAttr').parentElement
, (function(tmp){
tmp = document.createElement("div");
/*
    tmp.innerHTML = '<iframe new_iframe allowfullscreen="true" frameborder="0" marginheight="0" marginwidth="0" referrerpolicy="unsafe-url" scrolling="yes" sandbox="allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation" seamless="false" style="width:100%;height:1200px;border:1px solid gray;" src="about:blank"></iframe>';
    */
tmp.innerHTML = '<iframe new_iframe allowfullscreen="true" frameborder="0" marginheight="0" marginwidth="0" referrerpolicy="no-referrer" scrolling="yes" sandbox="" seamless="false" style="width:100%;height:1200px;border:1px solid gray;" src="about:blank"></iframe>';
return tmp.querySelector("iframe").cloneNode(true);
}())
, document.querySelector('footer')
));


bookmarklet:
javascript:(function(window,document,ebaydesc_src,pinpoint,pinpoint_parent,new_iframe,footer){while(null!==pinpoint.nextElementSibling)pinpoint_parent.removeChild(pinpoint.nextElementSibling);footer.insertBefore(new_iframe,footer.firstChild);new_iframe.style.display="none";new_iframe.onload=function(){setTimeout(function(){new_iframe.style.display="block"},100)};new_iframe.src=ebaydesc_src})(top,top.document,top.document.querySelector('iframe[src*="ebaydesc"]:not([new_iframe])').src,document.querySelector(".itemAttr"),document.querySelector(".itemAttr").parentElement,function(tmp){tmp=document.createElement("div");tmp.innerHTML='<iframe new_iframe allowfullscreen="true" frameborder="0" marginheight="0" marginwidth="0" referrerpolicy="no-referrer" scrolling="yes" sandbox="" seamless="false" style="width:100%;height:1200px;border:1px solid gray;" src="about:blank"></iframe>';return tmp.querySelector("iframe").cloneNode(true)}(),document.querySelector("footer"));