forked from makerling/osm_website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewScript.php
224 lines (172 loc) · 6.2 KB
/
viewScript.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
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
<?php
/******************************************************************************/
/* Ottoman Turkish project - script tag to view documents in multiple columns */
/******************************************************************************/
/* Developed by: Steve Bagwell */
/******************************************************************************/
function getLangAbbrevs() {
$langAbbrevs = array (
'Akad.',
'Alm.',
'Ar.',
'Aram.',
'Bulg.',
'Fa.',
'Fra.',
'İbr.', // Ruth 1:6, Allah (1665)
'İbr.', // 1819 Yeni Ahit Resullerin Amali 3:1 heykele
'İng.',
'İng.', // 1819 Yni Ahit Resullerin Amali 16:16 ruhul-hads
'İta.',
'Lat.',
'Mac.',
'Macar.',
'Moğ.', // Mog Apokalipsis 9:9, Ali 1665
'Moğ.', // Mog with decomposed unicode 1857 Yeni Ahit Pavlus'un Filippililere Risalesi 3:14
'Osm.',
'Rum.',
'Skt.',
'Soğ.', // with decomposed unicode (NFD)
'Soğ', // with composed unicode (NFC)
'Soğd.', // with NFC
'Soğd.', // with NFD
'E.Tü.', // Ruth 1:1, avrat (1665)
'E.Tü.', //with NFD
'K.Tü.',
'K.Tü.', // with NFD
'Kz.Tü.', // Ruth 2:21 bay (1665)
'Kz.Tü.', // with NFD
'T.Tü.',
'T.Tü.', // .Tu.with decomposed unicode 1857 Yeni Ahit Pavlus'un Filippililere Risalesi 3:14
'U.Tü.', // Ruth 2:14 etmek (1665)
'U.Tü.', // with NFD
'Y.Tü.',
'Y.Tü.', // with NFD
'Tü.', // Ruth 1:1, avrat (1665)
'E.Yun.',
'Yun.'
);
return $langAbbrevs;
}
function getAbbrevs() { // italicized
$abbrevs = array (
'bk.', // Tevrat 1 1:11 note on tenbit
'karş.', // Tevrat 1 32:18 note on peskes
'mec.', // Tevrat 1 24:48 note on tebarek
'(mec)', // Tevrat 1 2:25 not on hicab
);
return $abbrevs;
}
function getJsArray($jsName, $items) {
$jsItems = " " . $jsName . " = [
";
foreach ($items as $nextItem) {
$jsItems .= "'" . $nextItem . "',
";
}
$jsItems .= "
]
";
return $jsItems;
}
function getSetAnnotationsText(
$styleTop="'2px'",
$styleLeft="'2px'"
) {
$jsAbbrevs = getJsArray('abbrevs', getAbbrevs());
$jsLangAbbrevs = getJsArray('langAbbrevs', getLangAbbrevs());
$jsSetAnnotations = "
lastNotation = '';
// Abbreviations that get italicized
" . $jsAbbrevs . "
// Language abbreviations that need to get a special style
// Special characters are hard to deal with in vim, so separate them out.
" . $jsLangAbbrevs . "
// Wrap a string (e.g. mec.) in a span with a class to make italicized
// function replaceLangAbbrLite(origString, replString) {
function replaceAbbrev(origString, replString) {
spanClass = 'langAbbrLite';
outString = origString;
newReplString = '<span class=\"' + spanClass + '\">' + replString + '</span>';
outString = outString.replace(replString, newReplString);
return outString;
}
// Remove periods from a substring (e.g. Ar.) and wrap in a span with a class
// to make it bold and italicized
function replaceLangAbbrev(origString, replString) {
spanClass = 'langAbbreviation';
outString = origString;
while (outString.indexOf(replString) >= 0 ) {
// Start building the new replacement string
newReplString = replString;
// Remove the one or two periods
newReplString = newReplString.replace('.', '');
newReplString = newReplString.replace('.', '');
// Wrap the replacement string in a span
newReplString = '<span class=\"' + spanClass + '\">' + newReplString + '</span>';
outString = outString.replace(replString, newReplString);
}
return outString;
}
function setAnnotations(key) {
var a = annotations[key].split('^');
var annDef = a[1];
// Give the abbreviations and language abbreviations a different style via wrapping in a span
for (index = 0; index < abbrevs.length; index++) {
annDef = replaceAbbrev(annDef, abbrevs[index]);
}
for (index = 0; index < langAbbrevs.length; index++) {
annDef = replaceLangAbbrev(annDef, langAbbrevs[index]);
}
document.getElementById(\"viewAnnotations\").innerHTML = '<b>' + a[0] + '</b> : ' + annDef;
var links = a[2].split('\t');
for (i =0; i < links.length; i++)
{
if (links[i].search('http')) {
document.getElementById(\"viewAnnotations\").innerHTML += '<p />' + links[i];
} else {
if (i == 0) {
document.getElementById(\"viewAnnotations\").innerHTML += '<p />';
} else {
document.getElementById(\"viewAnnotations\").innerHTML += '<br>';
}
document.getElementById(\"viewAnnotations\").innerHTML += '<a href=\"' + links[i]+ '\" target=\"_blank\">' + links[i]+ '</a>';
}
}
document.getElementById(\"viewAnnotationsDiv\").style.visibility='visible';
document.getElementById(\"viewAnnotationsDiv\").style.top = " . $styleTop . ";
document.getElementById(\"viewAnnotationsDiv\").style.left = " . $styleLeft . ";
}
";
return $jsSetAnnotations;
}
$jsScrollFunctions = "
function scroll2Chapter(chapterSelect) {
id = chapterSelect.value;
element = document.getElementById(id);
element.scrollIntoView(true); // true => align with top
}
";
$showColumn = "
function showColumn(colNum, iso, st, addLabel) {
element = document.getElementById('column' + colNum);
element.innerHTML = \"<iframe src='viewColumns.php?iso=\" + iso + \"&st=\" + st + \"' width=100%; height=100%;></iframe>\";
if (colNum == 3) {
col4 = document.getElementById('column4');
col4.innerHTML = \"<input type='button' id='show_column4' value='\" + addLabel + \"' " .
"onclick='showColumn(4, '\" + iso + \"')'>\";
}
}
";
$jsAnnotationsOff = "
var bodyClickCount = 0;
function annotationsOff()
{
bodyClickCount += 1;
// The click on a link is counted as the first click. So, ignore that one.
if (bodyClickCount>1) {
document.getElementById('viewAnnotationsDiv').style.visibility='hidden';
bodyClickCount = 0;
}
}
";