Files
monkeygg2.github.io/games/a-dark-room/script/header.js
T
2023-08-25 13:31:04 +05:30

28 lines
540 B
JavaScript

/**
* Module that takes care of header buttons
*/
var Header = {
init: function(options) {
this.options = $.extend(
this.options,
options
);
},
options: {}, // Nothing for now
canTravel: function() {
return $('div#header div.headerButton').length > 1;
},
addLocation: function(text, id, module) {
return $('<div>').attr('id', "location_" + id)
.addClass('headerButton')
.text(text).click(function() {
if(Header.canTravel()) {
Engine.travelTo(module);
}
}).appendTo($('div#header'));
}
};