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 res = tel.innerHTML;
  23.  
  24. var a = document.createElement('a');
  25. a.href = 'data:text/html;charset=utf-8,' + res;
  26. a.download = 'file1.html';
  27. a.style.background = 'red';
  28. a.innerHTML = 'Нажми меня!';
  29.  
  30. var child = document.querySelector('.b-breadcrumbs');
  31. var parent = child.parentNode;
  32. parent.insertBefore(a, child);
  33.  
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 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);