-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathshow.php
More file actions
503 lines (420 loc) · 17.3 KB
/
show.php
File metadata and controls
503 lines (420 loc) · 17.3 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
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
<?php
require_once('head.inc.php');
require_once('setdefault.inc.php');
require_once('formatter.inc.php');
require_once('oversigt.inc.php');
// $minchap: Minimum chapter number
// $maxchap: Maximum chapter number
// $nextchap: Next chapter number, or -1
// $prevchap: Previous chapter number, or -1
$minchap = array();
$maxchap = array();
$nextchap = array();
$prevchap = array();
foreach ($chap as $book => $chaps) {
$minchap[$book] = min($chaps);
$maxchap[$book] = max($chaps);
$nextchap[$book] = array();
$prevchap[$book] = array();
$lastchap = -1;
foreach ($chaps as $ch) {
if ($lastchap!=-1)
$nextchap[$book][$lastchap] = $ch;
$prevchap[$book][$ch] = $lastchap;
$lastchap = $ch;
}
$nextchap[$book][$lastchap] = -1;
}
function pagination($book, $kapitel) {
global $chaptype, $chap, $style;
$outline_style = is_array($style[$book]) ? ($style[$book][$kapitel]??'') : $style[$book];
$outline_style = str_replace('btn','btn-outline',$outline_style);
echo " <div style=\"margin-left: auto; margin-right: auto;\">\n";
$chcount = count($chap[$book]);
for ($chix=0; $chix < $chcount; ++$chix) {
$chno = $chap[$book][$chix];
echo " <a href=\"show.php?bog=$book&kap=$chno\" "
. "class=\"mt-1 mb-1 ml-0 mr-0 btn chap-btn "
. ($chno==$kapitel ? $outline_style : (is_array($style[$book]) ? $style[$book][$chno] : $style[$book]))
. "\">$chno</a>\n";
}
echo " </div>\n";
}
function refhebgr($book,$chapt,$from,$to) {
global $hebbooks;
global $grbooks;
if (isset($hebbooks[$book])) {
$hbook = $hebbooks[$book];
if ($from==0)
return "<a target=\"_blank\" href=\"https://learner.bible/text/show_text/ETCBC4/$hbook/$chapt\">Ⓗ</a>";
elseif ($to==0)
return "<a target=\"_blank\" href=\"https://learner.bible/text/show_text/ETCBC4/$hbook/$chapt/$from/999\">Ⓗ</a>";
else
return "<a target=\"_blank\" href=\"https://learner.bible/text/show_text/ETCBC4/$hbook/$chapt/$from/$to\">Ⓗ</a>";
}
elseif (isset($grbooks[$book])) {
$gbook = $grbooks[$book];
if ($from==0)
return "<a target=\"_blank\" href=\"https://learner.bible/text/show_text/nestle1904/$gbook/$chapt\">Ⓖ</a>";
elseif ($to==0)
return "<a target=\"_blank\" href=\"https://learner.bible/text/show_text/nestle1904/$gbook/$chapt/$from/999\">Ⓖ</a>";
else
return "<a target=\"_blank\" href=\"https://learner.bible/text/show_text/nestle1904/$gbook/$chapt/$from/$to\">Ⓖ</a>";
}
else
return "Ukendt bog";
}
if (!isset($_GET['bog']) || !isset($_GET['kap']) || !is_numeric($_GET['kap'])) {
echo "<pre>Forkerte parametre</pre>";
die;
}
$kap = intval($_GET['kap']);
$bog = $_GET['bog'];
$fra = isset($_GET['fra']) && is_numeric($_GET['fra']) ? intval($_GET['fra']) : 0;
$til = isset($_GET['til']) && is_numeric($_GET['til']) ? intval($_GET['til']) : 0;
if (!isset($abbrev[$bog]))
makeheadstart('Ulovlig henvisning', true);
else
makeheadstart($abbrev[$bog] . ' ' . $kap, true);
if ($_SESSION['exegetic']=='on' && isset($style[$bog]))
$syntactic_layout = (is_array($style[$bog]) ? $style[$bog][$kap] : $style[$bog]) == $modenhed['med indrykning'];
else
$syntactic_layout = false;
?>
<style>
.bibletext, .biblenotes, .reflinks {
font-family: <?= $allfonts[$_SESSION['font']] ?>;
font-size: <?= $_SESSION['fontsize'] ?>%;
}
span.verseno {
vertical-align: super;
font-size: 0.625em;
}
h2 {
font-size: 1.125em;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
text-transform: none;
}
h2 small { /* Used for "ERREN" in "HERREN" */
font-size: 85%;
color: #333333;
font-weight: 700;
}
/* Taken in part from XKCD */
/* the reference tooltips style starts here */
.ref {
position: relative;
vertical-align: baseline;
}
.refnum, .refnumhead {
position: relative;
left: 2px;
bottom: 1ex;
color: #005994;
font-size: .7em;
font-weight: bold;
text-decoration: underline;
text-transform: lowercase;
cursor: pointer;
}
.tooltip-inner {
text-align: left;
max-width: 70%;
min-width: 100px;
font-size: <?= $_SESSION['fontsize'] ?>%;
}
div.paragraph {
text-indent: 2em;
display: block;
}
div.paragraphm {
text-indent: 0;
display: block;
}
div.textline {
margin-left: 11em;
text-indent: -11em;
}
#labelex {
font-weight: bold;
}
div.indented-number, div.indented-number-blank {
display: inline-block;
vertical-align: top;
width: 11em;
text-indent: 0em;
font-weight: bold;
}
div.indented-text {
display: inline-block;
margin-left: 0px; /* Temporary value, may be altered by JavaScript */
text-indent: 0px; /* Temporary value, may be altered by JavaScript */
}
div.poetry1 {
margin-left: 7em;
text-indent: -5em;
display: block;
}
div.poetry2 {
margin-left: 7em;
text-indent: -3em;
display: block;
}
@font-face {
font-family: 'Ezra SIL Webfont';
src: url('style/fonts/SILEOT.woff') format('woff');
}
.hebrew {
font-family: "Ezra SIL Webfont" !important;
font-size: 120% !important;
}
</style>
<script>
<?php if ($syntactic_layout): ?>
let maxindent = 0; // The maximum indentation level of the text
let pixels_per_space = 0; // The width of a space - calculated below
function do_indent() {
$(".indentspaces").remove(); // Remove old indentation, if any
<?php if ($_SESSION['indent_type']=='text'): ?>
// We do indentation of the first line of a paragraph by inserting an appropriate number of spaces.
// We do indentation of the following lines of a paragraph by seting margin-left.
// The reason we don't use margin-left for the first line is because we want to be able to
// copy-paste an indented text into a document.
// Make indentation match maxindent; however, don't indent more than 40 pixels per level.
// By dividing by maxindent+4 rather than maxindent below, we leave a litte room for the text.
let pixels_per_indent = Math.min(Math.round($(".bibletext").width()/(maxindent+4)),40);
$('.indented-text').each(function(i) {
let indentpixels = $(this).data('indent')*pixels_per_indent;
let indentspaces = Math.round(indentpixels/pixels_per_space);
let nbsps = '';
while (indentspaces>=10) {
nbsps += " ";
indentspaces -= 10;
}
// 6 is the length of " "
nbsps += " ".substring(0,indentspaces*6);
$(this).prepend('<span class="indentspaces">' + nbsps + '</span>');
$(this).css('margin-left',indentpixels + 'px')
.css('text-indent',(-indentpixels) + 'px');
});
<?php endif; ?>
<?php if ($_SESSION['indent_type']=='number'): ?>
$(".indented-number").each(function(i) {
let indentspaces = $(this).data('indent');
let nbsps = '';
while (indentspaces>=10) {
nbsps += " ";
indentspaces -= 10;
}
// 6 is the length of " "
nbsps += " ".substring(0,indentspaces*6);
$(this).prepend('<span class="indentspaces">' + nbsps + '|</span>');
})
<?php endif; ?>
}
<?php endif; ?>
$(function() {
<?php if ($_SESSION['showverse']=='on'): ?>
$('.verseno').show();
<?php else: ?>
$('.verseno').hide();
<?php endif; ?>
<?php if ($_SESSION['showchap']=='on'): ?>
$('.chapno').show();
<?php else: ?>
$('.chapno').hide();
<?php endif; ?>
<?php if ($_SESSION['showh2']=='on'): ?>
$('h2').show();
$('.paragraph1').css('text-indent','0');
<?php else: ?>
$('h2').hide();
<?php if ($_SESSION['showh2']=='off'): ?>
$('.paragraph1:first-of-type').css('text-indent','0');
<?php endif; ?>
<?php endif; ?>
<?php if ($_SESSION['showfna']=='on'): ?>
$('.refa').show();
<?php else: ?>
$('.refa').hide();
<?php endif; ?>
<?php if ($_SESSION['showfn1']=='on'): ?>
$('.ref1, .explain, .refh').show();
<?php else: ?>
$('.ref1, .explain, .refh').hide();
<?php endif; ?>
<?php if ($_SESSION['oneline']=='on' && !$syntactic_layout): ?>
$('.paragraph').css('display','inline');
$('.poetry').css('display','inline').css('margin-left','0');
$('.verseno').before('<br class="versebreak">');
<?php endif; ?>
<?php if ($_SESSION['linespace']=='on'): ?>
$('.paragraph').css('line-height','2');
$('.poetry').css('line-height','2');
$('.indent').css('line-height','2');
$('.indented-text').css('line-height','2');
<?php endif; ?>
<?php if ($_SESSION['showfna']=='on'): ?>
$('[data-let]').each(function( index ) {
$(this).text("[" + $(this).data('let') + "]");
<?php if ($_SESSION['showfnblock']=='on'): ?>
$('#footnotes').append("<b>" + $(this).data('let') + ":</b> " + $(this).attr('title') + "<br>");
<?php endif; ?>
});
<?php endif; ?>
<?php if ($_SESSION['showfn1']=='on'): ?>
$('[data-num]').each(function( index ) {
$(this).text("[" + $(this).data('num') + "]");
<?php if ($_SESSION['showfnblock']=='on'): ?>
$('#footnotes').append("<b>" + $(this).data('num') + ":</b> " + $(this).attr('title') + "<br>");
<?php endif; ?>
});
<?php endif; ?>
$('[data-toggle="tooltip"]').tooltip({trigger:'hover focus'});
<?php if ($syntactic_layout): ?>
// Find maxindent
$(".indented-text").each(function() {
thisindent = $(this).data("indent");
if (thisindent>maxindent)
maxindent = thisindent
});
pixels_per_space = $('#tenspaces').width()/10;
labelwidth = $('#labelex').width();
<?php if ($_SESSION['indent_type']=='number'): ?>
labelwidth += maxindent*pixels_per_space;
<?php endif; ?>
$(".textline").css('margin-left',labelwidth + 'px')
.css('text-indent',-labelwidth + 'px');
$(".indented-number").css('width',labelwidth + 'px');
$(".indented-number-blank").css('width',labelwidth + 'px');
do_indent();
$(window).resize(do_indent);
<?php endif; ?>
$('#tenspaces').hide();
$('#labelex').hide();
// Handler for Bible references
$('.refh').on('click', function() {
$('#ref-body').html($(this).data('refs'));
$('#ref-dialog').modal('show');
});
// Decloak email addresses
$('.mangemail').each(function() {
email = $(this).html()
.replace(/SNABEL/,'@')
.replace(/PRIK/g,'.')
.replace(/NR13RN/g,'r')
.replace(/NR5RN/g,'e');
$(this).html('<a href="mailto:' + email + '">' + email + '</a>');
});
<?php if ($syntactic_layout && $_SESSION['indent_type']=='text'): ?>
$('#main-container').removeClass('container').addClass('container-fluid');
<?php endif; ?>
});
</script>
<?php
makeheadend();
makemenus(null);
?>
<div id="main-container" class="container">
<div class="row">
<div class="col-lg-9 col-xl-8">
<?php
$formatter = make_formatter($bog, $kap, $fra, $til, $syntactic_layout);
$text = $formatter->to_html();
?>
<div class="card mt-4">
<h1 class="card-header bg-warning split"><span><?= $formatter->title ?></span><span><?= refhebgr($bog,$kap,$fra,$til) ?></span></h1>
<div class="card-body bibletext">
<?= $text ?>
<span id="tenspaces"> </span>
<span id="labelex">|29 </span>
</div>
</div>
</div>
<?php if (isset($chap[$bog])): ?>
<!-- Chapter chooser displayed at right for size lg and xl -->
<div class="d-none d-lg-block col-lg-3 col-xl-4">
<div class="card mt-4">
<h1 class="card-header bg-info text-light">Vælg <?= $chaptype[$bog] ?></h1>
<div class="card-body pl-xl-4 pl-lg-1 pr-0">
<?php pagination($bog,$kap); ?>
</div>
</div>
</div>
<?php endif; ?>
</div>
<?php
$show_note = $_SESSION['showfnblock']=='on'
&& ($_SESSION['showfna']=='on' || $_SESSION['showfn1']=='on')
&& ($formatter->nextnumber>1 || $formatter->nextletter>'a');
?>
<div class="row">
<?php if ($show_note): ?>
<div class="offset-xl-1 col-xl-6
offset-lg-1 col-lg-7
offset-md-2 col-md-8
offset-sm-1 col-sm-10">
<div class="card mt-3">
<h1 class="card-header bg-info text-light">Fodnoter</h1>
<div class="card-body biblenotes">
<small id="footnotes">
</small>
</div>
</div>
</div>
<?php endif; ?>
</div>
<?php if (isset($chap[$bog])): ?>
<!-- Chapter chooser displayed at bottom for size xs, sm, and md -->
<div class="row justify-content-center d-flex d-lg-none">
<div class="col-sm-8 col-md-6">
<div class="card mt-3">
<h1 class="card-header bg-info text-light">Vælg <?= $chaptype[$bog] ?></h1>
<div class="card-body pl-1 pl-sm-3 pr-0">
<?php pagination($bog,$kap); ?>
</div>
</div>
</div>
</div>
<?php endif; ?>
<div class="row">
<div class="offset-xl-2 col-xl-4
offset-lg-2 col-lg-5
offset-md-3 col-md-6
offset-sm-2 col-sm-8">
<div class="card mt-3">
<h1 class="card-header bg-info text-light">Status for dette kapitel</h1>
<div class="card-body biblenotes">
<?php foreach ($formatter->credit as $c): ?>
<small><?= $c ?></small><br>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</div><!--End of container-->
<!-- For debugging window sizes:
<div class="container">
<p class=" d-block d-sm-none ">Window size: XS</p>
<p class="d-none d-sm-block d-md-none ">Window size: SM</p>
<p class="d-none d-md-block d-lg-none ">Window size: MD</p>
<p class="d-none d-lg-block d-xl-none ">Window size: LG</p>
<p class="d-none d-xl-block d-xxl-none">Window size: XL</p>
<p class="d-none d-xxl-block ">Window size: XXL</p>
</div>
-->
<!-- Dialog for displaying Bible reference information -->
<div class="modal fade" id="ref-dialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header justify-content-between">
<div><h4 class="modal-title" id="ref-label">Henvisning</h4></div>
<div><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button></div>
</div>
<div class="modal-body" id="ref-body">
</div>
</div>
</div>
</div>
<?php
endbody();