1313 < meta charset ="utf-8 ">
1414 < title > JavaScript Snake</ title >
1515
16- < link rel =stylesheet id =style type =text/css href =./css/light-snake.css />
17- < h4 > Theme
18- < select onchange ="getTheme() " id ="select ">
19- < option > Light Theme</ option >
20- < option > Main Theme</ option >
21- < option > Dark Theme</ option >
22- < option > Revert To Original</ option >
23- </ select >
24- </ h4 >
25- < div id ="mode-wrapper " style ="display: inline; width: auto; ">
26- < h2 > Select which mode you would like to play in.</ h2 >
27- < button id ="Easy "> Easy</ button > < br />
28- < button id ="Medium "> Medium</ button > < br />
29- < button id ="Difficult "> Difficult</ button >
30- </ div >
31- < button id ="high-score "> Get your current high score for this game.</ button >
16+ < link rel =stylesheet id ="style " type ="text/css " href ="./css/main-snake.css " />
17+
18+ < style >
19+ .snake-toolbar {
20+ position : absolute;
21+ top : 0 ;
22+ left : 0 ;
23+ z-index : 10000 ;
24+ padding : 5px ;
25+ }
26+ </ style >
27+
3228< script >
3329function getTheme ( ) {
3430 function changeTheme ( Theme ) {
@@ -37,20 +33,23 @@ <h2>Select which mode you would like to play in.</h2>
3733 var index = document . getElementById ( "select" ) . selectedIndex ;
3834 switch ( index ) {
3935 case 0 :
40- changeTheme ( 'css/light-snake.css' ) ;
36+ changeTheme ( 'css/light-snake.css?' + Math . random ( ) ) ;
4137 break ;
4238 case 1 :
43- changeTheme ( 'css/main-snake.css' ) ;
39+ changeTheme ( 'css/main-snake.css?' + Math . random ( ) ) ;
4440 break ;
4541 case 2 :
46- changeTheme ( 'css/dark-snake.css' ) ;
42+ changeTheme ( 'css/dark-snake.css?' + Math . random ( ) ) ;
4743 break ;
4844 default :
49- changeTheme ( 'css/light -snake.css' ) ;
45+ changeTheme ( 'css/main -snake.css?' + Math . random ( ) ) ;
5046 break ;
5147 }
52-
48+ setTimeout ( function ( ) {
49+ document . getElementById ( 'game-area' ) . focus ( ) ;
50+ } , 10 ) ;
5351}
52+
5453if ( navigator . onLine && window . location . hostname === 'patorjk.com' ) {
5554 var _gaq = _gaq || [ ] ;
5655 _gaq . push ( [ '_setAccount' , 'UA-3312460-1' ] ) ;
@@ -65,9 +64,42 @@ <h2>Select which mode you would like to play in.</h2>
6564</ script >
6665</ head >
6766< body >
67+ < div class ="snake-toolbar ">
68+ < div style ="display:inline-block;margin-right:10px; ">
69+ < span > Theme:</ span >
70+ < select onchange ="getTheme() " id ="select ">
71+ < option > Light Theme</ option >
72+ < option selected > Main Theme</ option >
73+ < option > Dark Theme</ option >
74+ </ select >
75+ </ div >
76+ < div style ="display:inline-block;margin-right:10px; ">
77+ < span > Mode:</ span >
78+ < select id ="selectMode ">
79+ < option value ="100 "> Easy</ option >
80+ < option value ="75 " selected > Medium</ option >
81+ < option value ="50 "> Hard</ option >
82+ </ select >
83+ </ div >
84+ < div style ="display:inline-block;margin-right:10px; ">
85+ < button id ="high-score "> Your High Score</ button >
86+ </ div >
87+ </ div >
88+
89+ <!--
90+ <h2>Select which mode you would like to play in.</h2>
91+ <button id="Easy">Easy</button><br />
92+ <button id="Medium">Medium</button><br />
93+ <button id="Difficult">Difficult</button>
94+
95+ <button id="high-score">Get your current high score for this game.</button>
96+ -->
97+ < div id ="mode-wrapper " style ="display: inline; width: auto; ">
98+ </ div >
99+
68100 < div id ="game-area " tabindex ="0 ">
69101 </ div >
70- < script type ="text/javascript " src ="./js/min- snake.js "> </ script >
102+ < script type ="text/javascript " src ="./js/snake.js "> </ script >
71103 < script type ="text/javascript ">
72104
73105 var mySnakeBoard = new SNAKE . Board ( {
0 commit comments