fork download
  1. // ==UserScript==
  2. // @include /http://market\.yandex\.ru/model-spec\.xml\?modelid=\d+&hid=\d+/
  3. // @grant none
  4. // ==/UserScript==
  5. var tel = document.querySelector('.l-page__left');
  6.  
  7. var div = document.createElement('div');
  8. div.className = 'tovtable';
  9.  
  10.  
  11. var table = tel.querySelector('.b-properties');
  12. table.removeAttribute('xmlns:lego');
  13. table.removeAttribute('class');
  14. var p = tel.querySelector('.b-modelspec__note');
  15. p.removeAttribute('xmlns:lego');
  16. p.removeAttribute('class');
  17.  
  18. table.parentNode.insertBefore(div, table);
  19.  
  20. div.appendChild(table);
  21.  
  22. var trs = div.getElementsByTagName('tr');
  23.  
  24. var td,
  25. inner,
  26. inner2;
  27.  
  28. var lastStr = '<td style="border-bottom: 2px dotted rgb(3,63,29)" width="280px">';
  29.  
  30. for (var i = 0; i < trs.length; i++) {
  31. if (trs[i].childNodes.length == 1) {
  32. inner = trs[i].childNodes[0].innerHTML;
  33. trs[i].innerHTML = '<td height="40" colspan="2"><strong>'+inner+'</strong></td></tr>'
  34. } else {
  35. inner = trs[i].childNodes[0].innerHTML;
  36. trs[i].removeChild(trs[i].childNodes[0]);
  37. inner2 = trs[i].childNodes[0].innerHTML;
  38. trs[i].removeChild(trs[i].childNodes[0]);
  39. trs[i].innerHTML = lastStr+inner+'</td>'+'<td>'+inner2+'</td>';
  40. }
  41. }
  42.  
  43. var res = tel.innerHTML;
  44.  
  45. var a = document.createElement('a');
  46. a.href = 'data:text/html;charset=utf-8,' + res;
  47. a.download = 'file1.html';
  48. a.style.background = 'red';
  49. a.innerHTML = 'Нажми меня!';
  50.  
  51. var child = document.querySelector('.b-breadcrumbs');
  52. var parent = child.parentNode;
  53. parent.insertBefore(a, child);
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
// ==UserScript==
// @include /http://market\.yandex\.ru/model-spec\.xml\?modelid=\d+&hid=\d+/
// @grant none
// ==/UserScript==
var tel = document.querySelector('.l-page__left');

var div = document.createElement('div');
div.className = 'tovtable';


var table = tel.querySelector('.b-properties');
table.removeAttribute('xmlns:lego');
table.removeAttribute('class');
var p = tel.querySelector('.b-modelspec__note');
p.removeAttribute('xmlns:lego');
p.removeAttribute('class');

table.parentNode.insertBefore(div, table);

div.appendChild(table);

var trs = div.getElementsByTagName('tr');

var td,
inner,
inner2;

var lastStr = '<td style="border-bottom: 2px dotted rgb(3,63,29)" width="280px">';

for (var i = 0; i < trs.length; i++) {
if (trs[i].childNodes.length == 1) {
inner = trs[i].childNodes[0].innerHTML;
trs[i].innerHTML = '<td height="40" colspan="2"><strong>'+inner+'</strong></td></tr>'
} else {
inner = trs[i].childNodes[0].innerHTML;
trs[i].removeChild(trs[i].childNodes[0]);
inner2 = trs[i].childNodes[0].innerHTML;
trs[i].removeChild(trs[i].childNodes[0]);
trs[i].innerHTML = lastStr+inner+'</td>'+'<td>'+inner2+'</td>';
}
}

var res = tel.innerHTML;

var a = document.createElement('a');
a.href = 'data:text/html;charset=utf-8,' + res;
a.download = 'file1.html';
a.style.background = 'red';
a.innerHTML = 'Нажми меня!';

var child = document.querySelector('.b-breadcrumbs');
var parent = child.parentNode;
parent.insertBefore(a, child);