",
"",
], // If keepHtml is true, remove all tags except these
keepClasses: true, // Keep Classes
badTags: [
"style",
"script",
"applet",
"embed",
"noframes",
"noscript",
"html",
], // Remove full tags with contents
badAttributes: ["style", "start"], // Remove attributes from remaining tags
limitChars: false, // 0/false|# 0/false disables option
limitDisplay: "both", // text|html|both
limitStop: false, // true/false
},
});
}
$(".note-status-output").hide();
});
function _scrollTo(to, offset) {
$("html,body").animate({ scrollTop: $(to).offset().top - offset }, 800);
}
function ajax_object_action(event, object, callback) {
// event.preventDefault();
var data = {};
$.each(object.data(), function(index, value) {
if (typeof value !== "object") {
data[index] = value;
}
});
var url = data["url"];
// console.log(data);
// console.log(url);
$.ajax({
url: url,
data: data,
type: "POST",
dataType: "json",
cache: false,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
encode: true,
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
success: function(data) {
//console.log(data);
//data will send data to callback function
callback(data);
},
error: function(xhr, status, errorThrown) {
console.log(xhr);
console.log(xhr.responseText);
console.log(status);
console.log(errorThrown);
console.log("Sorry, there was a problem!");
},
});
return false;
}
$(function() {
$("#modals-load-content").on("show.bs.modal", function(event) {
var button = $(event.relatedTarget);
if (!button.data("id")) {
return;
}
var data = {};
$.each(button.data(), function(index, value) {
if (index !== "bs.tooltip") {
data[index] = value;
}
});
console.log(data);
loadModalInner(this, data);
});
function initModalInner() {
$('[data-toggle="reloadModal"]')
.off()
.on("click", function(event) {
event.preventDefault();
button = $(this);
var data = {};
$.each(button.data(), function(index, value) {
if (index !== "bs.tooltip") {
data[index] = value;
}
});
//console.log(data);
loadModalInner(this, data);
});
}
function loadModalInner(self, data) {
var url = data.route,
contentType = "application/x-www-form-urlencoded; charset=UTF-8";
$.ajax({
url: url,
data: data,
type: "POST",
dataType: "json",
cache: false,
contentType: contentType,
encode: true,
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
},
success: function(data) {
console.log(data);
if (data.response.modal) {
$(data.response.target)
.find(".modal-dialog")
.addClass(data.response.modal);
}
$(data.response.target)
.find(".modal-dialog")
.html(data.html);
$(data.response.target)
.find(".selectpicker")
.selectpicker("refresh");
initModalInner();
},
error: function(xhr, status, errorThrown) {
console.log(xhr);
console.log(xhr.responseText);
console.log(errorThrown);
console.log("Sorry, there was a problem!");
},
});
return false;
}
});