mirror of
https://github.com/nhammer514/textfiles-politics.git
synced 2025-07-29 00:58:36 -04:00
svg experiment
This commit is contained in:
parent
7ee8aa6570
commit
ffaf033877
29 changed files with 96504 additions and 0 deletions
174
docs/ent_network_legible/web_session/scripts/1d327552.scripts.js
Normal file
174
docs/ent_network_legible/web_session/scripts/1d327552.scripts.js
Normal file
|
@ -0,0 +1,174 @@
|
|||
"use strict";
|
||||
angular.module("cyViewerApp", ["ngCookies", "ngResource", "ngSanitize", "ngRoute", "ngAnimate", "ui.bootstrap", "angular-underscore", "colorpicker.module", "angularSpinner"]).config(["$routeProvider", function(a) {
|
||||
a.when("/", {
|
||||
templateUrl: "main.html",
|
||||
controller: "MainCtrl"
|
||||
}).otherwise({
|
||||
redirectTo: "/"
|
||||
})
|
||||
}]), angular.module("cyViewerApp").controller("MainCtrl", ["$scope", "$http", "$location", "$routeParams", "$window", "Network", "VisualStyles", function(a, b, c, d, e, f, g) {
|
||||
function h() {
|
||||
var b = angular.element(q);
|
||||
b.on("dragenter", function(a) {
|
||||
a.stopPropagation(), a.preventDefault()
|
||||
}), b.on("dragover", function(a) {
|
||||
a.stopPropagation(), a.preventDefault()
|
||||
}), b.on("drop", function(b) {
|
||||
b.preventDefault();
|
||||
var c = b.originalEvent.dataTransfer.files,
|
||||
d = c[0],
|
||||
e = new FileReader;
|
||||
e.onload = function(b) {
|
||||
var json = b.target.result
|
||||
if (!json.startsWith('{'))
|
||||
json = json.substr(json.indexOf('{'))
|
||||
|
||||
var c = JSON.parse(json)
|
||||
if (c.hasOwnProperty('format_version')){
|
||||
c = {[c.data.name]: c}
|
||||
}
|
||||
d = null
|
||||
Object.keys(c).forEach(function(name){
|
||||
a.networks[name] = c[name];
|
||||
if (a.networkNames.indexOf(name) === -1)
|
||||
a.networkNames.push(name);
|
||||
(d === null && (d = c[name], a.currentNetwork = name));
|
||||
z()
|
||||
}), a.cy.load(d.elements), k()
|
||||
}, e.readAsText(d)
|
||||
})
|
||||
}
|
||||
|
||||
function i(b) {
|
||||
|
||||
a.nodes = o.elements.nodes, a.edges = o.elements.edges, m(b);
|
||||
var c = o.data.name;
|
||||
a.networks[c] || (a.networks[c] = o, a.networkNames.push(c), a.currentNetwork = o.data.name), j(), d.bgcolor && (a.bg.color = d.bgcolor)
|
||||
}
|
||||
|
||||
function j() {
|
||||
a.columnNames = [], a.edgeColumnNames = [], a.networkColumnNames = [];
|
||||
var b = a.nodes[0];
|
||||
for (var c in b.data) a.columnNames.push(c);
|
||||
var d = a.edges[0];
|
||||
for (var e in d.data) a.edgeColumnNames.push(e);
|
||||
for (var f in o.data) a.networkColumnNames.push(f)
|
||||
}
|
||||
|
||||
function k() {
|
||||
a.selectedNodes = {}, a.selectedEdges = {}
|
||||
}
|
||||
|
||||
function l() {
|
||||
a.selectedNodes = {}, a.selectedEdges = {};
|
||||
var b = !1;
|
||||
a.cy.on("select", "node", function(c) {
|
||||
var d = c.cyTarget.id();
|
||||
a.selectedNodes[d] = c.cyTarget, b = !0
|
||||
}), a.cy.on("select", "edge", function(c) {
|
||||
var d = c.cyTarget.id();
|
||||
a.selectedEdges[d] = c.cyTarget, b = !0
|
||||
}), a.cy.on("unselect", "node", function(c) {
|
||||
var d = c.cyTarget.id();
|
||||
delete a.selectedNodes[d], b = !0
|
||||
}), a.cy.on("unselect", "edge", function(c) {
|
||||
var d = c.cyTarget.id();
|
||||
delete a.selectedEdges[d], b = !0
|
||||
}), setInterval(function() {
|
||||
b && a.browserState.show && (a.$apply(), b = !1)
|
||||
}, 300)
|
||||
}
|
||||
|
||||
function m(b) {
|
||||
_.each(b, function(b) {
|
||||
a.visualStyles[b.title] = b, a.visualStyleNames.push(b.title)
|
||||
}), a.currentVS = r
|
||||
}
|
||||
function z(){
|
||||
var el = document.getElementsByClassName('glyphicon')[0]
|
||||
el.click()
|
||||
el.click()
|
||||
}
|
||||
var n, o,
|
||||
q = "#network",
|
||||
r = "default";
|
||||
a.LAYOUTS = ["preset", "cola", "random", "grid", "circle", "concentric", "breadthfirst", "cose"], a.networks = {}, a.currentVS = null, a.visualStyles = [], a.visualStyleNames = [], a.networkNames = [], a.currentNetworkData = null, a.browserState = {
|
||||
show: !1
|
||||
}, a.overlayState = {
|
||||
show: !0
|
||||
}, a.toolbarState = {
|
||||
show: !0
|
||||
}, a.bg = {
|
||||
color: "#FAFAFA"
|
||||
}, a.columnNames = [], a.edgeColumnNames = [], a.networkColumnNames = [];
|
||||
var s = {
|
||||
showOverlay: !1,
|
||||
minZoom: .01,
|
||||
maxZoom: 200,
|
||||
boxSelectionEnabled: !0,
|
||||
layout: {
|
||||
name: "preset"
|
||||
},
|
||||
ready: function() {
|
||||
a.cy = this,
|
||||
|
||||
a.cy.load(o.elements),
|
||||
i(n),
|
||||
h(),
|
||||
l(),
|
||||
a.currentVS = r,
|
||||
a.currentLayout = "preset",
|
||||
a.cy.style().fromJson(a.visualStyles[r].style).update(),
|
||||
angular.element(".loading").remove()
|
||||
var b = {
|
||||
name: a.currentLayout
|
||||
};
|
||||
a.cy.layout(b)
|
||||
|
||||
z()
|
||||
}
|
||||
};
|
||||
a.toggleTableBrowser = function() {
|
||||
a.browserState.show = !a.browserState.show
|
||||
}, a.toggleOverlay = function() {
|
||||
a.overlayState.show = !a.overlayState.show
|
||||
}, a.toggleToolbar = function() {
|
||||
a.toolbarState.show = !a.toolbarState.show
|
||||
}, a.fit = function() {
|
||||
a.cy.fit()
|
||||
}, a.switchVS = function() {
|
||||
var b = a.currentVS.trim(),
|
||||
c = a.visualStyles[b].style;
|
||||
a.cy.style().fromJson(c).update()
|
||||
}, a.switchNetwork = function() {
|
||||
var b = a.networks[a.currentNetwork]
|
||||
a.cy.load(b.elements),
|
||||
a.currentNetworkData = o,
|
||||
k(), a.nodes = b.elements.nodes,
|
||||
a.edges = b.elements.edges,
|
||||
j()
|
||||
//a.switchLayout()
|
||||
}, a.switchLayout = function() {
|
||||
var b = {
|
||||
name: a.currentLayout
|
||||
};
|
||||
a.cy.layout(b)
|
||||
}, function(){
|
||||
var b = networks;
|
||||
a.networks = b;
|
||||
a.networkNames = Object.keys(b);
|
||||
c = a.networkNames[0];
|
||||
n = styles;
|
||||
o = b[c], a.currentNetworkData = o.data, a.currentNetwork = c
|
||||
,angular.element(q).cytoscape(s)
|
||||
}()
|
||||
}]), angular.module("cyViewerApp").factory("Network", ["$resource", function(a) {
|
||||
return a("data/:filename", {
|
||||
filename: "@filename"
|
||||
})
|
||||
return {get: function(){}}
|
||||
}]), angular.module("cyViewerApp").factory("VisualStyles", ["$resource", function(a) {
|
||||
return a("data/:filename", {
|
||||
filename: styles
|
||||
})
|
||||
}]);
|
28
docs/ent_network_legible/web_session/scripts/3e4be17b.app.js
Normal file
28
docs/ent_network_legible/web_session/scripts/3e4be17b.app.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
// Sample project for visualizing JSON files.
|
||||
//
|
||||
// by Keiichiro Ono
|
||||
//
|
||||
'use strict';
|
||||
|
||||
angular.module('cyViewerApp', [
|
||||
'ngCookies',
|
||||
'ngResource',
|
||||
'ngSanitize',
|
||||
'ngRoute',
|
||||
'ngAnimate',
|
||||
'ui.bootstrap',
|
||||
'angular-underscore',
|
||||
'colorpicker.module',
|
||||
'angularSpinner'
|
||||
])
|
||||
.config(function($routeProvider) {
|
||||
// Routing
|
||||
$routeProvider
|
||||
.when('/', {
|
||||
templateUrl: 'main.html',
|
||||
controller: 'MainCtrl'
|
||||
})
|
||||
.otherwise({
|
||||
redirectTo: '/'
|
||||
});
|
||||
});
|
29135
docs/ent_network_legible/web_session/scripts/65d77273.vendor.js
Normal file
29135
docs/ent_network_legible/web_session/scripts/65d77273.vendor.js
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,312 @@
|
|||
/*global _, angular */
|
||||
|
||||
angular.module('cyViewerApp')
|
||||
.controller('MainCtrl', function($scope, $http, $location, $routeParams, $window, Network, VisualStyles) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var FILE_LIST_NAME = 'filelist.json';
|
||||
|
||||
// Name of network tag in the DOM
|
||||
var NETWORK_SECTION_ID = '#network';
|
||||
|
||||
// Default Visual Style name
|
||||
var DEFAULT_VISUAL_STYLE_NAME = 'default';
|
||||
|
||||
var visualStyleFile;
|
||||
var networkData;
|
||||
|
||||
$scope.LAYOUTS = [
|
||||
'preset', 'cola', 'random', 'grid', 'circle', 'concentric', 'breadthfirst', 'cose'
|
||||
];
|
||||
|
||||
|
||||
// Application global objects
|
||||
$scope.networks = networks;
|
||||
$scope.currentVS = null;
|
||||
$scope.visualStyles = styles;
|
||||
$scope.visualStyleNames = Object.styles(styles);
|
||||
$scope.networkNames = Object.styles(networks);
|
||||
$scope.currentNetworkData = Network.get(
|
||||
{filename: $scope.networks[defaultNetworkName]},
|
||||
function () {
|
||||
angular.element(NETWORK_SECTION_ID).cytoscape(options);
|
||||
$scope.currentNetworkData = networkData;
|
||||
$scope.currentNetwork = defaultNetworkName;
|
||||
});;
|
||||
|
||||
|
||||
// Show / Hide Table browser
|
||||
$scope.browserState = {
|
||||
show: false
|
||||
};
|
||||
|
||||
// Show / Hide style selector UI
|
||||
$scope.overlayState = {
|
||||
show: true
|
||||
};
|
||||
|
||||
// Show / Hide toolbar
|
||||
$scope.toolbarState = {
|
||||
show: true
|
||||
};
|
||||
|
||||
// Background color
|
||||
$scope.bg = {
|
||||
color: '#FAFAFA'
|
||||
};
|
||||
|
||||
$scope.columnNames = [];
|
||||
$scope.edgeColumnNames = [];
|
||||
$scope.networkColumnNames = [];
|
||||
|
||||
// Basic settings for the Cytoscape window
|
||||
var options = {
|
||||
showOverlay: false,
|
||||
minZoom: 0.01,
|
||||
maxZoom: 200,
|
||||
boxSelectionEnabled: true,
|
||||
|
||||
layout: {
|
||||
name: 'preset'
|
||||
},
|
||||
|
||||
ready: function() {
|
||||
$scope.cy = this;
|
||||
$scope.cy.load(networkData.elements);
|
||||
|
||||
VisualStyles.query(
|
||||
{filename: visualStyleFile}, function (vs) {
|
||||
init(vs);
|
||||
dropSupport();
|
||||
setEventListeners();
|
||||
$scope.currentVS = DEFAULT_VISUAL_STYLE_NAME;
|
||||
$scope.currentLayout = 'preset';
|
||||
$scope.cy.style().fromJson($scope.visualStyles[DEFAULT_VISUAL_STYLE_NAME].style).update();
|
||||
angular.element('.loading').remove();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function dropSupport() {
|
||||
var dropZone = angular.element(NETWORK_SECTION_ID);
|
||||
dropZone.on('dragenter', function(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
dropZone.on('dragover', function(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
dropZone.on('drop', function(e) {
|
||||
e.preventDefault();
|
||||
var files = e.originalEvent.dataTransfer.files;
|
||||
var networkFile = files[0];
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(evt) {
|
||||
var network = JSON.parse(evt.target.result);
|
||||
var networkName = 'Unknown';
|
||||
// Check data section is available or not.
|
||||
networkData = network.data;
|
||||
if (networkData !== undefined) {
|
||||
if (networkData.name !== undefined) {
|
||||
networkName = networkData.name;
|
||||
$scope.currentNetworkData = networkData;
|
||||
}
|
||||
}
|
||||
|
||||
while (_.contains($scope.networkNames, networkName)) {
|
||||
networkName = networkName + '*';
|
||||
}
|
||||
|
||||
$scope.$apply(function() {
|
||||
$scope.networks[networkName] = network;
|
||||
$scope.networkNames.push(networkName);
|
||||
$scope.currentNetwork = networkName;
|
||||
});
|
||||
$scope.cy.load(network.elements);
|
||||
reset();
|
||||
};
|
||||
reader.readAsText(networkFile);
|
||||
});
|
||||
}
|
||||
|
||||
function init(vs) {
|
||||
$scope.nodes = networkData.elements.nodes;
|
||||
$scope.edges = networkData.elements.edges;
|
||||
initVisualStyleCombobox(vs);
|
||||
|
||||
// Set network name
|
||||
var networkName = networkData.data.name;
|
||||
if (!$scope.networks[networkName]) {
|
||||
$scope.networks[networkName] = networkData;
|
||||
$scope.networkNames.push(networkName);
|
||||
$scope.currentNetwork = networkData.data.name;
|
||||
}
|
||||
// Get column names
|
||||
setColumnNames();
|
||||
|
||||
if ($routeParams.bgcolor) {
|
||||
$scope.bg.color = $routeParams.bgcolor;
|
||||
}
|
||||
}
|
||||
|
||||
function setColumnNames() {
|
||||
$scope.columnNames = [];
|
||||
$scope.edgeColumnNames = [];
|
||||
$scope.networkColumnNames = [];
|
||||
|
||||
var oneNode = $scope.nodes[0];
|
||||
for (var colName in oneNode.data) {
|
||||
$scope.columnNames.push(colName);
|
||||
}
|
||||
var oneEdge = $scope.edges[0];
|
||||
for (var edgeColName in oneEdge.data) {
|
||||
$scope.edgeColumnNames.push(edgeColName);
|
||||
}
|
||||
for (var netColName in networkData.data) {
|
||||
$scope.networkColumnNames.push(netColName);
|
||||
}
|
||||
}
|
||||
|
||||
function reset() {
|
||||
$scope.selectedNodes = {};
|
||||
$scope.selectedEdges = {};
|
||||
}
|
||||
|
||||
/*
|
||||
Event listener setup for Cytoscape.js
|
||||
*/
|
||||
function setEventListeners() {
|
||||
$scope.selectedNodes = {};
|
||||
$scope.selectedEdges = {};
|
||||
|
||||
var updateFlag = false;
|
||||
|
||||
// Node selection
|
||||
$scope.cy.on('select', 'node', function(event) {
|
||||
var id = event.cyTarget.id();
|
||||
$scope.selectedNodes[id] = event.cyTarget;
|
||||
updateFlag = true;
|
||||
});
|
||||
|
||||
$scope.cy.on('select', 'edge', function(event) {
|
||||
var id = event.cyTarget.id();
|
||||
$scope.selectedEdges[id] = event.cyTarget;
|
||||
updateFlag = true;
|
||||
});
|
||||
|
||||
// Reset selection
|
||||
$scope.cy.on('unselect', 'node', function(event) {
|
||||
var id = event.cyTarget.id();
|
||||
delete $scope.selectedNodes[id];
|
||||
updateFlag = true;
|
||||
});
|
||||
$scope.cy.on('unselect', 'edge', function(event) {
|
||||
var id = event.cyTarget.id();
|
||||
delete $scope.selectedEdges[id];
|
||||
updateFlag = true;
|
||||
});
|
||||
|
||||
setInterval(function() {
|
||||
if (updateFlag && $scope.browserState.show) {
|
||||
$scope.$apply();
|
||||
updateFlag = false;
|
||||
}
|
||||
}, 300);
|
||||
|
||||
}
|
||||
|
||||
function initVisualStyleCombobox(vs) {
|
||||
_.each(vs, function(visualStyle) {
|
||||
$scope.visualStyles[visualStyle.title] = visualStyle;
|
||||
$scope.visualStyleNames.push(visualStyle.title);
|
||||
});
|
||||
|
||||
$scope.currentVS = DEFAULT_VISUAL_STYLE_NAME;
|
||||
}
|
||||
|
||||
|
||||
$scope.toggleTableBrowser = function() {
|
||||
$scope.browserState.show = !$scope.browserState.show;
|
||||
};
|
||||
|
||||
$scope.toggleOverlay = function() {
|
||||
$scope.overlayState.show = !$scope.overlayState.show;
|
||||
};
|
||||
|
||||
$scope.toggleToolbar = function() {
|
||||
$scope.toolbarState.show = !$scope.toolbarState.show;
|
||||
};
|
||||
|
||||
$scope.fit = function() {
|
||||
$scope.cy.fit();
|
||||
};
|
||||
|
||||
|
||||
// Apply Visual Style
|
||||
$scope.switchVS = function() {
|
||||
var vsName = $scope.currentVS.trim();
|
||||
var vs = $scope.visualStyles[vsName].style;
|
||||
// Apply Visual Style
|
||||
$scope.cy.style().fromJson(vs).update();
|
||||
};
|
||||
|
||||
|
||||
$scope.switchNetwork = function() {
|
||||
var networkFile = $scope.networks[$scope.currentNetwork];
|
||||
|
||||
networkData = Network.get(
|
||||
{filename: networkFile},
|
||||
function (network) {
|
||||
$scope.cy.load(network.elements);
|
||||
$scope.currentNetworkData = networkData;
|
||||
reset();
|
||||
$scope.nodes = network.elements.nodes;
|
||||
$scope.edges = network.elements.edges;
|
||||
setColumnNames();
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
$scope.switchLayout = function() {
|
||||
var layoutOptions = {
|
||||
name: $scope.currentLayout
|
||||
};
|
||||
$scope.cy.layout(layoutOptions);
|
||||
};
|
||||
|
||||
///////////////////// Start the loading process ////////////////
|
||||
|
||||
|
||||
/*$http.get(FILE_LIST_NAME).success(function(fileList) {
|
||||
visualStyleFile = styles;
|
||||
|
||||
var defaultNetworkName = null;
|
||||
$scope.networks = networks;
|
||||
_.each(_.keys(networks), function(key) {
|
||||
$scope.networkNames.push(key)
|
||||
}
|
||||
|
||||
_.each(_.keys(fileList), function(key) {
|
||||
if(key !== 'style') {
|
||||
if(defaultNetworkName === null) {
|
||||
defaultNetworkName = key;
|
||||
}
|
||||
$scope.networks[key] = fileList[key];
|
||||
$scope.networkNames.push(key);
|
||||
}
|
||||
});
|
||||
|
||||
networkData = Network.get(
|
||||
{filename: $scope.networks[defaultNetworkName]},
|
||||
function () {
|
||||
angular.element(NETWORK_SECTION_ID).cytoscape(options);
|
||||
$scope.currentNetworkData = networkData;
|
||||
$scope.currentNetwork = defaultNetworkName;
|
||||
});
|
||||
});
|
||||
});*/
|
15
docs/ent_network_legible/web_session/scripts/custom.js
Normal file
15
docs/ent_network_legible/web_session/scripts/custom.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
$( document ).ready(function(){
|
||||
// Custom Cytoscape.JS code goes here.
|
||||
|
||||
// Example: add linkouts to nodes that opens the "href" node attribute on click
|
||||
// cy.on('tap', 'node', function(){
|
||||
// try { // your browser may block popups
|
||||
// window.open( this.data('href') );
|
||||
// } catch(e){ // fall back on url change
|
||||
// window.location.href = this.data('href');
|
||||
// }
|
||||
// });
|
||||
|
||||
// For more options, check out http://js.cytoscape.org/
|
||||
|
||||
});
|
|
@ -0,0 +1,14 @@
|
|||
/**
|
||||
* Created by kono on 2014/01/24.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Services that persists and retrieves TODOs from localStorage
|
||||
*/
|
||||
angular.module('cyViewerApp')
|
||||
.factory('Network', ['$resource', function ($resource) {
|
||||
return $resource('data/:filename', {filename: '@filename'});
|
||||
}]
|
||||
);
|
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* Created by kono on 2014/01/24.
|
||||
*/
|
||||
/*
|
||||
'use strict';
|
||||
|
||||
angular.module('cyViewerApp')
|
||||
.factory('VisualStyles', ['$resource', function ($resource) {
|
||||
return $resource('data/:filename', {filename: '@filename'});
|
||||
}]
|
||||
);*/
|
Loading…
Add table
Add a link
Reference in a new issue