ora 8 9
This commit is contained in:
17
ora8/webtechnologies/script.js
Normal file
17
ora8/webtechnologies/script.js
Normal file
@@ -0,0 +1,17 @@
|
||||
function wrapTextLinesInSpan(element){
|
||||
const lines = element.textContent.split('\n').filter(Boolean);
|
||||
element.textContent = '';
|
||||
|
||||
for (let index = 0; index < lines.length; index++) {
|
||||
const span = document.createElement('span');
|
||||
span.className = 'line';
|
||||
span.textContent = lines[index];
|
||||
element.appendChild(span);
|
||||
|
||||
if(index < lines.length - 1){
|
||||
element.appendChild(document.createTextNode('\n'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.querySelectorAll('pre.number-lines').forEach(wrapTextLinesInSpan);
|
||||
Reference in New Issue
Block a user