(str)
| 263 | |
| 264 | // https://stackoverflow.com/a/23329386 |
| 265 | function byteLength(str) { |
| 266 | // returns the byte length of an utf8 string |
| 267 | var s = str.length; |
| 268 | for (var i = str.length - 1; i >= 0; i--) { |
| 269 | var code = str.charCodeAt(i); |
| 270 | if (code > 0x7f && code <= 0x7ff) s++; |
| 271 | else if (code > 0x7ff && code <= 0xffff) s += 2; |
| 272 | if (code >= 0xdc00 && code <= 0xdfff) i--; //trail surrogate |
| 273 | } |
| 274 | return s; |
| 275 | } |
| 276 | |
| 277 | try { |
| 278 | let text = document.body.innerText; |