56 lines
1.5 KiB
JavaScript
56 lines
1.5 KiB
JavaScript
(function(context,$) {
|
|
|
|
"use strict";
|
|
|
|
context.JK = context.JK || {};
|
|
context.JK.Banner = (function() {
|
|
var self = this;
|
|
var logger = context.JK.logger;
|
|
|
|
// responsible for updating the contents of the update dialog
|
|
// as well as registering for any event handlers
|
|
function show(options) {
|
|
var text = options.text;
|
|
var html = options.html;
|
|
|
|
var newContent = null;
|
|
if (html) {
|
|
newContent = $('#banner .dialog-inner').html(html);
|
|
}
|
|
else if(text) {
|
|
newContent = $('#banner .dialog-inner').html(text);
|
|
}
|
|
else {
|
|
console.error("unable to show banner for empty message")
|
|
return newContent;
|
|
}
|
|
|
|
$('#banner').attr('data-type', options.type).show()
|
|
$('#banner_overlay').show()
|
|
|
|
// return the core of the banner so that caller can attach event handlers to newly created HTML
|
|
return newContent;
|
|
}
|
|
|
|
function hide() {
|
|
$('#banner').hide();
|
|
$('#banner_overlay .dialog-inner').html("");
|
|
$('#banner_overlay').hide();
|
|
}
|
|
|
|
function initialize() {
|
|
|
|
return self;
|
|
}
|
|
|
|
// Expose publics
|
|
var me = {
|
|
initialize: initialize,
|
|
show : show,
|
|
hide : hide
|
|
}
|
|
|
|
return me;
|
|
})();
|
|
|
|
})(window,jQuery); |