Navigation Menu

Skip to content

Commit

Permalink
Fixed Infinite Loop Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
LikeMyBread committed Apr 23, 2015
1 parent 8dab3f5 commit b894096
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions js/generators.js
Expand Up @@ -613,11 +613,13 @@ function makeTest (seed, n) {
return someChoices(seed + 12, results, n);
}

function getSeedFromURL(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
function getSeedFromURL() {
url = window.location.href;
var n = url.lastIndexOf('?s=');
if (n == -1 || isNaN(parseInt(url.substring(n + 3)))) {
return "";
}
return url.substring(n + 3);
}

function ourSponsors(seed) {
Expand Down
2 changes: 1 addition & 1 deletion js/main.js
Expand Up @@ -4,7 +4,7 @@ var complement;
var navTop;
var topColor = "#fff";
var currentSite = window.location.href;
var gotSeed = getSeedFromURL('s');
var gotSeed = getSeedFromURL();
if (gotSeed == "") {
var newUrl = currentSite + "?s=" + seed;
location.href = newUrl;
Expand Down

0 comments on commit b894096

Please sign in to comment.