<commit_before>/**
 * @description	This module takes care of the header.
 * @copyright	2015 by <NAME>
 */

header = {

	_dom: $('header')

}

header.dom = function(selector) {

	if (selector===undefined||selector===null||selector==='') return header._dom;
	return header._dom.find(selector);

}

header.show = function() {

	var newMargin = -1*($('#imageview #image').height()/2)+20;

	clearTimeout($(window).data('timeout'));

	lychee.imageview.removeClass('full');
	header.dom().removeClass('hidden');

	// Adjust position or size of photo
	if ($('#imageview #image.small').length>0)	$('#imageview #image').css('margin-top', newMargin);
	else										$('#imageview #image').removeClass('full');

}

header.hide = function(e, delay) {

	var newMargin = -1*($('#imageview #image').height()/2);

	if (delay===undefined) delay = 500;

	if (visible.photo()&&!visible.infobox()&&!visible.contextMenu()&&!visible.message()) {

		clearTimeout($(window).data('timeout'));

		$(window).data('timeout', setTimeout(function() {

			lychee.imageview.addClass('full');
			header.dom().addClass('hidden');

			// Adjust position or size of photo
			if ($('#imageview #image.small').length>0)	$('#imageview #image').css('margin-top', newMargin);
			else										$('#imageview #image').addClass('full');

		}, delay));

	}

}

header.setTitle = function(title) {

	var $title	= header.dom('#title'),
		title	= title || 'Untitled';

	$title.html(title + build.iconic('caret-bottom'));

}

header.setMode = function(mode) {

	var albumID = album.getID();

	switch (mode) {

		case 'albums':

			header.dom().removeClass('view');
			$('#tools_album, #tools_photo').hide();
			$('#tools_albums').show();

			break;

		case 'album':

			header.dom().removeClass('view');
			$('#tools_albums, #tools_photo').hide();
			$('#tools_album').show();

			// Hide download button when album empty
			album.json.content === false ? $('#button_archive').hide() : $('#button_archive').show();

			// Hide download button when not logged in and album not downloadable
			if (lychee.publicMode===true&&album.json.downloadable==='0') $('#button_archive').hide();

			if (albumID==='s'||albumID==='f'||albumID==='r') {
				$('#button_info_album, #button_trash_album, #button_share_album').hide();
			} else if (albumID==='0') {
				$('#button_info_album, #button_share_album').hide();
				$('#button_trash_album').show();
			} else {
				$('#button_info_album, #button_trash_album, #button_share_album').show();
			}

			break;

		case 'photo':

			header.dom().addClass('view');
			$('#tools_albums, #tools_album').hide();
			$('#tools_photo').show();

			break;

	}

}

header.setEditable = function(editable) {

	var $title = header.dom('#title');

	// Hide editable icon when not logged in
	if (lychee.publicMode===true) editable = false;

	if (editable)	$title.addClass('editable');
	else			$title.removeClass('editable');

}<commit_msg>Return true/false in header functions<commit_after>/**
 * @description	This module takes care of the header.
 * @copyright	2015 by <NAME>
 */

header = {

	_dom: $('header')

}

header.dom = function(selector) {

	if (selector===undefined||selector===null||selector==='') return header._dom;
	return header._dom.find(selector);

}

header.show = function() {

	var newMargin = -1*($('#imageview #image').height()/2)+20;

	clearTimeout($(window).data('timeout'));

	lychee.imageview.removeClass('full');
	header.dom().removeClass('hidden');

	// Adjust position or size of photo
	if ($('#imageview #image.small').length>0)	$('#imageview #image').css('margin-top', newMargin);
	else										$('#imageview #image').removeClass('full');

	return true;

}

header.hide = function(e, delay = 500) {

	if (visible.photo()&&!visible.sidebar()&&!visible.contextMenu()&&!visible.message()) {

		var newMargin = -1*($('#imageview #image').height()/2);

		clearTimeout($(window).data('timeout'));

		$(window).data('timeout', setTimeout(function() {

			lychee.imageview.addClass('full');
			header.dom().addClass('hidden');

			// Adjust position or size of photo
			if ($('#imageview #image.small').length>0)	$('#imageview #image').css('margin-top', newMargin);
			else										$('#imageview #image').addClass('full');

		}, delay));

		return true;

	}

	return false;

}

header.setTitle = function(title = 'Untitled') {

	var $title	= header.dom('#title');

	$title.html(title + build.iconic('caret-bottom'));

	return true;

}

header.setMode = function(mode) {

	var albumID = album.getID();

	switch (mode) {

		case 'albums':

			header.dom().removeClass('view');
			$('#tools_album, #tools_photo').hide();
			$('#tools_albums').show();

			return true;
			break;

		case 'album':

			header.dom().removeClass('view');
			$('#tools_albums, #tools_photo').hide();
			$('#tools_album').show();

			// Hide download button when album empty
			album.json.content === false ? $('#button_archive').hide() : $('#button_archive').show();

			// Hide download button when not logged in and album not downloadable
			if (lychee.publicMode===true&&album.json.downloadable==='0') $('#button_archive').hide();

			if (albumID==='s'||albumID==='f'||albumID==='r') {
				$('#button_info_album, #button_trash_album, #button_share_album').hide();
			} else if (albumID==='0') {
				$('#button_info_album, #button_share_album').hide();
				$('#button_trash_album').show();
			} else {
				$('#button_info_album, #button_trash_album, #button_share_album').show();
			}

			return true;
			break;

		case 'photo':

			header.dom().addClass('view');
			$('#tools_albums, #tools_album').hide();
			$('#tools_photo').show();

			return true;
			break;

	}

	return false;

}

header.setEditable = function(editable) {

	var $title = header.dom('#title');

	// Hide editable icon when not logged in
	if (lychee.publicMode===true) editable = false;

	if (editable)	$title.addClass('editable');
	else			$title.removeClass('editable');

	return true;

}
{'fraction_non_alphanumeric': 0.20980788675429726, 'fraction_numerical': 0.005729693292888439, 'mean_word_length': 4.510677808727948, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4785164', 'n_tokens_mistral': 2185, 'n_tokens_neox': 1956, 'n_words': 377}