Recovered missing file
This commit is contained in:
parent
c1079d056e
commit
efb3dd6673
116
2016/08/bshelper-modal-v0.1.0.023.js
Normal file
116
2016/08/bshelper-modal-v0.1.0.023.js
Normal file
@ -0,0 +1,116 @@
|
||||
/**
|
||||
* BSHelper
|
||||
* Bootstrap Helper
|
||||
* @version v0.1.0.023 (2015/07/14 1157)
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* BSDialog
|
||||
*
|
||||
*/
|
||||
var BSDialog = {
|
||||
Create:function(id, title, url, is_big){
|
||||
id = "dlg" + id;
|
||||
if ($("#" + id).length <= 0) this.Add(id, title, ((is_big == undefined)? false : is_big));
|
||||
//--
|
||||
$("#" + id).find(".modal-content").load(url);
|
||||
$("#" + id).modal('show');
|
||||
$("#" + id).on('hide.bs.modal', function(){
|
||||
$("body > div[id='" + id + "']").remove();
|
||||
$("body > div[class~='modal-backdrop']").remove();
|
||||
$("body").removeClass("modal-open");
|
||||
});
|
||||
},
|
||||
Add:function(id, title, is_big){
|
||||
if ($("body > div#" + id).length > 0) return;
|
||||
//--
|
||||
var html = "";
|
||||
html += "<div class=\"modal fade\" id=\"" + id + "\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"" + id + "Label\" aria-hidden=\"true\">";
|
||||
html += " <div class=\"modal-dialog" + ((is_big)? " modal-lg" : "") + "\">";
|
||||
html += " <div class=\"modal-content\">";
|
||||
html += " <div class=\"modal-header\">";
|
||||
html += " <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>";
|
||||
html += " <strong class=\"modal-title\" id=\"" + id + "Label\">" + title + "</strong>";
|
||||
html += " </div>";
|
||||
html += " <div class=\"modal-body custom-loading\"></div>";
|
||||
html += " <div class=\"modal-footer\">";
|
||||
html += " <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Close</button>";
|
||||
html += " </div>";
|
||||
html += " </div>";
|
||||
html += " </div>";
|
||||
html += "</div>";
|
||||
//--
|
||||
$("body").append(html);
|
||||
},
|
||||
Close: function (id) {
|
||||
if (typeof (id) == "object")
|
||||
{
|
||||
var sender = null;
|
||||
|
||||
do
|
||||
{
|
||||
if (typeof (id.target) != "undefined")
|
||||
{
|
||||
sender = id.target;
|
||||
break;
|
||||
}
|
||||
|
||||
if (typeof (id) != "undefined")
|
||||
{
|
||||
sender = id;
|
||||
break;
|
||||
}
|
||||
} while (false);
|
||||
|
||||
if (sender == null) return;
|
||||
|
||||
var panel = $(sender).parentsUntil("div[id^='dlg']").parent();
|
||||
if ($(panel).length > 0)
|
||||
{
|
||||
var dialogID = $(panel).attr("id").substr(3);
|
||||
|
||||
this.Close(dialogID);
|
||||
}
|
||||
} else {
|
||||
if ($("body > div#dlg" + id).length <= 0) return;
|
||||
|
||||
$("body > div#dlg" + id).remove();
|
||||
$("body > div[class~='modal-backdrop']").remove();
|
||||
$("body").removeClass("modal-open");
|
||||
}
|
||||
},
|
||||
Clear:function(){
|
||||
$("body > div[class~='modal'][role='dialog']").remove();
|
||||
$("body > div[class~='modal-backdrop']").remove();
|
||||
$("body").removeClass("modal-open");
|
||||
},
|
||||
ShowToast:function(id, title, message, is_big){
|
||||
if ($("body > div#" + id).length > 0) return;
|
||||
//--
|
||||
var html = "";
|
||||
html += "<div class=\"modal fade\" id=\"" + id + "\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"" + id + "Label\" aria-hidden=\"true\">";
|
||||
html += " <div class=\"modal-dialog" + ((is_big)? " modal-lg" : "") + "\">";
|
||||
html += " <div class=\"modal-content\">";
|
||||
html += " <div class=\"modal-header\">";
|
||||
html += " <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>";
|
||||
html += " <strong class=\"modal-title\" id=\"" + id + "Label\">" + title + "</strong>";
|
||||
html += " </div>";
|
||||
html += " <div class=\"modal-body\">" + message + "</div>";
|
||||
html += " <div class=\"modal-footer\">";
|
||||
html += " <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Close</button>";
|
||||
html += " </div>";
|
||||
html += " </div>";
|
||||
html += " </div>";
|
||||
html += "</div>";
|
||||
//--
|
||||
$("body").append(html);
|
||||
//--
|
||||
$("#" + id).modal('show');
|
||||
$("#" + id).on('hide.bs.modal', function(){
|
||||
$("body > div[id='" + id + "']").remove();
|
||||
$("body > div[class~='modal-backdrop']").remove();
|
||||
$("body").removeClass("modal-open");
|
||||
});
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user