forked from algorithm-visualizer/algorithm-visualizer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_side_menu.js
More file actions
46 lines (37 loc) · 1.3 KB
/
setup_side_menu.js
File metadata and controls
46 lines (37 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
'use strict';
const app = require('../../app');
const Server = require('../../server');
const showAlgorithm = require('../show_algorithm');
const resizeWorkspace = require('../resize_workspace');
let sidemenu_percent;
module.exports = () => {
$('#navigation').click(() => {
const $sidemenu = $('.sidemenu');
const $workspace = $('.workspace');
$sidemenu.toggleClass('active');
$('.nav-dropdown').toggleClass('fa-caret-down fa-caret-right');
if ($sidemenu.hasClass('active')) {
$sidemenu.animate({ "right": (100 - sidemenu_percent) + '%'}, "fast" );
$workspace.animate({ "left": sidemenu_percent + '%' }, "fast" );
} else {
sidemenu_percent = $workspace.position().left / $('body').width() * 100;
$sidemenu.animate({ "right": "0%" }, "fast" );
$workspace.animate({ "left": "0%" }, "fast" );
}
resizeWorkspace();
});
$('#documentation').click(function () {
$('#btn_doc').click();
});
$('#powered-by').click(function () {
$(this).toggleClass('open')
$('#powered-by-list').toggle(300);
});
$('#scratch-paper').click(() => {
const category = 'scratch';
const algorithm = app.getLoadedScratch();
Server.loadAlgorithm(category, algorithm).then((data) => {
showAlgorithm(category, algorithm, data);
});
});
};