Skip to content

Commit

Permalink
Convert volleyball script to multi-line string.
Browse files Browse the repository at this point in the history
  • Loading branch information
VarunBarad committed Dec 21, 2024
1 parent 0074f09 commit 42000d2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/insertVolleyball.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
const stringToInsert = '<script>' +
'window.addEventListener("message", (event) => {' +
' if (!!window.parent && !!event.data.codeCommand) {' +
' window.parent.postMessage(event.data, "*");' +
' }' +
'});' +
'</script>';

let input = '';

// Listen for data events on stdin
Expand All @@ -8,6 +16,6 @@ process.stdin.on('data', (chunk) => {
// Listen for the end of the input stream
process.stdin.on('end', () => {
const lines = input.split('\n');
lines.splice(lines.length - 4, 0, '<script>window.addEventListener(\'message\', (event) => { if (!!window.parent && !!event.data.codeCommand) { window.parent.postMessage(event.data, \'*\'); } });</script>');
lines.splice(lines.length - 4, 0, stringToInsert);
console.log(lines.join('\n'));
});

0 comments on commit 42000d2

Please sign in to comment.