links.js
1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{% load staticfiles %}
{% load hash %}
{% load jsonify %}
var schema = new Array();
var connected = new Array();
var same = new Array();
{% for ident, connected in complement_position.items %}
connected["{{ ident }}"] = jQuery.parseJSON('{{ connected|hash:0|jsonify }}');
same["{{ ident }}"] = jQuery.parseJSON('{{ connected|hash:1|jsonify }}');
schema["{{ ident }}"] = jQuery.parseJSON('{{ connected|hash:2|jsonify }}');
{% endfor %}
var id = "";
function onClick(td_id) {
if (id) {
color(id, "", "", "", "");
}
if (id == td_id) {
id = ""
} else {
id = td_id;
color(id, "LightSteelBlue", "#E9E9E9", "#949494", "LightSteelBlue");
}
}
function color(what, how, subschema_background, subschema_text, self) {
for (i = 0; i < schema[what].length; i++) {
$('#' + schema[what][i]).css('background-color', subschema_background);
$('#' + schema[what][i]).css('color', subschema_text);
}
for (i = 0; i < connected[what].length; i++) {
$('#' + connected[what][i]).css('background-color', how);
}
for (i = 0; i < same[what].length; i++) {
$('#' + same[what][i]).css('background-color', self);
}
}