From 995cf6a9207dd3e61bdd5ba0d9d149a90eb7992c Mon Sep 17 00:00:00 2001 From: Kevin Chung Date: Fri, 13 Apr 2018 14:52:18 -0400 Subject: [PATCH] Add ezpg and jquery PATCH wrapper (#609) --- CTFd/themes/admin/static/js/ezq.js | 21 ++++++++++++++++++++- CTFd/themes/admin/static/js/utils.js | 2 +- CTFd/themes/core/static/js/ezq.js | 21 ++++++++++++++++++++- CTFd/themes/core/static/js/utils.js | 4 ++-- 4 files changed, 43 insertions(+), 5 deletions(-) diff --git a/CTFd/themes/admin/static/js/ezq.js b/CTFd/themes/admin/static/js/ezq.js index ecc3777..1a45b7d 100644 --- a/CTFd/themes/admin/static/js/ezq.js +++ b/CTFd/themes/admin/static/js/ezq.js @@ -16,6 +16,11 @@ var modal = '' + ''; +var progress = '
' + + '
' + + '
' + + '
'; + function ezal(args){ var res = modal.format(args.title, args.body); var obj = $(res); @@ -28,7 +33,9 @@ function ezal(args){ $(obj).on('hidden.bs.modal', function (e) { $(this).modal('dispose'); - }) + }); + + return obj; } function ezq(args){ @@ -51,4 +58,16 @@ function ezq(args){ }); obj.modal('show'); + + return obj; +} + +function ezpg(args){ + var bar = progress.format(args.width); + var res = modal.format(args.title, bar); + + var obj = $(res); + $('main').append(obj); + + return obj.modal('show'); } \ No newline at end of file diff --git a/CTFd/themes/admin/static/js/utils.js b/CTFd/themes/admin/static/js/utils.js index 1625dd2..2f2171f 100644 --- a/CTFd/themes/admin/static/js/utils.js +++ b/CTFd/themes/admin/static/js/utils.js @@ -58,7 +58,7 @@ function htmlentities(string) { } // http://stepansuvorov.com/blog/2014/04/jquery-put-and-delete/ -jQuery.each(["put", "delete"], function(i, method) { +jQuery.each(["patch", "put", "delete"], function(i, method) { jQuery[method] = function(url, data, callback, type) { if (jQuery.isFunction(data)) { type = type || callback; diff --git a/CTFd/themes/core/static/js/ezq.js b/CTFd/themes/core/static/js/ezq.js index ecc3777..1a45b7d 100644 --- a/CTFd/themes/core/static/js/ezq.js +++ b/CTFd/themes/core/static/js/ezq.js @@ -16,6 +16,11 @@ var modal = '' + ''; +var progress = '
' + + '
' + + '
' + + '
'; + function ezal(args){ var res = modal.format(args.title, args.body); var obj = $(res); @@ -28,7 +33,9 @@ function ezal(args){ $(obj).on('hidden.bs.modal', function (e) { $(this).modal('dispose'); - }) + }); + + return obj; } function ezq(args){ @@ -51,4 +58,16 @@ function ezq(args){ }); obj.modal('show'); + + return obj; +} + +function ezpg(args){ + var bar = progress.format(args.width); + var res = modal.format(args.title, bar); + + var obj = $(res); + $('main').append(obj); + + return obj.modal('show'); } \ No newline at end of file diff --git a/CTFd/themes/core/static/js/utils.js b/CTFd/themes/core/static/js/utils.js index 1809f32..2f2171f 100644 --- a/CTFd/themes/core/static/js/utils.js +++ b/CTFd/themes/core/static/js/utils.js @@ -58,7 +58,7 @@ function htmlentities(string) { } // http://stepansuvorov.com/blog/2014/04/jquery-put-and-delete/ -jQuery.each(["put", "delete"], function(i, method) { +jQuery.each(["patch", "put", "delete"], function(i, method) { jQuery[method] = function(url, data, callback, type) { if (jQuery.isFunction(data)) { type = type || callback; @@ -74,4 +74,4 @@ jQuery.each(["put", "delete"], function(i, method) { success: callback }); }; -}); \ No newline at end of file +});