Skip to content

Commit

Permalink
Update static JS files
Browse files Browse the repository at this point in the history
  • Loading branch information
hyanwong committed Apr 15, 2024
1 parent 487094e commit c57b640
Show file tree
Hide file tree
Showing 21 changed files with 128 additions and 10,078 deletions.
8 changes: 8 additions & 0 deletions static/js/analytics.min.js

Large diffs are not rendered by default.

Binary file added static/js/analytics.min.js.gz
Binary file not shown.
7 changes: 7 additions & 0 deletions static/js/bootstrap.bundle.min.js

Large diffs are not rendered by default.

Binary file added static/js/bootstrap.bundle.min.js.gz
Binary file not shown.
1 change: 1 addition & 0 deletions static/js/bootstrap.bundle.min.js.map

Large diffs are not rendered by default.

Binary file modified static/js/bootstrap.min.js.gz
Binary file not shown.
Binary file modified static/js/calendar.js.gz
Binary file not shown.
Binary file modified static/js/canvas2svg.js.gz
Binary file not shown.
10,078 changes: 4 additions & 10,074 deletions static/js/jquery.js

Large diffs are not rendered by default.

Binary file modified static/js/jquery.js.gz
Binary file not shown.
Binary file modified static/js/jquery.min.js.gz
Binary file not shown.
Binary file modified static/js/modernizr-2.8.3.min.js.gz
Binary file not shown.
Binary file modified static/js/qrcode.js.gz
Binary file not shown.
Binary file modified static/js/qrcode.min.js.gz
Binary file not shown.
Binary file modified static/js/respond-1.4.2.min.js.gz
Binary file not shown.
Binary file modified static/js/share.js.gz
Binary file not shown.
Binary file modified static/js/web2py-bootstrap3.js.gz
Binary file not shown.
82 changes: 82 additions & 0 deletions static/js/web2py-bootstrap4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
(function($, undefined) {
$.web2py.ajax_fields = function(target) {
/*
*this attaches something to a newly loaded fragment/page
* Ideally all events should be bound to the document, so we can avoid calling
* this over and over... all will be bound to the document
*/
/*adds btn class to buttons*/
$('button:not([class^="btn"])', target).addClass('btn btn-default');
$("p.w2p-autocomplete-widget input").addClass('form-control');
$('form input[type="submit"]:not([class^="btn"]), form input[type="button"]:not([class^="btn"])', target).addClass('btn btn-default');
/* javascript for PasswordWidget*/
$('input[type=password][data-w2p_entropy]', target).each(function() {
$.web2py.validate_entropy($(this));
});
/* javascript for ListWidget*/
$('ul.w2p_list', target).each(function() {
function pe(ul, e) {
var new_line = ml(ul);
rel(ul);
if ($(e.target).closest('li').is(':visible')) {
/* make sure we didn't delete the element before we insert after */
new_line.insertAfter($(e.target).closest('li'));
} else {
/* the line we clicked on was deleted, just add to end of list */
new_line.appendTo(ul);
}
new_line.find(":text").focus();
return false;
}

function rl(ul, e) {
if ($(ul).find('li').length > 1) {
/* only remove if we have more than 1 item so the list is never empty */
$(e.target).closest('li').remove();
}
}

function ml(ul) {
/* clone the first field */
var line = $(ul).find("li:first").clone(true);
line.find(':text').val('');
return line;
}

function rel(ul) {
/* keep only as many as needed*/
$(ul).find("li").each(function() {
var trimmed = $.trim($(this).find(":text").val());
if (trimmed == '') $(this).remove();
else $(this).find(":text").val(trimmed);
});
}
var ul = this;
$(ul).find(":text").addClass('form-control').wrap("<div class='input-group'></div>").after('<div class="input-group-append"><i class="fa fa-plus-circle"></i></div>&nbsp;<div class="input-group-append"><i class="fa fa-minus-circle"></i></div>').keypress(function(e) {
return (e.which == 13) ? pe(ul, e) : true;
}).next().click(function(e) {
pe(ul, e);
e.preventDefault();
}).next().click(function(e) {
rl(ul, e);
e.preventDefault();
});
});
}

$(function() {
$(".nav ul.dropdown-menu").each(function() {
var toggle = jQuery(this).parent();
if (toggle.parent().hasClass("nav")) {
toggle.attr("data-w2pmenulevel", "l0");
toggle.children("a")
.addClass("dropdown-toggle")
.append('<span class="caret"> </span>')
.attr("data-toggle", "dropdown");
} else {
toggle.addClass("dropdown-submenu").removeClass("dropdown");
};
});
});

})(jQuery);
Binary file added static/js/web2py-bootstrap4.js.gz
Binary file not shown.
30 changes: 26 additions & 4 deletions static/js/web2py.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
}
});
/* help preventing double form submission for normal form (not LOADed) */
$(doc).on('submit', 'form:not(.no_disable)', function (e) {
$(doc).on('submit', 'form', function (e) {
var submit_buttons = $(this).find(web2py.formInputClickSelector);
submit_buttons.each(function() {
web2py.disableElement($(this));
Expand All @@ -283,7 +283,11 @@
doc.ajaxSuccess(function (e, xhr) {
var redirect = xhr.getResponseHeader('web2py-redirect-location');
if (redirect !== null) {
window.location = redirect;
if (!redirect.endsWith('#')) {
window.location.href = redirect;
} else {
window.location.reload();
}
}
/* run this here only if this Ajax request is NOT for a web2py component. */
if (xhr.getResponseHeader('web2py-component-content') === null) {
Expand Down Expand Up @@ -335,7 +339,7 @@
} else {
formData = form.serialize(); // Fallback for older browsers.
}
web2py.ajax_page('post', url, formData, target, form);
web2py.ajax_page('post', url, formData, target);

e.preventDefault();
});
Expand Down Expand Up @@ -367,6 +371,24 @@
'data': data,
'processData': !isFormData,
'contentType': contentType,
'xhr': function() {
var xhr = new window.XMLHttpRequest();

xhr.upload.addEventListener("progress", function(evt) {
if (evt.lengthComputable) {
var percentComplete = evt.loaded / evt.total;
percentComplete = parseInt(percentComplete * 100);
web2py.fire(element, 'w2p:uploadProgress', [percentComplete], target);

if (percentComplete === 100) {
web2py.fire(element, 'w2p:uploadComplete', [], target);
}

}
}, false);

return xhr;
},
'beforeSend': function (xhr, settings) {
xhr.setRequestHeader('web2py-component-location', document.location);
xhr.setRequestHeader('web2py-component-element', target);
Expand Down Expand Up @@ -617,7 +639,7 @@
flash: function (message, status) {
var flash = $('.w2p_flash');
web2py.hide_flash();
flash.html(message).addClass(status);
flash.text(message).addClass(status);
if (flash.html()) flash.append('<span id="closeflash"> &times; </span>')[animateIn]();
},
hide_flash: function () {
Expand Down
Binary file modified static/js/web2py.js.gz
Binary file not shown.

0 comments on commit c57b640

Please sign in to comment.