@@ -152,33 +152,19 @@ goat.utils = {
152
152
return lessonName . replace ( / \s | \( | \) | \! | \: | \; | \@ | \# | \$ | \% | \^ | \& | \* / g, '' ) ; //TODO move the replace routine into util function
153
153
} ,
154
154
ajaxifyAttackHref : function ( ) {
155
- /* Jason I commented this implementation out
156
- * I think we should show the attack link on the lessons that need it by modifying the lesson
157
- * itself or we could add a new button up top for "show lesson link" */
158
- //re-enabling for now ... was breaking external links
155
+ // rewrite any links with hrefs point to relative attack URLs
159
156
$ . each ( $ ( 'a[href^="attack?"]' ) ,
160
157
function ( i , el ) {
161
158
var url = $ ( el ) . attr ( 'href' ) ;
162
159
$ ( el ) . unbind ( 'click' ) . attr ( 'href' , '#' ) . attr ( 'link' , url ) ;
163
160
//TODO pull currentMenuId
164
- $ ( el ) . click (
165
- function ( ) {
161
+ $ ( el ) . click ( function ( ) {
162
+ event . preventDefault ( ) ;
166
163
var _url = $ ( el ) . attr ( 'link' ) ;
167
164
$ . get ( _url , { success :showResponse } ) ;
168
165
}
169
166
) ;
170
167
} ) ;
171
-
172
- // alternate implementation
173
- // unbind any bound events so we are safe to be called twice
174
- /*
175
- $('#lesson_content a').unbind('click');
176
- $('#lesson_content a').bind('click', function(event) {
177
- event.preventDefault();
178
- $.get(this.href, {}, function(response) {
179
- $('#lesson_content').html(response);
180
- });
181
- });*/
182
168
}
183
169
} ;
184
170
0 commit comments