File tree Expand file tree Collapse file tree 2 files changed +10
-24
lines changed
resources/public/javascript Expand file tree Collapse file tree 2 files changed +10
-24
lines changed Original file line number Diff line number Diff line change @@ -48,25 +48,11 @@ var pageExitConditions = [
4848 }
4949] ;
5050
51- function nextPage ( ) {
52- if ( currentPage < pages . length - 1 ) {
53- goToPage ( currentPage + 1 ) ;
54- }
55- }
56-
57- function previousPage ( ) {
58- if ( currentPage > 0 ) {
59- goToPage ( currentPage - 1 ) ;
60- }
61- }
62-
63- function goToFirstPage ( ) {
64- if ( currentPage > 0 ) {
65- goToPage ( 0 ) ;
66- }
67- }
68-
6951function goToPage ( pageNumber ) {
52+ if ( pageNumber == currentPage || pageNumber < 0 || pageNumber >= pages . length ) {
53+ return ;
54+ }
55+
7056 currentPage = pageNumber ;
7157
7258 var block = $ ( "#changer" ) ;
@@ -115,18 +101,18 @@ function doCommand(input) {
115101 switch ( input ) {
116102 case 'next' :
117103 case 'forward' :
118- nextPage ( ) ;
104+ goToPage ( currentPage + 1 ) ;
119105 return true ;
120106 case 'previous' :
121107 case 'prev' :
122108 case 'back' :
123- previousPage ( ) ;
109+ goToPage ( currentPage - 1 ) ;
124110 return true ;
125111 case 'restart' :
126112 case 'reset' :
127113 case 'home' :
128114 case 'quit' :
129- goToFirstPage ( ) ;
115+ goToPage ( 0 ) ;
130116 return true ;
131117 default :
132118 return false ;
Original file line number Diff line number Diff line change 33 [hiccup.element :refer [javascript-tag link-to unordered-list]]
44 [hiccup.page :refer [include-css include-js html5]]))
55
6- (defpartial links []
6+ (defpartial links-html []
77 (unordered-list
88 [(link-to " http://clojure.org" " The official Clojure website" )
99 (link-to " http://dev.clojure.org/display/doc/Getting+Started" " Getting started with Clojure" )
3535 " You can see a Clojure interpreter above - we call it a <em>REPL</em>."
3636 ]
3737 [:p.bottom
38- " Type \" next\" in the REPL to begin."
38+ " Type <code> next</code> in the REPL to begin."
3939 ])
4040
4141(defn root-html []
8989 (about-html ))
9090
9191(defpage " /links" []
92- (links ))
92+ (links-html ))
You can’t perform that action at this time.
0 commit comments