Repository navigation
Expand file tree
/
Copy pathextras_explorerjs.js
More file actions
executable file
·366 lines (308 loc) · 11.6 KB
/
Copy pathextras_explorerjs.js
File metadata and controls
executable file
·366 lines (308 loc) · 11.6 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
/*
* Customize as you want ;)
*/
function callGeomap(){
db=JSON.stringify('php/community.db');
if(is_empty(selections)){
// jsonparams='["all"]';
jsonparams='["unique_id"]&unique_id='+getUrlParam.nodeidparam;
} else {
N=getNodesByAtt(catSoc).length;
nodesA = []
nodesB = []
socneigh = []
for(var i in selections) {
if(Nodes[i].type==catSoc) nodesA.push(i);
if(Nodes[i].type==catSem) nodesB.push(i);
}
if(nodesA.length==0 && nodesB.length>0) socneigh = getArrSubkeys(opos,"key");
if(nodesA.length>0 && nodesB.length>0) socneigh = getNeighs(nodesB,bipartiteN2D);
kSels = {}
for(var i in nodesA) {
kSels[nodesA[i]] = 1;
}
for(var i in socneigh) {
kSels[socneigh[i]] = 1;
}
k=Object.keys(kSels).length;
// cats=(categoriesIndex.length);
// arr={};
// if(cats==2 && swclickActual=="social") {
// N=Object.keys(partialGraph._core.graph.nodes.filter(function(n){return n.type==catSoc})).length;
// arr=nodes1;
// }
// if(cats==2 && swclickActual=="semantic") {
// N=Object.keys(partialGraph._core.graph.nodes.filter(function(n){return n.type==catSem})).length;
// arr=nodes2;
// }
// if(cats==1)
// N=Object.keys(Nodes).length;
// temp=getNeighs(Object.keys(selections),arr);
// sel_plus_neigh=Object.keys(temp);
// k=sel_plus_neigh.length;
// // if(N==k) jsonparams='["all"]';
pr ("N: "+N+" - k: "+k)
if(N==k) jsonparams='["unique_id"]&unique_id='+getUrlParam.nodeidparam;
else jsonparams=JSON.stringify(Object.keys(kSels));
//jsonparams=JSON.stringify(getSelections());
//jsonparams = jsonparams.split('&').join('__and__');
}
pr('in callGeomap: db='+db+'&query='+jsonparams);
initiateMap(db,jsonparams,"geomap2/");
// $("#ctlzoom").hide();
// $("#CurrentView").hide();
}
function callTWJS(){
// db=getCurrentDBforCurrentGexf();
// db=JSON.stringify(db);
// if(is_empty(selections)){
// jsonparams='["all"]';
// } else {
// jsonparams=JSON.stringify(getSelections());
// jsonparams = jsonparams.split('&').join('__and__');
// }
// pr('in callGeomap: db='+db+'&query='+jsonparams);
// initiateMap(db,jsonparams,"geomap/"); //From GEOMAP submod
$("#ctlzoom").show();
$("#CurrentView").show();
}
function selectionToMap(){
db=getCurrentDBforCurrentGexf();
db=JSON.stringify(db);
param='geomap/?db='+db+'';
if(is_empty(selections)){
newPopup('geomap/?db='+db+'&query=["all"]');
} else {
pr("selection to geomap:");
jsonparams=JSON.stringify(getSelections());
jsonparams = jsonparams.split('&').join('__and__');
pr('geomap/?db='+db+'&query='+jsonparams);
newPopup('geomap/?db='+db+'&query='+jsonparams);
}
}
//DataFolderMode
function getCurrentDBforCurrentGexf(){
folderID=dataFolderTree["gexf_idfolder"][decodeURIComponent(getUrlParam.file)];
dbsRaw = dataFolderTree["folders"][folderID];
dbsPaths=[];
for(var i in dbsRaw){
dbs = dbsRaw[i]["dbs"];
for(var j in dbs){
dbsPaths.push(i+"/"+dbs[j]);
}
break;
}
return dbsPaths;
}
//DataFolderMode
function getGlobalDBs(){
graphdb=dataFolderTree["folders"];
for(var i in graphdb){
for(var j in graphdb[i]){
if(j=="data") {
maindbs=graphdb[i][j]["dbs"];
for(var k in maindbs){
return jsonparams+"/"+maindbs[k];
}
}
}
}
}
//DataFolderMode
function getTopPapers(type){
if(getAdditionalInfo){
jsonparams=JSON.stringify(getSelections());
//jsonparams = jsonparams.replaceAll("&","__and__");
jsonparams = jsonparams.split('&').join('__and__');
dbsPaths=getCurrentDBforCurrentGexf();
//dbsPaths.push(getGlobalDBs());
dbsPaths=JSON.stringify(dbsPaths);
thisgexf=JSON.stringify(decodeURIComponent(getUrlParam.file));
image='<img style="display:block; margin: 0px auto;" src="'+twjs+'img/ajax-loader.gif"></img>';
$("#topPapers").html(image);
bi=(Object.keys(categories).length==2)?1:0;
$.ajax({
type: 'GET',
url: twjs+'php/info_div.php',
data: "type="+type+"&bi="+bi+"&query="+jsonparams+"&dbs="+dbsPaths+"&gexf="+thisgexf,
//contentType: "application/json",
//dataType: 'json',
success : function(data){
pr(twjs+'php/info_div.php?'+"type="+type+"&bi="+bi+"&query="+jsonparams+"&dbs="+dbsPaths+"&gexf="+thisgexf);
$("#topPapers").html(data);
},
error: function(){
pr('Page Not found: updateLeftPanel_uni()');
}
});
}
}
//very obsolete: please renew!
//For UNI-PARTITE
function updateLeftPanel_uni(){//Uni-partite graph
pr("\t ** in updateLeftPanel_uni() ** ");
var names='';
var information='';
counter=0;
names+='<div id="selectionsBox">';
names += '<h4>';
for(var i in selections){
if(counter==4){
names += '<h4>[...]</h4>';
break;
}
names += Nodes[i].label+', ';
counter++;
}
names += '</h4>';
names=names.replace(", </h4>","</h4>");
names=names.replace(", <h4>","<h4>");
names+='</div>';
minFont=12;
//maxFont=(minFont+oposMAX)-1;
maxFont=20;
getTopPapers("semantic");
js2='\');"';
information += '<br><h4>Information:</h4>';
information += '<ul>';
for(var i in selections){
information += '<div id="opossitesBox">';
information += '<li><b>' + Nodes[i].label.toUpperCase() + '</b></li>';
//for(var j in Nodes[i].attributes){
// if(Nodes[i].attributes[j].attr=="period"||
// Nodes[i].attributes[j].attr=="cluster_label"
// )
information +=
'<li><b>Topic' +
'</b>: '+Nodes[i].attributes["cluster_label"]+'</li>';
information += '<a href="https://www.google.com/#q='+Nodes[i].label+'" target=blank>'+'www</a>';
//}
information += '</div>';
information += '</ul><br>';
}
$("#names").html(names); //Information extracted, just added
$("#information").html(information); //Information extracted, just added
$("#tips").html("");
$("#topPapers").show();
/***** The animation *****/
_cG = $("#leftcolumn");
_cG.animate({
"left" : "0px"
}, function() {
$("#aUnfold").attr("class","leftarrow");
$("#zonecentre").css({
left: _cG.width() + "px"
});
});
i=0; for(var s in selections) i++;
if(is_empty(selections)==true || i==0){
cancelSelection(false);
partialGraph.draw();
}
}
//FOR UNI-PARTITE
function selectionUni(currentNode){
pr("in selectionUni");
if(checkBox==false && cursor_size==0) {
highlightSelectedNodes(false);
opossites = [];
selections = [];
partialGraph.refresh();
}
if((typeof selections[currentNode.id])=="undefined"){
selections[currentNode.id] = 1;
currentNode.active=true;
}
else {
delete selections[currentNode.id];
currentNode.active=false;
}
//highlightOpossites(nodes1[currentNode.id].neighbours);
// currentNode.color = currentNode.attr['true_color'];
// currentNode.attr['grey'] = 0;
//
//
partialGraph.zoomTo(partialGraph._core.width / 2, partialGraph._core.height / 2, 0.8);
partialGraph.refresh();
}
//JUST ADEME
function camaraButton(){
$("#PhotoGraph").click(function (){
//canvas=partialGraph._core.domElements.nodes;
var nodesCtx = partialGraph._core.domElements.nodes;
/*
var edgesCtx = document.getElementById("sigma_edges_1").getContext('2d');
var edgesImg = edgesCtx.getImageData(0, 0, document.getElementById("sigma_edges_1").width, document.getElementById("sigma_edges_1").height)
nodesCtx.putImageData(edgesImg,0,0);
//ctx.drawImage(partialGraph._core.domElements.edges,0,0)
//var oCanvas = ctx;
*/
//div = document.getElementById("sigma_nodes_1").getContext('2d');
//ctx = div.getContext("2d");
//oCanvas.drawImage(partialGraph._core.domElements.edges,0,0);
Canvas2Image.saveAsPNG(nodesCtx);
/*
Canvas2Image.saveAsJPEG(oCanvas); // will prompt the user to save the image as JPEG.
// Only supported by Firefox.
Canvas2Image.saveAsBMP(oCanvas); // will prompt the user to save the image as BMP.
// returns an <img> element containing the converted PNG image
var oImgPNG = Canvas2Image.saveAsPNG(oCanvas, true);
// returns an <img> element containing the converted JPEG image (Only supported by Firefox)
var oImgJPEG = Canvas2Image.saveAsJPEG(oCanvas, true);
// returns an <img> element containing the converted BMP image
var oImgBMP = Canvas2Image.saveAsBMP(oCanvas, true);
// all the functions also takes width and height arguments.
// These can be used to scale the resulting image:
// saves a PNG image scaled to 100x100
Canvas2Image.saveAsPNG(oCanvas, false, 100, 100);
*/
});
}
//JUST ADEME
function getChatFrame() {
content = '<div id="showChat" onclick="showhideChat();"><a href="#" id="aShowChat"> </a></div>';
content += '<iframe src="'+ircUrl+'"'
content += 'width="400" height="300"></iframe>';
$("#rightcolumn").html(content);
}
//JUST ADEME
function showhideChat(){
cg = document.getElementById("rightcolumn");
if(cg){
if(cg.style.right=="-400px"){
cg.style.right="0px";
}
else cg.style.right="-400px";
}
}
function getTips(){
text =
"<br>"+
"Basic Interactions:"+
"<ul>"+
"<li>Click on a node to select/unselect and get its information. In case of multiple selection, the button unselect clears all selections.</li>"+
"<li>The switch button switch allows to change the view type.</li>"+
"</ul>"+
"<br>"+
"Graph manipulation:"+
"<ul>"+
"<li>Link and node sizes indicate their strength.</li>"+
"<li>To fold/unfold the graph (keep only strong links or weak links), use the 'edges filter' sliders.</li>"+
"<li>To select a more of less specific area of the graph, use the 'nodes filter' slider.</li>"+
"</ul>"+
"<br>"+
"Micro/Macro view:"+
"<ul>"+
"<li>To explore the neighborhood of a selection, either double click on the selected nodes, either click on the macro/meso level button. Zoom out in meso view return to macro view.</li>"+
"<li>Click on the 'all nodes' tab below to view the full clickable list of nodes.</li>"+
"</ul>";
return text;
}
//da hell is this
function closeDialog () {
$('#windowTitleDialog').modal('hide');
}
function okClicked () {
//document.title = document.getElementById ("xlInput").value;
closeDialog ();
}