Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
david Chavalarias
clinicaltrials
Commits
2cf9e030
Commit
2cf9e030
authored
7 years ago
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed most deprecated code fragments
NB: still need to rm old nodes1 nodes2
parent
bc90228b
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
66 additions
and
931 deletions
+66
-931
crowdTerms.css
crowdsourcingModule/crowdTerms.css
+0
-3
explorerjs.html
explorerjs.html
+8
-5
extras_explorerjs.js
extras_explorerjs.js
+8
-160
selection-panels.css
libs/css2/selection-panels.css
+0
-53
twjs.css
libs/css2/twjs.css
+0
-26
Tinaweb.js
tinawebJS/Tinaweb.js
+3
-3
enviroment.js
tinawebJS/enviroment.js
+12
-39
globalUtils.js
tinawebJS/globalUtils.js
+29
-56
methods.js
tinawebJS/methods.js
+0
-296
sigma.parseCustom.js
tinawebJS/sigma.parseCustom.js
+0
-98
sigmaUtils.js
tinawebJS/sigmaUtils.js
+6
-189
custom.css
twitterAPI2/twitterlibs/custom.css
+0
-3
No files found.
crowdsourcingModule/crowdTerms.css
View file @
2cf9e030
...
...
@@ -11,9 +11,6 @@
margin
:
2px
0
;
}
#savesuggestion
.btn
{
}
#savesuggestion
.btn
[
disabled
],
#savesuggestion
.btn.disabled
{
background-color
:
#B0B0B0
;
background-image
:
none
;
...
...
This diff is collapsed.
Click to expand it.
explorerjs.html
View file @
2cf9e030
...
...
@@ -23,10 +23,13 @@
-->
<!-- <link href="https://fonts.googleapis.com/css?family=Ubuntu+Condensed" rel="stylesheet" type='text/css'> -->
<!-- Roboto
Good for tweets if Helvetica is not present
-->
<!-- <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type='text/css'> -->
<!-- Droid Sans -->
<link
href=
"https://fonts.googleapis.com/css?family=Droid+Sans"
rel=
"stylesheet"
>
<!-- Roboto
Good for tweets if Helvetica is not present
-->
<link
href=
"https://fonts.googleapis.com/css?family=Roboto"
rel=
"stylesheet"
type=
'text/css'
>
<!-- Crete Round
Original *and* informative :) -->
...
...
@@ -42,7 +45,7 @@
<!-- Sahitya & Gurajada
"book" (beautiful quality roman) + devanagari support + telugu -->
<
!-- <link href="https://fonts.googleapis.com/css?family=Gurajada" rel="stylesheet"> --
>
<
link
href=
"https://fonts.googleapis.com/css?family=Gurajada"
rel=
"stylesheet"
>
<!-- <link href="https://fonts.googleapis.com/css?family=Sahitya" rel="stylesheet"> -->
<!-- Itim
...
...
This diff is collapsed.
Click to expand it.
extras_explorerjs.js
View file @
2cf9e030
...
...
@@ -2,12 +2,6 @@
* Customize as you want ;)
*/
function
newPopup
(
url
)
{
popupWindow
=
window
.
open
(
url
,
'popUpWindow'
,
'height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=no'
)
}
// = = = = = = = = = = = [ Clusters Plugin ] = = = = = = = = = = = //
// Execution: changeGraphAppearanceByFacets( true )
// It reads scanned node-attributes and prepared legends in TW.Clusters
...
...
@@ -104,21 +98,6 @@ function changeGraphAppearanceByFacets( manualflag ) {
}
// creates TW.conf.legendsBins bins
// @sortedValues array, mandatory
function
intervalsInventory
(
sortedValues
)
{
var
binmins
=
[]
var
len
=
sortedValues
.
length
for
(
var
l
=
0
;
l
<
TW
.
conf
.
legendsBins
;
l
++
)
{
let
nthVal
=
Math
.
floor
(
len
*
l
/
TW
.
conf
.
legendsBins
)
binmins
.
push
(
sortedValues
[
nthVal
])
}
// console.info("legendRefTicks", binmins)
return
binmins
}
function
RunLouvain
()
{
var
node_realdata
=
[]
...
...
@@ -139,8 +118,14 @@ function RunLouvain() {
}
var
community
=
jLouvain
().
nodes
(
node_realdata
).
edges
(
edge_realdata
);
var
results
=
community
();
for
(
var
i
in
results
)
TW
.
Nodes
[
i
].
attributes
[
"clust_louvain"
]
=
results
[
i
]
for
(
var
i
in
results
)
{
let
n
=
TW
.
partialGraph
.
graph
.
nodes
(
i
)
if
(
n
)
{
n
.
attributes
[
"clust_louvain"
]
=
results
[
i
]
// TW.Nodes[i].attributes["clust_louvain"]=results[i]
}
}
}
...
...
@@ -213,17 +198,6 @@ function SomeEffect( ValueclassCode ) {
}
}
// // force 3 first labels
// for(var j in nodes_2_label) {
// if(j==3)
// break
// var ID = nodes_2_label[j].key
// TW.partialGraph.graph.nodes(ID).customAttrs.forceLabel = true;
// }
// TW.gui.selectionActive=true;
TW
.
partialGraph
.
refresh
()
}
...
...
@@ -338,38 +312,6 @@ function set_ClustersLegend ( daclass, groupedByTicks ) {
// = = = = = = = = = = = [ / Clusters Plugin ] = = = = = = = = = = = //
//For CNRS
// function getTopPapers(type){
// if(TW.conf.getRelatedDocs){
// console.log("getTopPapers")
// jsonparams=JSON.stringify(getSelections());
// bi=(Object.keys(categories).length==2)?1:0;
// //jsonparams = jsonparams.replaceAll("&","__and__");
// jsonparams = jsonparams.split('&').join('__and__');
// //dbsPaths.push(getGlobalDBs());
// thisgexf=JSON.stringify(decodeURIComponent(getUrlParam.file));
// image='<img style="display:block; margin: 0px auto;" src="'+TW.conf.relatedDocsAPI+'img/ajax-loader.gif"></img>';
// $("#tab-container-top").show();
// $("#topPapers").show();
// $("#topPapers").html(image);
// $.ajax({
// type: 'GET',
// url: TW.conf.relatedDocsAPI+'info_div.php',
// data: "type="+nodetype+"&bi="+bi+"&query="+jsonparams+"&gexf="+thisgexf+"&index="+TW.field[getUrlParam.file],
// //contentType: "application/json",
// //dataType: 'json',
// success : function(data){
// console.log(TW.conf.relatedDocsAPI+'info_div.php?'+"type="+nodetype+"&bi="+bi+"&query="+jsonparams+"&gexf="+thisgexf+"&index="+TW.field[getUrlParam.file]);
// $("#topPapers").html(data);
// },
// error: function(){
// console.log('Page Not found: getTopPapers');
// }
// });
// }
// }
// a custom variant of twitter plugin written for politoscope
// NB: this variant only for nodetype semantic
function
getTopPapers
(
nodetypeLegacy
){
...
...
@@ -516,60 +458,6 @@ function RenderTweet( tweet) {
return
html
;
}
//JUST ADEME
function
camaraButton
(){
$
(
"#PhotoGraph"
).
click
(
function
(){
//canvas=TW.partialGraph._core.domElements.nodes;
var
nodesCtx
=
TW
.
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(TW.partialGraph._core.domElements.edges,0,0)
//var oCanvas = ctx;
*/
//div = document.getElementById("sigma_nodes_1").getContext('2d');
//ctx = div.getContext("2d");
//oCanvas.drawImage(TW.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);
*/
});
}
function
getTips
(){
param
=
''
;
...
...
@@ -601,21 +489,6 @@ function getTips(){
}
function
draw1Circle
(
ctx
,
x
,
y
,
color
)
{
ctx
.
strokeStyle
=
'#000'
;
ctx
.
lineWidth
=
1
;
ctx
.
fillStyle
=
color
;
ctx
.
globalAlpha
=
0.5
;
ctx
.
beginPath
();
ctx
.
arc
(
x
,
y
,
10
,
0
,
Math
.
PI
*
2
,
true
);
ctx
.
closePath
();
ctx
.
fill
();
ctx
.
stroke
();
}
// show Selector circle
// --------------------
// new sigma.js: could be replaced by default _moveHandler with bindings ?
...
...
@@ -745,31 +618,6 @@ function circleLocalSubset(camX0, camY0 , camRay) {
}
// not used but useful to quickly make visible any nodes[]
function
flashNodesArray
(
nodesArray
)
{
// for diagnostic
var
minX
=
1000000
var
minY
=
1000000
var
maxX
=
0
var
maxY
=
0
for
(
var
j
in
nodesArray
)
{
var
n
=
nodesArray
[
j
]
if
(
minX
>
n
.
x
)
minX
=
n
.
x
if
(
minY
>
n
.
y
)
minY
=
n
.
y
if
(
maxX
<
n
.
x
)
maxX
=
n
.
x
if
(
maxY
<
n
.
y
)
maxY
=
n
.
y
n
.
size
=
300
n
.
label
=
"> "
+
n
.
label
+
"< "
n
.
color
=
"yellow"
}
console
.
log
(
"nodesArray encompassed by:"
,
minX
,
minY
,
';'
,
maxX
,
maxY
)
TW
.
partialGraph
.
render
()
}
// BASIC MODULARITY
// =================
// activateModules is for adding/removing features from TinawebJS
...
...
This diff is collapsed.
Click to expand it.
libs/css2/selection-panels.css
View file @
2cf9e030
...
...
@@ -89,36 +89,6 @@
}
/*.btn-sm[normal] {*/
/* background-image: -webkit-linear-gradient(#5f8ab9, #3e648d 50%, #385a7f);*/
/* background-image: linear-gradient(#5f8ab9, #3e648d 50%, #385a7f);*/
/* background-repeat: no-repeat;*/
/* filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5f8ab9', endColorstr='#ff385a7f', GradientType=0);*/
/* filter: none;*/
/* border: 1px solid #2e4b69;*/
/*}*/
.panel-heading
a
:before
{
font-family
:
'Glyphicons Halflings'
;
content
:
"\e114 "
;
float
:
right
;
color
:
#E3A13D
;
}
.panel-heading
a
{
text-decoration
:
none
!important
;
}
.panel-heading
a
.collapsed
:before
{
font-family
:
'Glyphicons Halflings'
;
content
:
"\e114 "
;
float
:
right
;
color
:
grey
;
}
/* ZOOMBAR */
#ctlzoom
{
...
...
@@ -139,8 +109,6 @@
text-align
:
center
;
}
#zoomSliderzone
{
}
.zoombarbuttons
{
position
:
relative
;
/* b/c they can contain absolute wait icon */
...
...
@@ -150,12 +118,6 @@
opacity
:
.7
;
}
#edgesButton
{
display
:
block
;
width
:
24px
;
height
:
24px
;
margin
:
0
auto
;
}
#zoomMinusButton
,
#zoomPlusButton
{
display
:
block
;
width
:
24px
;
...
...
@@ -189,11 +151,6 @@
#aUnfold
{
display
:
none
;
width
:
12px
;
height
:
12px
;
background-image
:
url("../img2/fleches-horiz.png")
;
margin
:
0
auto
;
}
/*
#saveAs {
display: block; width: 30px; height: 30px; background:url("../libs/img2/Save.png"); margin: 0 auto;
}
*/
#zoomSlider
{
background
:
#fff
;
...
...
@@ -201,16 +158,6 @@
height
:
90px
;
margin
:
0
auto
;
}
#showChat
{
position
:
absolute
;
top
:
16px
;
right
:
-14px
;
width
:
20px
;
height
:
100px
;
background
:
rgb
(
250
,
250
,
252
);
padding
:
2px
2px
2px
0
;
border-top-left-radius
:
5px
;
border-bottom-left-radius
:
5px
;
box-shadow
:
1px
1px
2px
#808090
;
}
#aShowChat
{
float
:
right
;
width
:
100%
;
height
:
100%
;
background-image
:
url("../libs/img2/chat.png")
;
}
/* GESTION DES PAVES DE GAUCHE (conteneur encore vide)*/
#lefttopbox
{
position
:
fixed
;
...
...
This diff is collapsed.
Click to expand it.
libs/css2/twjs.css
View file @
2cf9e030
...
...
@@ -190,32 +190,6 @@ html.waiting {
-border-radius
:
3px
;
}
#topProposals
{
display
:
none
;
margin
:
7px
;
padding
:
10px
0px
10px
10px
;
border-style
:
solid
;
background-color
:
white
;
color
:
black
;
margin
:
7px
;
border
:
1px
solid
#666
;
-moz-border-radius
:
3px
;
-webkit-border-radius
:
3px
;
-border-radius
:
3px
;
-moz-box-shadow
:
0px
2px
6px
#000
;
-webkit-box-shadow
:
0px
2px
6px
#000
;
box-shadow
:
0px
2px
6px
#000
;
}
.category1
{
display
:
none
;
/* initial display off but turned on when changetype */
}
.grey
{
color
:
#cccccc
;
font-style
:
italic
;
}
/* small messages */
p
.micromessage
{
font-size
:
85%
;
...
...
This diff is collapsed.
Click to expand it.
tinawebJS/Tinaweb.js
View file @
2cf9e030
...
...
@@ -82,11 +82,11 @@ function SelectionEngine() {
}
else
{
var
id_node
=
''
;
var
results
=
find
(
string
)
var
result
Nid
s
=
find
(
string
)
var
coincd
=
[]
for
(
var
i
in
results
)
{
coincd
.
push
(
result
s
[
i
].
id
)
for
(
var
i
in
result
Nid
s
)
{
coincd
.
push
(
result
Nids
[
i
]
)
}
var
targeted
=
this
.
SelectorEngine
(
{
addvalue
:
TW
.
gui
.
checkBox
,
...
...
This diff is collapsed.
Click to expand it.
tinawebJS/enviroment.js
View file @
2cf9e030
...
...
@@ -1027,54 +1027,27 @@ function updateSearchLabels(id,name,type){
});
}
function
extractContext
(
string
,
context
)
{
var
matched
=
string
.
toLowerCase
().
indexOf
(
context
.
toLowerCase
());
if
(
matched
==
-
1
)
return
string
.
slice
(
0
,
20
)
+
'...'
;
var
begin_pts
=
'...'
,
end_pts
=
'...'
;
if
(
matched
-
20
>
0
)
{
var
begin
=
matched
-
20
;
}
else
{
var
begin
=
0
;
begin_pts
=
''
;
}
if
(
matched
+
context
.
length
+
20
<
string
.
length
)
{
var
end
=
matched
+
context
.
length
+
20
;
}
else
{
var
end
=
string
.
length
;
end_pts
=
''
;
}
//============================ < / SEARCH > ============================//
str
=
string
.
slice
(
begin
,
end
);
if
(
str
.
indexOf
(
" "
)
!=
Math
.
max
(
str
.
lastIndexOf
(
" "
),
str
.
lastIndexOf
(
"."
)))
str
=
str
.
slice
(
str
.
indexOf
(
" "
),
Math
.
max
(
str
.
lastIndexOf
(
" "
),
str
.
lastIndexOf
(
"."
)));
//============================= < OTHER ACTIONS > =============================//
function
createWaitIcon
(
idname
,
width
)
{
let
icon
=
document
.
createElement
(
'img'
)
return
begin_pts
+
str
+
end_pts
;
}
icon
.
src
=
TW
.
conf
.
libspath
+
'/img2/loader.gif'
icon
.
style
.
position
=
'absolute'
icon
.
style
.
left
=
'0'
icon
.
style
.
width
=
width
||
'100%'
// TODO check duplicate function with sigmaUtils exactfind()
function
searchLabel
(
string
){
var
id_node
=
''
;
var
n
;
if
(
idname
)
{
icon
.
id
=
idname
}
nds
=
TW
.
partialGraph
.
_core
.
graph
.
nodes
.
filter
(
function
(
x
){
return
!
x
[
"hidden"
]});
for
(
var
i
in
nds
){
n
=
nds
[
i
]
if
(
n
.
label
==
string
)
{
return
n
;
}
}
return
icon
}
//============================ < / SEARCH > ============================//
//============================= < OTHER ACTIONS > =============================//
function
jsActionOnGexfSelector
(
gexfBasename
){
let
gexfPath
=
TW
.
gexfPaths
[
gexfBasename
]
||
gexfBasename
+
".gexf"
let
serverPrefix
=
''
...
...
This diff is collapsed.
Click to expand it.
tinawebJS/globalUtils.js
View file @
2cf9e030
...
...
@@ -52,17 +52,6 @@ var AjaxSync = function(args) {
return
Result
;
}
function
getClientTime
(){
var
totalSec
=
new
Date
().
getTime
()
/
1000
;
var
d
=
new
Date
();
var
hours
=
d
.
getHours
();
var
minutes
=
parseInt
(
totalSec
/
60
)
%
60
;
var
seconds
=
(
totalSec
%
60
).
toFixed
(
4
);
var
result
=
(
hours
<
10
?
"0"
+
hours
:
hours
)
+
":"
+
(
minutes
<
10
?
"0"
+
minutes
:
minutes
)
+
":"
+
(
seconds
<
10
?
"0"
+
seconds
:
seconds
);
return
result
;
}
function
compareNumbers
(
a
,
b
)
{
return
a
-
b
;
}
...
...
@@ -71,11 +60,6 @@ function isNumeric(a) {
return
parseFloat
(
a
)
==
a
;
}
// seconds since page load
function
tstamp
()
{
return
parseInt
(
performance
.
now
())
;
}
//python range(a,b) | range(a)
function
calc_range
(
begin
,
end
)
{
if
(
typeof
end
===
"undefined"
)
{
...
...
@@ -88,40 +72,40 @@ function calc_range(begin, end) {
return
result
;
}
//to general utils (not used btw)
function
cloneObject
(
source
)
{
for
(
i
in
source
)
{
if
(
typeof
source
[
i
]
==
'source'
)
{
this
[
i
]
=
new
cloneObject
(
source
[
i
]);
}
else
{
this
[
i
]
=
source
[
i
];
}
}
}
function
isUndef
(
variable
){
if
(
typeof
(
variable
)
===
"undefined"
)
return
true
;
else
return
false
;
}
$
.
fn
.
toggleClick
=
function
(){
methods
=
arguments
,
// store the passed arguments for future reference
count
=
methods
.
length
;
// cache the number of methods
function
stringToSomeInt
(
anyString
)
{
let
charCodeSum
=
0
for
(
let
i
=
0
;
i
<
anyString
.
length
;
i
++
)
{
charCodeSum
+=
anyString
.
charCodeAt
(
i
)
}
return
charCodeSum
}
//use return this to maintain jQuery chainability
return
this
.
each
(
function
(
i
,
item
){
// for each element you bind to
index
=
0
;
// create a local counter for that element
$
(
item
).
click
(
function
(){
// bind a click handler to that element
return
methods
[
index
++
%
count
].
apply
(
this
,
arguments
);
// that when called will apply the 'index'th method to that element
// the index % count means that we constrain our iterator between 0 and (count-1)
});
});
};
// shuffle algo from stackoverflow.com/a/6274398/2489184
function
shuffle
(
array
)
{
var
counter
=
array
.
length
;
// While there are elements in the array
while
(
counter
>
0
)
{
// Pick a random index
let
index
=
Math
.
floor
(
Math
.
random
()
*
counter
);
// Decrease counter by 1
counter
--
;
// And swap the last element with it
let
temp
=
array
[
counter
];
array
[
counter
]
=
array
[
index
];
array
[
index
]
=
temp
;
}
return
array
;
}
getUrlParam
=
(
function
()
{
var
get
=
{
...
...
@@ -207,24 +191,11 @@ function ArraySortByValue(array, sortFunc){
}
function
is_empty
(
obj
)
{
// Assume if it has a length property with a non-zero value
// that that property is correct.
if
(
obj
.
length
&&
obj
.
length
>
0
)
return
false
;
if
(
obj
.
length
&&
obj
.
length
===
0
)
return
true
;
for
(
var
key
in
obj
)
{
if
(
hasOwnProperty
.
call
(
obj
,
key
))
return
false
;
}
return
true
;
}
function
getByID
(
elem
)
{
return
document
.
getElementById
(
elem
);
}
// NB: check if we could use sigma.plugins.animate.parseColor instead
// hex can be RGB (3 or 6 chars after #) or RGBA (4 or 8 chars)
function
hex2rgba
(
sent_hex
)
{
if
(
!
sent_hex
)
{
...
...
@@ -347,6 +318,7 @@ var linkCheck = function(url) {
/**
* function to load a given css file
* cf. activateModules()
*/
loadCSS
=
function
(
href
)
{
var
cssLink
=
$
(
"<link rel='stylesheet' type='text/css' href='"
+
href
+
"'>"
);
...
...
@@ -355,6 +327,7 @@ var linkCheck = function(url) {
/**
* function to load a given js file
* cf. activateModules()
*/
loadJS
=
function
(
src
)
{
var
jsLink
=
$
(
"<script type='text/javascript' src='"
+
src
+
"'>"
);
...
...
This diff is collapsed.
Click to expand it.
tinawebJS/methods.js
View file @
2cf9e030
...
...
@@ -229,151 +229,6 @@ function highlightSelectedNodes(flag){
}
}
function
alertCheckBox
(
eventCheck
){
// NB: we use 2 booleans to adapt to SHIFT checking
// - var TW.gui.checkBox ---------> has the real box state
// - var TW.gui.manuallyChecked --> remembers if it was changed here
if
(
!
isUndef
(
eventCheck
.
checked
))
{
TW
.
gui
.
checkBox
=
eventCheck
.
checked
;
TW
.
gui
.
manuallyChecked
=
eventCheck
.
checked
}
}
// THIS IS THE ORIGINAL FIRST VERSION OF changeType()
// It's not used since before I arrived, but useful as a logical resume
//
// States:
// A : Macro-Social
// B : Macro-Semantic
// A*: Macro-Social w/selections
// B*: Macro-Semantic w/selections
// a : Meso-Social
// b : Meso-Semantic
// AaBb: Socio-Semantic
function
RefreshState
(
newNOW
){
console
.
log
(
"
\
t
\
t
\
tin RefreshState newNOW:_"
+
newNOW
+
"_."
)
if
(
newNOW
!=
""
)
{
PAST
=
NOW
;
NOW
=
newNOW
;
// if(NOW=="a" || NOW=="A" || NOW=="AaBb") {
// $("#category-A").show();
// }
// if(NOW=="b" || NOW=="B" || NOW=="AaBb") {
// $("#category-B").show();
// }
}
$
(
"#category-A"
).
hide
();
$
(
"#category-B"
).
hide
();
// i=0; for(var s in selections) { i++; break;}
// if(is_empty(selections) || i==0) LevelButtonDisable(true);
// else LevelButtonDisable(false);
//complete graphs case
// sels=getNodeIDs(selections).length
if
(
NOW
==
"A"
||
NOW
==
"a"
)
{
// N : number of nodes
// k : number of ( selected nodes + their neighbors )
// s : number of selections
var
N
=
(
Object
.
keys
(
TW
.
Nodes
).
filter
(
function
(
n
){
return
TW
.
Nodes
[
n
].
type
==
TW
.
conf
.
catSoc
})
).
length
var
k
=
Object
.
keys
(
getNeighs
(
Object
.
keys
(
selections
),
nodes1
)).
length
var
s
=
Object
.
keys
(
selections
).
length
console
.
log
(
"in social N: "
+
N
+
" - k: "
+
k
+
" - s: "
+
s
)
if
(
NOW
==
"A"
){
if
(
(
s
==
0
||
k
>=
(
N
-
1
))
)
{
LevelButtonDisable
(
true
);
}
else
LevelButtonDisable
(
false
);
if
(
s
==
N
)
LevelButtonDisable
(
false
);
}
if
(
NOW
==
"a"
)
{
LevelButtonDisable
(
false
);
}
$
(
"#semLoader"
).
hide
();
$
(
"#category-A"
).
show
();
$
(
"#colorGraph"
).
show
();
}
if
(
NOW
==
"B"
||
NOW
==
"b"
)
{
var
N
=
(
Object
.
keys
(
TW
.
Nodes
).
filter
(
function
(
n
){
return
TW
.
Nodes
[
n
].
type
==
TW
.
conf
.
catSem
})
).
length
var
k
=
Object
.
keys
(
getNeighs
(
Object
.
keys
(
selections
),
nodes2
)).
length
var
s
=
Object
.
keys
(
selections
).
length
console
.
log
(
"in semantic N: "
+
N
+
" - k: "
+
k
+
" - s: "
+
s
)
if
(
NOW
==
"B"
)
{
if
(
(
s
==
0
||
k
>=
(
N
-
1
))
)
{
LevelButtonDisable
(
true
);
}
else
LevelButtonDisable
(
false
);
if
(
s
==
N
)
LevelButtonDisable
(
false
);
}
if
(
NOW
==
"b"
)
{
LevelButtonDisable
(
false
);
}
if
(
semanticConverged
)
{
$
(
"#semLoader"
).
hide
();
$
(
"#category-B"
).
show
();
setTimeout
(
function
(){
EdgeWeightFilter
(
"#sliderBEdgeWeight"
,
"0|1"
,
"weight"
);
NodeWeightFilter
(
"#sliderBNodeWeight"
,
"NGram"
,
"size"
);
},
30
)
}
else
{
$
(
"#semLoader"
).
css
(
'visibility'
,
'visible'
);
$
(
"#semLoader"
).
show
();
}
}
if
(
NOW
==
"AaBb"
){
LevelButtonDisable
(
true
);
$
(
"#category-A"
).
show
();
$
(
"#category-B"
).
show
();
}
TW
.
partialGraph
.
render
();
}
function
pushSWClick
(
arg
){
swclickPrev
=
swclickActual
;
swclickActual
=
arg
;
}
// tag cloud div
// [but not used in monopart case]
function
htmlfied_alternodes
(
elems
)
{
var
oppositesNodes
=
[]
var
js1
=
'onclick="graphTagCloudElem(
\'
'
;
var
js2
=
"');
\"
"
var
frecMAX
=
elems
[
0
].
value
console
.
log
(
"htmlfied_alternodes elems"
,
elems
)
console
.
log
(
"htmlfied_alternodes frecMAX"
,
frecMAX
)
for
(
var
i
in
elems
){
var
id
=
elems
[
i
].
key
var
frec
=
elems
[
i
].
value
var
fontSize
var
htmlfied_alternode
if
(
frecMAX
==
1
)
fontSize
=
TW
.
conf
.
tagcloudFontsizeMin
;
else
{
fontSize
=
TW
.
conf
.
tagcloudFontsizeMin
+
(
frec
-
1
)
*
((
TW
.
conf
.
tagcloudFontsizeMax
-
TW
.
conf
.
tagcloudFontsizeMin
)
/
(
frecMAX
-
1
));
}
if
(
!
isUndef
(
TW
.
Nodes
[
id
])){
htmlfied_alternode
=
'<span class="tagcloud-item" style="font-size:'
+
fontSize
+
'px;" '
+
js1
+
id
+
js2
+
'>'
+
TW
.
Nodes
[
id
].
label
+
'</span>'
;
oppositesNodes
.
push
(
htmlfied_alternode
)
}
}
return
oppositesNodes
}
function
manualForceLabel
(
nodeid
,
active
,
justHover
)
{
// console.log("manual|"+nodeid+"|"+active)
var
nd
=
TW
.
partialGraph
.
graph
.
nodes
(
nodeid
)
...
...
@@ -574,20 +429,6 @@ function updateRelatedNodesPanel( sels , same, oppos ) {
else
getTopPapers
(
swActual
(
getActivetypes
()[
0
]));
}
function
printStates
()
{
console
.
log
(
"
\
t
\
t
\
t
\
t---------"
+
getClientTime
()
+
"---------"
)
console
.
log
(
"
\
t
\
t
\
t
\
tswMacro: "
+
swMacro
)
console
.
log
(
"
\
t
\
t
\
t
\
tswActual: "
+
swclickActual
+
" | swPrev: "
+
swclickPrev
)
console
.
log
(
"
\
t
\
t
\
t
\
tNOW: "
+
NOW
+
" | PAST: "
+
PAST
)
console
.
log
(
"
\
t
\
t
\
t
\
tselections: "
)
console
.
log
(
TW
.
SystemState
.
selectionNids
)
console
.
log
(
"
\
t
\
t
\
t
\
topposites neighbors: "
)
console
.
log
(
TW
.
SystemState
.
opposideSortdNeighs
)
console
.
log
(
"
\
t
\
t
\
t
\
tsame neighbors: "
)
console
.
log
(
TW
.
SystemState
.
samesideSortdNeighs
)
console
.
log
(
"
\
t
\
t
\
t
\
t------------------------------------"
)
}
// just css
//true: button disabled
//false: button enabled
...
...
@@ -595,121 +436,6 @@ function LevelButtonDisable( TF ){
$
(
'#changelevel'
).
prop
(
'disabled'
,
TF
);
}
// handler for clicking on a related or opposite node
// - provokes changeLevel to macro
// - if opposite node: provokes changeType
function
graphTagCloudElem
(
nodes
)
{
console
.
log
(
"in graphTagCloudElem, nodae_id: "
+
nodes
);
cancelSelection
();
var
ndsids
=
[]
if
(
!
$
.
isArray
(
nodes
))
ndsids
.
push
(
nodes
);
else
ndsids
=
nodes
;
let
newselsChecker
=
{}
for
(
let
i
in
ndsids
)
{
newselsChecker
[
ndsids
[
i
]]
=
true
}
var
vars
=
[]
var
catDict
=
TW
.
catDict
;
var
type
=
TW
.
Nodes
[
ndsids
[
0
]].
type
;
var
nextTypes
=
[];
for
(
var
c
in
catDict
)
nextTypes
.
push
(
c
==
type
)
var
nextTypesKey
=
nextTypes
.
map
(
Number
).
join
(
"|"
)
// £TODO fix low-level selectionlogic duplicate with MultipleSelection2 function 1/2
// Dictionaries of: selection+neighbors
var
nodes_2_colour
=
{}
var
edges_2_colour
=
{}
var
voisinage
=
{}
for
(
var
i
in
ndsids
)
{
let
nid
=
ndsids
[
i
];
let
neigh
=
TW
.
Relations
[
nextTypesKey
][
nid
]
if
(
neigh
)
{
for
(
var
j
in
neigh
)
{
t
=
neigh
[
j
]
// FIXME deprecated should use customAttrs.highlight = true;
// nodes_2_colour[t]=false;
edges_2_colour
[
nid
+
";"
+
t
]
=
true
;
edges_2_colour
[
t
+
";"
+
s
]
=
true
;
if
(
!
newselsChecker
[
t
]
)
voisinage
[
Number
(
t
)
]
=
true
;
}
}
// we make the selected (source) node active too
nodes_2_colour
[
ndsids
[
i
]]
=
true
;
}
// old strategy recreated a graph with the selected and its neighbors:
// we now do it only if type is different
if
(
nextTypesKey
!=
getActivetypesKey
())
{
TW
.
partialGraph
.
graph
.
clear
();
for
(
var
nid
in
nodes_2_colour
)
add1Elem
(
nid
)
for
(
var
eid
in
edges_2_colour
)
add1Elem
(
eid
)
// Adding intra-neighbors edges O(voisinage²)
voisinage
=
Object
.
keys
(
voisinage
)
for
(
var
i
=
0
;
i
<
voisinage
.
length
;
i
++
)
{
for
(
var
j
=
1
;
j
<
voisinage
.
length
;
j
++
)
{
if
(
voisinage
[
i
]
!=
voisinage
[
j
]
)
{
console
.
log
(
"
\
t"
+
voisinage
[
i
]
+
" vs "
+
voisinage
[
j
]
)
add1Elem
(
voisinage
[
i
]
+
";"
+
voisinage
[
j
]
)
}
}
}
}
// Nodes Selection now:
// ££TODO fix low-level selectionlogic duplicate with MultipleSelection2 function 2/2
if
(
ndsids
.
length
>
0
)
{
TW
.
instance
.
selNgn
.
MultipleSelection2
({
nodesDict
:
nodes_2_colour
,
edgesDict
:
edges_2_colour
});
TW
.
gui
.
selectionActive
=
true
}
var
present
=
TW
.
states
.
slice
(
-
1
)[
0
];
// Last
var
level
=
present
.
level
;
var
lastpos
=
TW
.
states
.
length
-
1
;
// like pushing down in a lifo state present becomes state penultimate
// £TODO setState should be doing this shifting
var
avantlastpos
=
lastpos
-
1
;
TW
.
states
[
avantlastpos
]
=
{};
TW
.
states
[
avantlastpos
].
selectionNids
=
present
.
selectionNids
;
TW
.
states
[
avantlastpos
].
level
=
present
.
level
;
TW
.
states
[
avantlastpos
].
activetypes
=
present
.
activetypes
;
// recording the new state
TW
.
setState
({
activetypes
:
nextTypes
,
level
:
false
,
// forced macro
sels
:
present
.
selectionNids
})
TW
.
partialGraph
.
camera
.
goTo
({
x
:
0
,
y
:
0
,
ratio
:
0.9
,
angle
:
0
})
TW
.
partialGraph
.
refresh
({
skipIndexation
:
true
});
sigma_utils
.
smartForceAtlas
({
'duration'
:
TW
.
conf
.
fa2Milliseconds
/
2
})
//
// ChangeGraphAppearanceByAtt(true)
}
function
unHide
(
nodeId
)
{
TW
.
partialGraph
.
graph
.
nodes
(
nodeId
).
hidden
=
false
}
// edges greyish color for unselected, when we have a selection
// NB: we just change the flags, not the colors
// renderer will see the flags and handle the case accordingly
...
...
@@ -741,28 +467,6 @@ function greyEverything(){
}
//
// function hideEverything(){
// console.log("\thiding all");
// nodeslength=0;
//
// var nodes = TW.partialGraph.nodes()
// for(var j in nodes){
// nodes[j].hidden=true;
// }
// if (TW.partialGraph.settings('drawEdges')) {
// var edges = TW.partialGraph.graph.edges()
// for(var i in edges){
// edges[i].hidden=true;
// }
// }
// overNodes=false;//magic line!
// console.log("\tall hidded");
// //Remember that this function is the analogy of EmptyGraph
// //"Saving node positions" should be applied in this function, too.
// }
// Converts from read nodes (sigma.parseCustom )
// Remarks:
...
...
This diff is collapsed.
Click to expand it.
tinawebJS/sigma.parseCustom.js
View file @
2cf9e030
...
...
@@ -212,7 +212,6 @@ function scanGexf(gexfContent) {
// (current expected structure in 'categories' can only accomodate 2 types
// and the way it and catDict are used is not entirely coherent throughout
// the project, cf. among others: - the effect on 'typestring'
// - the effect on 'swclickActual'
// - the way default cat is handled as 0...)
// -------------------
// expected content: usually a just a few cats over all nodes
...
...
@@ -982,103 +981,6 @@ function updateValueFacets(facetIdx, aNode, optionalFilter) {
}
// creates and updates nodes1 nodes2 and bipartiteN2D and bipartiteD2N
// but seems useless because all info is already in each nodes.type and edge.categ
// (especially when changeType uses a loop on all nodes anyway)
// (was previously done at the same time that updateRelations)
// (could be restored if we needed faster changeType)
function
sortNodesByTypeDeprecated
()
{
// Doc <-> Doc
// if(srcType==categories[0] && tgtType==categories[0] ) {
//
// edge.label = "nodes1";
// if(isUndef(nodes1[source])) {
// nodes1[source] = {
// label: nodes[source].label,
// neighbours: []
// };
// }
// if(isUndef(nodes1[target])) {
// nodes1[target] = {
// label: nodes[target].label,
// neighbours: []
// };
// }
// nodes1[source].neighbours.push(target);
// nodes1[target].neighbours.push(source);
// }
//
// if(categories.length>1) {
//
// // Term <-> Term
// if(srcType==categories[1] && tgtType==categories[1]){
// edge.label = "nodes2";
//
// if(isUndef(nodes2[source])) {
// nodes2[source] = {
// label: nodes[source].label,
// neighbours: []
// };
// }
// if(isUndef(nodes2[target])) {
// nodes2[target] = {
// label: nodes[target].label,
// neighbours: []
// };
// }
// nodes2[source].neighbours.push(target);
// nodes2[target].neighbours.push(source);
// }
//
// // Doc <-> Term
// if((srcType==categories[0] && tgtType==categories[1]) ||
// (srcType==categories[1] && tgtType==categories[0])) {
// edge.label = "bipartite";
//
// // // Source is Document
// if(srcType == categories[0]) {
//
// if(isUndef(bipartiteD2N[source])) {
// bipartiteD2N[source] = {
// label: nodes[source].label,
// neighbours: []
// };
// }
// if(isUndef(bipartiteN2D[target])) {
// bipartiteN2D[target] = {
// label: nodes[target].label,
// neighbours: []
// };
// }
//
// bipartiteD2N[source].neighbours.push(target);
// bipartiteN2D[target].neighbours.push(source);
//
// // // Source is NGram
// } else {
//
// if(isUndef(bipartiteN2D[source])) {
// bipartiteN2D[source] = {
// label: nodes[source].label,
// neighbours: []
// };
// }
// if(isUndef(bipartiteD2N[target])) {
// bipartiteD2N[target] = {
// label: nodes[target].label,
// neighbours: []
// };
// }
// bipartiteN2D[source].neighbours.push(target);
// bipartiteD2N[target].neighbours.push(source);
// }
// }
// }
}
// Level-00
function
scanJSON
(
data
)
{
...
...
This diff is collapsed.
Click to expand it.
tinawebJS/sigmaUtils.js
View file @
2cf9e030
...
...
@@ -574,89 +574,11 @@ var SigmaUtils = function () {
}
// /SigmaUtils object
function
createWaitIcon
(
idname
,
width
)
{
let
icon
=
document
.
createElement
(
'img'
)
icon
.
src
=
TW
.
conf
.
libspath
+
'/img2/loader.gif'
icon
.
style
.
position
=
'absolute'
icon
.
style
.
left
=
'0'
icon
.
style
.
width
=
width
||
'100%'
if
(
idname
)
{
icon
.
id
=
idname
}
return
icon
}
//
// //for socialgraph
// function showMeSomeLabels(N){
// // NB why is this not using methods.manualForceLabel ?!
//
// /*======= Show some labels at the beginning =======*/
// var minIn=50,
// maxIn=0,
// minOut=50,
// maxOut=0;
//
// // new sigma.js accessor
// var allNodes = TW.partialGraph.graph.nodes()
// for( j=0 ; j < allNodes.length ; j++ ) {
// n = allNodes[j]
// if(n.hidden==false){
// if(parseInt(n.inDegree) < minIn) minIn= n.inDegree;
// if(parseInt(n.inDegree) > maxIn) maxIn= n.inDegree;
// if(parseInt(n.outDegree) < minOut) minOut= n.outDegree;
// if(parseInt(n.outDegree) > maxOut) maxOut= n.outDegree;
// }
// }
// counter=0;
// n = getVisibleNodes();
// for(i=0;i<n.length;i++) {
// if(n[i].hidden==false){
// if(n[i].inDegree==minIn && n[i].customAttrs.forceLabel==false) {
// n[i].customAttrs.forceLabel=true;
// counter++;
// }
// if(n[i].inDegree==maxIn && n[i].customAttrs.forceLabel==false) {
// n[i].customAttrs.forceLabel=true;
// counter++;
// }
// if(n[i].outDegree==minOut && n[i].customAttrs.forceLabel==false) {
// n[i].customAttrs.forceLabel=true;
// counter++;
// }
// if(n[i].outDegree==maxOut && n[i].customAttrs.forceLabel==false) {
// n[i].customAttrs.forceLabel=true;
// counter++;
// }
// if(counter==N) break;
// }
// }
// // new sigma.js
// TW.partialGraph.render();
// /*======= Show some labels at the beginning =======*/
// }
// ===============================
// GLOBAL-SCOPE (window) variables
// (TODO REFA make them inside TW.- ns)
// getnodes => preferably use TW.partialGraph.graph.nodes(some_node_id) as accessor
// (not often necessary + costly in mem because is a clone)
function
getnodes
(){
// new sigma.js
return
TW
.
partialGraph
.
graph
.
nodes
();
}
// idem
function
getedges
(){
return
TW
.
partialGraph
.
graph
.
edges
();
}
// used for saving to gexf
function
getVisibleEdges
()
{
// new sigma js POSS custom index to avoid loop
...
...
@@ -673,29 +595,21 @@ function getVisibleNodes() {
});
}
function
getNodesByAtt
(
att
)
{
return
TW
.
partialGraph
.
graph
.
nodes
().
filter
(
function
(
n
)
{
return
n
[
'type'
]
==
att
;
});
}
// fulltext search handler for #searchinput
function
find
(
lquery
){
var
results
=
[];
if
(
typeof
lquery
==
'string'
&&
lquery
.
length
>
0
)
{
lquery
=
lquery
.
toLowerCase
()
;
var
nds
=
getnodes
()
// console.log("FIND: looking among nodes", nds)
for
(
var
i
in
nds
){
var
n
=
nds
[
i
];
if
(
!
n
.
hidden
){
var
possiblematch
=
n
.
label
.
toLowerCase
()
// console.log("FIND: looking among TW.labels", TW.labels)
for
(
var
i
in
TW
.
labels
){
var
labObj
=
TW
.
labels
[
i
]
if
(
labObj
&&
labObj
.
label
){
var
possiblematch
=
labObj
.
label
.
toLowerCase
()
// ------------------
// substring search
// ------------------
if
(
possiblematch
.
indexOf
(
lquery
)
!==-
1
)
{
results
.
push
(
n
);
results
.
push
(
labObj
.
id
);
}
}
}
...
...
@@ -703,21 +617,6 @@ function find(lquery){
return
results
;
}
function
exactfind
(
label
)
{
if
(
typeof
lquery
==
'string'
&&
lquery
.
length
>
0
)
{
for
(
var
i
in
TW
.
nodeIds
){
n
=
TW
.
partialGraph
.
graph
.
nodes
(
TW
.
nodeIds
[
i
]);
if
(
!
n
.
hidden
){
if
(
n
.
label
==
label
)
{
return
n
;
}
}
}
}
return
null
;
}
function
getNodeLabels
(
elems
){
var
labelss
=
[]
for
(
let
i
in
elems
){
...
...
@@ -735,50 +634,6 @@ function getSelections(){
return
selLabels
;
}
//This receives an array not a dict!
// i added an excpt... why
function
getNeighs
(
sels
,
arr
)
{
neighDict
=
{};
for
(
var
i
in
sels
)
{
id
=
sels
[
i
]
if
(
!
isUndef
(
arr
[
id
]))
{
A
=
arr
[
id
].
neighbours
;
for
(
var
j
in
A
){
neighDict
[
A
[
j
]]
=
1
}
neighDict
[
id
]
=
1
;
}
}
return
Object
.
keys
(
neighDict
);
}
//It returns an array not a dict!
//Using bipartiteN2D or bipartiteD2N
//This receives an array not a dict!
function
getNeighs2
(
sels
,
arr
){
neighDict
=
{};
for
(
var
i
in
sels
)
{
id
=
sels
[
i
]
if
(
!
isUndef
(
arr
[
id
]))
{
A
=
arr
[
id
].
neighbours
;
for
(
var
j
in
A
){
neighDict
[
A
[
j
]]
=
1
}
// neighDict[id]=1;
}
}
return
Object
.
keys
(
neighDict
);
}
//It returns an array not a dict!
//to general utils
function
getArrSubkeys
(
arr
,
id
)
{
var
result
=
[]
for
(
var
i
in
arr
)
{
result
.
push
(
arr
[
i
][
id
])
}
return
result
;
}
// for logs
function
edgeInfos
(
anEdge
)
{
return
`
${
anEdge
.
id
}
(
${
TW
.
Nodes
[
anEdge
.
source
].
label
}
->
${
TW
.
Nodes
[
anEdge
.
target
].
label
}
)`
;
...
...
@@ -1090,41 +945,3 @@ function clusterColoring(daclass) {
set_ClustersLegend
(
daclass
)
TW
.
partialGraph
.
render
();
}
function
stringToSomeInt
(
anyString
)
{
let
charCodeSum
=
0
for
(
let
i
=
0
;
i
<
anyString
.
length
;
i
++
)
{
charCodeSum
+=
anyString
.
charCodeAt
(
i
)
}
return
charCodeSum
}
//just for fun
function
makeEdgeWeightUndef
()
{
for
(
var
e
in
TW
.
partialGraph
.
_core
.
graph
.
edges
)
{
TW
.
partialGraph
.
_core
.
graph
.
edges
[
e
].
weight
=
1
;
}
}
// shuffle algo from stackoverflow.com/a/6274398/2489184
function
shuffle
(
array
)
{
var
counter
=
array
.
length
;
// While there are elements in the array
while
(
counter
>
0
)
{
// Pick a random index
let
index
=
Math
.
floor
(
Math
.
random
()
*
counter
);
// Decrease counter by 1
counter
--
;
// And swap the last element with it
let
temp
=
array
[
counter
];
array
[
counter
]
=
array
[
index
];
array
[
index
]
=
temp
;
}
return
array
;
}
This diff is collapsed.
Click to expand it.
twitterAPI2/twitterlibs/custom.css
View file @
2cf9e030
...
...
@@ -23,9 +23,6 @@ p.Tweet-text {
min-height
:
90px
!important
;
}
.SandboxRoot
{
display
:
none
!important
;
}
blockquote
.Tweet
a
{
color
:
inherit
!important
;
font-weight
:
normal
!important
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment