diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e43b0f9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.DS_Store
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..96d8792
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,20 @@
+{
+ "boss": true,
+ "curly": true,
+ "eqeqeq": true,
+ "eqnull": true,
+ "expr": true,
+ "immed": true,
+ "noarg": true,
+ "quotmark": "double",
+ "smarttabs": true,
+ "trailing": true,
+ "undef": true,
+ "unused": true,
+ "devel": true,
+ "jquery": true,
+ "globals": {
+ "$": false,
+ "document": false
+ }
+}
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..2c89ca0
--- /dev/null
+++ b/README.md
@@ -0,0 +1,95 @@
+# Tablelight
+
+## Overview
+
+Tablelight highlights cells in a table that are in a certain numerical range, allowing the user to quickly spot relevant data or significant outliers. There are two versions of Tablelight.
+
+* View a demo of Tablelight checkbox
+* View a demo of Tablelight slider
+
+### Tablelight Checkbox
+
+![checkbox screenshot](./docs/images/checkbox.png "Checkbox version")
+
+### Tablelight Slider
+
+![slider screenshot](./docs/images/slider.png "Slider version")
+
+## Dependencies
+
+To run tablelight, you will need the following:
+
+* jQuery (minimum version 1.4.1)
+* jQuery UI (minimum version - 1.7.1)
+
+## How to use
+
+### Tablelight Checkbox
+Tablelight checkbox highlights cells based on ranges selected by checkboxes. The js and css files can be found in the /checkbox directory along with a sample html file.
+
+ - /checkbox/js/tablelight_checkbox.js is the main JavaScript file
+ - /checkbox/css/tablelight_checkbox.css provides some basic default files
+
+You needs a `
` element in your html to hold the range checkboxes. The range values themselves are held in an object called tlRanges with the keys:
+
+ - tl-neg
+ - tl-a
+ - tl-b
+ - tl-c
+ - tl-d
+
+The tl-neg key-value pair is used to express negative values.
+
+The table holding the data needs a class "tl-table." Configuration occurs in the variable definitions in the .on handler near the top of the tablelight_checkbox.js file:
+
+* tableclasser - class of the data table. Default: tl-table
+* highlightbg - color value for highlighted cells. Default: #214f74
+* highlightfont - text color for highlighted cells. Default: #fff
+* lowlightbg - color of the non-selected cells. Default: transparent
+* lowlightfont - text color of the non-selected cells. Default: #222
+
+### Tablelight Slider
+
+Tablelight slider highlights cells based on ranges selected by a slider interface. The js and css files can be found in the /slider directory along with a sample html file.
+
+ - /slider/js/tablelight_slider.js is the main JavaScript file
+ - /slider/css/tablelight.slider.css provides some default files
+
+Your webpage will need a wrapper div `` for the slider and a div `` inside of it. The default range for the slider is 0 - 100. If you wish to change the min and max values for the slider, change those parameters in the $( "#tl-slider-range" ).slider( { } ) configuration.
+
+
+The table holding the data needs a class "tl-table". Configuration occurs in the variable definitions at the top of the tablelight_slider.js file:
+
+*Gradient colors*
+* colorstarter - minimum value gradient color
+* colorender - maximum value gradient color
+ * More gradients can be found at [uigradients](https://uigradients.com)
+* tableclasser - class of the data table. Default: tl-table
+* highlightbg - color value for highlighted cells. Default: #214f74
+* highlightfont - text color for highlighted cells. Default: #ffffff
+* lowlightbg - color of the non-selected cells. Default: transparent
+* lowlightfont - text color of the non-selected cells. Default: #222
+* animatespeed - speed of the highlighting animation. Default: 2000
+* grad - show gradient or just solid color. 1 for gradient, 0 for solid color
+* maxcolor - color for 100% max value color. Default: colorender
+
+## Authors
+
+The authors of TableLight are Mark Koyanagi, Rebecca Watkins, and Keith Wurst.
+
+## Acknowledgments
+
+We would like to acknowledge David Rice for the assistance and support he provided with this project.
+
+
+## License
+
+The MIT License (MIT)
+
+Copyright (c) 2018
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/checkbox/css/tablelight.checkbox.css b/checkbox/css/tablelight.checkbox.css
new file mode 100644
index 0000000..6ad75b4
--- /dev/null
+++ b/checkbox/css/tablelight.checkbox.css
@@ -0,0 +1,14 @@
+.tl-uncheck{
+ cursor: pointer;
+ display: inline-block;
+ margin: 10px 0px;
+ text-decoration: underline;
+}
+
+table.tl-table, .tl-table th, .tl-table td {
+
+ padding: 5px;
+ border-spacing: 10px;
+ border: 1px solid #000000;
+
+}
diff --git a/checkbox/index.html b/checkbox/index.html
new file mode 100644
index 0000000..ce47ed7
--- /dev/null
+++ b/checkbox/index.html
@@ -0,0 +1,156 @@
+
+
+
+
+
+
+
+ tablelight checkbox
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Click here to uncheck all
+
+
+
+
Brief table description here.
+
+
+
Name
+
Col 1
+
Col 2
+
Col 3
+
Col 4
+
Col 5
+
Col 6
+
Col 7
+
Col 8
+
Col 9
+
Col 10
+
Col 11
+
Col 12
+
+
+
+
+
Jorah
+
14
+
17
+
-8
+
9
+
-5
+
21
+
13
+
32
+
76
+
87
+
89
+
76
+
+
+
Gregor
+
31
+
73
+
-2
+
30
+
26
+
45
+
69
+
69
+
70
+
67
+
71
+
69
+
+
+
Cersei
+
27
+
0
+
14
+
23
+
22
+
42
+
76
+
76
+
86
+
90
+
91
+
90
+
+
+
Tyrion
+
-19
+
8
+
2
+
0
+
-8
+
15
+
23
+
33
+
40
+
45
+
63
+
64
+
+
+
Sansa
+
-61
+
-58
+
-8
+
-59
+
-33
+
13
+
63
+
59
+
61
+
57
+
64
+
70
+
+
+
Joffrey
+
6
+
-8
+
41
+
62
+
64
+
61
+
40
+
52
+
54
+
75
+
78
+
76
+
+
+
Bronn
+
-12
+
-45
+
-63
+
-23
+
-17
+
1
+
-35
+
-1
+
59
+
41
+
48
+
70
+
+
+
+
+
+
+
+
diff --git a/checkbox/js/tablelight.checkbox.js b/checkbox/js/tablelight.checkbox.js
new file mode 100644
index 0000000..dd66fa1
--- /dev/null
+++ b/checkbox/js/tablelight.checkbox.js
@@ -0,0 +1,64 @@
+// Licensed under the MIT license.
+
+$( function() {
+ var tlRanges = {
+ "tl-neg": "-100 to -1",
+ "tl-a": "0 to 25",
+ "tl-b": "26 to 50",
+ "tl-c": "51 to 75",
+ "tl-d": "76 to 100"
+ };
+
+ var keys = Object.keys( tlRanges );
+ var lastID = keys[ keys.length-1 ];
+
+ $.each( tlRanges, function( id,range ){
+ if( id === lastID ){
+ $( "#tl-ranges" ).append( "" );
+ }else{
+ $( "#tl-ranges" ).append( " " );
+ }
+ });//end each tlRanges
+
+ $( document ).on( "change", "#tl-ranges input", function() {
+ var idme = this.id; /*checkbox that was clicked */
+ var tableclasser = "tl-table"; /*class of the data table*/
+ var highlightbg = "#214f74"; /*the highlighted background */
+ var highlightfont = "#fff"; /*the highlighted font */
+ var lowlightbg = "transparent"; /*the lowlighted background */
+ var lowlightfont = "#222"; /*the lowlighted font */
+
+ var currentRange = tlRanges[ idme ].split( " to " );
+ var numstart = parseInt( currentRange[ 0 ] );
+ var numend = parseInt( currentRange[ 1 ] );
+
+ if ( document.getElementById( idme ).checked ) {
+ $( "."+tableclasser + " td" ).each( function( i, n ) {
+ if ( ( $( n ).text() >= numstart ) && ( $( n ).text() <= numend ) ) {
+ $( n ).stop().animate( {backgroundColor: highlightbg, color: highlightfont}, 2000 );
+ $( n ).addClass( "tl-touched" );
+ $( "th", $( n ).parents( "tr" ) ).stop().animate( {backgroundColor: highlightbg, color: highlightfont}, 2000 );
+ $( "th", $( n ).parents( "tr" ) ).addClass( "tl-touchedname" );
+ }
+ });
+ } else {
+ $( "."+tableclasser + " td" ).each( function( i, n ) {
+ if ( ( $( n ).text() >= numstart ) && ( $( n ).text() <= numend ) ) {
+ $( n ).removeClass( "tl-touched" );
+ $( n ).stop().animate( {backgroundColor: lowlightbg, color: lowlightfont}, 2000 );
+ var rowid = $( n ).closest( "tr" );
+ if ( $( rowid ).has( "td.tl-touched" ).length > 0 ) {
+ } else {
+ $( "th", $( n ).parents( "tr" ) ).stop().animate( {backgroundColor: lowlightbg, color: lowlightfont}, 2000 );
+ $( "th", $( n ).parents( "tr" ) ).removeClass( "tl-touchedname" );
+ }
+ } /* close if else on numstart numend */
+ } ); /* close ( classer ).each( function( i, n ) */
+ } /* close ( document.getElementById( idme ).checked ) */
+ } ); /* close $( document ).on( "change", "#tlRanges input", function( ) */
+
+ $( ".tl-uncheck" ).click( function(){
+ $( "#tl-ranges input" ).prop( "checked",false ).change();
+ } );//end on uncheck click
+
+} ); /* close function */
diff --git a/docs/images/checkbox.png b/docs/images/checkbox.png
new file mode 100644
index 0000000..c0aad2c
Binary files /dev/null and b/docs/images/checkbox.png differ
diff --git a/docs/images/slider.png b/docs/images/slider.png
new file mode 100644
index 0000000..523b4fe
Binary files /dev/null and b/docs/images/slider.png differ
diff --git a/slider/css/tablelight.slider.css b/slider/css/tablelight.slider.css
new file mode 100644
index 0000000..67d5922
--- /dev/null
+++ b/slider/css/tablelight.slider.css
@@ -0,0 +1,51 @@
+
+#tl-range{
+ padding-left:30px;
+}
+
+#tl-amount{
+ border:0;
+ color:#f6931f;
+ font-weight:bold;
+ font-size:16px;
+}
+
+#tl-amountmin{
+ border:0;
+ color:#f6931f;
+ font-weight:bold;
+ font-size:16px;
+ width:5ch;
+ outline: none;
+}
+
+#tl-amountmax{
+ border:0;
+ color:#f6931f;
+ font-weight:bold;
+ font-size:16px;
+ width:5ch;
+ outline: none;
+ padding-left:10px;
+ text-align:right;
+}
+
+#tl-slider-range{
+ width:300px;
+}
+
+#tl-dasher{
+ color:#f6931f;
+ font-weight:bold;
+ font-size:16px;
+}
+
+.bumper{
+ padding-bottom: 30px;
+}
+
+table.tl-table, .tl-table th, .tl-table td {
+ padding: 5px;
+ border-spacing: 10px;
+ border: 1px solid #000000;
+}
diff --git a/slider/index.html b/slider/index.html
new file mode 100644
index 0000000..6aa6479
--- /dev/null
+++ b/slider/index.html
@@ -0,0 +1,162 @@
+
+
+
+
+
+ tablelight slider
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ –
+
+
+
+
+
+
+
+
+
Brief table description here.
+
+
+
Name
+
Col 1
+
Col 2
+
Col 3
+
Col 4
+
Col 5
+
Col 6
+
Col 7
+
Col 8
+
Col 9
+
Col 10
+
Col 11
+
Col 12
+
+
+
+
+
Jorah
+
14
+
17
+
-8
+
9
+
5
+
21
+
133
+
32
+
76
+
87
+
89
+
76
+
+
+
Gregor
+
31
+
73
+
2
+
30
+
26
+
45
+
69
+
69
+
70
+
67
+
71
+
69
+
+
+
Cersei
+
27
+
0
+
14
+
23
+
22
+
42
+
76
+
76
+
86
+
90
+
91
+
90
+
+
+
Tyrion
+
19
+
8
+
2
+
0
+
8
+
15
+
23
+
33
+
40
+
45
+
63
+
64
+
+
+
Sansa
+
61
+
58
+
8
+
59
+
33
+
13
+
63
+
59
+
61
+
57
+
64
+
70
+
+
+
Joffrey
+
6
+
8
+
41
+
62
+
64
+
61
+
40
+
52
+
54
+
75
+
78
+
76
+
+
+
Bronn
+
12
+
45
+
63
+
23
+
17
+
1
+
35
+
1
+
59
+
41
+
48
+
70
+
+
+
+
+
+
+
diff --git a/slider/js/tablelight.slider.js b/slider/js/tablelight.slider.js
new file mode 100644
index 0000000..f7f8b1a
--- /dev/null
+++ b/slider/js/tablelight.slider.js
@@ -0,0 +1,185 @@
+// Licensed under the MIT license.
+
+/* Gradient: aqua marine */
+var colorstarter = "#26D0CE";
+var colorender = "#1A2980";
+/* get more gradients at https://uigradients.com */
+
+var tableclasser = "tl-table"; /*class of the data cell*/
+
+var highlightbg = "#214f74"; /*the highlighted background */
+var highlightbgname = "#214f74"; /*the highlighted background of the name cell*/
+var highlightfont = "#ffffff"; /*the color of the highlighted font */
+var lowlightbg = "transparent"; /*the lowlighted background */
+var lowlightfont = "#222"; /*the color of the lowlighted font */
+var animatespeed = 2000; /*the speed of the animation */
+var grad = 1; /*show gradient or just solid color. 1 for gradient, 0 for solid color ( highlightbg )*/
+var maxcolor = colorender; /*variable needed for 100% max color*/
+var tlMinValue = -10; /*minimum value for the slider*/
+var tlMaxValue = 300; /*maximum value for the slider*/
+
+$( function() {
+
+ $( "#tl-slider-range" ).slider( {
+ range: true,
+ min: tlMinValue,
+ max: tlMaxValue,
+ values: [tlMinValue, tlMinValue],
+ slide: function( event,ui ) {
+ $( "#tl-amountmin" ).val( ui.values[0] );
+ $( "#tl-amountmax" ).val( ui.values[1] );
+ $( "#tl-dasher" ).css( "visibility", "visible" );
+
+ },
+ stop: function( event, ui ) {
+ var lownum = ui.values[0];
+ var highnum = ui.values[1];
+
+ $( "."+tableclasser + " td" ).each( function( i, n ) {
+ if ( ( $( n ).text() >= lownum ) && ( $( n ).text() <= highnum ) ) {
+ var cellnum = $( n ).text();
+ var cellnumpercent = ( ( ( cellnum - lownum ) / ( highnum - lownum ) ) * 100 );
+ var cellnumpercentfinal = Math.round( cellnumpercent );
+ var hex = runner( cellnumpercentfinal,2 );
+
+ if ( grad === 1 ) {
+ if ( cellnumpercent !== 100 ) {
+ $( n ).stop().animate( { backgroundColor: hex, color: highlightfont}, animatespeed );
+ } else {
+ $( n ).stop().animate( { backgroundColor: maxcolor, color: highlightfont }, animatespeed );
+ }
+ } else {
+ $( n ).stop().animate( { backgroundColor: highlightbg, color: highlightfont }, animatespeed );
+ }
+
+ $( n ).addClass( "tl-touched" );
+ $( "th", $( n ).parents( "tr" ) ).stop().animate( { backgroundColor: highlightbgname, color: highlightfont }, animatespeed );
+ $( "th", $( n ).parents( "tr" ) ).addClass( "tl-touchedname" );
+ } else {
+ $( n ).removeClass( "tl-touched" );
+ $( n ).stop().animate( { backgroundColor: lowlightbg, color: lowlightfont }, animatespeed );
+ var rowid = $( n ).closest( "tr" );
+ if ( $( rowid ).has( "td.tl-touched" ).length > 0 ) {
+ } else {
+ $( "th", $( n ).parents( "tr" ) ).stop().animate( { backgroundColor: lowlightbg, color: lowlightfont }, animatespeed );
+ $( "th", $( n ).parents( "tr" ) ).removeClass( "tl-touchedname" );
+ }
+ } /* close if else on lownum highnum */
+ } ); /* close ( classer ).each( function( i, n ) */
+ } /* close stop: function( event, ui ) */
+ } ); /* close ( "#slider-range" ).slider */
+
+ $( "#tl-amountmax, #tl-amountmin" ).change( function() {
+ var whichID = $( this ).attr( "id" );
+ var maxOrMin = whichID.slice( -3 );
+ var currentVal = $( "#"+whichID ).val();
+ var currentParse = parseFloat( $( "#"+whichID ).val() );
+ var amountminParse = parseFloat( $( "#tl-amountmin" ).val() );
+ var amountmaxParse = parseFloat( $( "#tl-amountmax" ).val() );
+
+ if ( currentVal === "" ) {
+ alert( "Range values cannot be empty." );
+ setTempVals( amountminParse,amountmaxParse,maxOrMin );
+ }else if ( isNaN( currentParse ) ) {
+ alert( "The value must be a number." );
+ setTempVals( amountminParse,amountmaxParse,maxOrMin );
+ }//end check for empty or NaN
+
+ if ( currentParse < tlMinValue || currentParse > tlMaxValue ) {
+ alert( "The value must be between "+tlMinValue+" and "+tlMaxValue+"." );
+ setTempVals( amountminParse,amountmaxParse,maxOrMin );
+ }//end check for between min and max
+
+ if ( amountmaxParse < amountminParse ) {
+ alert( "The maximum range value must be greater than or equal to the minimum range value." );
+ setTempVals( amountminParse,amountmaxParse,maxOrMin );
+ }//end check for min greater than max
+
+ colorize();
+ } );//end change #amountmax
+} ); /* close function */
+
+function setTempVals( minVal,maxVal,whichVal ) {
+ if ( whichVal === "min" ) {
+ if ( maxVal >= ( tlMinValue+10 ) ) {
+ $( "#tl-amountmin" ).val( maxVal-10 );
+ }else{
+ $( "#tl-amountmin" ).val( tlMinValue );
+ $( "#tl-amountmax" ).val( tlMinValue+10 );
+ }//end check amountmax
+ }else{
+ if ( minVal >= (tlMaxValue-10) ) {
+ $( "#tl-amountmax" ).val( tlMaxValue );
+ $( "#tl-amountmin" ).val( tlMaxValue-10 );
+ }else{
+ $( "#tl-amountmax" ).val( minVal+10 );
+ }//end check amountmin
+ }//end find out which value to reset
+}//end setTempVals
+
+function colorize() {
+ var newmin = $( "#tl-amountmin" ).val();
+ var newmax = $( "#tl-amountmax" ).val();
+ $( "#tl-slider-range" ).slider( "values", 0, newmin );
+ $( "#tl-slider-range" ).slider( "values", 1, newmax );
+ $( "#tl-dasher" ).css( "visibility", "visible" );
+ var $sliderid = $( "#tl-slider-range" );
+ $sliderid.slider( "option", "stop" )( null, { values: $sliderid.slider( "values" ) } );
+}//end colorize
+
+function rgbToHex( r, g, b ) {
+ if ( r > 255 || g > 255 || b > 255 ) {
+ throw "Invalid color component";
+ }
+ return ( ( r << 16 ) | ( g << 8 ) | b ).toString( 16 );
+}
+
+function runner( xer,yer ) {
+ var x = xer;
+ var y = yer;
+ var c = $( "#palette" )[ 0 ].getContext( "2d" );
+ var p = c.getImageData( x, y, 1, 1 ).data;
+ var hexr = "#" + ( "000000" + rgbToHex( p[ 0 ], p[ 1 ], p[ 2 ] ) ).slice( -6 );
+ return hexr;
+}
+
+$( document ).ready( function () {
+ var colorCanvas = $( "",{ "id":"palette" } ).width( 100 ).height( 100 ).hide();
+ $( "body" ).prepend( colorCanvas );
+
+ var colorstart = colorstarter;
+ var colorstop = colorender;
+ var palette = document.getElementById( "palette" );
+ var context = palette.getContext( "2d" );
+
+ context.rect( 0, 0, palette.width, palette.height );
+
+ var grd = context.createLinearGradient( 0.000, 50.000, 100.000, 50.000 );
+
+ grd.addColorStop( 0, colorstart );
+ grd.addColorStop( 1, colorstop );
+ context.fillStyle = grd;
+ context.fill();
+
+ var colorstartranger = colorstarter;
+ var colorstopranger = colorender;
+
+ $( ".ui-slider-horizontal .ui-state-default:first-of-type" ).css( "background",colorstartranger );
+ $( ".ui-slider-horizontal .ui-state-default:last-of-type" ).css( "background",colorstopranger );
+
+ /* Chrome, Safari, Opera */
+ $( ".ui-slider-range" ).css( "background", "-webkit-gradient( linear, left top, right top, color-stop( 0%,"+colorstartranger+" ), color-stop( 100%,"+colorstopranger+" ) )" );
+
+ /* FireFox */
+$( ".ui-slider-range" ).css( "background", "-moz-linear-gradient( left, "+colorstartranger+" 0%, "+colorstopranger+" 100% )" );
+
+ /* IE 10+ */
+ $( ".ui-slider-range" ).css( "background", "-ms-linear-gradient( left, "+colorstartranger+" 0%, "+colorstopranger+" 100% )" );
+
+ /* IE 9 */
+ $( ".ui-slider-range" ).css( "filter", "progid:DXImageTransform.Microsoft.gradient( startColorstr="+colorstartranger+", endColorstr="+colorstopranger+", GradientType=1 )" );
+
+ /* W3C */
+ $( ".ui-slider-range" ).css( "background", "linear-gradient( left, "+colorstartranger+" 0%, "+colorstopranger+" 100% )" );
+
+} );