mirror of
https://github.com/norohind/SquadsActivityMonitor.git
synced 2025-04-13 05:17:12 +03:00
took out static files
This commit is contained in:
parent
2c5bfc143f
commit
7495ebd460
42
js/json2htmltable.js
Normal file
42
js/json2htmltable.js
Normal file
@ -0,0 +1,42 @@
|
||||
// Thanks to https://stackoverflow.com/a/21065846
|
||||
var _table_ = document.createElement('table'),
|
||||
_tr_ = document.createElement('tr'),
|
||||
_th_ = document.createElement('th'),
|
||||
_td_ = document.createElement('td');
|
||||
|
||||
// Builds the HTML Table out of myList json data from Ivy restful service.
|
||||
function buildHtmlTable(arr) {
|
||||
var table = _table_.cloneNode(false),
|
||||
columns = addAllColumnHeaders(arr, table);
|
||||
for (var i = 0, maxi = arr.length; i < maxi; ++i) {
|
||||
var tr = _tr_.cloneNode(false);
|
||||
for (var j = 0, maxj = columns.length; j < maxj; ++j) {
|
||||
var td = _td_.cloneNode(false);
|
||||
cellValue = arr[i][columns[j]];
|
||||
td.appendChild(document.createTextNode(arr[i][columns[j]] || ''));
|
||||
tr.appendChild(td);
|
||||
}
|
||||
table.appendChild(tr);
|
||||
}
|
||||
return table;
|
||||
}
|
||||
|
||||
// Adds a header row to the table and returns the set of columns.
|
||||
// Need to do union of keys from all records as some records may not contain
|
||||
// all records
|
||||
function addAllColumnHeaders(arr, table) {
|
||||
var columnSet = [],
|
||||
tr = _tr_.cloneNode(false);
|
||||
for (var i = 0, l = arr.length; i < l; i++) {
|
||||
for (var key in arr[i]) {
|
||||
if (arr[i].hasOwnProperty(key) && columnSet.indexOf(key) === -1) {
|
||||
columnSet.push(key);
|
||||
var th = _th_.cloneNode(false);
|
||||
th.appendChild(document.createTextNode(key));
|
||||
tr.appendChild(th);
|
||||
}
|
||||
}
|
||||
}
|
||||
table.appendChild(tr);
|
||||
return columnSet;
|
||||
}
|
16
js/table_styles.css
Normal file
16
js/table_styles.css
Normal file
@ -0,0 +1,16 @@
|
||||
table {
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid #dddddd;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table th {
|
||||
font-weight: bold;
|
||||
padding: 5px;
|
||||
background: #efefef;
|
||||
border: 1px solid #dddddd;
|
||||
}
|
||||
table td {
|
||||
border: 1px solid #dddddd;
|
||||
padding: 5px;
|
||||
text-align:center;
|
||||
}
|
7
web.py
7
web.py
@ -1,5 +1,3 @@
|
||||
import waitress
|
||||
|
||||
import model
|
||||
import json
|
||||
import falcon
|
||||
@ -102,8 +100,6 @@ app.add_route('/api/diff/{action_id}', ActivityDiff())
|
||||
app.add_route('/leaderboard/{leaderboard}/platform/{platform}', ActivityHtml())
|
||||
app.add_route('/diff/{action_id}', ActivityDiffHtml())
|
||||
|
||||
app.add_route('/js/{file}', JS())
|
||||
|
||||
app.add_route('/{var}', MainPage())
|
||||
|
||||
app.add_route('/api/cache/{action}', Cache())
|
||||
@ -111,4 +107,7 @@ app.add_route('/api/cache/{action}', Cache())
|
||||
application = app # for uwsgi
|
||||
|
||||
if __name__ == '__main__':
|
||||
import waitress
|
||||
import os
|
||||
app.add_static_route('/js', os.path.join(os.path.dirname(os.path.abspath(__file__)), 'js'))
|
||||
waitress.serve(app, host='127.0.0.1', port=9485)
|
||||
|
Loading…
x
Reference in New Issue
Block a user