53 lines
1.2 KiB
JavaScript
53 lines
1.2 KiB
JavaScript
(function($) {
|
|
|
|
// disable anchors in menu links which are disabled
|
|
$("li.disabled a").click(function () {
|
|
return false;
|
|
});
|
|
|
|
$("form.confirm").submit(function (event) {
|
|
event.preventDefault();
|
|
var form = this;
|
|
var text = "Confirm";
|
|
var confirmMsg = $(form).attr("confirm-msg");
|
|
if (confirmMsg) {
|
|
text = confirmMsg;
|
|
}
|
|
$("<div>" + text + "</div>")
|
|
.dialog({
|
|
title: "Confirm", // title
|
|
buttons: {
|
|
"Confirm": function () {
|
|
form.submit();
|
|
},
|
|
"Cancel": function () {
|
|
$(this).dialog("close");
|
|
}
|
|
}
|
|
});
|
|
return false;
|
|
});
|
|
|
|
$("form:not(.confirm)").submit(function() {
|
|
var btn = $(this).find(":submit");
|
|
btn.prop("disabled", true);
|
|
btn.html(
|
|
'<span class="spinner-border spinner-border-sm mr-3" role="status" aria-hidden="true"></span>Loading...'
|
|
);
|
|
});
|
|
|
|
$(".read-more")
|
|
.click(function () {
|
|
var control = $(this).attr('readcontrol');
|
|
$("#" + control).toggleClass("read-less");
|
|
if ($(this).text() === "Show Less")
|
|
$(this).text("Show More");
|
|
else
|
|
$(this).text("Show Less");
|
|
return false;
|
|
});
|
|
|
|
$(".click-submit").on('change', function () {
|
|
$(this).parents('form:first').submit();
|
|
});
|
|
})(jQuery); |