-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
81 lines (73 loc) · 2.38 KB
/
test.html
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Table Only View</title>
<style>
/* Hide header and navigation elements */
header,
#region-main .path-blocks-configurable_reports,
.navbar,
.breadcrumb,
#page-header, /* Moodle header */
.block_navigation, /* Navigation block */
.block_adminblock, /* Administration block */
.usermenu,
#topbar,
#site-navigation {
display: none !important;
}
/* Make the table full-width and centred */
table {
margin: 0 auto;
width: 100%;
border-collapse: collapse;
}
th, td {
padding: 10px;
border: 1px solid #ddd;
text-align: center;
}
/* Set body to full screen */
body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<iframe id="report-frame" src="https://www.tpilearninghub.org.uk/blocks/configurable_reports/viewreport.php?id=54&courseid=1"></iframe>
<script>
document.getElementById('report-frame').addEventListener('load', function () {
try {
const iframeDoc = this.contentDocument || this.contentWindow.document;
// Hide unwanted elements dynamically in iframe
const selectors = [
'header',
'.navbar',
'#page-header',
'.block_navigation',
'.block_adminblock',
'.breadcrumb',
'#topbar'
];
selectors.forEach(selector => {
iframeDoc.querySelectorAll(selector).forEach(el => el.style.display = 'none');
});
// Ensure table is styled
const table = iframeDoc.querySelector('table');
if (table) {
table.style.margin = '0 auto';
table.style.width = '100%';
table.style.borderCollapse = 'collapse';
}
} catch (e) {
console.error('Error hiding elements in iframe:', e);
}
});
</script>
</body>
</html>