You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$("html").css("background-color","black");// Set the background black
184
225
$(".words").remove()// Remove the current word (ie banana)
185
-
$(".win2").text("You scored "+(correct-incorrect)+" points.")// Set winning text
226
+
$(".win2").text(options.lang.points.replace("$score",(correct-incorrect).toString()))// Set winning text
186
227
$(".win2").fadeIn()// Fade in the winning text
187
-
$(".sboard").fadeIn()// Fade in the scoreboard
188
-
$.get("/get-score/",function(d){// Download the updated scoreboard
189
-
vararr=JSON.parse(d);// Parse what we've been given
190
-
for(vari=0;i<arr.length;i++){// Go through all the top 20 scores
191
-
$(".leaderboard").append("<li class='list-group-item'> "+arr[i].name+" - "+arr[i].score+" </li>")// And add them to the leaderboard
192
-
}
193
-
})
194
-
swal({// Create a dialog box:
195
-
title: 'What\'s your name?',
196
-
input: 'text',// With an input box
197
-
showCancelButton: true,
198
-
confirmButtonText: 'Submit',
199
-
showLoaderOnConfirm: true,
200
-
allowOutsideClick: false
201
-
}).then(function(name){// Then when user clicks submit
202
-
$.post("/add-score/",{name: name,score: (correct-incorrect)},function(data){// Then when that data is successfully sent
203
-
console.info(data);
204
-
setTimeout(function(){
205
-
$.get("/get-score/",function(d){// Download the updated scoreboard
206
-
vararr=JSON.parse(d);// Parse what we've been given
207
-
$(".leaderboard").html("")// Remove old scores
208
-
for(vari=0;i<arr.length;i++){// Go through all the top 20 scores
209
-
$(".leaderboard").append("<li class='list-group-item'> "+arr[i].name+" - "+arr[i].score+" </li>")// And add them to the leaderboard
210
-
}
211
-
})
212
-
},500)
228
+
if(options.leaderboard){
229
+
$(".sboard").fadeIn()// Fade in the scoreboard
230
+
$.get("/get-score/",function(d){// Download the updated scoreboard
231
+
vararr=JSON.parse(d);// Parse what we've been given
232
+
for(vari=0;i<arr.length;i++){// Go through all the top 20 scores
233
+
$(".leaderboard").append("<li class='list-group-item'> "+options.lang.scoreboard_entry.replace("$name",arr[i].name).replace("$score",arr[i].score)+" </li>")// And add them to the leaderboard
234
+
}
213
235
})
214
-
});
236
+
swal({// Create a dialog box:
237
+
title: 'What\'s your name?',
238
+
input: 'text',// With an input box
239
+
showCancelButton: true,
240
+
confirmButtonText: 'Submit',
241
+
showLoaderOnConfirm: true,
242
+
allowOutsideClick: false
243
+
}).then(function(name){// Then when user clicks submit
244
+
$.post("/add-score/",{name: name,score: (correct-incorrect)},function(data){// Then when that data is successfully sent
245
+
console.info(data);
246
+
setTimeout(function(){
247
+
$.get("/get-score/",function(d){// Download the updated scoreboard
248
+
vararr=JSON.parse(d);// Parse what we've been given
249
+
$(".leaderboard").html("")// Remove old scores
250
+
for(vari=0;i<arr.length;i++){// Go through all the top 20 scores
251
+
$(".leaderboard").append("<li class='list-group-item'> "+arr[i].name+" - "+arr[i].score+" </li>")// And add them to the leaderboard
252
+
}
253
+
})
254
+
},500)
255
+
})
256
+
});
257
+
};
215
258
document.onkeyup=function(){};// Finally, set the "onkeyup" function to empty so that users can't continue playing
0 commit comments