annotate ismi-python-neo4jrestclient/static/commentaries_authors2.html @ 30:cccbcc845d54

add arrowheads to commentary chains.
author casties
date Fri, 11 Dec 2015 13:03:04 -0500
parents 2564732249b3
children a6b2a09ea413
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
1 <html>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
2 <head>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
3 <meta name="viewport" content="width=device-width, initial-scale=1.0">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
4 <link rel="stylesheet" href="static/main.css">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
5 <title>ISMI commentary relations</title>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
6 </head>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
7
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
8 <body style="background:none;">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
9 <div role="navigation" class="navbar navbar-default navbar-static-top">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
10 <div class="container">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
11 <div class="row">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
12 <div class="col-sm-6 col-md-6">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
13 <ul class="nav navbar-nav">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
14 <li>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
15 <form role="search" class="navbar-form" id="search">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
16 <div class="form-group">
29
2564732249b3 search for authors names uses normalization now.
casties
parents: 19
diff changeset
17 <input type="text" value="jaghmini" placeholder="Search for person name" class="form-control" name="search">
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
18 </div>
29
2564732249b3 search for authors names uses normalization now.
casties
parents: 19
diff changeset
19 <button class="btn btn-default" type="submit">Search for author name</button>
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
20 </form>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
21 </li>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
22 </ul>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
23 </div>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
24 <div class="navbar-header col-sm-6 col-md-6">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
25 <div class="logo-well">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
26 <a href="//neo4j.com/developer-resources">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
27 <img src="//neo4j-contrib.github.io/developer-resources/language-guides/assets/img/logo-white.svg" alt="Neo4j World's Leading Graph Database" id="logo">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
28 </a>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
29 </div>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
30 <div class="navbar-brand">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
31 <div class="brand">ISMI Commentary relations between Texts</div>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
32 </div>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
33 </div>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
34 </div>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
35 </div>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
36 </div>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
37
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
38 <div class="row">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
39 <div class="col-md-5">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
40 <div class="panel panel-default">
19
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
41 <div class="panel-heading">
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
42 <span>Texts by this author</span>
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
43 <span class="clickhide">(click to hide)</span>
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
44 <span class="clickhide" style="display:none;">(click to show)</span>
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
45 </div>
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
46 <table id="results" class="table table-striped table-hover">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
47 <thead>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
48 <tr>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
49 <th>Author (translit)</th>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
50 <th>Title (translit)</th>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
51 <th>Title (arabic)</th>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
52 <th>ismi_id</th>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
53 </tr>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
54 </thead>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
55 <tbody>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
56 </tbody>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
57 </table>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
58 </div>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
59 </div>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
60 <div class="col-md-7">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
61 <div class="panel panel-default">
19
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
62 <div class="panel-heading">
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
63 <span id="title">Text details</span>
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
64 <span class="clickhide">(click to hide)</span>
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
65 <span class="clickhide" style="display:none;">(click to show)</span>
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
66 </div>
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
67 <div class="row">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
68 <!-- <div class="col-sm-4 col-md-4">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
69 <img src="" class="well" id="poster"/>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
70 </div> -->
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
71 <div class="col-md-8 col-sm-8">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
72 <h4>Details</h4>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
73 <ul id="info">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
74 </ul>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
75 <h4>Commenting on</h4>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
76 <ul id="commenting">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
77 </ul>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
78 <h4>Commentaries</h4>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
79 <ul id="commentaries">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
80 </ul>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
81 </div>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
82 </div>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
83 </div>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
84 </div>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
85 </div>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
86 <div class="col-lg-12">
17
09c0a9ceb778 more pimping of commentaries_authors.
casties
parents: 16
diff changeset
87 <div class="panel panel-default">
19
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
88 <div class="panel-heading">
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
89 <span>Graph of commentaries</span>
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
90 <span class="clickhide">(click to hide)</span>
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
91 <span class="clickhide" style="display:none;">(click to show)</span>
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
92 </div>
17
09c0a9ceb778 more pimping of commentaries_authors.
casties
parents: 16
diff changeset
93 <div id="graph">
09c0a9ceb778 more pimping of commentaries_authors.
casties
parents: 16
diff changeset
94 </div>
09c0a9ceb778 more pimping of commentaries_authors.
casties
parents: 16
diff changeset
95 </div>
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
96 </div>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
97
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
98 <style type="text/css">
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
99 .node { stroke: #222; stroke-width: 1.5px; }
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
100 .node.TEXT { fill: #888; }
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
101 .node.TEXT.marked { stroke: red; }
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
102 .node.TEXT.selected { fill: red; }
30
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
103 .link { stroke: #999; stroke-opacity: .6; stroke-width: 2px; }
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
104 .arrowHead { fill: #999 }
17
09c0a9ceb778 more pimping of commentaries_authors.
casties
parents: 16
diff changeset
105 tr.marked {border: 2px solid red;}
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
106 </style>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
107
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
108 <script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
109 <!-- <script src="https://d3js.org/d3.v3.min.js" type="text/javascript"></script> -->
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
110 <script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js" type="text/javascript"></script>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
111 <script type="text/javascript">
19
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
112 // make panels roll-up
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
113 $(".panel-heading").on("click", function() {
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
114 $(this).find(".clickhide").toggle();
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
115 $(this).next().slideToggle();
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
116 });
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
117 // provide search and graph
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
118 backendApiPrefix = "";
18
c5fffe4338a1 with clickable nodes now.
casties
parents: 17
diff changeset
119 searchApi = {};
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
120 $(function () {
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
121 function showText(text_id) {
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
122 $.get(backendApiPrefix+"/textandcommentaries/" + encodeURIComponent(text_id),
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
123 function (data) {
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
124 if (!data) return;
17
09c0a9ceb778 more pimping of commentaries_authors.
casties
parents: 16
diff changeset
125 $("#title").text("Title: "+data.title);
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
126 var $list = $("#info").empty();
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
127 $list.append($("<li> author: " + data.author + "</li>"));
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
128 for (var key in data.attrs) {
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
129 var val = data.attrs[key];
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
130 if (key === "link") {
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
131 val = "<a href=\"" + val + "\" target=\"_blank\">" + val + "</a>";
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
132 }
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
133 $list.append($("<li>" + key + ": " + val + "</li>"));
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
134 };
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
135 // re-set selected
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
136 $("#graph .selected").each(function(){this.classList.remove("selected")});
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
137 $("#graph .ismi-"+data.attrs.ismi_id).each(function(){this.classList.add("selected")});
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
138 var $commentaries = $("#commentaries").empty();
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
139 for (var key in data.commentaries) {
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
140 var val = data.commentaries[key];
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
141 $commentaries.append($("<li>" + val.title + " [<span class=\"text_id\">" + key + "</span>] by " + val.author + "</li>")
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
142 .click(function() { showText($(this).find("span.text_id").text());}));
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
143 }
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
144 var $commenting = $("#commenting").empty();
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
145 for (var key in data.commenting) {
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
146 var val = data.commenting[key];
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
147 $commenting.append($("<li>" + val.title + " [<span class=\"text_id\">" + key + "</span>] by " + val.author + "</li>")
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
148 .click(function() { showText($(this).find("span.text_id").text());}));
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
149 }
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
150 }, "json");
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
151 return false;
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
152 }
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
153 function search() {
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
154 var query=$("#search").find("input[name=search]").val();
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
155 $.get(backendApiPrefix+"/search?q=" + encodeURIComponent(query),
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
156 function (data) {
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
157 var t = $("table#results tbody").empty();
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
158 if (!data || data.length == 0) return;
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
159 // clear all marks
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
160 $("#graph .marked").each(function(){this.classList.remove("marked")});
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
161 data.forEach(function (row) {
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
162 var text = row.text;
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
163 var author = row.author;
17
09c0a9ceb778 more pimping of commentaries_authors.
casties
parents: 16
diff changeset
164 var comm = row.is_commentary || row.has_commentaries;
09c0a9ceb778 more pimping of commentaries_authors.
casties
parents: 16
diff changeset
165 var $row = $("<tr><td>" + author.label + "</td><td>" + text.label + "</td><td>" + text.full_title + "</td><td class='text_id'>" + text.ismi_id + "</td></tr>").appendTo(t)
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
166 .click(function() { showText($(this).find("td.text_id").text());});
17
09c0a9ceb778 more pimping of commentaries_authors.
casties
parents: 16
diff changeset
167 if (comm) {
09c0a9ceb778 more pimping of commentaries_authors.
casties
parents: 16
diff changeset
168 $row.addClass("marked");
09c0a9ceb778 more pimping of commentaries_authors.
casties
parents: 16
diff changeset
169 }
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
170 // set mark
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
171 $("#graph .ismi-"+text.ismi_id).each(function(){this.classList.add("marked")});
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
172 });
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
173 showText(data[0].text.ismi_id);
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
174 }, "json");
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
175 return false;
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
176 }
18
c5fffe4338a1 with clickable nodes now.
casties
parents: 17
diff changeset
177 // export API
c5fffe4338a1 with clickable nodes now.
casties
parents: 17
diff changeset
178 searchApi.showText = showText;
c5fffe4338a1 with clickable nodes now.
casties
parents: 17
diff changeset
179 searchApi.search = search;
c5fffe4338a1 with clickable nodes now.
casties
parents: 17
diff changeset
180 // start search
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
181 $("#search").submit(search);
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
182 search();
19
2b2699d47eba now with collapsible panels.
casties
parents: 18
diff changeset
183 });
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
184 </script>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
185
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
186 <script type="text/javascript">
17
09c0a9ceb778 more pimping of commentaries_authors.
casties
parents: 16
diff changeset
187 var width = 1400, height = 1400;
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
188
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
189 var force = d3.layout.force()
17
09c0a9ceb778 more pimping of commentaries_authors.
casties
parents: 16
diff changeset
190 .charge(-100) // -200
30
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
191 .linkDistance(20) // 30
17
09c0a9ceb778 more pimping of commentaries_authors.
casties
parents: 16
diff changeset
192 .size([width, height]);
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
193
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
194 var svg = d3.select("#graph").append("svg")
17
09c0a9ceb778 more pimping of commentaries_authors.
casties
parents: 16
diff changeset
195 .attr("width", "1400px").attr("height", "1400px")
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
196 .attr("pointer-events", "all");
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
197
30
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
198 // arrow head marker
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
199 var defs = svg.append("defs").append("marker")
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
200 .attr({
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
201 "id":"arrow",
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
202 "markerUnits": "strokeWidth",
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
203 "viewBox":"0 -5 10 10",
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
204 "refX": 20, // 5
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
205 "refY":0,
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
206 "markerWidth":4,
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
207 "markerHeight":4,
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
208 "orient":"auto"
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
209 })
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
210 .append("path")
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
211 .attr("d", "M0,-5 L10,0 L0,5")
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
212 .attr("class","arrowHead");
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
213
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
214 // load graph
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
215 d3.json(backendApiPrefix+"/graph?limit=1000", function(error, graph) {
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
216 if (error) return;
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
217
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
218 force.nodes(graph.nodes).links(graph.links).start();
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
219
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
220 var link = svg.selectAll(".link")
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
221 .data(graph.links).enter()
30
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
222 .append("line").attr({
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
223 "class": "link",
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
224 "marker-end": "url(#arrow)"
cccbcc845d54 add arrowheads to commentary chains.
casties
parents: 29
diff changeset
225 });
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
226
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
227 var node = svg.selectAll(".node")
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
228 .data(graph.nodes).enter()
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
229 .append("circle")
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
230 .attr("class", function (d) { return "node "+d.label+" ismi-"+d.ismi_id})
17
09c0a9ceb778 more pimping of commentaries_authors.
casties
parents: 16
diff changeset
231 .attr("r", 8) // 10
18
c5fffe4338a1 with clickable nodes now.
casties
parents: 17
diff changeset
232 .attr("data-ismi_id", function(d) {return d.ismi_id})
c5fffe4338a1 with clickable nodes now.
casties
parents: 17
diff changeset
233 .on("click", function() {
c5fffe4338a1 with clickable nodes now.
casties
parents: 17
diff changeset
234 console.log("click on ", this);
c5fffe4338a1 with clickable nodes now.
casties
parents: 17
diff changeset
235 var id = this.getAttribute("data-ismi_id");
c5fffe4338a1 with clickable nodes now.
casties
parents: 17
diff changeset
236 searchApi.showText(id);
c5fffe4338a1 with clickable nodes now.
casties
parents: 17
diff changeset
237 })
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
238 .call(force.drag);
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
239
18
c5fffe4338a1 with clickable nodes now.
casties
parents: 17
diff changeset
240 console.log("searchApi:", searchApi);
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
241 // html title attribute
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
242 node.append("title")
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
243 .text(function (d) { return d.title; })
17
09c0a9ceb778 more pimping of commentaries_authors.
casties
parents: 16
diff changeset
244
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
245 // force feed algo ticks
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
246 force.on("tick", function() {
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
247 link.attr("x1", function(d) { return d.source.x; })
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
248 .attr("y1", function(d) { return d.source.y; })
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
249 .attr("x2", function(d) { return d.target.x; })
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
250 .attr("y2", function(d) { return d.target.y; });
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
251
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
252 node.attr("cx", function(d) { return d.x; })
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
253 .attr("cy", function(d) { return d.y; });
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
254 });
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
255 });
17
09c0a9ceb778 more pimping of commentaries_authors.
casties
parents: 16
diff changeset
256
16
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
257 </script>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
258 </body>
ad3eefa2cb80 pimped commentaries_authors.html visualisation.
casties
parents:
diff changeset
259 </html>