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
|
const so = ev.target.options[ev.target.selectedIndex];
if( so ){
eIframe.setAttribute('src', so.value || so.innerText);
}
});
/*
Prepend the fossil instance's URL to each link so that this script
works when run from a non-localhost "fossil ui/server" instance.
We _assume_ that this script is run from /uv or /ext, with no
subsequent dirs after /uv or /ext. To run from deeper levels the
following logic needs to be adjusted to guess where the fossil
instance's CGI script is.
*/
let top = (''+window.location).split('/');
top.pop(); // this file name
top.pop(); // parent dir
/* We're hopefully now at the top-most fossil-served
URL. */
top = top.join('/');
for( const o of eSelect.options ){
o.value = top + (o.value || o.innerText);
}
const eBtnPrev = E('#btn-prev');
const eBtnNext = E('#btn-next');
const cycleLink = function(dir){
let n = eSelect.selectedIndex + dir;
|
|
|
|
<
<
|
>
|
>
|
|
>
>
|
|
>
>
>
>
>
|
>
|
|
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
|
const so = ev.target.options[ev.target.selectedIndex];
if( so ){
eIframe.setAttribute('src', so.value || so.innerText);
}
});
/*
Prepend the fossil instance's URL to each link. We have to guess
which part of the URL is the fossil CGI/server instance. The
following works when run (A) from under /uv or /ext and (B) from
/doc/branchname/test/link-tester.html.
*/
let urlTop;
let loc = (''+window.location);
let aLoc = loc.split('/')
aLoc.pop(); /* this file name */
const rxDoc = /.*\/doc\/[^/]+\/.*/;
//console.log(rxDoc, loc, aLoc);
if( loc.match(rxDoc) ){
/* We're hopefully now at the top-most fossil-served
URL. */
aLoc.pop(); aLoc.pop(); /* /doc/foo */
aLoc.pop(); /* current dir name */
}else{
aLoc.pop(); /* current dir name */
}
urlTop = aLoc.join('/');
//console.log(urlTop, aLoc);
for( const o of eSelect.options ){
o.value = urlTop + (o.value || o.innerText);
}
const eBtnPrev = E('#btn-prev');
const eBtnNext = E('#btn-next');
const cycleLink = function(dir){
let n = eSelect.selectedIndex + dir;
|