Mini Kabibi Habibi
/* Dialog UI */
(function (wa, $) {
var ui = wa.UI = wa.UI || {};
ui.CheckListDialog = function (options) {
var animateDuration = 400,
el = {
$dialog: $("#wa-dialog")
},
create = function () {
clearDialog();
createHeader();
createContent();
createButtons();
},
createHeader = function () {
if (options.header) {
el.$dialog.append(
$("<div>", {
id: "wa-dialog-header",
html: options.header.html
}).addClass(options.header.css));
}
},
createContent = function () {
if (options.content) {
el.$dialog.append(
$("<div>", {
id: "wa-dialog-content",
html: options.content.html
}));
}
},
createButtons = function () {
if (options.buttons) {
var $buttons = $("<div>", {
id: "wa-dialog-buttons"
}).appendTo(el.$dialog);
var buttons = options.buttons;
for (var i = 0; i < buttons.length; i++) {
if (buttons[i]) {
$buttons.append($("<input>", {
id: buttons[i].id,
'class': buttons[i].css,
type: "button",
value: buttons[i].text,
click: buttons[i].click
}));
}
}
}
},
clearDialog = function () {
el.$dialog.unbind();
el.$dialog.empty();
};
this.open = function () {
create();
var dialogWidth = "370px";
if (options.dialogWidth) {
dialogWidth = options.dialogWidth;
}
el.$dialog
.css({
bottom: el.$dialog.outerHeight(),
width: dialogWidth
})
.animate({
bottom: 0
}, animateDuration);
return this;
};
this.close = function (callback) {
el.$dialog
.animate({
bottom: el.$dialog.outerHeight()
}, {
duration: animateDuration,
complete: function () {
if (callback && typeof callback === "function") {
callback();
return;
}
}
});
return this;
};
};
ui.WebAdvisorDialog = function (options) {
var buttonOkId = "wa-dialog-button-ok",
buttonCancelId = "wa-dialog-button-cancel",
buttonClass = "wa-button",
fix = {
id: buttonOkId,
css: buttonClass
},
ignore = {
id: buttonCancelId,
css: buttonClass
};
return new ui.CheckListDialog({
header: options.header,
content: options.content,
buttons: function () {
if (options.buttons[1]) {
$.extend(options.buttons[1], fix);
}
if (options.buttons[0]) {
$.extend(options.buttons[0], ignore);
}
return options.buttons;
}()
});
};
}(window.WebAdvisor = window.WebAdvisor || {}, jQuery));
//E4DF997AD98E004C3F50121CF37056EA801765AA3D979B83875AAA2BC3A1989A736EEC1E7E5E731E21D5362EEDB1EAA55DF21984221DCA7E52DA430E5C98C31D++