Skip to content

Commit 2dee8c6

Browse files
authored
Merge pull request algorithm-visualizer#172 from parkjs814/fullscreen
Fullscreen
2 parents 8539e29 + 68a3bdd commit 2dee8c6

11 files changed

Lines changed: 169 additions & 85 deletions

css/stylesheet.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@ body {
33
margin: 0;
44
padding: 0;
55
overflow: hidden;
6+
position: absolute;
7+
top: 0;
8+
left: 0;
9+
width: 100%;
10+
height: 100%;
11+
background: rgb(63, 63, 63);
612
}
713

814
body {
9-
background: rgb(63, 63, 63);
1015
font-family: 'Roboto', sans-serif;
1116
color: rgb(187, 187, 187);
1217
-webkit-font-smoothing: subpixel-antialiased;

index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ <h3>
3232
</h3>
3333
</button>
3434
<div class="top-menu-buttons">
35+
<div class="btn" id="btn_fullscreen">
36+
<div class="wrapper">
37+
<i class="fa fa-arrows-alt"></i> Fullscreen
38+
</div>
39+
</div>
3540
<div class="btn" id="btn_share">
3641
<div class="wrapper">
3742
<i class="fa fa-share" aria-hidden="true"></i> Share <input type="text" class="collapse" id="shared">

js/dom/enable_fullscreen.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'use strict';
2+
3+
module.exports = () => {
4+
let $func = 'requestFullScreen',
5+
vendorPrefixes = ['webkit', 'moz', 'ms', 'o'],
6+
db = document.body;
7+
8+
for (let p of vendorPrefixes) {
9+
let fName = p + $func [0].toUpperCase () + $func.slice (1);
10+
if (db [fName]) {
11+
$func = fName;
12+
break;
13+
}
14+
}
15+
16+
$('#btn_fullscreen').click (function () {
17+
db [$func] ();
18+
});
19+
};

js/dom/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const showRequestedAlgorithm = require('./show_requested_algorithm');
99
const showWiki = require('./show_wiki');
1010
const enableSearch = require('./enable_search');
1111
const resizeWorkspace = require('./resize_workspace');
12+
const enableFullScreen = require('./enable_fullscreen');
1213

1314
module.exports = {
1415
showAlgorithm,
@@ -19,5 +20,6 @@ module.exports = {
1920
showRequestedAlgorithm,
2021
showWiki,
2122
enableSearch,
22-
resizeWorkspace
23-
};
23+
resizeWorkspace,
24+
enableFullScreen
25+
};

js/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ $(() => {
4747

4848
//enable search feature
4949
DOM.enableSearch ();
50+
//enable fullscreen feature
51+
DOM.enableFullScreen ();
5052

5153
// determine if the app is loading a pre-existing scratch-pad
5254
// or the home page
@@ -85,4 +87,4 @@ $(() => {
8587
window.location.href = window.location.protocol + '//' + window.location.host + window.location.pathname + '#path=scratch/' + vLoadedScratch;
8688
}
8789

88-
});
90+
});

public/algorithm_visualizer.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,15 @@ body {
120120
margin: 0;
121121
padding: 0;
122122
overflow: hidden;
123+
position: absolute;
124+
top: 0;
125+
left: 0;
126+
width: 100%;
127+
height: 100%;
128+
background: rgb(63, 63, 63);
123129
}
124130

125131
body {
126-
background: rgb(63, 63, 63);
127132
font-family: 'Roboto', sans-serif;
128133
color: rgb(187, 187, 187);
129134
-webkit-font-smoothing: subpixel-antialiased;

0 commit comments

Comments
 (0)