/**
* Created by stephanep on 20.08.15.
*/
"use strict";
var test_data = {"item1": {"locator": ["A1","A2", "B1", "B2"], "type": "type1"},
"item2": {"locator": ["C5", "C6", "C7", "D5", "D6", "D7"], "type":"type2"}};
var color_map = {"type1": "green", "type2": "red"};
var current_data = {}; // this will hold the current view of the data
function render_data(data){ // called only once, during init
for(var obj in data){
color_cells(data, obj);
}
}
// The following 2 functions are only here to help compute
// the coordinates for the new positions
function ord(string) {
// discuss at: http://phpjs.org/functions/ord/
// original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// bugfixed by: Onno Marsman
// improved by: Brett Zamir (http://brett-zamir.me)
// input by: incidence
// example 1: ord('K');
// returns 1: 75
// example 2: ord('\uD800\uDC00'); // surrogate pair to create a single Unicode character
// returns 2: 65536
var str = string + '',
code = str.charCodeAt(0);
if (0xD800 <= code && code <= 0xDBFF) { // High surrogate (could change last hex to 0xDB7F to treat high private surrogates as single characters)
var hi = code;
if (str.length === 1) {
return code; // This is just a high surrogate with no following low surrogate, so we return its value;
// we could also throw an error as it is not a complete character, but someone may want to know
}
var low = str.charCodeAt(1);
return ((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000;
}
if (0xDC00 <= code && code <= 0xDFFF) { // Low surrogate
return code; // This is just a low surrogate with no preceding high surrogate, so we return its value;
// we could also throw an error as it is not a complete character, but someone may want to know
}
return code;
}
function chr(codePt) {
// discuss at: http://phpjs.org/functions/chr/
// original by: Kevin van Zonneveld...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.