blob: 718603790904e033cc636c6ad5672a4ffe90c437 [file] [log] [blame]
avm999634c1a6792020-08-31 21:30:42 +02001function injectStylesheet(stylesheetName) {
2 var link = document.createElement('link');
3 link.setAttribute('rel', 'stylesheet');
4 link.setAttribute('href', stylesheetName);
5 document.head.appendChild(link);
6}
7
8function injectStyles(css) {
9 injectStylesheet('data:text/css;charset=UTF-8,' + encodeURIComponent(css));
10}
11
12function injectScript(scriptName) {
13 var script = document.createElement('script');
14 script.src = scriptName;
15 document.head.appendChild(script);
16}
avm99963943b8492020-08-31 23:40:43 +020017
18function escapeUsername(username) {
19 var quoteRegex = /"/g;
20 var commentRegex = /<!---->/g;
21 return username.replace(quoteRegex, '\\"').replace(commentRegex, '');
22}