|
|
@ -28,6 +28,12 @@
|
|
|
|
// Find categories that this page is part of
|
|
|
|
// Find categories that this page is part of
|
|
|
|
var categories = findCategories(data);
|
|
|
|
var categories = findCategories(data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( categories.length > 0 && categories.length < 2){
|
|
|
|
|
|
|
|
//if we have only one category we add another one at random
|
|
|
|
|
|
|
|
var keys = Object.keys(data)
|
|
|
|
|
|
|
|
keys.splice(categories[1], 1)
|
|
|
|
|
|
|
|
categories.push(keys[Math.floor(Math.random() * keys.length)])
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Select a pseudo-randomised category for buttonA
|
|
|
|
// Select a pseudo-randomised category for buttonA
|
|
|
|
var buttonA = categories[Math.floor(Math.random() * categories.length)];
|
|
|
|
var buttonA = categories[Math.floor(Math.random() * categories.length)];
|
|
|
|