mirror of https://github.com/JohnHammond/CTFd.git
Closes #168
parent
dce34af7a9
commit
068006874d
|
@ -0,0 +1,55 @@
|
|||
//http://stackoverflow.com/a/1186309
|
||||
$.fn.serializeObject = function()
|
||||
{
|
||||
var o = {};
|
||||
var a = this.serializeArray();
|
||||
$.each(a, function() {
|
||||
if (o[this.name] !== undefined) {
|
||||
if (!o[this.name].push) {
|
||||
o[this.name] = [o[this.name]];
|
||||
}
|
||||
o[this.name].push(this.value || '');
|
||||
} else {
|
||||
o[this.name] = this.value || '';
|
||||
}
|
||||
});
|
||||
return o;
|
||||
};
|
||||
|
||||
|
||||
//http://stackoverflow.com/a/2648463 - wizardry!
|
||||
String.prototype.format = String.prototype.f = function() {
|
||||
var s = this,
|
||||
i = arguments.length;
|
||||
|
||||
while (i--) {
|
||||
s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]);
|
||||
}
|
||||
return s;
|
||||
};
|
||||
|
||||
//http://stackoverflow.com/a/7616484
|
||||
String.prototype.hashCode = function() {
|
||||
var hash = 0, i, chr, len;
|
||||
if (this.length == 0) return hash;
|
||||
for (i = 0, len = this.length; i < len; i++) {
|
||||
chr = this.charCodeAt(i);
|
||||
hash = ((hash << 5) - hash) + chr;
|
||||
hash |= 0; // Convert to 32bit integer
|
||||
}
|
||||
return hash;
|
||||
};
|
||||
|
||||
function colorhash (x) {
|
||||
color = ""
|
||||
for (var i = 20; i <= 60; i+=20){
|
||||
x += i
|
||||
x *= i
|
||||
color += x.toString(16)
|
||||
};
|
||||
return "#" + color.substring(0, 6)
|
||||
}
|
||||
|
||||
function htmlentities(string) {
|
||||
return $('<div/>').text(string).html();
|
||||
}
|
|
@ -298,7 +298,7 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script src="{{ request.script_root }}/static/{{ ctf_theme() }}/js/utils.js"></script>
|
||||
<script src="{{ request.script_root }}/static/{{ ctf_theme() }}/admin/js/multi-modal.js"></script>
|
||||
<script src="{{ request.script_root }}/static/{{ ctf_theme() }}/admin/js/chalboard.js"></script>
|
||||
<script src="{{ request.script_root }}/static/admin/js/utils.js"></script>
|
||||
<script src="{{ request.script_root }}/static/admin/js/multi-modal.js"></script>
|
||||
<script src="{{ request.script_root }}/static/admin/js/chalboard.js"></script>
|
||||
{% endblock %}
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script src="{{ request.script_root }}/static/{{ ctf_theme() }}/js/utils.js"></script>
|
||||
<script src="{{ request.script_root }}/static/admin/js/utils.js"></script>
|
||||
<script>
|
||||
$('#delete-solve').click(function(e){
|
||||
e.preventDefault();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends "admin/base.html" %}
|
||||
|
||||
{% block stylesheets %}
|
||||
<link rel="stylesheet" type="text/css" href="{{ request.script_root }}/static/{{ ctf_theme() }}/css/vendor/codemirror.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="{{ request.script_root }}/static/admin/css/vendor/codemirror.min.css">
|
||||
<style>
|
||||
.row-fluid { margin: 25px; padding-bottom: 25px; }
|
||||
</style>
|
||||
|
@ -38,7 +38,7 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script src="{{ request.script_root }}/static/{{ ctf_theme() }}/js/vendor/codemirror.min.js"></script>
|
||||
<script src="{{ request.script_root }}/static/admin/js/vendor/codemirror.min.js"></script>
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("admin-pages-editor"), {
|
||||
lineNumbers: true,
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
display: block;
|
||||
}
|
||||
</style>
|
||||
<script src="{{ request.script_root }}/static/{{ ctf_theme() }}/js/vendor/plotly.min.js"></script>
|
||||
<script src="{{ request.script_root }}/static/admin/js/vendor/plotly.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
// $.distint(array)
|
||||
// Unique elements in array
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends "admin/base.html" %}
|
||||
|
||||
{% block stylesheets %}
|
||||
<link rel="stylesheet" type="text/css" href="{{ request.script_root }}/static/{{ ctf_theme() }}/css/vendor/codemirror.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="{{ request.script_root }}/static/admin/css/vendor/codemirror.min.css">
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
@ -60,7 +60,7 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script src="{{ request.script_root }}/static/{{ ctf_theme() }}/js/vendor/codemirror.min.js"></script>
|
||||
<script src="{{ request.script_root }}/static/admin/js/vendor/codemirror.min.js"></script>
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("pages-editor"), {
|
||||
lineNumbers: true,
|
||||
|
|
|
@ -134,7 +134,7 @@
|
|||
<td class="text-center">{{ award.value }}</td>
|
||||
<td class="text-center">{{ award.category }}</td>
|
||||
<td class="text-center">{{ award.icon }}</td>
|
||||
|
||||
|
||||
<td class="text-center"><i class="fa fa-times"></i></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -221,10 +221,10 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script src="{{ request.script_root }}/static/{{ ctf_theme() }}/js/vendor/moment.min.js"></script>
|
||||
<script src="{{ request.script_root }}/static/{{ ctf_theme() }}/js/vendor/plotly.min.js"></script>
|
||||
<script src="{{ request.script_root }}/static/{{ ctf_theme() }}/js/utils.js"></script>
|
||||
<script src="{{ request.script_root }}/static/{{ ctf_theme() }}/admin/js/team.js"></script>
|
||||
<script src="{{ request.script_root }}/static/admin/js/vendor/moment.min.js"></script>
|
||||
<script src="{{ request.script_root }}/static/admin/js/vendor/plotly.min.js"></script>
|
||||
<script src="{{ request.script_root }}/static/admin/js/utils.js"></script>
|
||||
<script src="{{ request.script_root }}/static/admin/js/team.js"></script>
|
||||
<script>
|
||||
$('#delete-solve').click(function (e) {
|
||||
e.preventDefault();
|
||||
|
@ -291,7 +291,7 @@
|
|||
var description = "<span>Are you sure you want to delete the " +
|
||||
"<strong>{0}</strong> award?</span>".format(chal_name);
|
||||
var action = '{{ request.script_root }}/admin/awards/{0}/delete'.format(award_id);
|
||||
}
|
||||
}
|
||||
|
||||
var msg = {
|
||||
title : title,
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script src="{{ request.script_root }}/static/{{ ctf_theme() }}/js/utils.js"></script>
|
||||
<script src="{{ request.script_root }}/static/admin/js/utils.js"></script>
|
||||
<script>
|
||||
$('#delete-solve').click(function (e) {
|
||||
e.preventDefault();
|
||||
|
|
Loading…
Reference in New Issue