<commit_before>Wu.StatusPane = Wu.Class.extend({

	_ : 'statuspane', 

	initialize : function (options) {
		
		// set options
		Wu.setOptions(this, options);

		// init container
		this.initContainer();

		// add hooks
		this.addHooks();

	},

	initContainer : function () {

		// create div
		var container 	= this._container 	= Wu.DomUtil.create('div', 'home-container');
		var logo 	= this._logo 		= Wu.DomUtil.create('div', 'home-logo', container);
		var statusWrap 	= this._statusWrap 	= Wu.DomUtil.create('div', 'home-status-wrap', container);
		var status 				= Wu.DomUtil.create('div', 'home-status', statusWrap);
		var statusInner 			= Wu.DomUtil.create('div', 'home-status-inner', status);

		// set default status
		this.clearStatus();

		// add to sidepane if assigned container in options
		if (this.options.addTo) this.addTo(this.options.addTo);

		// add tooltip
		app.Tooltip.add(this._container, 'This is the main menu. Here you can change projects, view documents, download files, etc.', { extends : 'systyle', tipJoint : 'bottom right' });

	},

	addHooks : function () {

		// open sidepane menu on mousedown
		Wu.DomEvent.on(this._container, 'mousedown', this._GAtoggle, this);

		// global TAB key toggle
		// Wu.DomEvent.on(document, 'keydown', this.tab, this);	// todo: fix tabbing in inputs
	},


	tab : function (e) {
		if (e.keyCode == 9) this.toggle();
	},


	_GAtoggle : function () {

		// Google Analytics event trackign
		app.Analytics.setGaEvent(['Status Pane', 'toggle']);

		this.toggle();
	},

	toggle : function () {
		this.isOpen ? this.close() : this.open();
	
		// div cleanups to do when hitting home
		this.cleaningJobs();
	},

	cleaningJobs: function () {

		// make sure layermenu edit is disabled
		var layerMenu = Wu.app.MapPane.getControls().layermenu;
		if (layerMenu) layerMenu.disableEdit();

		// close all open options
		if (app.SidePane.Options) app.SidePane.Options.closeAll();
	},

	// open sidepane menu
	open : function (e) {

		this.isOpen = true;
		
		// expand sidepane
		if (app.SidePane) app.SidePane.expand();

		// check 
		this.checkMapBlur();
		this.setContentHeights();

		// trigger activation on active menu item
		app._activeMenu._activate();

		// Hide button section and Layer info when the Home dropdown menu opens (j)
		this._hideTopleftControlCorner();

		// close layermenu edit if open  
		var layermenuControl = app.MapPane.getControls().layermenu;
		if (layermenuControl) layermenuControl.disableEdit();

		// Face out startpane if it's open
		if (app.StartPane.isOpen) this._fadeOutStartpane();

		// Mobile option
		if (app.mobile) this._openMobile();

	},

	// close sidepane menu
	close : function (e) {

		this.isOpen = false;

		// collapse sidepane
		if (app.SidePane) app.SidePane.collapse();

		// removes the blur on map if it's set by one of the fullpanes
		Wu.DomUtil.removeClass(app.MapPane._container, "map-blur");

		// Show button section and Layer info when the Home dropdown menu opens (j)
		this._showTopleftControlCorner();

		// Face out startpane if it's open
		if (app.StartPane.isOpen) this._fadeInStartpane();

		// Mobile option : activate default sidepane on close to avoid opening in fullscreen
		if (app.mobile) this._closeMobile();

		this._hideDescription();
	},

	_hideDescription : function () {
		// Only open the description box if there is anything inside of it
		var dc = app.MapPane.getControls().description;
		if (!dc) return;

		// if no active layers selected in layermenu
		var active = app.MapPane._controls.layermenu._getActiveLayers();
		if (!active.length) return dc.hide();
		
		// if no active layers
		if (!dc.activeLayer) return dc.hide();
		
		var d = dc.activeLayer.getDescription();
		var canEdit = app.access.to.edit_project();

		// if active layers, but empty and not editor
		if (!d && !canEdit) return dc.hide();

	},

	_hideTopleftControlCorner : function () {
		if (app._map) app._map._controlCorners.topleft.style.opacity = 0;
	},

	_showTopleftControlCorner : function () {
		if (app._map) {
			var topleft = app._map._controlCorners.topleft;
		    	topleft.style.opacity = 1;<commit_msg>collapsing sidepane<commit_after>Wu.StatusPane = Wu.Class.extend({

	_ : 'statuspane', 

	initialize : function (options) {
		
		// set options
		Wu.setOptions(this, options);

		// init container
		this.initContainer();

		// add hooks
		this.addHooks();

	},

	initContainer : function () {

		// create div
		var container 	= this._container 	= Wu.DomUtil.create('div', 'home-container');
		var logo 	= this._logo 		= Wu.DomUtil.create('div', 'home-logo', container);
		var statusWrap 	= this._statusWrap 	= Wu.DomUtil.create('div', 'home-status-wrap', container);
		var status 				= Wu.DomUtil.create('div', 'home-status', statusWrap);
		var statusInner 			= Wu.DomUtil.create('div', 'home-status-inner', status);

		// set default status
		this.clearStatus();

		// add to sidepane if assigned container in options
		if (this.options.addTo) this.addTo(this.options.addTo);

		// add tooltip
		app.Tooltip.add(this._container, 'This is the main menu. Here you can change projects, view documents, download files, etc.', { extends : 'systyle', tipJoint : 'bottom right' });

	},

	addHooks : function () {

		// open sidepane menu on mousedown
		Wu.DomEvent.on(this._container, 'mousedown', this._GAtoggle, this);

		// global TAB key toggle
		// Wu.DomEvent.on(document, 'keydown', this.tab, this);	// todo: fix tabbing in inputs
	},


	tab : function (e) {
		if (e.keyCode == 9) this.toggle();
	},


	_GAtoggle : function () {

		// Google Analytics event trackign
		app.Analytics.setGaEvent(['Status Pane', 'toggle']);

		this.toggle();
	},

	toggle : function () {
		this.isOpen ? this.close() : this.open();
	
		// div cleanups to do when hitting home
		this.cleaningJobs();
	},

	cleaningJobs: function () {

		// make sure layermenu edit is disabled
		var layerMenu = Wu.app.MapPane.getControls().layermenu;
		if (layerMenu) layerMenu.disableEdit();

		// close all open options
		if (app.SidePane.Options) app.SidePane.Options.closeAll();
	},

	// open sidepane menu
	open : function (e) {

		this.isOpen = true;
		
		// expand sidepane
		if (app.SidePane) app.SidePane.expand();

		// check 
		this.checkMapBlur();
		this.setContentHeights();

		// trigger activation on active menu item
		app._activeMenu._activate();

		// Hide button section and Layer info when the Home dropdown menu opens (j)
		this._hideTopleftControlCorner();

		// close layermenu edit if open  
		var layermenuControl = app.MapPane.getControls().layermenu;
		if (layermenuControl) layermenuControl.disableEdit();

		// Face out startpane if it's open
		if (app.StartPane.isOpen) this._fadeOutStartpane();

		// Mobile option
		if (app.mobile) this._openMobile();

		// events for auto-closing of sidepane. clicking on map/header pane collapses the sidepane
		this._addAutoCloseEvents();

	},

	_addAutoCloseEvents : function () {

		//console.log('_addAutoCloseEvents');

		var mapPaneDiv = app.MapPane._container; // mapPaneDiv = Wu.DomUtil.get('map'); or document.getElementById('map');
		Wu.DomEvent.on(mapPaneDiv, 'click', this.close, this);

		var headerPaneDiv = app.HeaderPane._container;
		Wu.DomEvent.on(headerPaneDiv, 'click', this.close, this);

	},

	_removeAutoCloseEvents : function () {

		//console.log('_removeAutoCloseEvents');

		var mapPaneDiv = app.MapPane._container; // mapPaneDiv = Wu.DomUtil.get('map'); or document.getElementById('map');
		Wu.DomEvent.off(mapPaneDiv, 'click', this.close, this);

		var headerPaneDiv = app.HeaderPane._container;
		Wu.DomEvent.off(headerPaneDiv, 'click', this.close, this);

	},

	// close sidepane menu
	close : function (e) {

		this.isOpen = false;

		// collapse sidepane
		if (app.SidePane) app.SidePane.collapse();

		// removes the blur on map if it's set by one of the fullpanes
		Wu.DomUtil.removeClass(app.MapPane._container, "map-blur");

		// Show button section and Layer info when the Home dropdown menu opens (j)
		this._showTopleftControlCorner();

		// Face out startpane if it's open
		if (app.StartPane.isOpen) this._fadeInStartpane();

		// Mobile option : activate default sidepane on close to avoid opening in fullscreen
		if (app.mobile) this._closeMobile();

		this._hideDescription();

		// unregister auto-close events
		this._removeAutoCloseEvents();
	},

	_hideDescription : function () {
		// Only open the description box if there is anything inside of it
		var dc = app.MapPane.getControls().description;
		if (!dc) return;

		// if no active layers selected in layermenu
		var active = app.MapPane._controls.layermenu._getActiveLayers();
		if (!active.length) return dc.hide();
		
		// if no active layers
		if (!dc.activeLayer) return dc.hide();
		
		var d = dc.activeLayer.getDescription();
		var canEdit = app.access.to.edit_project();

		// if active layers, but empty and not editor
		if (!d && !canEdit) return dc.hide();

	},

	_hideTopleftControlCorner : function () {
		if (app._map) app._map._controlCorners.topleft.style.opacity = 0;
	},

	_showTopleftControlCorner : function () {
		if (app._map) {
			var topleft = app._map._controlCorners.topleft;
		    	topleft.style.opacity = 1;
{'fraction_non_alphanumeric': 0.13428943937418514, 'fraction_numerical': 0.000651890482398957, 'mean_word_length': 3.5277914412198723, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7300889', 'n_tokens_mistral': 3315, 'n_tokens_neox': 2933, 'n_words': 789}