-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathby_father.php
178 lines (151 loc) · 7.49 KB
/
by_father.php
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HistoricalChristian.Faith</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css" />
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.12/jstree.min.js"></script>
<link rel="apple-touch-icon" sizes="180x180" href="favicon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon.png">
<style>
#content { height: 100vh; }
details > div, details > details { padding-left: 20px; }
details, summary { cursor: pointer; }
#sidebarMenu { height: 100vh; overflow-y: auto; }
.sidebar-sticky { position: -webkit-sticky; position: sticky; top: 56px; /* Height of navbar */ }
/* Additional style for toggle button */
.sidebar-toggle {
display: none;
position: fixed;
top: 56px; /* Below the top navbar */
left: 0;
z-index: 1000; /* Above sidebar and content */
}
@media (max-width: 992px) {
.sidebar-toggle {
display: block; /* Show toggle button on small screens */
}
}
.jstree-anchor {
/*enable wrapping*/
white-space : normal !important;
/*ensure lower nodes move down*/
height : auto !important;
/*offset icon width*/
padding-right : 24px;
}
</style>
<script>
function get_url_hash_fragment(url) {
// When jumping to source from the commentaries site, we have a commentary fragment appended to the url after the hashtag.
// Let's pass this commentary fragment to the iframe, so the source website can scroll to / highlight that commentary fragment.
var hashtag_fragment = "#";
var parts = window.location.href.split('#');
// Check if there is a hashtag with text after it
if (parts.length > 1 && parts[1].length > 0) {
hashtag_fragment += parts[1];
}
return hashtag_fragment;
}
function loadFile(filePath) {
document.getElementById('content').removeAttribute('srcdoc');
console.log("Loading file...", filePath)
document.getElementById('content').src = "https://historicalchristianfaith.github.io/Writings-Database/" + filePath;
const url = new URL(window.location);
url.searchParams.set('file', filePath);
window.history.pushState({}, '', url);
$('#sidebarMenu').removeClass('show');
}
function loadMetaFile(filePath) {
document.getElementById('content').removeAttribute('srcdoc');
console.log("Loading metafile...", filePath)
document.getElementById('content').src = filePath;
}
$(document).ready(function(){
$('#cfmenu').jstree();
const urlParams = new URLSearchParams(window.location.search);
const file = urlParams.get('file');
if (file) {
console.log("Onload: file...", file)
document.getElementById('content').removeAttribute('srcdoc');
document.getElementById('content').src = "https://historicalchristianfaith.github.io/Writings-Database/" + file + get_url_hash_fragment();
var tree = $.jstree.reference('#cfmenu');
var allNodes = tree.get_json('#', { 'flat': true });
var nodeToSelect = allNodes.find(node => node.li_attr && node.li_attr['data-fname'] === file);
if(nodeToSelect) {
tree.select_node(nodeToSelect.id);
} else {
console.log('No node found with data-fname:', file);
}
}
$('#cfmenu').on("changed.jstree", function (e, data) {
console.log("***ii1", data.selected);
});
$('#cfmenu').on('activate_node.jstree', function (e, data) {
if(data.node.children.length > 0) {
// Toggle (open/close) the node
$("#cfmenu").jstree(true).toggle_node(data.node);
if (data.node && data.node['li_attr'] && data.node['li_attr']['data-metadataurl']) {
loadMetaFile(data.node['li_attr']['data-metadataurl']);
}
return;
}
if (data.node && data.node['li_attr'] && data.node['li_attr']['data-fname']) {
loadFile(data.node['li_attr']['data-fname']);
}
});
});
</script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light sticky-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="/by_father.php" target="_blank">
<span class="d-lg-none">HCF - By Father</span> <!-- Visible on xs to md screens -->
<span class="d-none d-lg-inline">HistoricalChristian.Faith - By Father</span> <!-- Visible on lg and larger screens -->
</a>
</div>
<div class="ml-auto">
<button class="navbar-toggler" type="button" aria-label="Toggle navigation" onclick="$('#sidebarMenu').toggleClass('show');">
<span class="navbar-toggler-icon"></span>
</button>
<a href="/" class="navbar-text d-none d-lg-inline-block">View By Verse</a>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<nav id="sidebarMenu" class="col-md-4 col-lg-3 d-md-block bg-light sidebar collapse">
<div class="sidebar-sticky">
<!-- Visible only on xs, sm, and md screens -->
<h4 class="d-block d-lg-none">
<a href='/'>By Verse</a> |
<a href='/by_father.php' style="font-weight:bold;">By Father</a>
</h4>
<div id="cfmenu">
<?php
$htmlContent = file_get_contents("https://historicalchristianfaith.github.io/Writings-Database/menu.html?v=1");
if ($htmlContent !== false) {
echo $htmlContent;
} else {
echo "Error fetching menu.";
}
?>
</div>
</div>
</nav>
<main role="main" class="col-md-8 ml-sm-auto col-lg-9 px-4" style="height: 100vh;padding: 0px !important;">
<iframe id="content" name="contentFrame" style="width: 100%; height: 100%;" srcdoc="<p>Click on a writing from the menu to open it here!</p><p>Note: This database is open source, and everything is in the public domain! <a target='_blank' href='https://github.com/HistoricalChristianFaith/Writings-Database/'>Contribute/fix typos here!</a></p>"></iframe>
</main>
</div>
</div>
</body>
</html>