forked from hugsy/ctfhub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchallenge.js
28 lines (24 loc) · 959 Bytes
/
challenge.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
window.addEventListener('DOMContentLoaded', (event) => {
var formatSelect = document.getElementById('id_format');
var dataTextArea = document.getElementById('id_data');
formatSelect.addEventListener('change', function () {
var selectedFormat = this.value;
var placeholderText;
switch (selectedFormat) {
case 'RAW':
placeholderText = 'name | category';
break;
case 'CTFd':
placeholderText = 'paste CTFd JSON /api/v1/challenges';
break;
case 'rCTF':
placeholderText = 'paste rCTF JSON /api/v1/challs';
break;
default:
placeholderText = '';
}
dataTextArea.setAttribute('placeholder', placeholderText);
});
// Trigger the change event on page load to set initial placeholder
formatSelect.dispatchEvent(new Event('change'));
});