Commit 0ca4e2f3 authored by Romain Loth's avatar Romain Loth

basic version of one search bar

parent d3fcaa96
......@@ -58,15 +58,28 @@
margin: 0 ;
padding: 0;
}
/* small messages */
p.micromessage{
font-size: 85%;
color: #707070 ;
}
/* ------------- crowdsourcing proprement dit ----------------------- */
#crowdsourcing_intro{
#crowdsourcing_answer{
font-size: 85%;
color: #707070 ;
padding:0 1em ;
text-align:center ;
}
#savesuggestion.btn {
#crowdsourcing_answer p {
margin: 2px 0;
}
#savesuggestion.btn {
}
#savesuggestion.btn[disabled], #savesuggestion.btn.disabled {
background-color: #B0B0B0 ;
......
......@@ -14,8 +14,9 @@ loadCSS(module_name+"/crowdTerms.css")
loadJS(module_name+"/modal.js") ;
// histogram
loadJS(module_name+"/dygraph/dygraph.combined.js") ;
loadCSS(module_name+"/dygraph/gallery.css") ;
loadCSS(module_name+"/dygraph/textarea.css") ;
loadJS(module_name+"/dygraph/dygraph.combined.js") ;
console.log("OK LOADED " + module_name) ;
This diff is collapsed.
This diff is collapsed.
......@@ -11,6 +11,7 @@ function newPopup(url) {
// Execution: ChangeGraphAppearanceByAtt( true )
// It scans the existing node-attributes and t keeps only those which are Numeric.
// then, add the button in the html with the sigmaUtils.clustersBy(x) listener.
// [TODO: fonction un peu lourde dans le profilage]
function ChangeGraphAppearanceByAtt( manualflag ) {
if ( !isUndef(manualflag) && !TW.colorByAtt ) TW.colorByAtt = manualflag;
......
......@@ -23,11 +23,16 @@
margin-bottom:1px;
}
#defaultop{
#defaultop{
min-height: 5%;
max-height: 10%;
}
/* searchnav gets same padding as bootstrap's .navbar-nav > li > a */
#defaultop div#searchnav {
padding-top: 13px;
padding-bottom: 9px;
}
#sigma-example {
width: 100%;
height: 300px;
......@@ -45,6 +50,10 @@
.my-legend {
position:fixed;
/* width: we set it smaller than #leftcolumn container's width */
width:16%;
max-height: 40%;
overflow-y:scroll;
bottom:5px;
left:5px;
......
.fsslider {
position: relative;
min-width: 100px;
/* min-width: 100px; */
min-width: 75px;
height: 8px;
display: inline-block;
width: 100%;
......
......@@ -51,6 +51,8 @@ var TW = {}
TW.SystemStates.opposites = [];
TW.catSoc = "Document";
TW.catSem = "NGram";
TW.strSearchBar = "Select or suggest topics";
var ParseCustom = function () {};
var SigmaUtils = function () {};
......@@ -67,7 +69,6 @@ var inactiveColor = '#666';
var startingNodeId = "1";
var minLengthAutoComplete = 1;
var maxSearchResults = 10;
var strSearchBar = "Search";
var cursor_size_min= 0;
var cursor_size= 0;
......
This diff is collapsed.
......@@ -833,6 +833,8 @@ function extractContext(string, context) {
return begin_pts + str + end_pts;
}
// TODO check duplicate function with sigmaUtils exactfind()
function searchLabel(string){
var id_node = '';
var n;
......
......@@ -193,6 +193,46 @@ function rgbToHex(r, g, b) {
}
// lowercase etc query strings
normalizeString = function(string) {
if (! typeof string == "string") {
return "" ;
}
else {
return $.trim( string.toLowerCase() )
}
}
// html-escape user input strings
// /!\ TODO check if safe enough?
saferString = function(string) {
// TODO table in an outer scope
conversions = {
'&' : '&' ,
'<' : '&lt;' ,
'>' : '&gt;' ,
'"' : '&quot;' ,
"'" : '&apos;' ,
'%' : '&percnt;'
} ;
matchables = /[&<>"'%]/ ;
if (! typeof string == "string") {
return "" ;
}
else {
return string.replace(
matchables,
function(char) {
return conversions[char]
}
)
}
}
/**
* function to load a given css file
*/
......@@ -207,4 +247,4 @@ function rgbToHex(r, g, b) {
loadJS = function(src) {
var jsLink = $("<script type='text/javascript' src='"+src+"'>");
$("head").append(jsLink);
};
\ No newline at end of file
};
......@@ -265,7 +265,7 @@ if(RES["OK"]) {
console.log(typestring)
if(typestring=="0|1") {
$("#category0").hide();set_ClustersLegend
$("#category0").hide();
$("#category1").show();
if($("#slidercat1nodesweight").html()=="")
......@@ -364,6 +364,9 @@ if(RES["OK"]) {
// load optional modules
ProcessDivsFlags() ;
// grey message in the search bar from settings
$("#searchinput").attr('placeholder', TW.strSearchBar) ;
console.log("finish")
......
......@@ -37,7 +37,12 @@ function cancelSelection (fromTagCloud) {
$("#searchinput").val("");
$("#unselectbutton").hide();
$("#tips").html(getTips());
}
}
// we send our "eraseNodeSet" event
// (signal for plugins that any selection behavior is finished)
$('#searchinput').trigger("tw:eraseNodeSet");
for(var i in deselections){
if( !isUndef(TW.partialGraph._core.graph.nodesIndex[i]) ) {
TW.partialGraph._core.graph.nodesIndex[i].forceLabel=false;
......
......@@ -27,6 +27,8 @@ SigmaUtils = function () {
if(Number(n.id)==287) console.log("coordinates of node 287: ( "+n.x+" , "+n.y+" ) ")
graph.addNode( n.id , node);
// fill the "labels" global variable
updateSearchLabels( n.id , n.label , n.type);
}
}
......@@ -148,17 +150,20 @@ function gete(id){
}
function find(label){
function find(lquery){
var results=[];
var nds=getnodesIndex();
label=label.toLowerCase()
for(var i in nds){
var n=nds[i];
if(n.hidden==false){
var possiblematch=n.label.toLowerCase()
if (possiblematch.indexOf(label)!==-1) {
results.push(n);
}
if (typeof lquery == 'string' && lquery.length > 0) {
lquery=lquery.toLowerCase() ;
var nds=getnodesIndex();
for(var i in nds){
var n=nds[i];
if(n.hidden==false){
var possiblematch=n.label.toLowerCase()
// string.indexOf(substring) faster than search/match
if (possiblematch.indexOf(lquery)!==-1) {
results.push(n);
}
}
}
}
return results;
......@@ -166,11 +171,13 @@ function find(label){
function exactfind(label) {
nds=getnodesIndex();
for(var i in nds){
n=nds[i];
if(!n.hidden){
if (n.label==label) {
return n;
if (typeof lquery == 'string' && lquery.length > 0) {
for(var i in nds){
n=nds[i];
if(!n.hidden){
if (n.label==label) {
return n;
}
}
}
}
......@@ -387,4 +394,4 @@ function makeEdgeWeightUndef() {
for(var e in TW.partialGraph._core.graph.edges) {
TW.partialGraph._core.graph.edges[e].weight=1;
}
}
\ No newline at end of file
}
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