Skip to content

Commit 87f759e

Browse files
committed
changes for codesandbox
1 parent 0acdf4f commit 87f759e

File tree

2 files changed

+35
-31
lines changed

2 files changed

+35
-31
lines changed

index.html

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,7 @@
2626
</style>
2727

2828
<script>
29-
function getTheme () {
30-
function changeTheme (Theme) {
31-
document.getElementById('style').setAttribute('href', Theme);
32-
}
33-
var index = document.getElementById("select").selectedIndex;
34-
switch (index) {
35-
case 0:
36-
changeTheme('css/light-snake.css?' + Math.random());
37-
break;
38-
case 1:
39-
changeTheme('css/main-snake.css?' + Math.random());
40-
break;
41-
case 2:
42-
changeTheme('css/dark-snake.css?' + Math.random());
43-
break;
44-
case 3:
45-
changeTheme('css/green-snake.css?' + Math.random());
46-
break;
47-
default:
48-
changeTheme('css/main-snake.css?' + Math.random());
49-
break;
50-
}
51-
setTimeout(function() {
52-
document.getElementById('game-area').focus();
53-
}, 10);
54-
}
29+
5530

5631
if (navigator.onLine && window.location.hostname === 'patorjk.com') {
5732
var _gaq = _gaq || [];
@@ -104,10 +79,7 @@ <h2>Select which mode you would like to play in.</h2>
10479
<script type="text/javascript" src="./js/snake.js"></script>
10580
<script type="text/javascript">
10681

107-
var mySnakeBoard = new SNAKE.Board( {
108-
boardContainer: "game-area",
109-
fullScreen: true
110-
});
82+
11183

11284
</script>
11385
</body>

js/snake.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ SNAKE.Board = SNAKE.Board || (function() {
649649

650650
elmAboutPanel = document.createElement("div");
651651
elmAboutPanel.className = "snake-panel-component";
652-
elmAboutPanel.innerHTML = "<a href='http://patorjk.com/blog/software/' class='snake-link'>more patorjk.com apps</a> - <a href='https://github.com/patorjk/JavaScript-Snake' class='snake-link'>source code</a>";
652+
elmAboutPanel.innerHTML = "<a href='http://patorjk.com/blog/software/' class='snake-link'>more patorjk.com apps</a> - <a href='https://github.com/patorjk/JavaScript-Snake' class='snake-link'>source code</a> - <a href='https://www.instagram.com/patorjk/' class='snake-link'>pat's instagram</a>";
653653

654654
elmLengthPanel = document.createElement("div");
655655
elmLengthPanel.className = "snake-panel-component";
@@ -1025,3 +1025,35 @@ SNAKE.Board = SNAKE.Board || (function() {
10251025

10261026
}; // end return function
10271027
})();
1028+
1029+
function getTheme () {
1030+
function changeTheme (Theme) {
1031+
document.getElementById('style').setAttribute('href', Theme);
1032+
}
1033+
var index = document.getElementById("select").selectedIndex;
1034+
switch (index) {
1035+
case 0:
1036+
changeTheme('css/light-snake.css?' + Math.random());
1037+
break;
1038+
case 1:
1039+
changeTheme('css/main-snake.css?' + Math.random());
1040+
break;
1041+
case 2:
1042+
changeTheme('css/dark-snake.css?' + Math.random());
1043+
break;
1044+
case 3:
1045+
changeTheme('css/green-snake.css?' + Math.random());
1046+
break;
1047+
default:
1048+
changeTheme('css/main-snake.css?' + Math.random());
1049+
break;
1050+
}
1051+
setTimeout(function() {
1052+
document.getElementById('game-area').focus();
1053+
}, 10);
1054+
}
1055+
1056+
var mySnakeBoard = new SNAKE.Board( {
1057+
boardContainer: "game-area",
1058+
fullScreen: true
1059+
});

0 commit comments

Comments
 (0)