Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

This should fix the broken-ness

  • Loading branch information...
commit 9072d7a44bfaba5a56d0958b16be2091ed0c70d7 1 parent 8874b9c
Andrew Armenia asquared authored

Showing 1 changed file with 82 additions and 2 deletions. Show diff stats Hide diff stats

  1. +82 2 public_html/scoreboard.js
84 public_html/scoreboard.js
@@ -23,6 +23,8 @@ var autocompletePenalties = [];
23 23 var clockState = { };
24 24 var lastStopTimeElapsed = 0;
25 25 var overtime_length = 5*60*10;
  26 +var down = 1;
  27 +var togo = 10;
26 28
27 29 function getText(sourceurl, callback) {
28 30 jQuery.ajax({
@@ -171,8 +173,15 @@ jQuery.fn.buildTeamControl = function() {
171 173
172 174 $(elem).find("#lockControl").click(lockControl);
173 175 $(elem).find("#unlockControl").click(unlockControl);
174   - $(elem).find("#goal").click(goalScored);
  176 +
  177 + $(elem).find("#plusOne").click(function() { addPoints.call(this, 1); });
  178 + $(elem).find("#plusTwo").click(function() { addPoints.call(this, 2); });
  179 + $(elem).find("#plusThree").click(function() { addPoints.call(this, 3); });
  180 + $(elem).find("#plusSix").click(function() { addPoints.call(this, 6); });
  181 +
175 182 $(elem).find("#shotOnGoal").click(shotTaken);
  183 + $(elem).find("#takeTimeout").click(timeoutTaken);
  184 + $(elem).find("#possession").click(possessionChange);
176 185 $(elem).find("#minorPenalty").click(function() { newPenalty.call(this, 1200); });
177 186 $(elem).find("#doubleMinorPenalty").click(function() { newPenalty.call(this, 2400); });
178 187 $(elem).find("#majorPenalty").click(function() { newPenalty.call(this, 3000); });
@@ -192,7 +201,7 @@ jQuery.fn.buildTeamControl = function() {
192 201
193 202 // and hockey
194 203 $(elem).find("#emptyNet").click(emptyNet);
195   - $(elem).find("#emptyNet").click(delayedPenalty);
  204 + $(elem).find("#delayedPenalty").click(delayedPenalty);
196 205
197 206 $(elem).find("input,select").change(function() { $(this).team().putTeamData() });
198 207
@@ -558,6 +567,19 @@ function goalScored() {
558 567 viewCommand({"goal_scored_by" : $(this).team().data('url')});
559 568 }
560 569
  570 +// addPoints
  571 +// add points to a team's score
  572 +function addPoints(points) {
  573 + $(this).team().find("#score").val(
  574 + intOrZero($(this).team().find("#score").val()) + points
  575 + );
  576 + $(this).team().putTeamData();
  577 + // trigger any kind of blinky goal animations (or whatever)
  578 + if (points >= 3) {
  579 + viewCommand({"goal_scored_by" : $(this).team().data('url')});
  580 + }
  581 +}
  582 +
561 583 function shotTaken() {
562 584 $(this).team().find("#shotsOnGoal").val(
563 585 intOrZero($(this).team().find("#shotsOnGoal").val()) + 1
@@ -601,6 +623,28 @@ function clearTeamStatus() {
601 623 $(this).team().putTeamData( );
602 624 }
603 625
  626 +function timeoutTaken() {
  627 + var tol = intOrZero($(this).team().find("#timeoutsLeft").val());
  628 + if (tol > 0) {
  629 + $(this).team().find("#timeoutsLeft").val(tol - 1);
  630 + $(this).team().putTeamData();
  631 + putJson('/status', { message : "TIMEOUT " + $(this).team().find("#name").val() });
  632 + }
  633 +}
  634 +
  635 +function possessionChange() {
  636 + var this_poss = $(this).team().find("#possession");
  637 + if (this_poss.is(':checked')) {
  638 + $(".teamControl").each( function(index) {
  639 + var other_poss = $(this).find("#possession");
  640 + if (other_poss.get(0) !== this_poss.get(0)) {
  641 + other_poss.prop('checked', false);
  642 + $(this).putTeamData();
  643 + }
  644 + } );
  645 + }
  646 +}
  647 +
604 648 // lockControl
605 649 // Toggle whether the team setup controls are locked or unlocked.
606 650 function lockControl() {
@@ -752,4 +796,40 @@ $(document).ready(function() {
752 796 $("#transitionControl #down").click(scoreboardDown);
753 797 $("#setClock").click(setClock);
754 798 $("#autoSync").change(changeAutosync);
  799 +
  800 + $("#down1").click( function() { down = 1; updateDD(); } );
  801 + $("#down2").click( function() { down = 2; updateDD(); } );
  802 + $("#down3").click( function() { down = 3; updateDD(); } );
  803 + $("#down4").click( function() { down = 4; updateDD(); } );
  804 + $("#nextDown").click( function() { if (down < 4) { down += 1; } updateDD(); } );
  805 + $("#firstAndTen").click( function() { down = 1; togo = 10; updateDD(); } );
  806 + $("#toGoG").click( function() { togo = -1; updateDD(); } );
  807 + $("#toGoI").click( function() { togo = 0; updateDD(); } );
  808 + $("#toGo1").click( function() { togo = 1; updateDD(); } );
  809 + $("#toGo2").click( function() { togo = 2; updateDD(); } );
  810 + $("#toGo3").click( function() { togo = 3; updateDD(); } );
  811 + $("#toGo4").click( function() { togo = 4; updateDD(); } );
  812 + $("#toGo5").click( function() { togo = 5; updateDD(); } );
  813 + $("#toGo6").click( function() { togo = 6; updateDD(); } );
  814 + $("#toGo7").click( function() { togo = 7; updateDD(); } );
  815 + $("#toGo8").click( function() { togo = 8; updateDD(); } );
  816 + $("#toGo9").click( function() { togo = 9; updateDD(); } );
  817 + $("#toGo10").click( function() { togo = 10; updateDD(); } );
  818 + $("#toGo11").click( function() { togo = 11; updateDD(); } );
  819 + $("#toGo12").click( function() { togo = 12; updateDD(); } );
  820 + $("#toGo13").click( function() { togo = 13; updateDD(); } );
  821 + $("#toGo14").click( function() { togo = 14; updateDD(); } );
  822 + $("#toGo15").click( function() { togo = 15; updateDD(); } );
  823 + $("#toGo16").click( function() { togo = 16; updateDD(); } );
  824 + $("#toGo17").click( function() { togo = 17; updateDD(); } );
  825 + $("#toGo18").click( function() { togo = 18; updateDD(); } );
  826 + $("#toGo19").click( function() { togo = 19; updateDD(); } );
  827 + $("#toGo20").click( function() { togo = 20; updateDD(); } );
  828 + $("#toGoMinus5").click( function() { if (togo > 5) { togo -= 5; } updateDD(); } );
  829 + $("#toGoPlus5").click( function() { togo += 5; updateDD(); } );
  830 + $("#toGoEnter").click( customToGo );
  831 + $("#showDD").click( showDD );
  832 + $("#clearDD").click( clearDD );
  833 + $("#flagDD").click( flagDD );
  834 +
755 835 });

0 comments on commit 9072d7a

Please sign in to comment.
Something went wrong with that request. Please try again.