X-Git-Url: https://troll.desast.re/troll.git/blobdiff_plain/32050f92ddfeefc143c87440ac4fe6b10c78a9cb..c6dd514a31a3ddf46b63b4deffc002a03ea714a9:/src/main/resources/view/config.js diff --git a/src/main/resources/view/config.js b/src/main/resources/view/config.js index 164519f..3ac3c9a 100644 --- a/src/main/resources/view/config.js +++ b/src/main/resources/view/config.js @@ -13,14 +13,35 @@ export const modules = [ , ToggleModule ]; +function trollCase(string) { + return string.split('') + .map(c => c < 64 ? c : String.fromCharCode(c.charCodeAt(0) ^ (32 * (Math.floor(2*Math.random()))))) + .join(''); +} + +function trollToggle(toggle, title, def) { + var obj = {}; + obj['toggle'] = toggle; + obj['title'] = trollCase(title); + obj['values'] = {}; + for (var i = 3; i < arguments.length; i += 2) { + obj['values'][trollCase(arguments[i])] = arguments[i+1]; + } + obj['default'] = def; + if (def == undefined) { + if (values.length > 2) { + obj['default'] = values.length * Math.floor(2 * Math.random()); + } + else { + obj['default'] = Math.random() < 0.5; + } + } + return ToggleModule.defineToggle(obj); +} + export const options = [ - ToggleModule.defineToggle({ - toggle: 'debug', - title: 'Debug Mode', - values: { - 'on': true, - 'off': false - }, - default: false - }) + trollToggle('verboseTrolling', 'Verbose Trolling', true, + 'on', true, 'off', false), + trollToggle('debug', 'Detroll Mode', false, + 'on', true, 'off', false) ];