SHARE
TWEET

Untitled

a guest May 23rd, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var informationContainer = document.getElementsByClassName("informationContainer");
  2.  
  3. Array.prototype.forEach.call(informationContainer, function(el) {
  4.  
  5. var contentbox=el.innerHTML;
  6.  
  7. try{
  8.  
  9. var ahorro=contentbox.split("Ahorro: USD");
  10.  
  11. ahorro=ahorro[1].split(" ");
  12.  
  13. //ahorro=ahorro[0].replace(".","").trim();
  14.  
  15. //ahorro=ahorro.replace(",",".");
  16.  
  17. var Antes=contentbox.split('Antes:&nbsp;<span class="line-through">');
  18.  
  19. if(Antes[1]==undefined)Antes=contentbox.split('Precio:USD');
  20.  
  21. Antes=Antes[1].split("&nbsp;");
  22.  
  23. //Antes=Antes[0].replace(".","");
  24.  
  25. Antes=Antes.replace(",",".");
  26.  
  27. Antes=Antes.replace("USD","").trim();
  28.  
  29. var Descuento_porc=Math.round(ahorro/Antes*100);
  30.  
  31. if(ahorro!='')el.innerHTML='<div id="flag" style="position:absolute;top:0;right:0;z-index:1;overflow:hidden;width:70px;height:70px"><span style="font-size:12px;font-weight:700;color:#FFF;text-transform:uppercase;text-align:center;line-height:25px;width:100px;display:block;background:#e4022d ;box-shadow:0 1px 8px -5px rgba(0,0,0,1);padding-right:30px">'+Descuento_porc+'% OFF</span></div>'+el.innerHTML;
  32.  
  33. }
  34.  
  35. catch(err) {
  36.  
  37. }
  38.  
  39. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top