From d7213640306ea001ba14612b4b8f6bdaf0fa2042 Mon Sep 17 00:00:00 2001 From: Douglas Muth Date: Sat, 18 Feb 2017 00:03:43 -0500 Subject: [PATCH] Now doing conditional loading of Javascript based on GET method. #4 --- main.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 3bbf21e..c55bb27 100644 --- a/main.js +++ b/main.js @@ -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) { //