Add ezpg and jquery PATCH wrapper (#609)

selenium-screenshot-testing
Kevin Chung 2018-04-13 14:52:18 -04:00 committed by GitHub
parent 96a3d2c9bd
commit 995cf6a920
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 5 deletions

View File

@ -16,6 +16,11 @@ var modal = '<div class="modal fade" tabindex="-1" role="dialog">' +
' </div>' +
'</div>';
var progress = '<div class="progress">' +
' <div class="progress-bar progress-bar-success progress-bar-striped progress-bar-animated" role="progressbar" style="width: \{0\}%">' +
' </div>' +
'</div>';
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');
}

View File

@ -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;

View File

@ -16,6 +16,11 @@ var modal = '<div class="modal fade" tabindex="-1" role="dialog">' +
' </div>' +
'</div>';
var progress = '<div class="progress">' +
' <div class="progress-bar progress-bar-success progress-bar-striped progress-bar-animated" role="progressbar" style="width: \{0\}%">' +
' </div>' +
'</div>';
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');
}

View File

@ -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;