-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathwebviewer.records.txt
More file actions
41 lines (39 loc) · 1.58 KB
/
webviewer.records.txt
File metadata and controls
41 lines (39 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* =====================================================
* webviewer.records ( format ; css ; color )
*
* RETURNS: (string) Web viewer using formatted string
* DEPENDENCIES: webviewer.data(), html.document(), html.css()
* NOTES: Available placeholders [current], [found], [percentage]
* =====================================================
*
*/
// example:
// webviewer.records ( "Record [current] of [found] | [percentage]" ; "#bar { background-color: green }" )
Let ( [
var.record = Get(RecordNumber);
var.found = Get(FoundCount);
var.total = Get(TotalRecordCount);
isSubset = var.total = var.found;
var.percentage = Truncate ( ( var.record / var.found ) * 100 ; 0 ) & "%";
cssBar = Substitute ( "#bar { background-color: @color; height: 100%; width: @width; }";
[ "@color" ; If ( isempty ( color ) ; "transparent" ; color ) ];
[ "@width" ; var.percentage ]
)
];
webviewer.data( "";
"<title>Record Information</title>";
html.css( "body { text-align: center; margin: 0; border: 0; } #text{ margin:0 auto; }" & cssBar & css ); // load user css after the bar for override support
List (
"<div id=\"bar\" style=\"position: absolute; top: 0; left: 0;\"></div>";
"<div id=\"text\" style=\"position: absolute; top: 0; left: 0; width: 100%\">";
Substitute (
format;
[ "[current]" ; var.record ];
[ "[found]" ; var.found ];
[ "[percentage]" ; var.percentage ]
);
"</div>";
)
)
)