// ==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);
Ly8gPT1Vc2VyU2NyaXB0PT0KLy8gQGluY2x1ZGUgL2h0dHA6Ly9tYXJrZXRcLnlhbmRleFwucnUvbW9kZWwtc3BlY1wueG1sXD9tb2RlbGlkPVxkKyZoaWQ9XGQrLwovLyBAZ3JhbnQgICAgICAgbm9uZQovLyA9PS9Vc2VyU2NyaXB0PT0KdmFyIHRlbCA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoJy5sLXBhZ2VfX2xlZnQnKTsKCnZhciBkaXYgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKTsKZGl2LmNsYXNzTmFtZSA9ICd0b3Z0YWJsZSc7CgoKdmFyIHRhYmxlID0gdGVsLnF1ZXJ5U2VsZWN0b3IoJy5iLXByb3BlcnRpZXMnKTsKdGFibGUucmVtb3ZlQXR0cmlidXRlKCd4bWxuczpsZWdvJyk7CnRhYmxlLnJlbW92ZUF0dHJpYnV0ZSgnY2xhc3MnKTsKdmFyIHAgPSB0ZWwucXVlcnlTZWxlY3RvcignLmItbW9kZWxzcGVjX19ub3RlJyk7CnAucmVtb3ZlQXR0cmlidXRlKCd4bWxuczpsZWdvJyk7CnAucmVtb3ZlQXR0cmlidXRlKCdjbGFzcycpOwoKdGFibGUucG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