// ==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);
Standard input is empty
// ==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);