-
Notifications
You must be signed in to change notification settings - Fork 71.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adds a 2, 3, 4 and 8 way split view option * Updated description * Generate the table on demand, so any number of sites from 1 to 8 generates a sensible layout * Update readme & don't crash if a name is missing
- Loading branch information
Showing
4 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<% | ||
|
||
let urlArray = []; | ||
let nameArray = []; | ||
|
||
for (let i = 0; i <= 8; i++) { | ||
let u = settings['frameUrl' + i]; | ||
let n = settings['frameName' + i] || " "; | ||
if (u) { | ||
urlArray.push(u); | ||
nameArray.push(n); | ||
} | ||
} | ||
|
||
const sitesPerRow = urlArray.length > 3 ? Math.round(urlArray.length / 2) : urlArray.length; | ||
const rows = urlArray.length > 3 ? 2 : 1; | ||
|
||
%><html> | ||
<head> | ||
<title>Nightscout multiframe view</title> | ||
<link rel="preload" href="/css/main.css" as="style" onload="this.onload=null;this.rel='stylesheet'"> | ||
<style media="screen" type="text/css"> | ||
html, body, table, tr, td { | ||
margin:0 !important; | ||
padding:0 !important; | ||
border: 0; | ||
} | ||
table { | ||
width:100%; | ||
height:100%; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<table> | ||
<% let s = 0; | ||
for (let r = 1; r <= rows; r++) { | ||
%><tr> | ||
<% for (let sp = 0; sp < sitesPerRow; sp++) { | ||
let pointer = sp + s; | ||
%><td align="center" style="height:20px"><%= nameArray[pointer] %></td> | ||
<% } %> | ||
</tr> | ||
<tr> | ||
<% for (let sp = 0; sp < sitesPerRow; sp++) { | ||
let pointer = sp + s; | ||
%><td align="center" width="auto"><iframe src="<%= urlArray[pointer] %>" style="width:100%;height:100%;"></iframe></td> | ||
<% } %> | ||
</tr> | ||
<% s += sitesPerRow; } %> | ||
</table> | ||
</body> | ||
|
||
</html> |