Commit 46599baf authored by Romain Loth's avatar Romain Loth

Re-integrate samuel's tagcloud design in sidepanel

parent efa58079
......@@ -165,9 +165,7 @@
display:inline-block;
border:solid 1px;
/*box-shadow: 0px 0px 0px 1px rgba(0,0,0,0.3); */
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
-khtml-border-radius: 6px;'+
border-radius: 6px;
border-color:#BDBDBD;
padding:0px 2px 0px 2px;
margin:1px 0px 1px 0px;
......@@ -376,7 +374,7 @@
.tab { display: inline-block; zoom:1; *display:inline; background: #eee; border: solid 1px #999; border-bottom: none; -moz-border-radius: 4px 4px 0 0; -webkit-border-radius: 4px 4px 0 0; }
.tab a { font-size: 12px; line-height: 2em; display: block; padding: 0 10px; outline: none; }
.tab a:hover { text-decoration: underline; }
.tab.active { background: #fff; padding-top: 6px; position: relative; top: 1px; border-color: #666; }
.tab.active { background: #fff; padding-top: 6px; position: relative; top: 3px; border-color: #666; }
.tab a.active { font-weight: bold; }
.tab-container .panel-container { background: #fff; border: solid #666 1px; padding: 10px; -moz-border-radius: 0 4px 4px 4px; -webkit-border-radius: 0 4px 4px 4px; }
.panel-container { margin-bottom: 10px; }
......@@ -30,6 +30,8 @@ var mainfile = ["db.json"];
// getUrlParam.file = window.location.origin+"/"+$("#graphid").html(); // garg exclusive
// var corpusesList = {} // garg exclusive -> corpus comparison
var tagcloud_limit = 50;
var current_url = window.location.origin+window.location.pathname+window.location.search
getUrlParam.file = current_url.replace(/projects/g, "api/projects")
......
......@@ -405,22 +405,6 @@ function manualForceLabel(nodeid,active) {
partialGraph.draw();
}
function htmlfied_samenodes(elems) {
console.log('FUN t.methods:htmlfied_samenodes')
var sameNodes=[]
js1=' onmouseover="manualForceLabel(this.id,true);" ';
js2=' onmouseout="manualForceLabel(this.id,true);" ';
if(elems.length>0) {
var A = getVisibleNodes()
for (var a in A){
n = A[a]
if(!n.active && n.color.charAt(0)=="#" ) {
sameNodes.push('<li onmouseover="manualForceLabel(\''+n.id+'\',true)" onmouseout="manualForceLabel(\''+n.id+'\',false)" ><a>'+ n.label+ '</a></li>')
}
}
}
return sameNodes
}
// nodes information div
function htmlfied_nodesatts(elems){
......@@ -469,6 +453,45 @@ function htmlfied_nodesatts(elems){
return socnodes.concat(semnodes)
}
function manualSelectNode ( nodeid ) {
console.log('FUN t.methods:manualSelectNode')
cancelSelection(false);
var SelInst = new SelectionEngine();
SelInst.MultipleSelection2({nodes:[nodeid]});
}
function htmlfied_tagcloud(elems , limit) {
console.log('FUN t.methods:htmlfied_tagcloud')
if(elems.length==0) return false;
var termNodes=[]
js1="" //'onclick="graphTagCloudElem(\'';
js2="" //"');\""
frecMAX=elems[0].value
for(var i in elems){
if(i==limit)
break
id=elems[i].key
frec=elems[i].value
if(frecMAX==1) fontSize=desirableTagCloudFont_MIN;
else {
fontSize=
desirableTagCloudFont_MIN+
(frec-1)*
((desirableTagCloudFont_MAX-desirableTagCloudFont_MIN)/(frecMAX-1));
}
if(!isUndef(Nodes[id])){
// js1 js2
// onclick="graphTagCloudElem(' ');
var jspart = ' onclick="manualSelectNode(\''+id+'\')" onmouseover="manualForceLabel(\''+id+'\',true)" onmouseout="manualForceLabel(\''+id+'\',false)"'
htmlfied_terms = '<span class="tagcloud-item" style="font-size:'+fontSize+'px;" '+jspart+'>'+ Nodes[id].label+ '</span>';
termNodes.push(htmlfied_terms)
}
}
return termNodes
}
//missing: getTopPapers for both node types
//considering complete graphs case! <= maybe i should mv it
function updateLeftPanel_fix( sels , oppos ) {
......@@ -500,9 +523,23 @@ function updateLeftPanel_fix( sels , oppos ) {
}
sameNodesDIV = "";
sameNodesDIV+='<div id="sameNodes"><ul style="list-style: none;">';//tagcloud
sameNodesDIV += htmlfied_samenodes( getNodeIDs(sels) ).join("\n") ;
sameNodesDIV+= '</ul></div>';
if(getNodeIDs(sels).length>0) {
var temp_voisinage = {}
var A = getVisibleNodes()
for (var a in A){
var n = A[a]
if(!n.active && n.color.charAt(0)=="#" ) {
temp_voisinage[n.id] = Math.round(Nodes[n.id].size)
}
}
var voisinage = ArraySortByValue(temp_voisinage, function(a,b){
return b-a
});
sameNodesDIV+='<div id="sameNodes">';//tagcloud
var tagcloud_opposite_neigh = htmlfied_tagcloud( voisinage , tagcloud_limit)
sameNodesDIV+= (tagcloud_opposite_neigh!=false) ? tagcloud_opposite_neigh.join("\n") : "No related terms.";
sameNodesDIV+= '</div>';
}
// getTopPapers("semantic");
......
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