e22b39b702
* Move ChannelsList in pages and use template * Add fullscreen page * Change filename for result * Move script for cytoscape to be common
40 lines
1.2 KiB
HTML
40 lines
1.2 KiB
HTML
<script>
|
|
var cy = cytoscape({
|
|
container: document.getElementById('cy'),
|
|
elements: $.getJSON("{{ site.baseurl }}/public/data/channelslist.json"),
|
|
style: [
|
|
{
|
|
selector: 'node',
|
|
style: {
|
|
'label': 'data(label)',
|
|
'text-valign': 'center',
|
|
'background-color': 'data(color)',
|
|
'width': 'data(size)',
|
|
'height': 'data(size)',
|
|
'color': 'white',
|
|
'text-outline-width': 2,
|
|
'text-outline-color': '#888'
|
|
}
|
|
},
|
|
{
|
|
selector: 'edge',
|
|
style: {
|
|
'line-color': 'data(color)'
|
|
}
|
|
}],
|
|
layout: {
|
|
name: 'cose',
|
|
nodeDimensionsIncludeLabels: true,
|
|
nodeOverlap: 50
|
|
}
|
|
});
|
|
|
|
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');
|
|
}
|
|
});
|
|
</script>
|
|
|