cockpit/js/instance.js in cpee-1.3.181 vs cockpit/js/instance.js in cpee-1.3.183
- old
+ new
@@ -1,16 +1,17 @@
var ws;
var running = false;
-var graphrealization;
var subscription;
var subscription_state = 'less';
var save = {};
save['state']= undefined;
save['dsl'] = undefined;
save['endpoints'] = undefined;
save['dataelements'] = undefined;
+ save['attributes'] = undefined;
save['details'] = undefined;
+ save['details_target'] = undefined;
var node_state = {};
var sub_more = 'topic' + '=' + 'activity' + '&' +// {{{
'events' + '=' + 'calling,status,manipulating,failed,done' + '&' +
'topic' + '=' + 'activity' + '&' +
'votes' + '=' + 'syncing_after' + '&' +
@@ -65,12 +66,12 @@
$("button[name=savesvg]").click(function(){ save_svg(); });
$("input[name=votecontinue]").click(check_subscription);
$("input[name=testsetfile]").change(load_testsetfile_after);
$("input[name=modelfile]").change(load_modelfile_after);
- $.ajax({
- url: "testsets/testsets.xml",
+ $.ajax({
+ url: "testsets/testsets.xml",
dataType: 'xml',
success: function(res){
$('testset',res).each(function(){
var ts = $(this).text();
$('#predefinedtestsets').append($("<div class='menuitem'></div>").text(ts));
@@ -92,15 +93,15 @@
} else if (q.monitor) {
$("input[name=instance-url]").val(q.monitor);
ui_activate_tab("#tabexecution");
// ui_toggle_vis_tab($("#instance td.switch"));
monitor_instance(false);
- }
+ }
}
});
- $.ajax({
- url: "testsets/transformations.xml",
+ $.ajax({
+ url: "testsets/transformations.xml",
dataType: 'xml',
success: function(res){
$('transformation',res).each(function(){
var ts = $(this).text();
$('#modeltypes').append($("<div class='menuitem'></div>").text(ts));
@@ -113,67 +114,67 @@
var url = $("#current-instance").text();
var num = 0;
if ($("input[name=votecontinue]").is(':checked')) num += 1;
if (num > 0 && subscription_state == 'less') {
$.ajax({
- type: "PUT",
+ type: "PUT",
url: url + "/notifications/subscriptions/" + subscription,
data: (
- 'message-uid' + '=' + 'xxx' + '&' +
sub_more + '&' +
+ 'message-uid' + '=' + 'xxx' + '&' +
'fingerprint-with-producer-secret' + '=' + 'xxx'
)
});
subscription_state = 'more';
- }
+ }
if (num == 0 && subscription_state == 'more') {
$.ajax({
- type: "PUT",
+ type: "PUT",
url: url + "/notifications/subscriptions/" + subscription,
data: (
- 'message-uid' + '=' + 'xxx' + '&' +
sub_less + '&' +
+ 'message-uid' + '=' + 'xxx' + '&' +
'fingerprint-with-producer-secret' + '=' + 'xxx'
)
- });
+ });
subscription_state = 'less';
format_visual_vote_clear();
- }
+ }
}// }}}
function create_instance(ask) {// {{{
var info = ask ? ask: prompt("Instance info?", "Enter info here");
if (info != null) {
if (info.match(/\S/)) {
var base = $("input[name=base-url]").val();
$.ajax({
- type: "POST",
+ type: "POST",
url: base,
dataType: "text",
- data: "info=" + info,
+ data: "info=" + info,
success: function(res){
$("input[name=instance-url]").val((base + "//" + res + "/").replace(/\/+/g,"/").replace(/:\//,"://"));
if (ask) monitor_instance(true);
- },
+ },
error: function(a,b,c) {
alert("No CPEE running.");
}
});
} else {
alert("An instance info is necessary!");
}
- }
+ }
}// }}}
-
+
function monitor_instance(load) {// {{{
var url = $("input[name=instance-url]").val();
$('.tabbehind button').hide();
$('#dat_details').empty();
$.ajax({
- type: "GET",
+ type: "GET",
url: url + "/properties/schema/",
success: function(res){
$("ui-tabbed.hidden, ui-rest.hidden").removeClass("hidden");
$("ui-resizehandle.hidden").removeClass("hidden");
$("ui-tabbed ui-tab.hidden, ui-rest ui-tab.hidden").removeClass("hidden");
@@ -192,19 +193,19 @@
// Change url to return to current instance when reloading (because new subscription is made)
$("input[name=votecontinue]").removeAttr('checked');
subscription_state = 'less';
$.ajax({
- type: "POST",
+ type: "POST",
url: url + "/notifications/subscriptions/",
data: sub_less,
success: function(res){
res = res.unserialize();
$.each(res,function(a,b){
if (b[0] == 'key') {
subscription = b[1];
- }
+ }
});
append_to_log("monitoring", "id", subscription);
var Socket = "MozWebSocket" in window ? MozWebSocket : WebSocket;
if (ws) ws.close();
ws = new Socket(url.replace(/http/,'ws') + "/notifications/subscriptions/" + subscription + "/ws/");
@@ -214,21 +215,22 @@
ws.onmessage = function(e) {
data = $.parseXML(e.data);
if ($('event > topic',data).length > 0) {
switch($('event > topic',data).text()) {
case 'dataelements':
- monitor_instance_dataelements();
+ monitor_instance_values("dataelements");
break;
case 'description':
monitor_instance_dsl();
break;
case 'endpoints':
- monitor_instance_endpoints();
+ monitor_instance_values("endpoints");
break;
case 'attributes':
- monitor_instance_attributes();
+ monitor_instance_values("attributes");
monitor_instance_transformation();
+ monitor_graph_change();
break;
case 'state':
monitor_instance_state_change(JSON.parse($('event > notification',data).text()).state);
break;
case 'position':
@@ -245,118 +247,79 @@
}
if ($('vote > topic',data).length > 0) {
var notification = $('vote > notification',data).text();
append_to_log("vote", $('vote > topic',data).text() + "/" + $('vote > vote',data).text(), notification);
monitor_instance_vote_add(notification);
- }
+ }
};
ws.onclose = function() {
append_to_log("monitoring", "closed", "server down i assume.");
};
if (load) load_testset();
}
});
- monitor_instance_dataelements();
- monitor_instance_endpoints();
- monitor_instance_attributes();
+ monitor_instance_values("dataelements");
+ monitor_instance_values("endpoints");
+ monitor_instance_values("attributes");
monitor_instance_transformation();
monitor_instance_dsl();
monitor_instance_state();
},
error: function(a,b,c) {
alert("This ain't no CPEE instance");
ui_activate_tab("#tabnew");
}
- });
+ });
}// }}}
-function monitor_instance_dataelements() {// {{{
+function monitor_instance_values(val) {// {{{
var url = $("#current-instance").text();
$.ajax({
- type: "GET",
- url: url + "/properties/values/dataelements/",
+ type: "GET",
+ url: url + "/properties/values/" + val + "/",
success: function(res){
- var values = $("value > *",res);
- var temp = {};
- values.each(function() {
- temp[this.nodeName] = format_text($(this).text());
- });
- var temp_xml = serialize_hash(temp);
-
- if (temp_xml != save['dataelements']) {
- save['dataelements'] = temp_xml;
- var ctv = $("#dat_dataelements");
- ctv.empty();
- $.each(temp,function(a,b){
- var node = $("#dat_template_pair tr").clone(true);
- $('.pair_name',node).val(a);
- $('.pair_value',node).val(b);
- ctv.append(node);
- });
- }
+ save[val].content(res);
}
- });
+ });
} // }}}
-function monitor_instance_endpoints() {// {{{
- var url = $("#current-instance").text();
- $.ajax({
- type: "GET",
- url: url + "/properties/values/endpoints/",
- success: function(res){
- var values = $("value > *",res);
- var temp = {}
- values.each(function(){
- temp[this.nodeName] = $(this).text();
+function adaptor_init(url,theme,dslx) {
+ new WfAdaptor($('body').data('theme-base') + '/' + theme + '/theme.js',function(graphrealization){
+ graphrealization.set_svg_container($('#graphcanvas'));
+ graphrealization.set_description($(dslx), true);
+ graphrealization.notify = function(svgid) {
+ $.ajax({
+ type: "PUT",
+ url: url + "/properties/values/description/",
+ data: ({'content': '<content>' + graphrealization.get_description() + '</content>'})
});
- var temp_xml = serialize_hash(temp);
-
- if (temp_xml != save['endpoints']) {
- save['endpoints'] = temp_xml;
- var ctv = $("#dat_endpoints");
- ctv.empty();
- $.each(temp,function(a,b){
- var node = $("#dat_template_pair tr").clone(true);
- $('.pair_name',node).val(a);
- $('.pair_value',node).val(b);
- ctv.append(node);
- });
- ctv.append(temp);
- }
- }
+ manifestation.events.click(svgid,undefined);
+ };
+ monitor_instance_pos();
});
-}// }}}
+}
-function monitor_instance_attributes() {// {{{
+function monitor_graph_change() {
var url = $("#current-instance").text();
$.ajax({
- type: "GET",
- url: url + "/properties/values/attributes/",
- success: function(res){
- var values = $("value > *",res);
- var temp = {}
- values.each(function(){
- temp[this.nodeName] = $(this).text();
+ type: "GET",
+ url: url + "/properties/values/dslx/",
+ success: function(dslx){
+ $.ajax({
+ type: "GET",
+ url: url + "/properties/values/attributes/theme/",
+ success: function(res){
+ adaptor_init(url,$('value',res).text(),dslx);
+ },
+ error: function() {
+ adaptor_init(url,'default',dslx);
+ }
});
- var temp_xml = serialize_hash(temp);
-
- if (temp_xml != save['attributes']) {
- save['attributes'] = temp_xml;
- var ctv = $("#dat_attributes");
- ctv.empty();
- $.each(temp,function(a,b){
- var node = $("#dat_template_pair tr").clone(true);
- $('.pair_name',node).val(a);
- $('.pair_value',node).val(b);
- ctv.append(node);
- });
- ctv.append(temp);
- }
}
});
-}// }}}
+}
function monitor_instance_dsl() {// {{{
var url = $("#current-instance").text();
$.ajax({
type: "GET",
@@ -371,46 +334,31 @@
res = format_code(res,false,true);
res = res.replace(/activity\s+:([A-Za-z][a-zA-Z0-9_]+)/g,"<span class='activities' id=\"activity-$1\">activity :$1</span>");
res = res.replace(/activity\s+\[:([A-Za-z][a-zA-Z0-9_]+)([^\]]*\])/g,"<span class='activities' id=\"activity-$1\">activity [:$1$2</span>");
ctv.append(res);
-
- $.ajax({
- type: "GET",
- url: url + "/properties/values/dslx/",
- success: function(res){
- graphrealization = new WfAdaptor(CPEE);
- graphrealization.set_svg_container($('#graphcanvas'));
- graphrealization.set_description($(res), true);
- graphrealization.notify = function(svgid) {
- console.log('rrr');
- save_description();
- manifestation.events.click(svgid,undefined);
- };
- monitor_instance_pos();
- }
- });
+ monitor_graph_change();
}
}
});
}// }}}
function monitor_instance_state() {// {{{
var url = $("#current-instance").text();
$.ajax({
- type: "GET",
+ type: "GET",
url: url + "/properties/values/state/",
dataType: "text",
success: function(res){
monitor_instance_state_change(res);
}
});
}// }}}
function monitor_instance_transformation() {// {{{
var url = $("#current-instance").text();
$.ajax({
- type: "GET",
+ type: "GET",
url: url + "/properties/values/attributes/modeltype",
success: function(res){
$("#currentmodel").text($(res.documentElement).text());
},
error: function() {
@@ -420,11 +368,11 @@
}// }}}
function monitor_instance_pos() {// {{{
var url = $("#current-instance").text();
$.ajax({
- type: "GET",
+ type: "GET",
url: url + "/properties/values/positions/",
success: function(res){
var values = $("value > *",res);
format_visual_clear();
values.each(function(){
@@ -444,23 +392,23 @@
format_visual_remove(parts.activity,"active")
} // }}}
function monitor_instance_state_change(notification) { //{{{
if (notification == "ready" || notification == "stopped" || notification == "running") {
$("#state button").removeAttr('disabled');
- }
+ }
if (notification != save['state']) {
save['state'] = notification;
var ctv = $("#state");
ctv.empty();
if (notification == "stopped") {
monitor_instance_pos();
- }
+ }
if (notification == "running") {
format_visual_clear();
- }
+ }
var but = "";
if (notification == "ready" || notification == "stopped") {
but = " ⇒ <button onclick='$(this).attr(\"disabled\",\"disabled\");start_instance();'>start</button> / <button onclick='$(this).attr(\"disabled\",\"disabled\");sim_instance();'>simulate</button>";
}
@@ -470,25 +418,25 @@
if (notification == "finished") {
$('.tabbehind button').hide();
} else {
$('#parameters .tabbehind button').show();
- }
+ }
ctv.append(notification + but);
}
} //}}}
function monitor_instance_pos_change(notification) {// {{{
var parts = JSON.parse(notification);
if (parts['unmark']) {
$.each(parts['unmark'],function(a,b){
- format_visual_remove(b,"passive")
+ format_visual_remove(b,"passive")
});
}
if (parts['at']) {
$.each(parts['at'],function(a,b){
- format_visual_add(b,"passive")
+ format_visual_add(b,"passive")
});
}
} // }}}
function monitor_instance_vote_add(notification) {// {{{
@@ -502,11 +450,11 @@
format_visual_add(parts.activity,"vote")
}// }}}
function monitor_instance_vote_remove(activity,callback,value) {//{{{
var url = $("#current-instance").text();
$.ajax({
- type: "PUT",
+ type: "PUT",
url: url + "/callbacks/" + callback,
data: ({'continue': value}),
error: report_failure
});
format_visual_remove(activity,"vote");
@@ -514,29 +462,29 @@
}//}}}
function start_instance() {// {{{
var url = $("#current-instance").text();
$.ajax({
- type: "PUT",
+ type: "PUT",
url: url + "/properties/values/state",
data: ({value: "running"}),
error: report_failure
});
}// }}}
function sim_instance() {// {{{
var url = $("#current-instance").text();
$.ajax({
- type: "PUT",
+ type: "PUT",
url: url + "/properties/values/state",
data: ({value: "simulating"}),
error: report_failure
});
}// }}}
function stop_instance() {// {{{
var url = $("#current-instance").text();
$.ajax({
- type: "PUT",
+ type: "PUT",
url: url + "/properties/values/state",
data: ({value: "stopping"}),
error: report_failure
});
}// }}}
@@ -544,60 +492,60 @@
function save_testset() {// {{{
var base = $("#current-instance").text();
var testset = $X('<testset/>');
$.ajax({
- type: "GET",
+ type: "GET",
url: base + "/properties/values/dataelements/",
success: function(res){
var pars = $X('<dataelements/>');
pars.append($(res.documentElement).children());
testset.append(pars);
$.ajax({
- type: "GET",
+ type: "GET",
url: base + "/properties/values/handlerwrapper/",
success: function(res){
var pars = $X('<handlerwrapper>' + res + '</handlerwrapper>');
testset.append(pars);
$.ajax({
- type: "GET",
+ type: "GET",
url: base + "/properties/values/endpoints/",
success: function(res){
var pars = $X('<endpoints/>');
pars.append($(res.documentElement).children());
testset.append(pars);
$.ajax({
- type: "GET",
+ type: "GET",
url: base + "/properties/values/positions/",
success: function(res){
var pars = $X('<positions/>');
pars.append($(res.documentElement).children());
testset.append(pars);
$.ajax({
- type: "GET",
+ type: "GET",
url: base + "/properties/values/dslx/",
success: function(res){
var pars = $X('<description/>');
pars.append($(res.documentElement));
testset.append(pars);
pars = $X('<transformation><description type="copy"/><dataelements type="none"/><endpoints type="none"/></transformation>');
testset.append(pars);
$.ajax({
- type: "GET",
+ type: "GET",
url: base + "/properties/values/attributes/",
success: function(res){
var name = $("value > info",res).text();
var pars = $X('<attributes/>');
pars.append($(res.documentElement).children());
testset.append(pars);
$('#savetestset').attr('download',name + '.xml');
$('#savetestset').attr('href','data:application/xml;charset=utf-8;base64,' + window.btoa(testset.serializeXML()));
document.getElementById('savetestset').click();
- },
+ },
error: report_failure
});
- },
+ },
error: report_failure
});
},
error: report_failure
});
@@ -607,42 +555,42 @@
},
error: report_failure
});
},
error: report_failure
- });
-}// }}}
+ });
+}// }}}
function save_svg() {// {{{
var base = $("#current-instance").text();
var params = { mimetype: 'image/svg+xml' };
var gc = $('#graphcanvas').clone();
$.ajax({
- type: "GET",
+ type: "GET",
url: "lib/wfadaptor.css",
success: function(res){
gc.prepend($X('<style xmlns="http://www.w3.org/2000/svg" type="text/css"><![CDATA[' + res + ']]></style>'));
$.ajax({
- type: "GET",
+ type: "GET",
url: base + "/properties/values/attributes/info/",
success: function(res){
var name = $(res.documentElement).text();
$('#savesvg').attr('download',name + '.svg');
$('#savesvg').attr('href','data:application/xml;charset=utf-8;base64,' + window.btoa(gc.serializeXML()));
document.getElementById('savesvg').click();
- },
+ },
error: report_failure
});
- }
+ }
});
}// }}}
function set_testset(testset) {// {{{
var url = $("#current-instance").text();
$.ajax({
- type: "GET",
+ type: "GET",
url: url + "/notifications/subscriptions/",
success: function(res){
var rcount = 0;
var values = $("subscriptions > subscription[url]",res);
var vals = [];
@@ -650,11 +598,11 @@
vals.push($(this).attr('url'));
});
load_testset_handlers(url,testset,vals);
},
error: report_failure
- });
+ });
load_testset_dataelements(url,testset);
load_testset_attributes(url,testset);
load_testset_endpoints(url,testset);
load_testset_pos(url,testset);
@@ -664,30 +612,30 @@
$("testset > transformation > *",testset).each(function(){
ser += $(this).serializeXML() + "\n";
});
var val = "<content>" + ser + "</content>";
$.ajax({
- type: "PUT",
+ type: "PUT",
url: url + "/properties/values/transformation",
data: ({content: val}),
- success: function() {
- load_testset_des(url,testset);
+ success: function() {
+ load_testset_des(url,testset);
},
error: report_failure
});
} else {
- load_testset_des(url,testset);
+ load_testset_des(url,testset);
}
-
+
load_testset_hw(url,testset);
$.ajax({
- type: "GET",
+ type: "GET",
url: url + "/properties/values/state/",
dataType: "text",
success: function(res){
$.ajax({
- type: "PUT",
+ type: "PUT",
url: url + "/properties/values/state",
data: ({value: res}),
error: report_failure
});
}
@@ -698,19 +646,19 @@
if (running) return;
running = true;
if (typeof window.FileReader !== 'function') {
alert('FileReader not yet supportet');
return;
- }
+ }
var files = $('#testsetfile').get(0).files;
var reader = new FileReader();
reader.onload = function(){
set_testset($.parseXML(reader.result));
running = false;
- }
- reader.onerror = function(){ running = false; }
- reader.onabort = function(){ running = false; }
+ }
+ reader.onerror = function(){ running = false; }
+ reader.onabort = function(){ running = false; }
reader.readAsText(files[0]);
} //}}}
function load_testsetfile() {// {{{
if (running) return;
document.getElementById('testsetfile').click();
@@ -720,20 +668,20 @@
if (running) return;
running = true;
if (typeof window.FileReader !== 'function') {
alert('FileReader not yet supportet');
return;
- }
+ }
var files = $('#modelfile').get(0).files;
var reader = new FileReader();
reader.onload = function(){
var url = $("#current-instance").text();
load_des(url,reader.result);
running = false;
- }
- reader.onerror = function(){ running = false; }
- reader.onabort = function(){ running = false; }
+ }
+ reader.onerror = function(){ running = false; }
+ reader.onabort = function(){ running = false; }
reader.readAsText(files[0]);
} //}}}
function load_modelfile() {// {{{
if (running) return;
document.getElementById('modelfile').click();
@@ -742,15 +690,15 @@
function load_testset() {// {{{
if (running) return;
running = true;
var name = $("#predefinedtestsets div.menuitem[data-selected=selected]").text();
- $.ajax({
+ $.ajax({
cache: false,
dataType: 'xml',
url: "testsets/" + name + ".xml",
- success: function(res){
+ success: function(res){
save['dsl'] = null; // reload dsl and position under all circumstances
$('#main .tabbehind button').hide();
$('#dat_details').empty();
document.title = name;
@@ -763,19 +711,19 @@
}// }}}
function load_modeltype() {// {{{
if (running) return;
var url = $("#current-instance").text();
running = true;
-
+
var name = $("#modeltypes div.menuitem[data-selected=selected]").text();
- $.ajax({
+ $.ajax({
cache: false,
dataType: 'xml',
url: "testsets/" + name + ".xml",
- success: function(res){
+ success: function(res){
$.ajax({
- type: "PUT",
+ type: "PUT",
url: url + "/properties/values/attributes/modeltype",
data: ({value: name}),
success: function(){
set_testset(res);
},
@@ -790,11 +738,11 @@
function load_des(url,model) { //{{{
model = model.replace(/<\?[^\?]+\?>/,'');
var val = "<content>" + model + "</content>";
$.ajax({
- type: "PUT",
+ type: "PUT",
url: url + "/properties/values/description",
data: ({content: val}),
error: report_failure
});
} //}}}
@@ -809,11 +757,11 @@
} // }}}
function load_testset_hw(url,testset) {// {{{
$("testset > handlerwrapper",testset).each(function(){
var val = $(this).text();
$.ajax({
- type: "PUT",
+ type: "PUT",
url: url + "/properties/values/handlerwrapper",
data: ({value: val}),
error: report_failure
});
});
@@ -824,11 +772,11 @@
$("testset > dataelements > *",testset).each(function(){
ser += $(this).serializeXML() + "\n";
});
var val = "<content>" + ser + "</content>";
$.ajax({
- type: "PUT",
+ type: "PUT",
url: url + "/properties/values/dataelements",
data: ({content: val}),
error: report_failure
});
}// }}}
@@ -838,11 +786,11 @@
$("testset > attributes > *",testset).each(function(){
ser += $(this).serializeXML() + "\n";
});
var val = "<content>" + ser + "</content>";
$.ajax({
- type: "PUT",
+ type: "PUT",
url: url + "/properties/values/attributes",
data: ({content: val}),
error: report_failure
});
}// }}}
@@ -852,30 +800,30 @@
$("testset > endpoints > *",testset).each(function(){
ser += $(this).serializeXML() + "\n";
});
var val = "<content>" + ser + "</content>";
$.ajax({
- type: "PUT",
+ type: "PUT",
url: url + "/properties/values/endpoints/",
data: ({content: val}),
error: report_failure
- });
+ });
}// }}}
function load_testset_pos(url,testset) {// {{{
if ($("testset > positions",testset).length == 0) { return; }
var ser = '';
$("testset > positions > *",testset).each(function(){
ser += $(this).serializeXML() + "\n";
});
var val = "<content>" + ser + "</content>";
$.ajax({
- type: "PUT",
+ type: "PUT",
url: url + "/properties/values/positions/",
data: ({content: val}),
success: monitor_instance_pos,
error: report_failure
- });
+ });
}// }}}
function load_testset_handlers(url,testset,vals) {// {{{
$("testset > handlers > *",testset).each(function(){
var han = this;
var suburl = $(han).attr('url');
@@ -884,11 +832,11 @@
$("*",han).each(function(){
inp += "&topic=" + $(this).attr('topic');
inp += "&" + this.nodeName + "=" + $(this).text();
});
$.ajax({
- type: "POST",
+ type: "POST",
url: url + "/notifications/subscriptions/",
data: inp
});
}
});
@@ -910,57 +858,57 @@
node_state[what][cls] -= 1;
format_visual_set(what);
}//}}}
function format_visual_set(what) {//{{{
if (node_state[what] != undefined) {
- if (node_state[what]['vote'] == undefined) node_state[what]['vote'] = 0;
- if (node_state[what]['active'] == undefined) node_state[what]['active'] = 0;
- if (node_state[what]['passive'] == undefined) node_state[what]['passive'] = 0;
+ if (node_state[what]['vote'] == undefined) node_state[what]['vote'] = 0;
+ if (node_state[what]['active'] == undefined) node_state[what]['active'] = 0;
+ if (node_state[what]['passive'] == undefined) node_state[what]['passive'] = 0;
var votes = node_state[what]['vote'];
var actives = node_state[what]['active'];
var passives = node_state[what]['passive'];
if (actives > 0 && votes > 0)
$('g[element-id="' + what + '"] .super .colon').each(function(a,b){
b.setAttribute('class','colon necessary');
});
- else
+ else
$('g[element-id="' + what + '"] .super .colon').each(function(a,b){
b.setAttribute('class','colon');
});
if (actives > 0)
$('g[element-id="' + what + '"] .super .active').each(function(a,b){
b.setAttribute('class','active necessary');
var txt = b.childNodes[0];
txt.nodeValue = actives;
});
- else
+ else
$('g[element-id="' + what + '"] .super .active').each(function(a,b){
b.setAttribute('class','active');
});
if (votes > 0)
$('g[element-id="' + what + '"] .super .vote').each(function(a,b){
b.setAttribute('class','vote necessary');
var txt = b.childNodes[0];
txt.nodeValue = votes;
});
- else
+ else
$('g[element-id="' + what + '"] .super .vote').each(function(a,b){
b.setAttribute('class','vote');
});
$.each(['#activity-' + what, 'g[element-id="' + what + '"] g'],function(i,t){
- $(t).each(function(a,b){
+ $(t).each(function(a,b){
if (actives > 0) vs = 'active';
else if (votes > 0) vs = 'vote';
else if (passives > 0) vs = 'passive';
else vs = '';
b.setAttribute("class",'activities ' + vs);
});
});
- }
+ }
}//}}}
function format_visual_clear() {//{{{
node_state = {};
$('.super .active').each(function(a,b){b.setAttribute("class","active");});
@@ -1000,13 +948,13 @@
l++;
}
res = res.replace(/ /g,"  ");
res = res.replace(/\n$/g,"\n<div> ");
res = res.replace(/\n|$/g,"</div>\n");
- }
+ }
} catch(e) {
alert(e.toString());
- }
+ }
return res;
}// }}}
function format_text(res) {// {{{
res = res.replace(/&/g,'&');
res = res.replace(/</g,'<');