fix conflicts
|
@ -15,7 +15,7 @@ const TIME_X1 = -275;
|
|||
const TIME_X2 = 270 ;
|
||||
const TIME_Y = CY - 5;
|
||||
|
||||
var vizcanvas, times, timeslots, offsets;
|
||||
var times, timeslots, offsets;
|
||||
|
||||
// TODO: Make visualization an event emitter, so I can call on('connection', fn) and emit('connection', connection)
|
||||
|
||||
|
@ -36,7 +36,6 @@ function onInit(connections){
|
|||
console.log("= onInit = allConnections.length = %s" , allConnections.length);
|
||||
// draw clock dial
|
||||
console.log('initializing clock from %s connections', connections.length);
|
||||
vizcanvas = document.querySelector('.vizcanvas');
|
||||
aggregate.emit('init', connections);
|
||||
times = ['12 am', '1 am', '2 am', '3 am', '4 am', '5 am', '6 am', '7 am', '8 am', '9 am', '10 am', '11 am', '12 pm', '1 pm', '2 pm', '3 pm', '4 pm', '5 pm', '6 pm', '7 pm', '8 pm', '9 pm', '10 pm', '11 pm', '12 am'];
|
||||
timeslots = {};
|
||||
|
|
|
@ -24,6 +24,17 @@ const STATUS = 12;
|
|||
const CACHEABLE = 13;
|
||||
const FROM_PRIVATE_MODE = 14;
|
||||
|
||||
var vizcanvas = document.querySelector('.vizcanvas');
|
||||
var mapDocument, mapcanvas;
|
||||
document.querySelector('.world-map').addEventListener('load', function(event){
|
||||
mapDocument = event.target.contentDocument;
|
||||
mapcanvas = mapDocument.querySelector('.mapcanvas');
|
||||
console.log('we should have a mapcanvas now: %o', mapcanvas);
|
||||
initMap();
|
||||
console.log('map initialized');
|
||||
}, false);
|
||||
|
||||
|
||||
// DOM Utility
|
||||
|
||||
function elem(name, attributes, children){
|
||||
|
@ -72,9 +83,6 @@ function elem(name, attributes, children){
|
|||
window.addEventListener('load', function(evt){
|
||||
addon.emit("privateWindowCheck");
|
||||
// Wire up events
|
||||
// document.querySelector('.btn_group.visualization').click();
|
||||
// document.querySelector('[data-value=' + (localStorage.visualization || 'Graph') + ']').click();
|
||||
// document.querySelector('[data-value=' + (localStorage.visualization || 'Graph') + ']').setAttribute("data-selected").click();
|
||||
document.querySelector('[data-value=' + (localStorage.visualization || 'Graph') + ']').setAttribute("data-selected", true);
|
||||
document.querySelector('.btn_group.visualization [data-selected]').classList.remove("collapsed");
|
||||
switchVisualization(localStorage.visualization.toLowerCase() || 'graph');
|
||||
|
@ -129,6 +137,26 @@ function resetAddtionalUI(){
|
|||
clearAllBubbles();
|
||||
// show vizcanvas again in case it is hidden
|
||||
document.querySelector(".vizcanvas").classList.remove("hide");
|
||||
// toggle graph legend section
|
||||
console.log(currentVisualization.name);
|
||||
if( currentVisualization.name != "graph" ){
|
||||
document.querySelector(".graph-legend").classList.add("hidden");
|
||||
}else{
|
||||
document.querySelector(".graph-legend").classList.remove("hidden");
|
||||
document.querySelector('.stage-header h1').textContent = 'Graph View';
|
||||
}
|
||||
if( currentVisualization.name != "list" ){
|
||||
document.querySelector(".list-footer").classList.add("hidden");
|
||||
console.log('should be hidden');
|
||||
}else{
|
||||
document.querySelector(".list-footer").classList.remove("hidden");
|
||||
document.querySelector('.stage-header h1').textContent = 'List View';
|
||||
}
|
||||
if( currentVisualization.name != "clock" ){
|
||||
|
||||
}else{
|
||||
document.querySelector('.stage-header h1').textContent = 'Clock View';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ var graph = new Emitter();
|
|||
visualizations.graph = graph;
|
||||
graph.name = "graph";
|
||||
var width = 1000, height = 1000;
|
||||
var force, vizcanvas, vis;
|
||||
var force, vis;
|
||||
|
||||
// There are three phases for a visualization life-cycle:
|
||||
// init does initialization and receives the existing set of connections
|
||||
|
@ -30,8 +30,7 @@ function setFilter(){
|
|||
function onInit(connections){
|
||||
console.log("= onInit = allConnections.length = %s" , allConnections.length);
|
||||
console.log('initializing graph from %s connections', connections.length);
|
||||
vizcanvas = document.querySelector('.vizcanvas');
|
||||
vis = d3.select('.vizcanvas');
|
||||
vis = d3.select(vizcanvas);
|
||||
// A D3 visualization has a two main components, data-shaping, and setting up the D3 callbacks
|
||||
aggregate.emit('load', connections);
|
||||
// This binds our data to the D3 visualization and sets up the callbacks
|
||||
|
|
После Ширина: | Высота: | Размер: 488 B |
После Ширина: | Высота: | Размер: 905 B |
После Ширина: | Высота: | Размер: 957 B |
После Ширина: | Высота: | Размер: 370 B |
После Ширина: | Высота: | Размер: 679 B |
После Ширина: | Высота: | Размер: 872 B |
После Ширина: | Высота: | Размер: 703 B |
После Ширина: | Высота: | Размер: 1.8 KiB |
После Ширина: | Высота: | Размер: 642 B |
После Ширина: | Высота: | Размер: 734 B |
После Ширина: | Высота: | Размер: 817 B |
После Ширина: | Высота: | Размер: 765 B |
После Ширина: | Высота: | Размер: 970 B |
После Ширина: | Высота: | Размер: 807 B |
После Ширина: | Высота: | Размер: 579 B |
После Ширина: | Высота: | Размер: 1.3 KiB |
После Ширина: | Высота: | Размер: 4.6 KiB |
2757
data/index.html
|
@ -1,6 +1,6 @@
|
|||
(function(global){
|
||||
function initMap(){
|
||||
|
||||
const oriMapViewBox = document.querySelector('.mapcanvas').getAttribute('viewBox');
|
||||
var oriMapViewBox = mapcanvas.getAttribute('viewBox');
|
||||
|
||||
// update info when clicking on a node in the graph visualization
|
||||
document.querySelector('#content').addEventListener('click', function(event){
|
||||
|
@ -36,25 +36,25 @@ function getServerInfo(nodeName, callback){
|
|||
|
||||
// reset map
|
||||
function resetMap(){
|
||||
var preHighlight = document.querySelectorAll(".highlight-country");
|
||||
var preHighlight = mapDocument.querySelectorAll(".highlight-country");
|
||||
if (preHighlight){
|
||||
toArray(preHighlight).forEach(function(element){
|
||||
element.classList.remove("highlight-country");
|
||||
});
|
||||
}
|
||||
document.querySelector(".mapcanvas").setAttribute("viewBox", oriMapViewBox);
|
||||
mapcanvas.setAttribute("viewBox", oriMapViewBox);
|
||||
}
|
||||
|
||||
// update map
|
||||
function updateMap(countryCode){
|
||||
var countryOnMap = d3.select(".mapcanvas").select("#" + countryCode.toLowerCase());
|
||||
var countryOnMap = d3.select(mapcanvas).select("#" + countryCode.toLowerCase());
|
||||
countryOnMap.classed("highlight-country", true);
|
||||
countryOnMap.selectAll("*").classed("highlight-country", true);
|
||||
|
||||
// position the highlighted country in center
|
||||
var svgViewBox = document.querySelector(".mapcanvas").getAttribute("viewBox").split(" ");
|
||||
var worldDimen = document.querySelector(".mapcanvas").getClientRects()[0];
|
||||
var countryDimen = document.querySelector("#"+countryCode).getClientRects()[0];
|
||||
var svgViewBox = mapcanvas.getAttribute("viewBox").split(" ");
|
||||
var worldDimen = mapcanvas.getClientRects()[0];
|
||||
var countryDimen = mapDocument.querySelector("#"+countryCode).getClientRects()[0];
|
||||
|
||||
var ratio = svgViewBox[2] / worldDimen.width;
|
||||
var worldCenter = {
|
||||
|
@ -72,7 +72,7 @@ function updateMap(countryCode){
|
|||
w: svgViewBox[2],
|
||||
h: svgViewBox[3]
|
||||
};
|
||||
setZoom(newViewBox,'mapcanvas');
|
||||
setZoom(newViewBox, mapcanvas);
|
||||
}
|
||||
|
||||
|
||||
|
@ -120,7 +120,39 @@ function updateInfo(nodeName){
|
|||
|
||||
}
|
||||
|
||||
/* mapcanvas events */
|
||||
mapcanvas.addEventListener("mousedown",function(event){
|
||||
onDragMap = true;
|
||||
mapDragStart.x = event.clientX;
|
||||
mapDragStart.y = event.clientY;
|
||||
},false);
|
||||
|
||||
})(this);
|
||||
mapcanvas.addEventListener("mousemove",function(event){
|
||||
if ( onDragMap ){
|
||||
mapcanvas.style.cursor = "-moz-grab";
|
||||
var offsetX = ( Math.ceil(event.clientX) - mapDragStart.x );
|
||||
var offsetY = ( Math.ceil(event.clientY) - mapDragStart.y );
|
||||
var box = getZoom(mapcanvas);
|
||||
box.x -= (offsetX * 10);
|
||||
box.y -= (offsetY * 10);
|
||||
mapDragStart.x += offsetX;
|
||||
mapDragStart.y += offsetY;
|
||||
setZoom(box,mapcanvas);
|
||||
}
|
||||
|
||||
},false);
|
||||
|
||||
mapcanvas.addEventListener("mouseup",function(event){
|
||||
onDragMap = false;
|
||||
mapcanvas.style.cursor = "default";
|
||||
},false);
|
||||
|
||||
mapcanvas.addEventListener("mouseleave",function(event){
|
||||
onDragMap = false;
|
||||
mapcanvas.style.cursor = "default";
|
||||
},false);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
112
data/list.js
|
@ -9,8 +9,6 @@ var list = new Emitter();
|
|||
visualizations.list = list;
|
||||
list.name = "list";
|
||||
|
||||
var vizcanvas;
|
||||
|
||||
list.on("init", onInit);
|
||||
list.on("conneciton", onConnection);
|
||||
list.on("remove", onRemove);
|
||||
|
@ -26,12 +24,12 @@ function setFilter(){
|
|||
|
||||
function onInit(connections){
|
||||
console.log('initializing list from %s connections', connections.length);
|
||||
vizcanvas = document.querySelector('.vizcanvas');
|
||||
vizcanvas.classList.add("hide"); // we don't need vizcanvas here, so hide it
|
||||
// A D3 visualization has a two main components, data-shaping, and setting up the D3 callbacks
|
||||
aggregate.emit('load', connections);
|
||||
// This binds our data to the D3 visualization and sets up the callbacks
|
||||
initList();
|
||||
initializeHandlers();
|
||||
//aggregate.on('updated', function(){ });
|
||||
}
|
||||
|
||||
|
@ -52,14 +50,15 @@ function onRemove(){
|
|||
function initList(){
|
||||
console.log('begin initList()');
|
||||
var stage = document.querySelector('.stage');
|
||||
stage.classList.add("list");
|
||||
document.querySelector('.stage-stack').classList.add("list");
|
||||
document.querySelector('.stage-header h1').textContent = 'List View';
|
||||
|
||||
// list header
|
||||
var table = elem("div", {'class': 'list-table'}, [
|
||||
elem('table', [
|
||||
elem('thead', {'class': 'header-table'}, [
|
||||
elem('tr', [
|
||||
elem('th', elem('input', {'class': 'selectedHeader', type: 'checkbox'})),
|
||||
elem('th', elem('input', {'class': 'selected-header', type: 'checkbox'})),
|
||||
elem('th', 'Type'),
|
||||
elem('th', 'Prefs'),
|
||||
elem('th', 'Website'),
|
||||
|
@ -131,18 +130,13 @@ function getNodes(filter){
|
|||
|
||||
function nodeToRow(node){
|
||||
var settings = userSettings[node.name] || '';
|
||||
var settingsSort = {
|
||||
'': 0,
|
||||
'block': 1,
|
||||
'hide': 2,
|
||||
'watch': 3
|
||||
}[settings];
|
||||
return elem('tr', {
|
||||
'class': userSettings[node.name] + ' node ' + node.nodeType,
|
||||
'class': 'node ' + node.nodeType,
|
||||
'data-pref': settings,
|
||||
'data-name': node.name,
|
||||
'site-url': node.name
|
||||
}, [
|
||||
elem('td', elem('input', {'type': 'checkbox', 'class': 'selectedRow'})),
|
||||
elem('td', elem('input', {'type': 'checkbox', 'class': 'selected-row'})),
|
||||
elem('td', {'data-sort-key': node.nodeType}, node.nodeType === 'thirdparty' ? 'Third Party' : 'Visited'),
|
||||
elem('td', {'class': 'preferences', 'data-sort-key': settings}, '\u00A0'),
|
||||
elem('td', {'data-sort-key': node.name}, node.name),
|
||||
|
@ -213,7 +207,6 @@ function sortTableOnColumn(table, n){
|
|||
}
|
||||
|
||||
function resort(table){
|
||||
try{
|
||||
var direction = localStorage.lastSortDirection;
|
||||
if (direction){
|
||||
var index = parseInt(localStorage.lastSortColumn, 10) + 1; // nth child is 1-based
|
||||
|
@ -223,9 +216,6 @@ function resort(table){
|
|||
header.classList.add(direction === 'forward' ? 'reverse-sorted' : 'sorted');
|
||||
header.dispatchEvent(new MouseEvent('click'))
|
||||
}
|
||||
}catch(e){
|
||||
console.log('Problem in resort: %o', e);
|
||||
}
|
||||
}
|
||||
|
||||
function resetCanvas(){
|
||||
|
@ -234,4 +224,92 @@ function resetCanvas(){
|
|||
vizcanvas.classList.remove("hide");
|
||||
}
|
||||
|
||||
function getSelectedRows(){
|
||||
// returns selected rows as an Array
|
||||
return Array.prototype.slice.call(document.querySelectorAll('.body-table tr')).filter(function(item){
|
||||
return item.querySelector('.selected-row:checked');
|
||||
})
|
||||
}
|
||||
|
||||
// Event handlers
|
||||
|
||||
function setUserSetting(row, pref){
|
||||
var site = row.dataset.name;
|
||||
console.log('setting user setting %s for %s', pref, site);
|
||||
// change setting
|
||||
userSettings[site] = pref;
|
||||
// send change through to add-on
|
||||
addon.emit('updateBlocklist', site, pref === 'block');
|
||||
// modify row
|
||||
row.dataset.pref = pref;
|
||||
// Add sort order to preference column
|
||||
row.querySelector('.preferences').dataset.sortKey = pref;
|
||||
// Re-sort if sorted by preference
|
||||
if(localStorage.lastSortColumn === '2'){
|
||||
resort(document.querySelector(".list-table"));
|
||||
}
|
||||
}
|
||||
|
||||
function selectAllRows(flag){
|
||||
console.log('selecting all rows');
|
||||
var checkboxes = document.querySelectorAll('.selected-row');
|
||||
for (var i = 0; i < checkboxes.length; i++){
|
||||
checkboxes[i].checked = flag;
|
||||
}
|
||||
}
|
||||
|
||||
function setPreferences(pref){
|
||||
getSelectedRows().forEach(function(row){
|
||||
setUserSetting(row, pref);
|
||||
});
|
||||
}
|
||||
|
||||
function toggleHiddenSites(target){
|
||||
if (target.dataset.state === 'shown'){
|
||||
target.dataset.state = 'hidden';
|
||||
target.textContent = 'Show Hidden';
|
||||
document.querySelector('.stage-stack').classList.add('hide-hidden-rows');
|
||||
localStorage.listViewHideRows = true;
|
||||
}else{
|
||||
target.dataset.state = 'shown';
|
||||
target.textContent = 'Hide Hidden';
|
||||
document.querySelector('.stage-stack').classList.remove('hide-hidden-rows');
|
||||
localStorage.listViewHideRows = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Restore state on load
|
||||
if (localStorage.listViewHideRows){
|
||||
var button = document.querySelector('.toggle-hidden a');
|
||||
button.dataset.state = 'hidden';
|
||||
button.textContent = 'Show Hidden';
|
||||
document.querySelector('.stage-stack').classList.add('hide-hidden-rows');
|
||||
}
|
||||
|
||||
// Install handlers
|
||||
function initializeHandlers(){
|
||||
try{
|
||||
document.querySelector('.selected-header').addEventListener('change', function(event){
|
||||
selectAllRows(event.target.checked);
|
||||
}, false);
|
||||
|
||||
document.querySelector('.stage-stack').addEventListener('click', function(event){
|
||||
var target = event.target;
|
||||
if(target.mozMatchesSelector('.block-pref a')){
|
||||
setPreferences('block');
|
||||
}else if (target.mozMatchesSelector('.hide-pref a')){
|
||||
setPreferences('hide');
|
||||
}else if (target.mozMatchesSelector('.watch-pref a')){
|
||||
setPreferences('watch');
|
||||
}else if(target.mozMatchesSelector('.no-pref a')){
|
||||
setPreferences('');
|
||||
}else if(target.mozMatchesSelector('.toggle-hidden a')){
|
||||
toggleHiddenSites(target);
|
||||
}
|
||||
}, false);
|
||||
}catch(e){
|
||||
console.log('Error: %o', e);
|
||||
}
|
||||
}
|
||||
|
||||
})(visualizations);
|
||||
|
|
После Ширина: | Высота: | Размер: 1.4 MiB |
|
@ -1,496 +0,0 @@
|
|||
/*
|
||||
SortTable
|
||||
version 2
|
||||
7th April 2007
|
||||
Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
|
||||
|
||||
Instructions:
|
||||
Download this file
|
||||
Add <script src="sorttable.js"></script> to your HTML
|
||||
Add class="sortable" to any table you'd like to make sortable
|
||||
Click on the headers to sort
|
||||
|
||||
Thanks to many, many people for contributions and suggestions.
|
||||
Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
|
||||
This basically means: do what you want with it.
|
||||
*/
|
||||
|
||||
|
||||
var stIsIE = /*@cc_on!@*/false;
|
||||
|
||||
sorttable = {
|
||||
init: function() {
|
||||
// quit if this function has already been called
|
||||
if (arguments.callee.done) return;
|
||||
// flag this function so we don't do the same thing twice
|
||||
arguments.callee.done = true;
|
||||
// kill the timer
|
||||
if (_timer) clearInterval(_timer);
|
||||
|
||||
if (!document.createElement || !document.getElementsByTagName) return;
|
||||
|
||||
sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;
|
||||
|
||||
forEach(document.getElementsByTagName('table'), function(table) {
|
||||
if (table.className.search(/\bsortable\b/) != -1) {
|
||||
sorttable.makeSortable(table);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
makeSortable: function(table) {
|
||||
if (table.getElementsByTagName('thead').length == 0) {
|
||||
// table doesn't have a tHead. Since it should have, create one and
|
||||
// put the first table row in it.
|
||||
the = document.createElement('thead');
|
||||
the.appendChild(table.rows[0]);
|
||||
table.insertBefore(the,table.firstChild);
|
||||
}
|
||||
// Safari doesn't support table.tHead, sigh
|
||||
if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0];
|
||||
|
||||
if (table.tHead.rows.length != 1) return; // can't cope with two header rows
|
||||
|
||||
// Sorttable v1 put rows with a class of "sortbottom" at the bottom (as
|
||||
// "total" rows, for example). This is B&R, since what you're supposed
|
||||
// to do is put them in a tfoot. So, if there are sortbottom rows,
|
||||
// for backwards compatibility, move them to tfoot (creating it if needed).
|
||||
sortbottomrows = [];
|
||||
for (var i=0; i<table.rows.length; i++) {
|
||||
if (table.rows[i].className.search(/\bsortbottom\b/) != -1) {
|
||||
sortbottomrows[sortbottomrows.length] = table.rows[i];
|
||||
}
|
||||
}
|
||||
if (sortbottomrows) {
|
||||
if (table.tFoot == null) {
|
||||
// table doesn't have a tfoot. Create one.
|
||||
tfo = document.createElement('tfoot');
|
||||
table.appendChild(tfo);
|
||||
}
|
||||
for (var i=0; i<sortbottomrows.length; i++) {
|
||||
tfo.appendChild(sortbottomrows[i]);
|
||||
}
|
||||
delete sortbottomrows;
|
||||
}
|
||||
|
||||
// work through each column and calculate its type
|
||||
headrow = table.tHead.rows[0].cells;
|
||||
for (var i=0; i<headrow.length; i++) {
|
||||
// manually override the type with a sorttable_type attribute
|
||||
if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip this col
|
||||
mtch = headrow[i].className.match(/\bsorttable_([a-z0-9]+)\b/);
|
||||
if (mtch) { override = mtch[1]; }
|
||||
if (mtch && typeof sorttable["sort_"+override] == 'function') {
|
||||
headrow[i].sorttable_sortfunction = sorttable["sort_"+override];
|
||||
} else {
|
||||
headrow[i].sorttable_sortfunction = sorttable.guessType(table,i);
|
||||
}
|
||||
// make it clickable to sort
|
||||
headrow[i].sorttable_columnindex = i;
|
||||
headrow[i].sorttable_tbody = table.tBodies[0];
|
||||
|
||||
dean_addEvent(headrow[i],"click", sorttable.innerSortFunction = function(e) {
|
||||
|
||||
if (this.className.search(/\bsorttable_sorted\b/) != -1) {
|
||||
// if we're already sorted by this column, just
|
||||
// reverse the table, which is quicker
|
||||
sorttable.reverse(this.sorttable_tbody);
|
||||
this.className = this.className.replace('sorttable_sorted',
|
||||
'sorttable_sorted_reverse');
|
||||
this.removeChild(document.getElementById('sorttable_sortfwdind'));
|
||||
sortrevind = document.createElement('span');
|
||||
sortrevind.id = "sorttable_sortrevind";
|
||||
sortrevind.innerHTML = stIsIE ? ' <font face="webdings">5</font>' : ' ▴';
|
||||
this.appendChild(sortrevind);
|
||||
return;
|
||||
}
|
||||
if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) {
|
||||
// if we're already sorted by this column in reverse, just
|
||||
// re-reverse the table, which is quicker
|
||||
sorttable.reverse(this.sorttable_tbody);
|
||||
this.className = this.className.replace('sorttable_sorted_reverse',
|
||||
'sorttable_sorted');
|
||||
this.removeChild(document.getElementById('sorttable_sortrevind'));
|
||||
sortfwdind = document.createElement('span');
|
||||
sortfwdind.id = "sorttable_sortfwdind";
|
||||
sortfwdind.innerHTML = stIsIE ? ' <font face="webdings">6</font>' : ' ▾';
|
||||
this.appendChild(sortfwdind);
|
||||
return;
|
||||
}
|
||||
|
||||
// remove sorttable_sorted classes
|
||||
theadrow = this.parentNode;
|
||||
forEach(theadrow.childNodes, function(cell) {
|
||||
if (cell.nodeType == 1) { // an element
|
||||
cell.className = cell.className.replace('sorttable_sorted_reverse','');
|
||||
cell.className = cell.className.replace('sorttable_sorted','');
|
||||
}
|
||||
});
|
||||
sortfwdind = document.getElementById('sorttable_sortfwdind');
|
||||
if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); }
|
||||
sortrevind = document.getElementById('sorttable_sortrevind');
|
||||
if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); }
|
||||
|
||||
this.className += ' sorttable_sorted';
|
||||
sortfwdind = document.createElement('span');
|
||||
sortfwdind.id = "sorttable_sortfwdind";
|
||||
sortfwdind.innerHTML = stIsIE ? ' <font face="webdings">6</font>' : ' ▾';
|
||||
this.appendChild(sortfwdind);
|
||||
|
||||
// build an array to sort. This is a Schwartzian transform thing,
|
||||
// i.e., we "decorate" each row with the actual sort key,
|
||||
// sort based on the sort keys, and then put the rows back in order
|
||||
// which is a lot faster because you only do getInnerText once per row
|
||||
row_array = [];
|
||||
col = this.sorttable_columnindex;
|
||||
rows = this.sorttable_tbody.rows;
|
||||
for (var j=0; j<rows.length; j++) {
|
||||
row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]];
|
||||
}
|
||||
/* If you want a stable sort, uncomment the following line */
|
||||
//sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
|
||||
/* and comment out this one */
|
||||
row_array.sort(this.sorttable_sortfunction);
|
||||
|
||||
tb = this.sorttable_tbody;
|
||||
for (var j=0; j<row_array.length; j++) {
|
||||
tb.appendChild(row_array[j][1]);
|
||||
}
|
||||
|
||||
delete row_array;
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
guessType: function(table, column) {
|
||||
// guess the type of a column based on its first non-blank row
|
||||
sortfn = sorttable.sort_alpha;
|
||||
for (var i=0; i<table.tBodies[0].rows.length; i++) {
|
||||
text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
|
||||
if (text != '') {
|
||||
if (text.match(/^-?[£$¤]?[\d,.]+%?$/)) {
|
||||
return sorttable.sort_numeric;
|
||||
}
|
||||
// check for a date: dd/mm/yyyy or dd/mm/yy
|
||||
// can have / or . or - as separator
|
||||
// can be mm/dd as well
|
||||
possdate = text.match(sorttable.DATE_RE)
|
||||
if (possdate) {
|
||||
// looks like a date
|
||||
first = parseInt(possdate[1]);
|
||||
second = parseInt(possdate[2]);
|
||||
if (first > 12) {
|
||||
// definitely dd/mm
|
||||
return sorttable.sort_ddmm;
|
||||
} else if (second > 12) {
|
||||
return sorttable.sort_mmdd;
|
||||
} else {
|
||||
// looks like a date, but we can't tell which, so assume
|
||||
// that it's dd/mm (English imperialism!) and keep looking
|
||||
sortfn = sorttable.sort_ddmm;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return sortfn;
|
||||
},
|
||||
|
||||
getInnerText: function(node) {
|
||||
// gets the text we want to use for sorting for a cell.
|
||||
// strips leading and trailing whitespace.
|
||||
// this is *not* a generic getInnerText function; it's special to sorttable.
|
||||
// for example, you can override the cell text with a customkey attribute.
|
||||
// it also gets .value for <input> fields.
|
||||
|
||||
if (!node) return "";
|
||||
|
||||
hasInputs = (typeof node.getElementsByTagName == 'function') &&
|
||||
node.getElementsByTagName('input').length;
|
||||
|
||||
if (node.getAttribute("sorttable_customkey") != null) {
|
||||
return node.getAttribute("sorttable_customkey");
|
||||
}
|
||||
else if (typeof node.textContent != 'undefined' && !hasInputs) {
|
||||
return node.textContent.replace(/^\s+|\s+$/g, '');
|
||||
}
|
||||
else if (typeof node.innerText != 'undefined' && !hasInputs) {
|
||||
return node.innerText.replace(/^\s+|\s+$/g, '');
|
||||
}
|
||||
else if (typeof node.text != 'undefined' && !hasInputs) {
|
||||
return node.text.replace(/^\s+|\s+$/g, '');
|
||||
}
|
||||
else {
|
||||
switch (node.nodeType) {
|
||||
case 3:
|
||||
if (node.nodeName.toLowerCase() == 'input') {
|
||||
return node.value.replace(/^\s+|\s+$/g, '');
|
||||
}
|
||||
case 4:
|
||||
return node.nodeValue.replace(/^\s+|\s+$/g, '');
|
||||
break;
|
||||
case 1:
|
||||
case 11:
|
||||
var innerText = '';
|
||||
for (var i = 0; i < node.childNodes.length; i++) {
|
||||
innerText += sorttable.getInnerText(node.childNodes[i]);
|
||||
}
|
||||
return innerText.replace(/^\s+|\s+$/g, '');
|
||||
break;
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
reverse: function(tbody) {
|
||||
// reverse the rows in a tbody
|
||||
newrows = [];
|
||||
for (var i=0; i<tbody.rows.length; i++) {
|
||||
newrows[newrows.length] = tbody.rows[i];
|
||||
}
|
||||
for (var i=newrows.length-1; i>=0; i--) {
|
||||
tbody.appendChild(newrows[i]);
|
||||
}
|
||||
delete newrows;
|
||||
},
|
||||
|
||||
/* sort functions
|
||||
each sort function takes two parameters, a and b
|
||||
you are comparing a[0] and b[0] */
|
||||
sort_numeric: function(a,b) {
|
||||
aa = parseFloat(a[0].replace(/[^0-9.-]/g,''));
|
||||
if (isNaN(aa)) aa = 0;
|
||||
bb = parseFloat(b[0].replace(/[^0-9.-]/g,''));
|
||||
if (isNaN(bb)) bb = 0;
|
||||
return aa-bb;
|
||||
},
|
||||
sort_alpha: function(a,b) {
|
||||
if (a[0]==b[0]) return 0;
|
||||
if (a[0]<b[0]) return -1;
|
||||
return 1;
|
||||
},
|
||||
sort_ddmm: function(a,b) {
|
||||
mtch = a[0].match(sorttable.DATE_RE);
|
||||
y = mtch[3]; m = mtch[2]; d = mtch[1];
|
||||
if (m.length == 1) m = '0'+m;
|
||||
if (d.length == 1) d = '0'+d;
|
||||
dt1 = y+m+d;
|
||||
mtch = b[0].match(sorttable.DATE_RE);
|
||||
y = mtch[3]; m = mtch[2]; d = mtch[1];
|
||||
if (m.length == 1) m = '0'+m;
|
||||
if (d.length == 1) d = '0'+d;
|
||||
dt2 = y+m+d;
|
||||
if (dt1==dt2) return 0;
|
||||
if (dt1<dt2) return -1;
|
||||
return 1;
|
||||
},
|
||||
sort_mmdd: function(a,b) {
|
||||
mtch = a[0].match(sorttable.DATE_RE);
|
||||
y = mtch[3]; d = mtch[2]; m = mtch[1];
|
||||
if (m.length == 1) m = '0'+m;
|
||||
if (d.length == 1) d = '0'+d;
|
||||
dt1 = y+m+d;
|
||||
mtch = b[0].match(sorttable.DATE_RE);
|
||||
y = mtch[3]; d = mtch[2]; m = mtch[1];
|
||||
if (m.length == 1) m = '0'+m;
|
||||
if (d.length == 1) d = '0'+d;
|
||||
dt2 = y+m+d;
|
||||
if (dt1==dt2) return 0;
|
||||
if (dt1<dt2) return -1;
|
||||
return 1;
|
||||
},
|
||||
|
||||
shaker_sort: function(list, comp_func) {
|
||||
// A stable sort function to allow multi-level sorting of data
|
||||
// see: http://en.wikipedia.org/wiki/Cocktail_sort
|
||||
// thanks to Joseph Nahmias
|
||||
var b = 0;
|
||||
var t = list.length - 1;
|
||||
var swap = true;
|
||||
|
||||
while(swap) {
|
||||
swap = false;
|
||||
for(var i = b; i < t; ++i) {
|
||||
if ( comp_func(list[i], list[i+1]) > 0 ) {
|
||||
var q = list[i]; list[i] = list[i+1]; list[i+1] = q;
|
||||
swap = true;
|
||||
}
|
||||
} // for
|
||||
t--;
|
||||
|
||||
if (!swap) break;
|
||||
|
||||
for(var i = t; i > b; --i) {
|
||||
if ( comp_func(list[i], list[i-1]) < 0 ) {
|
||||
var q = list[i]; list[i] = list[i-1]; list[i-1] = q;
|
||||
swap = true;
|
||||
}
|
||||
} // for
|
||||
b++;
|
||||
|
||||
} // while(swap)
|
||||
}
|
||||
}
|
||||
|
||||
/* ******************************************************************
|
||||
Supporting functions: bundled here to avoid depending on a library
|
||||
****************************************************************** */
|
||||
|
||||
// Dean Edwards/Matthias Miller/John Resig
|
||||
|
||||
/* for Mozilla/Opera9 */
|
||||
if (document.addEventListener) {
|
||||
document.addEventListener("DOMContentLoaded", sorttable.init, false);
|
||||
}
|
||||
|
||||
/* for Internet Explorer */
|
||||
/*@cc_on @*/
|
||||
/*@if (@_win32)
|
||||
document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
|
||||
var script = document.getElementById("__ie_onload");
|
||||
script.onreadystatechange = function() {
|
||||
if (this.readyState == "complete") {
|
||||
sorttable.init(); // call the onload handler
|
||||
}
|
||||
};
|
||||
/*@end @*/
|
||||
|
||||
/* for Safari */
|
||||
if (/WebKit/i.test(navigator.userAgent)) { // sniff
|
||||
var _timer = setInterval(function() {
|
||||
if (/loaded|complete/.test(document.readyState)) {
|
||||
sorttable.init(); // call the onload handler
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
|
||||
/* for other browsers */
|
||||
window.onload = sorttable.init;
|
||||
|
||||
// written by Dean Edwards, 2005
|
||||
// with input from Tino Zijdel, Matthias Miller, Diego Perini
|
||||
|
||||
// http://dean.edwards.name/weblog/2005/10/add-event/
|
||||
|
||||
function dean_addEvent(element, type, handler) {
|
||||
if (element.addEventListener) {
|
||||
element.addEventListener(type, handler, false);
|
||||
} else {
|
||||
// assign each event handler a unique ID
|
||||
if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++;
|
||||
// create a hash table of event types for the element
|
||||
if (!element.events) element.events = {};
|
||||
// create a hash table of event handlers for each element/event pair
|
||||
var handlers = element.events[type];
|
||||
if (!handlers) {
|
||||
handlers = element.events[type] = {};
|
||||
// store the existing event handler (if there is one)
|
||||
if (element["on" + type]) {
|
||||
handlers[0] = element["on" + type];
|
||||
}
|
||||
}
|
||||
// store the event handler in the hash table
|
||||
handlers[handler.$$guid] = handler;
|
||||
// assign a global event handler to do all the work
|
||||
element["on" + type] = handleEvent;
|
||||
}
|
||||
};
|
||||
// a counter used to create unique IDs
|
||||
dean_addEvent.guid = 1;
|
||||
|
||||
function removeEvent(element, type, handler) {
|
||||
if (element.removeEventListener) {
|
||||
element.removeEventListener(type, handler, false);
|
||||
} else {
|
||||
// delete the event handler from the hash table
|
||||
if (element.events && element.events[type]) {
|
||||
delete element.events[type][handler.$$guid];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function handleEvent(event) {
|
||||
var returnValue = true;
|
||||
// grab the event object (IE uses a global event object)
|
||||
event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
|
||||
// get a reference to the hash table of event handlers
|
||||
var handlers = this.events[event.type];
|
||||
// execute each event handler
|
||||
for (var i in handlers) {
|
||||
this.$$handleEvent = handlers[i];
|
||||
if (this.$$handleEvent(event) === false) {
|
||||
returnValue = false;
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
};
|
||||
|
||||
function fixEvent(event) {
|
||||
// add W3C standard event methods
|
||||
event.preventDefault = fixEvent.preventDefault;
|
||||
event.stopPropagation = fixEvent.stopPropagation;
|
||||
return event;
|
||||
};
|
||||
fixEvent.preventDefault = function() {
|
||||
this.returnValue = false;
|
||||
};
|
||||
fixEvent.stopPropagation = function() {
|
||||
this.cancelBubble = true;
|
||||
}
|
||||
|
||||
// Dean's forEach: http://dean.edwards.name/base/forEach.js
|
||||
/*
|
||||
forEach, version 1.0
|
||||
Copyright 2006, Dean Edwards
|
||||
License: http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
// array-like enumeration
|
||||
if (!Array.forEach) { // mozilla already supports this
|
||||
Array.forEach = function(array, block, context) {
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
block.call(context, array[i], i, array);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// generic enumeration
|
||||
Function.prototype.forEach = function(object, block, context) {
|
||||
for (var key in object) {
|
||||
if (typeof this.prototype[key] == "undefined") {
|
||||
block.call(context, object[key], key, object);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// character enumeration
|
||||
String.forEach = function(string, block, context) {
|
||||
Array.forEach(string.split(""), function(chr, index) {
|
||||
block.call(context, chr, index, string);
|
||||
});
|
||||
};
|
||||
|
||||
// globally resolve forEach enumeration
|
||||
var forEach = function(object, block, context) {
|
||||
if (object) {
|
||||
var resolve = Object; // default
|
||||
if (object instanceof Function) {
|
||||
// functions have a "length" property
|
||||
resolve = Function;
|
||||
} else if (object.forEach instanceof Function) {
|
||||
// the object implements a custom forEach method so use that
|
||||
object.forEach(block, context);
|
||||
return;
|
||||
} else if (typeof object == "string") {
|
||||
// the object is a string
|
||||
resolve = String;
|
||||
} else if (typeof object.length == "number") {
|
||||
// the object is array-like
|
||||
resolve = Array;
|
||||
}
|
||||
resolve.forEach(object, block, context);
|
||||
}
|
||||
};
|
||||
|
185
data/style.css
|
@ -80,7 +80,7 @@ h3 {
|
|||
}
|
||||
|
||||
.hidden{
|
||||
display: none;
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Button Styling =============== */
|
||||
|
@ -433,38 +433,49 @@ h3 {
|
|||
}
|
||||
.stage-header h1{
|
||||
font-family:"Helvetica Neue", Arial, sans-serif;
|
||||
font-smooth:always;
|
||||
letter-spacing:3px;
|
||||
font-weight: 100;
|
||||
}
|
||||
|
||||
.stage{
|
||||
flex: 1;
|
||||
margin:20px 0px;
|
||||
margin: 20px 0px;
|
||||
}
|
||||
.showinfo .stage-stack{
|
||||
margin-right: 300px;
|
||||
}
|
||||
|
||||
.stage-footer{
|
||||
.list-footer{
|
||||
flex: none;
|
||||
display: none;
|
||||
}
|
||||
.stage-footer h3{
|
||||
|
||||
.list .list-footer{
|
||||
display: block;
|
||||
}
|
||||
.list-footer h3{
|
||||
font-size: 12px;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
.stage-footer-btns{
|
||||
.list-footer-btns{
|
||||
display:flex;
|
||||
justify-content:space-between;
|
||||
align-items:flex-start;
|
||||
}
|
||||
.stage-footer-btns .btn{
|
||||
.list-footer-btns .btn{
|
||||
margin-right:20px;
|
||||
color: rgb(234, 234, 234);
|
||||
border: 0;
|
||||
}
|
||||
.stage-footer-btns .btn a{
|
||||
.list-footer-btns .btn a{
|
||||
padding-right:10px;
|
||||
}
|
||||
.btn-spacer{
|
||||
flex:1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* SVG STYLES */
|
||||
|
||||
text {
|
||||
|
@ -551,10 +562,6 @@ text {
|
|||
strokewidth: 3px;
|
||||
}
|
||||
|
||||
line{
|
||||
stroke: #FFF;
|
||||
}
|
||||
|
||||
.greyed-out{
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
@ -660,6 +667,40 @@ line{
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
[data-pref=watch]{
|
||||
color: teal;
|
||||
}
|
||||
|
||||
.preferences{
|
||||
background-size: 16px;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
}
|
||||
|
||||
[data-pref=watch] .preferences{
|
||||
background-image: url(icons/collusion_icon_watch.png);
|
||||
}
|
||||
|
||||
[data-pref=block]{
|
||||
color: red;
|
||||
}
|
||||
|
||||
[data-pref=block] .preferences{
|
||||
background-image: url(icons/collusion_icon_block.png);
|
||||
}
|
||||
|
||||
[data-pref=hide]{
|
||||
color: orange;
|
||||
}
|
||||
|
||||
[data-pref=hide] .preferences{
|
||||
background-image: url(icons/collusion_icon_hide.png);
|
||||
}
|
||||
|
||||
.hide-hidden-rows [data-pref=hide]{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.list-table tbody tr:hover{
|
||||
background: #33464d;
|
||||
}
|
||||
|
@ -798,3 +839,123 @@ line{
|
|||
}
|
||||
|
||||
|
||||
|
||||
/* Legend for Graph */
|
||||
|
||||
.graph-legend{
|
||||
margin-right: 30px;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.graph-legend .legend-header{
|
||||
overflow: hidden;
|
||||
border-bottom: 1px solid #fff;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.legend-header div:first-of-type{
|
||||
float: left;
|
||||
}
|
||||
|
||||
.legend-header div:last-of-type{
|
||||
float: right;
|
||||
}
|
||||
|
||||
.graph-legend header{
|
||||
display: inline-block;
|
||||
font-size: 15px;
|
||||
color: #4CC7E6;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
.graph-legend .legend-toggle{
|
||||
display: inline-block;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.graph-legend .legend-controls{
|
||||
clear: both;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.graph-legend .column{
|
||||
float: left;
|
||||
}
|
||||
|
||||
.graph-legend .column .btn{
|
||||
width: 170px;
|
||||
margin-right: 30px;
|
||||
margin-bottom: 8px;
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.graph-legend .column .btn:hover{
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.graph-legend .column .btn.active{
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.graph-legend .legend-canvas-small,
|
||||
.graph-legend .legend-canvas-large{
|
||||
height: 18px;
|
||||
position: relative;
|
||||
top: 7px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.graph-legend .legend-canvas-small{
|
||||
width: 17px;
|
||||
}
|
||||
|
||||
.graph-legend .legend-canvas-large{
|
||||
width: 34px;
|
||||
}
|
||||
|
||||
.visitedSites,
|
||||
.unvisitedSites{
|
||||
fill: #FFF;
|
||||
}
|
||||
|
||||
.connectionLine{
|
||||
stroke: #FFF;
|
||||
stroke-width: 2;
|
||||
}
|
||||
|
||||
.watchedSites{
|
||||
fill: #FFF;
|
||||
stroke: #268CB7;
|
||||
stroke-width: 2;
|
||||
}
|
||||
|
||||
.blockedSites{
|
||||
fill: #FFF;
|
||||
stroke: #FF0000;
|
||||
stroke-width: 2;
|
||||
}
|
||||
|
||||
.hiddenSites{
|
||||
fill: #FFF;
|
||||
stroke: #FA9828;
|
||||
stroke-width: 2;
|
||||
}
|
||||
|
||||
.secureConnection{
|
||||
stroke: #107A10;
|
||||
stroke-width: 2;
|
||||
}
|
||||
|
||||
.unsecureConnection{
|
||||
stroke: #FFFF00;
|
||||
stroke-width: 2;
|
||||
}
|
||||
|
||||
.cookies{
|
||||
fill: #800080;
|
||||
}
|
||||
|
||||
.noCookies{
|
||||
fill: #FFF;
|
||||
}
|
||||
|
|
138
data/ui.js
|
@ -157,43 +157,15 @@ document.querySelector('.stage').addEventListener('click', function(event){
|
|||
|
||||
|
||||
function getZoom(canvas){
|
||||
// TODO: code cleanup if both cases use basically the same code
|
||||
switch(canvas){
|
||||
case 'vizcanvas': {
|
||||
var box = document.querySelector('.vizcanvas')
|
||||
.getAttribute('viewBox')
|
||||
.split(/\s/)
|
||||
.map(function(i){ return parseInt(i, 10); });
|
||||
return {x: box[0], y: box[1], w: box[2], h: box[3]};
|
||||
}
|
||||
case 'mapcanvas': {
|
||||
var box = document.querySelector('.mapcanvas')
|
||||
.getAttribute('viewBox')
|
||||
.split(/\s/)
|
||||
.map(function(i){ return parseInt(i, 10); });
|
||||
console.log(box);
|
||||
return {x: box[0], y: box[1], w: box[2], h: box[3]};
|
||||
}
|
||||
default: throw new Error('It has to be one of the choices above');
|
||||
}
|
||||
var box = canvas.getAttribute('viewBox')
|
||||
.split(/\s/)
|
||||
.map(function(i){ return parseInt(i, 10); });
|
||||
return {x: box[0], y: box[1], w: box[2], h: box[3]};
|
||||
}
|
||||
|
||||
function setZoom(box,canvas){
|
||||
// TODO: code cleanup if both cases use basically the same code
|
||||
switch(canvas){
|
||||
case 'vizcanvas': {
|
||||
document.querySelector('.vizcanvas')
|
||||
.setAttribute('viewBox', [box.x, box.y, box.w, box.h].join(' '));
|
||||
break;
|
||||
}
|
||||
case 'mapcanvas': {
|
||||
document.querySelector('.mapcanvas')
|
||||
.setAttribute('viewBox', [box.x, box.y, box.w, box.h].join(' '));
|
||||
break;
|
||||
|
||||
}
|
||||
default: throw new Error('It has to be one of the choices above');
|
||||
}
|
||||
canvas.setAttribute('viewBox', [box.x, box.y, box.w, box.h].join(' '));
|
||||
}
|
||||
|
||||
|
||||
|
@ -276,16 +248,15 @@ function svgZooming(target,ratio){
|
|||
return box;
|
||||
}
|
||||
|
||||
|
||||
if ( target == "vizcanvas" ){
|
||||
var box = getZoom("vizcanvas");
|
||||
var box = getZoom(vizcanvas);
|
||||
var newViewBox = generateNewViewBox(target, box);
|
||||
setZoom(newViewBox,"vizcanvas");
|
||||
setZoom(newViewBox,vizcanvas);
|
||||
|
||||
}else{
|
||||
var box = getZoom("mapcanvas");
|
||||
var box = getZoom(mapcanvas);
|
||||
var newViewBox = generateNewViewBox(target, box);
|
||||
setZoom(newViewBox,"mapcanvas");
|
||||
setZoom(newViewBox, mapcanvas);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -310,61 +281,27 @@ document.querySelector(".stage").addEventListener("mousedown",function(event){
|
|||
|
||||
document.querySelector(".stage").addEventListener("mousemove",function(event){
|
||||
if ( event.target.mozMatchesSelector(".vizcanvas") && !event.target.mozMatchesSelector(".node, .node *") && onDragGraph ){
|
||||
document.querySelector(".vizcanvas").style.cursor = "-moz-grab";
|
||||
vizcanvas.style.cursor = "-moz-grab";
|
||||
var offsetX = ( Math.ceil(event.clientX) - graphDragStart.x );
|
||||
var offsetY = ( Math.ceil(event.clientY) - graphDragStart.y );
|
||||
var box = getZoom("vizcanvas");
|
||||
var box = getZoom(vizcanvas);
|
||||
box.x -= ( offsetX * box.w/700);
|
||||
box.y -= ( offsetY * box.h/700);
|
||||
graphDragStart.x += offsetX;
|
||||
graphDragStart.y += offsetY;
|
||||
setZoom(box,"vizcanvas");
|
||||
setZoom(box,vizcanvas);
|
||||
}
|
||||
|
||||
},false);
|
||||
|
||||
document.querySelector(".stage").addEventListener("mouseup",function(event){
|
||||
onDragGraph = false;
|
||||
document.querySelector(".vizcanvas").style.cursor = "default";
|
||||
vizcanvas.style.cursor = "default";
|
||||
},false);
|
||||
|
||||
document.querySelector(".stage").addEventListener("mouseleave",function(event){
|
||||
onDragGraph = false;
|
||||
document.querySelector(".vizcanvas").style.cursor = "default";
|
||||
},false);
|
||||
|
||||
/* mapcanvas */
|
||||
document.querySelector(".world-map").addEventListener("mousedown",function(event){
|
||||
if ( event.target.mozMatchesSelector(".mapcanvas, .mapcanvas *") ){
|
||||
onDragMap = true;
|
||||
mapDragStart.x = event.clientX;
|
||||
mapDragStart.y = event.clientY;
|
||||
}
|
||||
},false);
|
||||
|
||||
document.querySelector(".world-map").addEventListener("mousemove",function(event){
|
||||
if ( event.target.mozMatchesSelector(".mapcanvas, .mapcanvas *") && onDragMap ){
|
||||
document.querySelector(".mapcanvas").style.cursor = "-moz-grab";
|
||||
var offsetX = ( Math.ceil(event.clientX) - mapDragStart.x );
|
||||
var offsetY = ( Math.ceil(event.clientY) - mapDragStart.y );
|
||||
var box = getZoom("mapcanvas");
|
||||
box.x -= (offsetX * 10);
|
||||
box.y -= (offsetY * 10);
|
||||
mapDragStart.x += offsetX;
|
||||
mapDragStart.y += offsetY;
|
||||
setZoom(box,"mapcanvas");
|
||||
}
|
||||
|
||||
},false);
|
||||
|
||||
document.querySelector(".world-map").addEventListener("mouseup",function(event){
|
||||
onDragMap = false;
|
||||
document.querySelector(".mapcanvas").style.cursor = "default";
|
||||
},false);
|
||||
|
||||
document.querySelector(".world-map").addEventListener("mouseleave",function(event){
|
||||
onDragMap = false;
|
||||
document.querySelector(".mapcanvas").style.cursor = "default";
|
||||
vizcanvas.style.cursor = "default";
|
||||
},false);
|
||||
|
||||
|
||||
|
@ -379,27 +316,6 @@ document.querySelector(".help-mode").addEventListener("click", function(){
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
/* Settings Page ========================= */
|
||||
document.querySelector(".settings").addEventListener("click", function(event){
|
||||
if ( currentVisualization.name == "clock" || currentVisualization.name == "graph" ){
|
||||
document.querySelector(".vizcanvas").classList.toggle("hide");
|
||||
}else{
|
||||
document.querySelector(".list-breadcrumb").classList.toggle("hide");
|
||||
document.querySelector(".list-header").classList.toggle("hide");
|
||||
document.querySelector(".list-table").classList.toggle("hide");
|
||||
|
||||
}
|
||||
var infoBarVisible = document.querySelector("#content").classList.contains("showinfo");
|
||||
if ( infoBarVisible ){
|
||||
document.querySelector("#content").classList.remove("showinfo");
|
||||
}
|
||||
document.querySelector(".settings").parentElement.classList.toggle("active");
|
||||
document.querySelector(".settings-page").classList.toggle("hide");
|
||||
});
|
||||
|
||||
|
||||
|
||||
/* Clock View ===================================== */
|
||||
|
||||
function highlightColludedNode(selection){
|
||||
|
@ -484,3 +400,29 @@ document.querySelector(".connections-list ul").addEventListener("click", functio
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* Legend & Controls for Graph ===================================== */
|
||||
|
||||
document.querySelector(".graph-legend .legend-controls").addEventListener("click", function(event){
|
||||
if (event.target.mozMatchesSelector(".btn, .btn *")){
|
||||
var btn = event.target;
|
||||
while(btn.mozMatchesSelector('.btn *')){
|
||||
btn = btn.parentElement;
|
||||
}
|
||||
btn.classList.toggle("active");
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelector(".graph-legend .legend-toggle").addEventListener("click", function(event){
|
||||
var controlsSection = document.querySelector(".graph-legend .legend-controls");
|
||||
if ( controlsSection.classList.contains("hidden") ){
|
||||
controlsSection.classList.remove("hidden");
|
||||
event.target.innerHTML = "Hide";
|
||||
}else{
|
||||
controlsSection.classList.add("hidden");
|
||||
event.target.innerHTML = "Show";
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
|