Below is the entire contents of a JS/JQuery file. I didn't write it, but I'm trying to add on to it. I am having trouble understanding what this
is referring to. I haven't seen functions set up in this style before (SmartPhone = function() {}
)
SmartPhone = function()
{
this.miniMap = new GameModeMap();
this.init = function()
{
var self=this;
var $PhoneContainer = $("#PhoneContainer");
$PhoneContainer.append("<div id='PhoneScreen'></div>");
$PhoneContainer.append("<div class='PhoneButton'></div>");
$('.PhoneButton').click(function(){self.toggleClicked()});
this.miniMap.init("#PhoneScreen");
//append the appMenu
$("#PhoneScreen").append("<div id='AppMenu'></div>");
$("#AppMenu").hide();
initMenu();
//toggleClicked();
}
this.toggleClicked = function()
{
console.log(this);
$('#PhoneContainer').toggleClass ('clicked');
$('#PhoneScreen').toggleClass ('vertical');
this.miniMap.toggle();
$('#AppMenu').toggle();
}
this.init();
}