2016-01-17 18:00:44 +00:00
|
|
|
// © 2013 the CatBase Authors under the WTFPL. See AUTHORS for the list of authors.
|
2013-12-10 23:37:07 +00:00
|
|
|
|
2016-03-24 17:32:40 +00:00
|
|
|
package fact
|
2013-06-01 17:10:15 +00:00
|
|
|
|
|
|
|
// I hate this, but I'm creating strings of the templates to avoid having to
|
|
|
|
// track where templates reside.
|
|
|
|
|
2016-01-15 06:12:26 +00:00
|
|
|
// 2016-01-15 Later note, why are these in plugins and the server is in bot?
|
|
|
|
|
2019-05-27 23:21:53 +00:00
|
|
|
var factoidIndex = `
|
2013-06-01 17:10:15 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
2013-06-01 17:29:12 +00:00
|
|
|
<title>Factoids</title>
|
2019-05-28 02:16:35 +00:00
|
|
|
<link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/pure-min.css" integrity="sha384-nn4HPE8lTHyVtfCBi5yW9d20FjT8BJwUXyWZT9InLYax14RDjBj46LmSztkmNP9w" crossorigin="anonymous">
|
2013-06-17 03:23:58 +00:00
|
|
|
|
|
|
|
<!-- DataTables CSS -->
|
2016-05-18 02:19:46 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="https://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css">
|
2013-06-17 03:23:58 +00:00
|
|
|
|
|
|
|
<!-- jQuery -->
|
2016-05-18 02:19:46 +00:00
|
|
|
<script type="text/javascript" charset="utf8" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script>
|
2013-06-17 03:23:58 +00:00
|
|
|
|
|
|
|
<!-- DataTables -->
|
2016-05-18 02:19:46 +00:00
|
|
|
<script type="text/javascript" charset="utf8" src="https://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js"></script>
|
2013-06-17 03:23:58 +00:00
|
|
|
|
2013-06-01 17:10:15 +00:00
|
|
|
</head>
|
2019-05-28 02:16:35 +00:00
|
|
|
<body>
|
2013-06-01 17:10:15 +00:00
|
|
|
<div>
|
2013-06-01 20:20:45 +00:00
|
|
|
<form action="/factoid" method="GET" class="pure-form">
|
2013-06-01 17:29:12 +00:00
|
|
|
<fieldset>
|
|
|
|
<legend>Search for a factoid</legend>
|
|
|
|
<input type="text" name="entry" placeholder="trigger" value="{{.Search}}" />
|
|
|
|
<button type="submit" class="pure-button notice">Find</button>
|
|
|
|
</fieldset>
|
2013-06-01 17:10:15 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
|
2013-06-01 17:29:12 +00:00
|
|
|
<div>
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
.pure-button-success,
|
|
|
|
.pure-button-error,
|
|
|
|
.pure-button-warning,
|
|
|
|
.pure-button-secondary {
|
|
|
|
color: white;
|
|
|
|
border-radius: 4px;
|
|
|
|
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
|
|
|
|
padding: 2px;
|
|
|
|
}
|
2013-06-01 17:10:15 +00:00
|
|
|
|
2013-06-01 17:29:12 +00:00
|
|
|
.pure-button-success {
|
|
|
|
background: rgb(76, 201, 71); /* this is a green */
|
|
|
|
}
|
|
|
|
|
|
|
|
.pure-button-error {
|
|
|
|
background: rgb(202, 60, 60); /* this is a maroon */
|
|
|
|
}
|
|
|
|
|
|
|
|
.pure-button-warning {
|
|
|
|
background: orange;
|
|
|
|
}
|
2013-06-01 17:10:15 +00:00
|
|
|
|
2013-06-01 17:29:12 +00:00
|
|
|
.pure-button-secondary {
|
|
|
|
background: rgb(95, 198, 218); /* this is a light blue */
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
{{if .Error}}
|
|
|
|
<span id="error" class="pure-button-error">{{.Error}}</span>
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{if .Count}}
|
|
|
|
<span id="count" class="pure-button-success">Found {{.Count}} entries.</span>
|
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{{if .Entries}}
|
|
|
|
<div style="padding-top: 1em;">
|
2013-06-17 03:23:58 +00:00
|
|
|
<table class="pure-table" id="factTable">
|
2013-06-01 17:29:12 +00:00
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Trigger</th>
|
|
|
|
<th>Full Text</th>
|
|
|
|
<th>Author</th>
|
|
|
|
<th># Hits</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>
|
|
|
|
{{range .Entries}}
|
|
|
|
<tr>
|
2016-03-29 14:20:44 +00:00
|
|
|
<td>{{linkify .Fact}}</td>
|
|
|
|
<td>{{linkify .Tidbit}}</td>
|
|
|
|
<td>{{linkify .Owner}}</td>
|
|
|
|
<td>{{.Count}}</td>
|
2013-06-01 17:29:12 +00:00
|
|
|
</tr>
|
|
|
|
{{end}}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2013-06-01 17:10:15 +00:00
|
|
|
{{end}}
|
|
|
|
|
2013-06-17 03:23:58 +00:00
|
|
|
<script>
|
|
|
|
$(document).ready(function(){
|
|
|
|
$('#factTable').dataTable({
|
|
|
|
"bPaginate": false
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
2019-05-28 02:16:35 +00:00
|
|
|
</body>
|
2013-06-17 03:23:58 +00:00
|
|
|
|
2013-06-01 17:10:15 +00:00
|
|
|
</html>
|
|
|
|
`
|