|
Link Here
|
| 10 |
******************************************************************************/ |
10 |
******************************************************************************/ |
| 11 |
/*eslint-env browser, amd*/ |
11 |
/*eslint-env browser, amd*/ |
| 12 |
/*global URL*/ |
12 |
/*global URL*/ |
| 13 |
define(['orion/webui/littlelib', 'orion/PageUtil', 'orion/URL-shim'], function(lib, PageUtil) { |
13 |
define(['orion/webui/littlelib', 'orion/PageUtil', 'orion/EventTarget', 'orion/URL-shim'], function(lib, PageUtil, EventTarget) { |
| 14 |
var LOCAL_STORAGE_NAME = "sideMenuNavigation"; |
14 |
var LOCAL_STORAGE_NAME = "sideMenuNavigation"; |
| 15 |
var OPEN_STATE = "open"; |
15 |
var OPEN_STATE = "open"; |
| 16 |
var CLOSED_STATE = "closed"; |
16 |
var CLOSED_STATE = "closed"; |
|
Link Here
|
| 20 |
var SETTINGS_CATEGORY_ID = "settings"; //$NON-NLS-0$ |
20 |
var SETTINGS_CATEGORY_ID = "settings"; //$NON-NLS-0$ |
| 21 |
|
21 |
|
| 22 |
function SideMenu(parentNode, contentNode) { |
22 |
function SideMenu(parentNode, contentNode) { |
|
|
23 |
EventTarget.attach(this); |
| 24 |
|
| 23 |
this._parentNode = lib.node(parentNode); |
25 |
this._parentNode = lib.node(parentNode); |
| 24 |
if (!this._parentNode) { |
26 |
if (!this._parentNode) { |
| 25 |
throw new Error("Missing parentNode"); //$NON-NLS-0$ |
27 |
throw new Error("Missing parentNode"); //$NON-NLS-0$ |
|
Link Here
|
| 200 |
} |
202 |
} |
| 201 |
this._renderTimeout = window.setTimeout(function() { |
203 |
this._renderTimeout = window.setTimeout(function() { |
| 202 |
this._parentNode.style.display = 'none'; //$NON-NLS-0$ |
204 |
this._parentNode.style.display = 'none'; //$NON-NLS-0$ |
|
|
205 |
this._notifyToggleListeners(); |
| 203 |
this._renderTimeout = null; |
206 |
this._renderTimeout = null; |
| 204 |
}.bind(this), TRANSITION_DURATION_MS); |
207 |
}.bind(this), TRANSITION_DURATION_MS); |
| 205 |
this._parentNode.classList.add("animating"); //$NON-NLS-0$ |
208 |
this._parentNode.classList.add("animating"); //$NON-NLS-0$ |
|
Link Here
|
| 208 |
window.clearTimeout(this._renderTimeout); |
211 |
window.clearTimeout(this._renderTimeout); |
| 209 |
this._renderTimeout = null; |
212 |
this._renderTimeout = null; |
| 210 |
} |
213 |
} |
|
|
214 |
this._renderTimeout = window.setTimeout(function() { |
| 215 |
this._notifyToggleListeners(); |
| 216 |
}.bind(this), TRANSITION_DURATION_MS); |
| 211 |
this._parentNode.classList.remove("animating"); //$NON-NLS-0$ |
217 |
this._parentNode.classList.remove("animating"); //$NON-NLS-0$ |
| 212 |
this._parentNode.style.display = 'block'; //$NON-NLS-0$ |
218 |
this._parentNode.style.display = 'block'; //$NON-NLS-0$ |
| 213 |
this._parentNode.style.width = SIDE_MENU_OPEN_WIDTH; |
219 |
this._parentNode.style.width = SIDE_MENU_OPEN_WIDTH; |
|
Link Here
|
| 376 |
}, this); |
382 |
}, this); |
| 377 |
}, |
383 |
}, |
| 378 |
_show : function(){ |
384 |
_show : function(){ |
|
|
385 |
}, |
| 386 |
_notifyToggleListeners: function() { |
| 387 |
this.dispatchEvent({type: "toggle", closed: this._state === CLOSED_STATE}); //$NON-NLS-0$ |
| 379 |
} |
388 |
} |
| 380 |
}; |
389 |
}; |
| 381 |
return SideMenu; |
390 |
return SideMenu; |