paritybit.ca

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit aec24b6bbe5949774db0876776bae3145358cb42
parent e3e9ad02ff90397ac8aed1aea501f601bbbe7a4e
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Mon, 15 Apr 2019 23:20:10 -0400

Flesh out comments

Diffstat:
Mpublic/js/roll.js | 31+++++++++++++++++++++++++++----
1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/public/js/roll.js b/public/js/roll.js @@ -1,8 +1,23 @@ -// roll.js -// Created By: Jake Bauer -// 2019-03-14 -// Simple functions for rolling dice. +/*roll.js +* Copyright (C) 2019 Jake Bauer +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <https://www.gnu.org/licenses/>. +*/ +/* stringRoll() + * @brief This function rolls dice based on the input from the text-field + */ function stringRoll() { let rollString = document.getElementById("inputString").value; let result = 0; @@ -59,6 +74,10 @@ function stringRoll() { hist.innerHTML = (resultStr + "\n") + hist.innerHTML; } +/* roll() + * @brief This function rolls the dice according to which button was pressed + * @input Element The button representing which dice to roll + */ function roll(element) { let btnId = element.id; let numRolls = document.getElementById(('num'+btnId)).value; @@ -98,6 +117,10 @@ function roll(element) { hist.innerHTML = (resultStr + "\n") + hist.innerHTML; } +/* clear_history() + * @brief This function clears the history box, restting it back to default + * values while also clearing results and input boxes. + */ function clear_history() { let results = document.getElementsByTagName("p"); for (let i = 0; i < Object.keys(results).length; i++) {