5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 <title>MKWS demo: Reference & Credo, and popup widget, development</title>
7 <link rel="stylesheet" type="text/css" href="tools/htdocs/mkws.css" />
8 <link rel="stylesheet" type="text/css" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css" />
9 <link rel="stylesheet" type="text/css" href="mkws-widget-reference.css" />
10 <link rel="stylesheet" type="text/css" href="mkws-widget-credo.css" />
11 <link rel="stylesheet" type="text/css" href="mkws-widget-ru.css" />
13 <script type="text/javascript">
15 sp_auth_credentials: "mkwstest/mkwstest"
19 <script type="text/javascript" src="tools/htdocs/jquery-1.10.0.min.js"></script>
20 <script type="text/javascript" src="//code.jquery.com/ui/1.11.2/jquery-ui.min.js"></script>
22 <script type="text/javascript" src="tools/htdocs/pz2.js"></script>
23 <script type="text/javascript" src="tools/htdocs/handlebars-v2.0.0.js"></script>
24 <script type="text/javascript" src="tools/htdocs/jquery.json-2.4.js"></script>
25 <script type="text/javascript" src="tools/htdocs/jsnlog.min.js"></script>
27 <script type="text/javascript" src="src/mkws-handlebars.js"></script>
28 <script type="text/javascript" src="src/mkws-core.js"></script>
29 <script type="text/javascript" src="src/mkws-team.js"></script>
30 <script type="text/javascript" src="src/mkws-filter.js"></script>
31 <script type="text/javascript" src="src/mkws-widget.js"></script>
32 <script type="text/javascript" src="src/mkws-widget-main.js"></script>
33 <script type="text/javascript" src="src/mkws-widget-facets.js"></script>
34 <script type="text/javascript" src="src/mkws-widget-authname.js"></script>
35 <script type="text/javascript" src="src/mkws-widget-categories.js"></script>
36 <script type="text/javascript" src="src/mkws-widget-log.js"></script>
37 <script type="text/javascript" src="src/mkws-widget-record.js"></script>
38 <script type="text/javascript" src="src/mkws-widget-reference.js"></script>
39 <script type="text/javascript" src="src/mkws-widget-builder.js"></script>
40 <script type="text/javascript" src="src/mkws-templates.js"></script>
41 <script type="text/javascript" src="src/mkws-popup.js"></script>
43 <script type="text/javascript" src="mkws-widget-credo.js"></script>
44 <script type="text/javascript" src="mkws-widget-ru.js"></script>
56 background-color: #888892;
60 flex-direction: column;
66 #top-bar, #current-bar {
70 justify-content: space-between;
73 background-color: #002868;
77 background-color: #54d8a8;
83 background-color: #4368a1;
87 border: 1px solid #7492c3;
88 padding: 0.15em 0.25em;
90 header button:hover, header button:active, header button:focus {
91 background-color: #2f5591;
94 background-color: #F0AD4E;
95 border-color: #EEA236;
99 #maybe:hover, #maybe:active, #maybe:focus {
100 background-color: #EC971F;
101 border-color: #D58512;
104 background-color: #5CB85C;
105 border-color: #4CAE4C;
109 #yes:hover, #yes:focus, #yes:active {
110 background-color: #449D44;
111 border-color: #398439;
114 background-color: #D9534F;
115 border-color: #D43F3A;
119 #no:hover, #no:focus, #no:active {
120 background-color: #C9302C;
121 border-color: #AC2925;
127 #settings, #judiciary {
132 #results, #query-info {
137 justify-content: flex-end;
146 justify-content: center;
153 justify-content: center;
155 #results-table table {
156 border-collapse: collapse;
159 #results-table td, #results-table th {
160 padding: .25em 1.25em;
163 #results-table tr:first-child {
164 border-bottom: 1px solid black;
167 border-bottom: 1px dotted black;
169 #results-table tr:last-child {
182 <button id="widget-markup-button">Widget</button>
183 <button id="queries-button">Queries</button>
187 <button id="results-table-button">Table</button>
188 <button id="results-csv-button">| delimited</button>
193 <header id="current-bar">
194 <span id="judiciary">
195 Relevant to query <span id="query"></span>?
196 <button id="yes" class="judgement">Yes</button>
197 <button id="no" class="judgement">No</button>
198 <button id="maybe" class="judgement">Maybe</button>
200 <span id="query-info">
201 <span id="count"></span>
205 <div id="widget-markup" class="dialog" title="Widget markup">
206 <textarea></textarea>
208 <div id="queries" class="dialog" title="Queries">
209 <textarea></textarea>
211 <div id="results-csv" class="dialog" title="| delimited results">
212 <textarea readonly></textarea>
214 <div id="results-table" class="dialog" title="Results as table">
219 <div id="test-subject"></div>
223 (function () { // wrapper
225 this.queries = ["sushi", "wurst", "berlin", "hammer", "bristol", "copenhagen", "tea", "latte"];
226 $("#queries > textarea").html(this.queries.join("\n"));
227 this.widgetMarkup = '<div class="mkws-reference" autosearch="{{query}}">Loading..</div>';
228 $("#widget-markup > textarea").html(this.widgetMarkup);
234 var showNext = function () {
235 if (next < this.queries.length) {
236 $('#test-subject').html(this.widgetMarkup.replace("{{query}}", this.queries[next]));
237 $('#query').html('"' + this.queries[next] + '"');
239 $('#count').html(next + " / " + this.queries.length);
240 mkws.init('#test-subject');
242 $("#results-table").dialog("open");
245 var startEval = function () {
246 $(".dialog").dialog("close");
248 context.results = {};
251 var judge = function (e) {
252 var query = $('#test-subject > div').attr('autosearch');
253 context.results[query] = {judgement: $(this).html()};
258 $(".dialog").dialog({
263 open: function(event, ui) {
264 $(this).parent().css('position', 'fixed');
269 var updateMarkup = function () {
270 context.widgetMarkup = $("#widget-markup > textarea").val();
273 $("#widget-markup-button").click(function () {
274 $("#widget-markup").dialog("open");
276 $("#widget-markup").dialog("option", "buttons", [
277 {text: "Start new evaluation", click: updateMarkup},
278 {text: "Cancel", click: function() { $(this).dialog("close"); }}
282 var updateQueries = function () {
283 context.queries = $("#queries > textarea").val().split("\n");
286 $("#queries-button").click(function () {
287 $("#queries").dialog("open");
289 $("#queries").dialog("option", "buttons", [
290 {text: "Start new evaluation", click: updateQueries},
291 {text: "Cancel", click: function() { $(this).dialog("close"); }}
295 $("#results-table-button").click(function () {
296 $("#results-table").dialog("open");
298 $("#results-csv-button").click(function () {
299 $("#results-csv").dialog("open");
301 $("#results-table").dialog("option", "open", function () {
302 var html = "<tr><th>Query</th><th>Relevant?</th><tr>";
303 for (var i = 0; i < context.queries.length; i++) {
304 var q = context.queries[i];
305 var r = context.results;
307 html += "<tr><td>" + q + "</td><td>" + r[q].judgement + "</td></tr>\n";
310 $("#results-table > table").html(html);
312 $("#results-csv").dialog("option", "open", function () {
313 var csv = "Query|Relevant?\n";
314 for (var i = 0; i < context.queries.length; i++) {
315 var q = context.queries[i];
316 var r = context.results;
318 csv += [q, r[q].judgement].join("|") + "\n";
321 $("#results-csv > textarea").html(csv);
324 $('button.judgement').click(judge);