| 29 | } |
| 30 | |
| 31 | function blockText(block, ignoreNewLines) { |
| 32 | var result = ''; |
| 33 | for (var i = 0; i < block.childNodes.length; i++) |
| 34 | if (block.childNodes[i].nodeType == 3) { |
| 35 | var chunk = block.childNodes[i].nodeValue; |
| 36 | if (ignoreNewLines) |
| 37 | chunk = chunk.replace(/\n/g, ''); |
| 38 | result += chunk; |
| 39 | } else if (block.childNodes[i].nodeName == 'BR') |
| 40 | result += '\n'; |
| 41 | else |
| 42 | result += blockText(block.childNodes[i]); |
| 43 | // Thank you, MSIE... |
| 44 | if (/MSIE [678]/.test(navigator.userAgent)) |
| 45 | result = result.replace(/\r/g, '\n'); |
| 46 | return result; |
| 47 | } |
| 48 | |
| 49 | function blockLanguage(block) { |
| 50 | var classes = block.className.split(/\s+/) |