Maximiliano Guerra avatar Maximiliano Guerra committed b1e61d6 Draft

Adicionando rolador de dados

Comments (0)

Files changed (2)

   <div class="container">
     <div class="row">
       <div class="span4">
+        <form class="bs-docs" id="dice-roller">
+          <fieldset>
+            <legend>Rolador de dados</legend>
+            <button type="submit" class="btn btn-info input-block-level" style="margin-bottom: 10px">Rolar!</button>
+            <hr />
+            <div id="dice-result" class="text-center hide">
+              <span class="label label-info">Resultados:</span>
+              <span class="badge badge-info" data-id="result-one"></span>
+              <span class="badge badge-info" data-id="result-two"></span><br />
+              <span class="label label-info">Maior:</span>
+              <span class="badge badge-info" data-id="results-biggest"></span>
+            </div>
+          </fieldset>
+        </form>
+
+      </div>
+
+      <div class="span4">
         <form class="bs-docs" id="accuracy">
           <fieldset>
             <legend>Acerto</legend>
           </fieldset>
         </form>
       </div>
-      <div class="span4">
-      </div>
     </div>
 
     <hr>
+$("#dice-roller").submit(function(event) {
+    var result1 = Math.floor(Math.random() * 10) + 1;
+    var result2 = Math.floor(Math.random() * 10) + 1;
+    var biggest;
+    if (result1 >= result2)
+        biggest = result1;
+    else
+        biggest = result2;
+
+    $("#dice-roller [data-id=result-one]").text(result1);
+    $("#dice-roller [data-id=result-two]").text(result2);
+    $("#dice-roller [data-id=results-biggest]").text(biggest);
+
+    $("#dice-result").show();
+});
+
 function setSubmitHandlerBy(attribute) {
     $("#" + attribute).submit(function(event) {
         event.preventDefault();
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.