Commit df98e8a5 authored by Marc Duez's avatar Marc Duez

germline_builder.js : convert(again) germlines.data from json to js / and add...

germline_builder.js : convert(again) germlines.data from json to js /  and add fallback for offline mode
parent d1b73424
......@@ -51,6 +51,7 @@
<script type="text/javascript" src='js/menu.js'></script>
<script type="text/javascript" src='js/dbscan.js'></script>
<script type="text/javascript" src='js/germline.js'></script>
<script type="text/javascript" src='../germline/germlines.data'></script>
<script type="text/javascript" src='js/germline_builder.js'></script>
<script type="text/javascript" src='js/segmenter.js'></script>
<script type="text/javascript" src='js/model.js'></script>
......
......@@ -677,7 +677,7 @@ Builder.prototype = {
span.className = "systemBox";
if ((typeof system != 'undefined')){
span.appendChild(document.createTextNode(this.m.germlineList.getShortcut(system)));
if (this.m.system_selected.indexOf(system) == -1)
if (this.m.system_selected.indexOf(system) != -1)
span.style.background = this.m.germlineList.getColor(system)
span.title = system
}else{
......
......@@ -18,8 +18,8 @@
*/
function GermlineList () {
this.init()
this.list = {}
this.init()
}
GermlineList.prototype = {
......@@ -30,7 +30,7 @@ GermlineList.prototype = {
//load germlines.data file from server
load : function () {
var self=this;
this.fallbackLoad() //just in case
$.ajax({
url: window.location.origin + "/germline/germlines.data",
......@@ -39,19 +39,25 @@ GermlineList.prototype = {
//remove comment (json don't have comment)
var json = result.replace(/ *\/\/[^\n]*\n */g , "")
//convert from js to json (json begin with { or [, never with a var name)
json = json.replace("germlines = " , "")
json = json.replace("germline_data = " , "")
self.list = jQuery.parseJSON(json);
}
catch(err){
myConsole.flash("server : germlines.data malformed", 2);
myConsole.flash("server : germlines.data malformed, use local js file instead (can be outdated) ", 2);
}
},
error: function (request, status, error) {
myConsole.flash("server : error impossible to retrieve germlines.data", 2);
myConsole.flash("server : error impossible to retrieve germlines.data, use local js file instead (can be outdated)", 2);
},
dataType: "text"
});
},
fallbackLoad : function () {
this.list = germline_data
},
//add a list of custom germlines
......
......@@ -958,7 +958,7 @@ Graph.prototype = {
}
})
.attr("class", function (p) {
if (!p.active()){
if (!p.active){
return "graph_inactive";
}else{
return "graph_data";
......
{
germline_data = {
"TRA": {
"shortcut": "A",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment