Adrià Vilanova MartÃnez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 1 | // Escapes username from HTML generated by the Community Console. |
| 2 | export function escapeUsername(username) { |
| 3 | var quoteRegex = /"/g; |
| 4 | var commentRegex = /<!---->/g; |
| 5 | return username.replace(quoteRegex, '\\"').replace(commentRegex, ''); |
| 6 | } |
| 7 | |
| 8 | // Retrieves authuser from the data-startup attribute. |
| 9 | export function getAuthUser() { |
| 10 | var startup = |
| 11 | JSON.parse(document.querySelector('html').getAttribute('data-startup')); |
| 12 | return startup?.[2]?.[1] || '0'; |
| 13 | } |