Skip to content

Commit

Permalink
Now doing conditional loading of Javascript based on GET method. #4
Browse files Browse the repository at this point in the history
  • Loading branch information
dmuth committed Feb 18, 2017
1 parent 6ca2567 commit d721364
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -522,10 +522,20 @@ Diceware.go = function() {

var get_data = Diceware.extractGetData(location.search);

var dice = 5;
if (get_data["dice"]) {
if (get_data["dice"] >= 5 && get_data["dice"] <= 7) {
dice = get_data["dice"];
}
}

var js = "./wordlist/wordlist-" + dice + "-dice.js";
console.log("Looks like we're loading '" + js + "'!");

//
// Load our wordlist.
//
jQuery.getScript("./wordlist/wordlist-5-dice.js").done(
jQuery.getScript(js).done(
function(data) {

//
Expand Down

0 comments on commit d721364

Please sign in to comment.