JSFiddle - React, Tailwind, and code Playground

by legion28

HTML

<script src="http://bramp.net/javascript/lib/jquery/jquery.tinysort.js"></script>
<link rel="stylesheet" href="http://bramp.net/javascript/reset.css">
<title>The Wheel of Scrub Quarterbacks</title>
<body>
<div id="venues" style="display: none;"><ul/></div>
<div id="wheel">
    <div id="text">
      <h2>The Wheel of Scrub Quarterbacks</h2>
      <p>All starting week 16 QBs that are free agents in Dynasty</p>
    </div>
<canvas id="canvas" width="1000" height="600"></canvas>
</div>
<div id="stats">
<div id="counter"></div>
</div>
</body>

CSS

div#text { float: right; margin: 20px 120px 0 0; }
h2 { font-size: 36px; }

JavaScript

// Helpers
	shuffle = function(o) {
		for ( var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x)
			;
		return o;
	};

	String.prototype.hashCode = function(){
		// See http://www.cse.yorku.ca/~oz/hash.html		
		var hash = 5381;
		for (i = 0; i < this.length; i++) {
			char = this.charCodeAt(i);
			hash = ((hash<<5)+hash) + char;
			hash = hash & hash; // Convert to 32bit integer
		}
		return hash;
	}

	Number.prototype.mod = function(n) {
		return ((this%n)+n)%n;
	}

	venues = {
		"116208"  : "Chad Henne",
		"66271"   : "Jason Campbell",
		"55184"   : "Ryan Fitzpatrick",
		"392360"  : "Kellen Clemens",
		"41457"   : "Kirk Cousins",
        "398123"  : "Matt McGloin",
        "2210952" : "Thad Lewis",
        "3478953" : "*Legion*'s Choice :D",
        "4389534" : "Elliottx's Choice :("
	};

	$(function() {

		var venueContainer = $('#venues ul');
		$.each(venues, function(key, item) {
			venueContainer.append(
		        $(document.createElement("li"))
		        .append(
	                $(document.createElement("input")).attr({
                         id:    'venue-' + key
                        ,name:  item
                        ,value: item
                        ,type:  'checkbox'
                        ,checked:true
	                })
	                .change( function() {
	                	var cbox = $(this)[0];
	                	var segments = wheel.segments;
	                	var i = segments.indexOf(cbox.value);

	                	if (cbox.checked && i == -1) {
	                		segments.push(cbox.value);

	                	} else if ( !cbox.checked && i != -1 ) {
	                		segments.splice(i, 1);
	                	}

	                	segments.sort();
	                	wheel.update();
	                } )

		        ).append(
	                $(document.createElement('label')).attr({
	                    'for':  'venue-' + key
	                })
	                .text( item )
		        )
		   ...