JSFiddle - React, Tailwind, and code Playground
by loren_hibbard
CSS
body{
margin:0px;
background-color:#ebebeb;
font-size:4pt;
}
.pixel{
width:48px;
height:48px;
border-radius:40px;
font-size:5pt;
}
.fl{
float:left;
}
.cb{
width:0px;
height:0px;
clear:both;
}
.break{
}
JavaScript
/*
author: Tim Down
source: http://stackoverflow.com/a/4257739/1252748
*/
function hasClass(el, cssClass) {
return el.className && new RegExp("(^|\\s)" + cssClass + "(\\s|$)").test(el.className);
}
function checkVisibility(id) {
console.log(id);
}
function timeFunction(current, element) {
var elementId = element.id;
/*
author: Remy Sharp
source: http://twitter.com/#!/rem/status/15427387974
*/
var color = '#' + (~~ (Math.random() * 16777215)).toString(16);
var border = '#' + (~~ (Math.random() * 16777215)).toString(16);
console.log(color);
$('#' + elementId).css("backgroundColor", color);
$('#' + elementId).css("border", "1px solid " + border);
}
function randomFromInterval(from, to, qty) {
/*
author: Francisc
source: http://stackoverflow.com/a/7228322/1252748
*/
var arr = [];
for (var i=0; i <= qty; i++) {
arr[i] = Math.floor(Math.random() * (to - from + 1) + from);
}
return arr;
}
function getDelayArray(qty) {
var from = 100;
var to = 10000;
var delayArray = randomFromInterval(from, to, qty);
return delayArray;
}
function filterUndefinedRecordsInArray(arr) {
/*
author: vsync
source: http://stackoverflow.com/a/2843625/1252748
*/
//arr = arr.filter(function(){return true});
arr = arr.filter(Number);
return arr;
}
//remove non-numbers
function only_numbers(str) {
//remove non-numbers
/*
author: csj
source: http://stackoverflow.com/a/1862219/1252748
*/
str = str.replace(/\D/g,'');
return str;
}
function getColors() {
var colors = randomFromInterval(0, 255, 3);
var r = colors[0];
var g = colors[1];
var b = colors[2];
//random alpha
var a = (Math.random()).toFixed(2);
var c = {
r: r,
g: g,
b: b,
a: a,
}
...