I have a simple Greasemonkey script here:
// Replace lines breaks in table cells
// ######################################
function newlinesToBreaks (string) {
return string.split('\n').map(function (str) {
return str.trim()
}).join('<br>')
}
var cells = document.querySelectorAll('td.listBodyCell');
for (var i = 0, il = cells.length; i < il; i++) {
cell = cells[i]
cell.innerHTML = newlinesToBreaks(cell.innerHTML)
}
It replaces line breaks with <br>
tags so that the formatting on the web page is displayed correctly.
It works fine when the whole page loads.
The web page displays a list of updates made to a call. When there are more than 20 updates, there is a "next" icon, and more updates can be loaded, via XMLHttpRequest.
The response delivered by that call is in JSON format.
And the output of that does not trigger the GM script, presumably because the entire page is not refreshed.
Is there any way around this or is it a limitation of loading content via XMLHttpRequest?