Φανάρια diederichs Angel Eyes για BMW ΣΕΙΡΑ 1 E81/E82/E87/E88 09.04+ ANGELEYES CHROME Τα φανάρια Angel Eyes της /
wrapper (editor markup) */
var lead = function (li) {
var n = first(li);
while (n && n.nodeType === 1 && WRAP.test(n.tagName)) { n = first(n); }
return n;
};
var BOLD = /^(STRONG|B)$/;
/* consecutive bold pieces count as one ("Συνολικό βάρος:") */
var boldRun = function (n) {
var run = [];
while (n) {
if (n.nodeType === 1 && BOLD.test(n.tagName)) { run.push(n); }
else if (!(n.nodeType === 3 && !n.textContent.trim())) { break; }
n = n.nextSibling;
}
return run;
};
var spec = items.every(function (li) {
var run = boldRun(lead(li));
return run.length && /:\s*$/.test(run.map(function (b) { return b.textContent; }).join(''));
});
if (!spec) { return; }
/* unwrap so "Name:" and the value are direct children (the table is a CSS grid on the
) */
items.forEach(function (li) {
var n = first(li);
while (n && n.nodeType === 1 && WRAP.test(n.tagName)) {
while (n.firstChild) { li.insertBefore(n.firstChild, n); }
li.removeChild(n);
n = first(li);
}
var run = boldRun(first(li));
for (var i = 1; i < run.length; i++) {
while (run[i].firstChild) { run[0].appendChild(run[i].firstChild); }
var gap = run[0].nextSibling;
while (gap && gap !== run[i]) { var nx = gap.nextSibling; li.removeChild(gap); gap = nx; }
li.removeChild(run[i]);
}
});
ul.classList.add('pdp-spec-list');
});
/* a paragraph that is all bold text is a sub-heading (one style for every product) */
document.querySelectorAll('#pdp-pane-description p').forEach(function (p) {
var t = p.textContent.replace(/\s+/g, '');
if (!t || t.length > 90) { return; }
var b = '';
p.querySelectorAll('strong, b').forEach(function (s) { if (!s.closest('strong strong, b b')) { b += s.textContent; } });
if (b.replace(/\s+/g, '') === t) { p.classList.add('pdp-subhead'); }
});
/* the spec table(s) get their own tab next to the description */
var lists = document.querySelectorAll('#pdp-pane-description ul.pdp-spec-list');
var nav = document.querySelector('.pdp-info-tabs__nav');
var content = document.querySelector('.pdp-info-tabs__content');
if (lists.length && nav && content && !document.getElementById('pdp-pane-specs')) {
var li = document.createElement('li');
li.className = 'nav-item';
li.setAttribute('role', 'presentation');
li.innerHTML = '';
nav.appendChild(li);
var pane = document.createElement('div');
pane.className = 'tab-pane fade pdp-info-pane';
pane.id = 'pdp-pane-specs-auto';
pane.setAttribute('role', 'tabpanel');
content.appendChild(pane);
lists.forEach(function (ul) {
var prev = ul.previousElementSibling;
if (prev && prev.textContent.length < 60 && /χαρακτηριστικ/i.test(prev.textContent)) { prev.parentNode.removeChild(prev); }
pane.appendChild(ul);
});
}
})();