{"size": 1516, "ext": "js", "max_stars_repo_path": "static/js/board/tool_settings.js", "max_stars_repo_name": "DXsmiley/Whiteboard", "max_stars_repo_stars_event_min_datetime": "2017-10-15T02:47:05.000Z", "max_stars_repo_stars_event_max_datetime": "2021-04-28T23:09:51.000Z", "max_issues_repo_path": "static/js/board/tool_settings.js", "max_issues_repo_name": "DXsmiley/Whiteboard", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "static/js/board/tool_settings.js", "max_forks_repo_name": "DXsmiley/Whiteboard", "max_forks_repo_forks_event_min_datetime": "2016-04-28T07:36:53.000Z", "max_forks_repo_forks_event_max_datetime": "2020-07-03T16:00:50.000Z"}
{"max_stars_count": 17, "max_issues_count": null, "max_forks_count": 6, "avg_line_length": 29.7254901961, "max_line_length": 78, "alphanum_fraction": 0.7381266491}
// When the 'clear' button is clicked, clear the board.
$('#modal_settings_button_clear').bind(device_click_event, function() {
	whiteboard.modalClose('.modal_settings');
	whiteboard.sendPaintEvent('clear', 0);
});

// When the return button is clicked, close the settings panal.
$('#modal_settings_button_cancel').bind(device_click_event, function() {
	whiteboard.modalClose('.modal_settings');
});

// When the download button is clicked, save the image to the user's computer.
var b = document.getElementById('modal_settings_button_download');
b.addEventListener('click', function() {
	console.log('Trying to download...');
	var c = document.getElementById('canvas1');
	// Get a URL for the imahe data
	this.href = c.toDataURL();
	var n = whiteboard.whiteboard_id;
	// Make the user download the data
    this.download = 'whiteboard-' + n + '.png';
});

function SettingsHead() {
	// This object has no constructor
}

// This shouldn't trigger.
SettingsHead.prototype.onModalConfirm = function() {
	whiteboard.modalClose('.modal_settings');
}

// This shouldn't trigger.
SettingsHead.prototype.onModalCancel = function() {
	whiteboard.modalClose('.modal_settings');
}

// Tool constructor
function SettingsTool() {
	this.name = 'settings';
	this.shortcut_key = 's';
}

// When the settings button is clicked, open the settings
SettingsTool.prototype.onButtonClick = function() {
	whiteboard.modalOpen('.modal_settings', '.modal_centered');
	return new SettingsHead();
};

whiteboard.makeTool(new SettingsTool());
