Skip to content

Commit 0b20123

Browse files
committed
format js code
1 parent 873af79 commit 0b20123

File tree

4 files changed

+28
-45
lines changed

4 files changed

+28
-45
lines changed

assets/config.js

+14-13
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
if ($ === undefined) $ = CTFd.lib.$;
2+
23
function update_configs(obj) {
34
var target = "/plugins/ctfd-whale/admin/settings";
45
var method = "PATCH";
56

67
var params = {};
78

8-
Object.keys(obj).forEach(function (x) {
9+
Object.keys(obj).forEach(function(x) {
910
if (obj[x] === "true") {
1011
params[x] = true;
1112
} else if (obj[x] === "false") {
@@ -16,23 +17,23 @@ function update_configs(obj) {
1617
});
1718

1819
CTFd.fetch(target, {
19-
method: method,
20-
credentials: "same-origin",
21-
headers: {
22-
Accept: "application/json",
23-
"Content-Type": "application/json"
24-
},
25-
body: JSON.stringify(params)
26-
})
27-
.then(function (response) {
20+
method: method,
21+
credentials: "same-origin",
22+
headers: {
23+
Accept: "application/json",
24+
"Content-Type": "application/json"
25+
},
26+
body: JSON.stringify(params)
27+
})
28+
.then(function(response) {
2829
return response.json();
2930
})
30-
.then(function (data) {
31+
.then(function(data) {
3132
window.location.reload();
3233
});
3334
}
34-
$(function () {
35-
$(".config-section > form:not(.form-upload)").submit(function (e) {
35+
$(function() {
36+
$(".config-section > form:not(.form-upload)").submit(function(e) {
3637
e.preventDefault();
3738
var obj = $(this).serializeJSON();
3839
update_configs(obj);

assets/containers.js

-18
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,6 @@ function htmlentities(str) {
44
return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
55
}
66

7-
const modalTpl =
8-
'<div class="modal fade" tabindex="-1" role="dialog">' +
9-
' <div class="modal-dialog" role="document">' +
10-
' <div class="modal-content">' +
11-
' <div class="modal-header">' +
12-
' <h5 class="modal-title">{0}</h5>' +
13-
' <button type="button" class="close" data-dismiss="modal" aria-label="Close">' +
14-
' <span aria-hidden="true">&times;</span>' +
15-
" </button>" +
16-
" </div>" +
17-
' <div class="modal-body">' +
18-
" </div>" +
19-
' <div class="modal-footer">' +
20-
" </div>" +
21-
" </div>" +
22-
" </div>" +
23-
"</div>";
24-
257
$(".delete-container").click(function(e) {
268
e.preventDefault();
279
var container_id = $(this).attr("container-id");

assets/create.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
// Markdown Preview
22
if ($ === undefined) $ = CTFd.lib.$
3-
$('#desc-edit').on('shown.bs.tab', function (event) {
3+
$('#desc-edit').on('shown.bs.tab', function(event) {
44
if (event.target.hash == '#desc-preview') {
55
var editor_value = $('#desc-editor').val();
66
$(event.target.hash).html(
77
CTFd._internal.challenge.render(editor_value)
88
);
99
}
1010
});
11-
$('#new-desc-edit').on('shown.bs.tab', function (event) {
11+
$('#new-desc-edit').on('shown.bs.tab', function(event) {
1212
if (event.target.hash == '#new-desc-preview') {
1313
var editor_value = $('#new-desc-editor').val();
1414
$(event.target.hash).html(
1515
CTFd._internal.challenge.render(editor_value)
1616
);
1717
}
1818
});
19-
$("#solve-attempts-checkbox").change(function () {
19+
$("#solve-attempts-checkbox").change(function() {
2020
if (this.checked) {
2121
$('#solve-attempts-input').show();
2222
} else {
@@ -25,6 +25,6 @@ $("#solve-attempts-checkbox").change(function () {
2525
}
2626
});
2727

28-
$(document).ready(function () {
28+
$(document).ready(function() {
2929
$('[data-toggle="tooltip"]').tooltip();
30-
});
30+
});

assets/update.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
if ($ === undefined) $ = CTFd.lib.$
2-
$('#submit-key').click(function (e) {
2+
$('#submit-key').click(function(e) {
33
submitkey($('#chalid').val(), $('#answer').val())
44
});
55

6-
$('#submit-keys').click(function (e) {
6+
$('#submit-keys').click(function(e) {
77
e.preventDefault();
88
$('#update-keys').modal('hide');
99
});
1010

1111
$('#limit_max_attempts').change(function() {
12-
if(this.checked) {
12+
if (this.checked) {
1313
$('#chal-attempts-group').show();
1414
} else {
1515
$('#chal-attempts-group').hide();
@@ -18,15 +18,15 @@ $('#limit_max_attempts').change(function() {
1818
});
1919

2020
// Markdown Preview
21-
$('#desc-edit').on('shown.bs.tab', function (event) {
21+
$('#desc-edit').on('shown.bs.tab', function(event) {
2222
if (event.target.hash == '#desc-preview') {
2323
var editor_value = $('#desc-editor').val();
2424
$(event.target.hash).html(
2525
window.challenge.render(editor_value)
2626
);
2727
}
2828
});
29-
$('#new-desc-edit').on('shown.bs.tab', function (event) {
29+
$('#new-desc-edit').on('shown.bs.tab', function(event) {
3030
if (event.target.hash == '#new-desc-preview') {
3131
var editor_value = $('#new-desc-editor').val();
3232
$(event.target.hash).html(
@@ -36,17 +36,17 @@ $('#new-desc-edit').on('shown.bs.tab', function (event) {
3636
});
3737

3838
function loadchal(id, update) {
39-
$.get(script_root + '/admin/chal/' + id, function(obj){
39+
$.get(script_root + '/admin/chal/' + id, function(obj) {
4040
$('#desc-write-link').click(); // Switch to Write tab
4141
if (typeof update === 'undefined')
4242
$('#update-challenge').modal();
4343
});
4444
}
4545

46-
function openchal(id){
46+
function openchal(id) {
4747
loadchal(id);
4848
}
4949

50-
$(document).ready(function(){
50+
$(document).ready(function() {
5151
$('[data-toggle="tooltip"]').tooltip();
52-
});
52+
});

0 commit comments

Comments
 (0)