2 typeof define === "function" ? function (m) { define("kismet-ui-sidebar-js", m); } :
3 typeof exports === "object" ? function (m) { module.exports = m(); } :
4 function(m){ this.kismet_ui_sidebar = m(); }
11 // Flag we're still loading
12 exports.load_complete = 0;
14 var local_uri_prefix = "";
15 if (typeof(KISMET_URI_PREFIX) !== 'undefined')
16 local_uri_prefix = KISMET_URI_PREFIX;
24 href: local_uri_prefix + 'css/kismet.ui.sidebar.css'
27 /* Sidebar items are stored as a list of objects defining callbacks which
28 * allow us to create the entries and map clicks */
30 var SidebarItems = new Array();
34 * Options is a dictionary which must include:
36 * id: id for created div
37 * listTitle: Title shown in list, which can include HTML for improved icons
38 * clickCallback: function in for handling a click event
40 * priority: order priority in list (optional)
42 exports.AddSidebarItem = function(options) {
43 if (!('id' in options) ||
44 !('listTitle' in options) ||
45 !('clickCallback' in options)) {
49 if (!('priority' in options)) {
50 options['priority'] = 0;
53 SidebarItems.push(options);
56 function createListCallback(c) {
58 // Hack closing the sidemenu
59 $('.pm_overlay').click();
64 function populateList(list) {
65 SidebarItems.sort(function(a, b) {
66 if (a.priority < b.priority)
68 if (a.priority > b.priority)
74 for (var i in SidebarItems) {
75 var c = SidebarItems[i];
79 class: 'k-sb-list-item'
82 .on('click', createListCallback(c))
87 // Populate the sidebar content in the supplied div
88 exports.MakeSidebar = function(div) {
93 exports.load_complete = 1;