Fossil SCM
Initial draft of a "manual link tester" page. TODO is loading the list of link from a JSON file. Instructions are at the top of link-tester.html.
Commit
3eef0e230dfbe986a382887a74f121762d5caeb8f0713f749d684f71e01e4754
Parent
15b0110ac529133…
2 files changed
+61
+38
+61
| --- a/test/link-tester.html | ||
| +++ b/test/link-tester.html | ||
| @@ -0,0 +1,61 @@ | ||
| 1 | +<!DOCTYPE html> | |
| 2 | +<head><!-- | |
| 3 | + This file is intended to be loaded from a fossil | |
| 4 | + repository, either using: | |
| 5 | + | |
| 6 | + fossil ui --extpage test/link-tester.html | |
| 7 | + | |
| 8 | + or by adding test/link-tester.* to uv and then: | |
| 9 | + | |
| 10 | + fossil ui -page uv/link-tester.html | |
| 11 | +--></head> | |
| 12 | +<style> | |
| 13 | + body { | |
| 14 | + width: 100%; | |
| 15 | + height: 100%; | |
| 16 | + margin: 0; | |
| 17 | + padding: 0; | |
| 18 | + display: flex; | |
| 19 | + flex-direction: column; | |
| 20 | + } | |
| 21 | + hea.25em 0 0.25em; | |
| 22 | + padding: 0 padding-bottom: 0.: 1; | |
| 23 | + } | |
| 24 | + #controls.: 1; | |
| 25 | + } | |
| 26 | + #controlWrapper { | |
| 27 | + margin: 0;0; | |
| 28 | + borderwhite /*do non't bleed iframe through */; | |
| 29 | + } | |
| 30 | + #controls > button { | |
| 31 | + flex-grow: 1; | |
| 32 | + margin: 0.5em; | |
| 33 | + } | |
| 34 | + #selectPage { | |
| 35 | + flex-grow: 8padding: 1em; | |
| 36 | + } | |
| 37 | + #; border: none; margin: 0; padding: 0; | |
| 38 | + display: block; | |
| 39 | + /* Absolute positioning is apparently the only way to get | |
| 40 | + the iframe to stretch to fill the page, but we have to | |
| 41 | + set its Y coordinate to something a bit below #controls. */ | |
| 42 | + width: 100%; | |
| 43 | + height: calc(100% - 5em); | |
| 44 | + position: absolute; | |
| 45 | + top: 4em; | |
| 46 | + } | |
| 47 | +</style> | |
| 48 | +<body> | |
| 49 | + <header> | |
| 50 | + Fossil link test app. Select links from the list below to load | |
| 51 | + them. Use the arrow keys to cycle through the list. The links are | |
| 52 | + loaded withinfossil | |
| 53 | + instance is run within an ifra | |
| 54 | + will stay within that frame. | |
| 55 | + </header> | |
| 56 | + <header id='controlWrapper'>divdiv id='conts'> | |
| 57 | +elect id='selectPag> | |
| 58 | + <a target=' This file <a target=' This file is int<!DO</button> | |
| 59 | + </div> | |
| 60 | + </h</select> | |
| 61 | +</div |
| --- a/test/link-tester.html | |
| +++ b/test/link-tester.html | |
| @@ -0,0 +1,61 @@ | |
| --- a/test/link-tester.html | |
| +++ b/test/link-tester.html | |
| @@ -0,0 +1,61 @@ | |
| 1 | <!DOCTYPE html> |
| 2 | <head><!-- |
| 3 | This file is intended to be loaded from a fossil |
| 4 | repository, either using: |
| 5 | |
| 6 | fossil ui --extpage test/link-tester.html |
| 7 | |
| 8 | or by adding test/link-tester.* to uv and then: |
| 9 | |
| 10 | fossil ui -page uv/link-tester.html |
| 11 | --></head> |
| 12 | <style> |
| 13 | body { |
| 14 | width: 100%; |
| 15 | height: 100%; |
| 16 | margin: 0; |
| 17 | padding: 0; |
| 18 | display: flex; |
| 19 | flex-direction: column; |
| 20 | } |
| 21 | hea.25em 0 0.25em; |
| 22 | padding: 0 padding-bottom: 0.: 1; |
| 23 | } |
| 24 | #controls.: 1; |
| 25 | } |
| 26 | #controlWrapper { |
| 27 | margin: 0;0; |
| 28 | borderwhite /*do non't bleed iframe through */; |
| 29 | } |
| 30 | #controls > button { |
| 31 | flex-grow: 1; |
| 32 | margin: 0.5em; |
| 33 | } |
| 34 | #selectPage { |
| 35 | flex-grow: 8padding: 1em; |
| 36 | } |
| 37 | #; border: none; margin: 0; padding: 0; |
| 38 | display: block; |
| 39 | /* Absolute positioning is apparently the only way to get |
| 40 | the iframe to stretch to fill the page, but we have to |
| 41 | set its Y coordinate to something a bit below #controls. */ |
| 42 | width: 100%; |
| 43 | height: calc(100% - 5em); |
| 44 | position: absolute; |
| 45 | top: 4em; |
| 46 | } |
| 47 | </style> |
| 48 | <body> |
| 49 | <header> |
| 50 | Fossil link test app. Select links from the list below to load |
| 51 | them. Use the arrow keys to cycle through the list. The links are |
| 52 | loaded withinfossil |
| 53 | instance is run within an ifra |
| 54 | will stay within that frame. |
| 55 | </header> |
| 56 | <header id='controlWrapper'>divdiv id='conts'> |
| 57 | elect id='selectPag> |
| 58 | <a target=' This file <a target=' This file is int<!DO</button> |
| 59 | </div> |
| 60 | </h</select> |
| 61 | </div |
+38
| --- a/test/link-tester.js | ||
| +++ b/test/link-tester.js | ||
| @@ -0,0 +1,38 @@ | ||
| 1 | +/** | |
| 2 | + JS code for link-tester.html. We cannot host this JS inline in that | |
| 3 | + file because fossil's default Content Security Policy won't let it | |
| 4 | + run that way. | |
| 5 | +*/ | |
| 6 | +window.addEventListener("DOMContentLoaded", function(){ | |
| 7 | + const E = function(s){ | |
| 8 | + const e = document.querySelector(s); | |
| 9 | + if( !e ) throw new Error("Missing element: "+s); | |
| 10 | + return e; | |
| 11 | + }; | |
| 12 | + const EAll = function(s){ | |
| 13 | + const e = document.querySelectorAll(s); | |
| 14 | + if( !e || !e.length ) throw new Error("Missing elements: "+s); | |
| 15 | + return e; | |
| 16 | + }; | |
| 17 | + const eIframe = E('#iframe'); | |
| 18 | + const eSelect = E('#selectPage'); | |
| 19 | + } | |
| 20 | + }urrentUrl = E('#currentUrl'); | |
| 21 | + | |
| 22 | + /* | |
| 23 | + Prepend the fossil instance's URL to each link. We have to guess | |
| 24 | + which part of the URL is the fossil CGI/server instance. The | |
| 25 | + following works when run (A) from under /uv or /ext and (B) from | |
| 26 | + / so that this script | |
| 27 | + '+window.locatiofrom a non-localhost "fossil ui/server" instance. | |
| 28 | + We _assume_ that this script is run from /uv or /ext, with no | |
| 29 | + subsequent dirs after /uv or /ext. To run from deeper levels the | |
| 30 | + following logic needs to be adjusted to guess where the fossil | |
| 31 | + instance's CGI script is. | |
| 32 | + */ | |
| 33 | + let top = (''+window.location).split('/'); | |
| 34 | + top.pop(); // this file name | |
| 35 | + top.pop(); // parent dir | |
| 36 | +p, a time the window size | |
| 37 | + e =URL. */ | |
| 38 | + top = top.join('/'t |
| --- a/test/link-tester.js | |
| +++ b/test/link-tester.js | |
| @@ -0,0 +1,38 @@ | |
| --- a/test/link-tester.js | |
| +++ b/test/link-tester.js | |
| @@ -0,0 +1,38 @@ | |
| 1 | /** |
| 2 | JS code for link-tester.html. We cannot host this JS inline in that |
| 3 | file because fossil's default Content Security Policy won't let it |
| 4 | run that way. |
| 5 | */ |
| 6 | window.addEventListener("DOMContentLoaded", function(){ |
| 7 | const E = function(s){ |
| 8 | const e = document.querySelector(s); |
| 9 | if( !e ) throw new Error("Missing element: "+s); |
| 10 | return e; |
| 11 | }; |
| 12 | const EAll = function(s){ |
| 13 | const e = document.querySelectorAll(s); |
| 14 | if( !e || !e.length ) throw new Error("Missing elements: "+s); |
| 15 | return e; |
| 16 | }; |
| 17 | const eIframe = E('#iframe'); |
| 18 | const eSelect = E('#selectPage'); |
| 19 | } |
| 20 | }urrentUrl = E('#currentUrl'); |
| 21 | |
| 22 | /* |
| 23 | Prepend the fossil instance's URL to each link. We have to guess |
| 24 | which part of the URL is the fossil CGI/server instance. The |
| 25 | following works when run (A) from under /uv or /ext and (B) from |
| 26 | / so that this script |
| 27 | '+window.locatiofrom a non-localhost "fossil ui/server" instance. |
| 28 | We _assume_ that this script is run from /uv or /ext, with no |
| 29 | subsequent dirs after /uv or /ext. To run from deeper levels the |
| 30 | following logic needs to be adjusted to guess where the fossil |
| 31 | instance's CGI script is. |
| 32 | */ |
| 33 | let top = (''+window.location).split('/'); |
| 34 | top.pop(); // this file name |
| 35 | top.pop(); // parent dir |
| 36 | p, a time the window size |
| 37 | e =URL. */ |
| 38 | top = top.join('/'t |