/*
Description: $.fn.dialog
Author: Kris Zhang
*/
;(function($) {
$.fn.dialog = function(options) {
var self = this
, $this = $(self)
, $body = $(document.body)
, $msgbox = $this.closest('.dialog')
, parentDataName = 'dialog-parent'
, arg1 = arguments[1]
, arg2 = arguments[2]
;
var create = function() {
var msghtml
= ''
+ '
'
;
$msgbox = $(msghtml);
$(document.body).append($msgbox);
$msgbox.find(".modal-body").append($this);
};
var createButton = function(_options) {
var buttons = (_options || options || {}).buttons || {}
, $btnrow = $msgbox.find(".modal-footer");
//clear old buttons
$btnrow.empty();
var isButtonArr = buttons.constructor == Array;
for (var button in buttons) {
var btnObj = buttons[button]
, id = ""
, text = ""
, classed = "btn-default"
, click = "";
if (btnObj.constructor == Object) {
id = btnObj.id;
text = btnObj.text;
classed = btnObj['class'] || btnObj.classed || classed;
click = btnObj.click;
}
//Buttons should be an object, etc: { 'close': function { } }
else if (!isButtonArr && btnObj.constructor == Function) {
text = button;
click = btnObj;
}
else {
continue;
}
//
$button = $('