Skip to content
This repository was archived by the owner on Jul 18, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/assets/js/main.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/networkcube/vistorian-bookmarkbrowser.git"
"url": "git+https://ithub.com/alkadi-mh/vistorian-bookmarkbrowser.git"
},
"collaborators": [
"Jean-Daniel Fekete <Jean-Daniel.Fekete@inria.fr",
"Alexandra Ibarra Cuesta"
],
"homepage": "https://github.com/networkcube/networkcube#readme",
"homepage": "https://github.com/alkadi-mh/vistorian-bookmarkbrowser#readme",
"bundledDependencies": [
"jquery",
"lz-string",
Expand Down
24 changes: 15 additions & 9 deletions src/bookmarkbrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export function createSelectionCategory(name: string, type: string) {
.datum(type)
.attr('type', 'button')
.attr('value', '+')
.attr('onclick','trace.event(\'vis_13\',document.location.pathname,\'add \' ,\'' + type + '\')')
.on('click', function (d: string) { createSelection(d) })

}
Expand All @@ -69,10 +70,12 @@ export function updateViewOnlyList(type: string, name: string){
//Remove duplicates
var tmp: any[] = [];
var trimmedColors = (dgraph.nodeArrays as any).color.filter(function (v: any) {
if (tmp.indexOf(v.toString()) < 0) {
tmp.push(v.toString());
return v;
}
if(typeof v!='undefined' && v){
if (tmp.indexOf(v.toString()) < 0) {
tmp.push(v.toString());
return v;
}
}
});
//Remove null/undefinted
var tmp: any[] = [];
Expand All @@ -87,10 +90,12 @@ export function updateViewOnlyList(type: string, name: string){
//Remove duplicates
var tmp: any[] = [];
var trimmedShapes = (dgraph.nodeArrays as any).shape.filter(function (v: any) {
if (tmp.indexOf(v.toString()) < 0) {
tmp.push(v.toString());
return v;
}
if(typeof v!='undefined' && v){
if (tmp.indexOf(v.toString()) < 0) {
tmp.push(v.toString());
return v;
}
}
});
//Remove null/undefinted
var tmp: any[] = [];
Expand Down Expand Up @@ -268,8 +273,9 @@ export function updateList(type: string, name: string) {
nodeGs.append('svg:image')
.attr('id', 'eye_' + name)
.attr('class', 'icon_eye icon')
.attr('xlink:href', 'eye-visible.png')
.attr('xlink:href', 'eye-seeing.png')//eye-visible.png
.attr('x', 130 + (RECT_SIZE + GAP_ICONS) * i++)
.attr('onclick','trace.event(\'vis_14\',document.location.pathname,\'' +name + '\' , this.getAttribute(\'href\'))')
.on('click', function (d: datamanager.Selection, i: any) {
messenger.filterSelection(d, !d.filter);
})
Expand Down
7 changes: 4 additions & 3 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<script src="../node_modules/moment/moment.js"></script>
<script src="../node_modules/lz-string/libs/lz-string.js"></script>
<script src="./static/science.js"></script>
<script type="text/javascript" src="./static/traces/trace.js"></script>

<script> var exports = {}; </script>
<script src="../node_modules/vistorian-core/lib/vistorian-core.js"></script>
Expand All @@ -22,11 +23,11 @@

<div id="searchDiv">
<input id="searchField" type="text" name="searchInput" value="Search ..."
onfocus="if (this.value == 'Search ...') {this.value = '';}" width="100%" />
onfocus="if (this.value == 'Search ...') {this.value = '';}" onblur="trace.event('vis_10', 'Bookmark', 'search textbook', 'search term entered')" width="100%" />
</br>
<input id="searchButton" type="button" name="searchButton" value="Find" onclick="startSearch()" />
<input id="searchButton" type="button" name="searchButton" value="Find" onclick="startSearch();trace.event('vis_11', 'Bookmark', 'search button', 'Vis Nodes')" />
<input id="clearButton" type="button" name="clearButton" value="Clear Search"
onclick="clearSearchSelection()" />
onclick="clearSearchSelection();trace.event('vis_12', 'Bookmark', 'Clear search button', 'Vis Nodes')" />
<ul id="searchResults">
</ul>
</div>
Expand Down
184 changes: 184 additions & 0 deletions web/static/traces/trace.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
(function() {

var _traceq = _traceq || [];
var traceUrl = "/trace";
// "http://localhost:5000/trace";
var _sending = null;
var sessionId;
var starting = true;
var debug = false;
var loggingEnabled=false;

const storageType=sessionStorage;
const LoggingPhase='acceptLogging';
const SessionLogId='SessionLogId';

function SetLoggingStatus(val) {
localStorage.setItem(LoggingPhase, val);


}
function UpdateLoggingStatus() {
loggingEnabled= Boolean(localStorage.getItem(LoggingPhase));

};
UpdateLoggingStatus();

trace = {version: "0.3"};

trace.url = function(url) {
if (!arguments.length) return url;
traceUrl = url;
return trace;
};

trace.sessionId = function() {
return sessionId;
};

trace.debug = function(d) {
if (!arguments.length) return debug;
// debug = d;
return trace;
};

var uuid = function() {
if (!(localStorage.getItem(SessionLogId))){
var uuid = "", i, random;
for (i = 0; i < 32; i++) {
random = Math.random() * 16 | 0;

if (i == 8 || i == 12 || i == 16 || i == 20) {
uuid += "-";
}
uuid += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).toString(16);
}
localStorage.setItem(SessionLogId, uuid);
}
else{
uuid=localStorage.getItem(SessionLogId);
}

return uuid;
};

var sendLogs_ = function(list) {
var httpRequest;
if (window.XDomainRequest)
{
httpRequest=new XDomainRequest();
httpRequest.onload = function() { sendMoreOrAgain(true); };
}
else if (window.XMLHttpRequest)
httpRequest=new XMLHttpRequest();
else
httpRequest=new ActiveXObject("Microsoft.XMLHTTP");
httpRequest.onreadystatechange = function() {
if (debug) {
window.console && console.log("readyState =%d", httpRequest.readyState);
}
if (httpRequest.readyState == this.DONE) {
if (debug) {
window.console && console.log("status =%d", httpRequest.status);
}
sendMoreOrAgain(httpRequest.status < 300);
}
};
var json = JSON.stringify(list);
httpRequest.open("POST", traceUrl, true);
if (window.XDomainRequest) {
// no request header?
}
else if (window.XMLHttpRequest) {
httpRequest.setRequestHeader("Content-Type", "application/json");
httpRequest.setRequestHeader("Accept", "text/plain");
// httpRequest.setRequestHeader("Content-Length", json.length);
}
// httpRequest.send(json);
};

var sendLogs = function() {
if (_traceq.length == 0) return;
_sending = _traceq;
if (debug) {
window.console && console.log("Sending %d messages", _sending.length);
}
_traceq = [];
sendLogs_(_sending);
};

var sendMoreOrAgain = function(ok) {
if (ok) {
_sending = null;
sendLogs();
}
else {
if (_traceq.length != 0) {
_sending = _sending.concat(_traceq);
_traceq = [];
}
if (debug) {
window.console && console.log("Re-sending %d messages", _sending.length);
}
sendLogs_(_sending); // try again
}
};

function traceMetadata(action, label, value) {
return traceEvent("_trace", action, label, value);
}

function traceEvent(cat, action, label, value) {

if (localStorage.getItem("acceptLogging")==="true"){

if (starting) {
//if (StartedLogging()) {
// storageType.setItem(LoggingPhase,false);

starting = false;
_sending = [];
traceEvent("log_1", "Vistorian Trace", "Session", "Start");
traceEvent("_trace", "document.location", "href", localStorage.getItem(SessionLogId));
// traceEvent("_trace", "browser", "userAgent", navigator.userAgent);
// traceEvent("_trace", "screen", "size", "w:"+screen.width+";h:"+screen.height);
// traceEvent("_trace", "window", "innerSize", "w:"+window.innerWidth+";h:"+window.innerHeight);
_sending = null;
}

if (debug) {
window.console && console.log("Track["+cat+","+action+","+label+"]");
}
var ts = Date.now();
_traceq.push({"session": sessionId,
"ts": ts,
"cat": cat,
"action": action,
"label": label,
"value": value});
if (_sending == null)
sendLogs();
return trace;
}
}

// console.log("Trace initialized with sessionId=%s", sessionId);

function traceEventDeferred(delay, cat, action, label, value) {
return window.setTimeout(function() {
traceEvent(cat, action, label, value);
}, delay);
return trace;
}

function traceEventClear(id) {
if(typeof id == "number") {
clearTimeout(id);
}
return trace;
}
trace.event = traceEvent;
trace.eventDeferred = traceEventDeferred;
trace.eventClear = traceEventClear;
sessionId = uuid();
})();
32 changes: 32 additions & 0 deletions web/static/traces/trace_test_130529.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// COOKIE STUFF
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}

function eraseCookie(name) {
createCookie(name,"",-1);
}

trace.debug(true);


function trace_help() {
trace.event("help", "ts_matrixVisManual", "CCC", "DDD")
}