From f0181813ecf9867f13a206d87fc46b15d295acbc Mon Sep 17 00:00:00 2001 From: dweller Date: Mon, 26 Feb 2024 11:47:32 +0200 Subject: wire up frontend with PHP, badly --- common.php | 8 ++++ index.html | 75 --------------------------------- index.php | 91 ++++++++++++++++++++++++++++++++++++++++ js/copy.js | 32 ++++++++++++++ js/lmmtfy.js | 32 ++++++++++++++ main.php | 0 search.html | 94 ----------------------------------------- search.php | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ style/main.css | 29 ++++++++----- style/man.css | 2 +- style/search.css | 16 +++---- 11 files changed, 315 insertions(+), 188 deletions(-) create mode 100644 common.php delete mode 100644 index.html create mode 100644 index.php create mode 100644 js/copy.js create mode 100644 js/lmmtfy.js delete mode 100644 main.php delete mode 100644 search.html create mode 100644 search.php diff --git a/common.php b/common.php new file mode 100644 index 0000000..b7b588d --- /dev/null +++ b/common.php @@ -0,0 +1,8 @@ + diff --git a/index.html b/index.html deleted file mode 100644 index 561746a..0000000 --- a/index.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - Manup               Lonely MAN near You - - - - - - - - - - -
-
- -
- - - - - -
- - diff --git a/index.php b/index.php new file mode 100644 index 0000000..23e9ccb --- /dev/null +++ b/index.php @@ -0,0 +1,91 @@ + + + + + + + + Manup               Lonely MAN near You + + + + + + + + + + +
+
+ +
+ + + + + +
+ + +'; +?> + diff --git a/js/copy.js b/js/copy.js new file mode 100644 index 0000000..3bc7707 --- /dev/null +++ b/js/copy.js @@ -0,0 +1,32 @@ +const dom_lmmtfy = document.getElementById("lmmtfy_url"); +const dom_copy = document.getElementById("lmmtfy_copy"); + +dom_copy.onclick = lmmtfy_copy; + +function lmmtfy_copy() +{ + dom_lmmtfy.focus(); + dom_lmmtfy.select(); + + try + { + // TODO: deprecated -- https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand + if(document.execCommand('copy')) + dom_copy.innerHTML = "Copied!" + + setTimeout(() => + { + dom_copy.innerHTML = "Copy" + }, 3000); + + } + catch(err) + { + dom_copy.innerHTML = "Error :("; + console.log('Oops, unable to copy'); + } + + // This unfocuses the element, but W3C decided to be funny with + // the naming. + document.activeElement.blur(); +} diff --git a/js/lmmtfy.js b/js/lmmtfy.js new file mode 100644 index 0000000..d0410ab --- /dev/null +++ b/js/lmmtfy.js @@ -0,0 +1,32 @@ +const dom_query = document.getElementById("query"); +const dom_sect = document.getElementById("sect"); +const dom_man = document.getElementById("man"); + +const query = dom_query.value; +dom_query.value = ""; + +let i = 0, j = 0; +let elapsed = 0; +let actions = +[ + [250, () => { dom_query.focus(); }, 1], + [150, () => { dom_query.value += query[j++]; }, query.length], + [250, () => { dom_man.focus(); }, 1], + [250, () => { dom_man.click(); }, 1], +]; + +function do_stuff() +{ + elapsed += 50; + + if((elapsed % actions[i][0]) == 0) + { + actions[i][1](); + actions[i][2]--; + if(actions[i][2] <= 0) i++; + } + + setTimeout(do_stuff, 50); +} + +do_stuff(); diff --git a/main.php b/main.php deleted file mode 100644 index e69de29..0000000 diff --git a/search.html b/search.html deleted file mode 100644 index 37031f3..0000000 --- a/search.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - Manup               Lonely MAN near You - - - - - - - - - - - -
-
- - - -
-
-

Found 14 results

-
-
man (1)
-
an interface to the system reference manuals
-
manconv (1)
-
convert manual page from one encoding to another
-
mandb (8)
-
create or update the manual page index caches
-
mandoc (1)
-
format manual pages
-
mandoc.db (5)
-
manual page database
-
mandoc_char (7)
-
mandoc special characters
-
mandoc_eqn (7)
-
eqn language reference for mandoc
-
mandoc_man (7)
-
legacy formatting language for manual pages
-
mandoc_mdoc (7)
-
semantic markup language for formatting manual pages
-
mandoc_roff (7)
-
roff language reference for mandoc
-
mandoc_tbl (7)
-
tbl language reference for mandoc
-
mandocd (8)
-
server process to format manual pages in batch mode
-
manpath (1)
-
determine search path for manual pages
-
manpath (5)
-
format of the /etc/manpath.config file
-
-
- -
- - diff --git a/search.php b/search.php new file mode 100644 index 0000000..a66fc41 --- /dev/null +++ b/search.php @@ -0,0 +1,124 @@ + + + + + + + + Manup               Lonely MAN near You + + + + + + + + + + + + +
+
+ + + +
+
+
"; + echo "
"; + echo " "; + echo "
+ +
+ + diff --git a/style/main.css b/style/main.css index f373e37..0f76c33 100644 --- a/style/main.css +++ b/style/main.css @@ -190,14 +190,14 @@ a:hover { text-decoration: underline; } font-size: 32pt; } -#gc-let { color: var(--logo-a); font-size: 46pt; } -#gc-me { color: var(--logo-b); } -#gc-man { color: var(--logo-c); font-family: fn-code-logo, monospace; font-size: 30pt; } -#gc-that { color: var(--logo-a); } -#gc-for { color: var(--logo-d); font-size: 38pt; } -#gc-you { color: var(--logo-b); display: inline-block; transform: rotate(-2.5deg); } +#logo-let { color: var(--logo-a); font-size: 46pt; } +#logo-me { color: var(--logo-b); } +#logo-man { color: var(--logo-c); font-family: fn-code-logo, monospace; font-size: 30pt; } +#logo-that { color: var(--logo-a); } +#logo-for { color: var(--logo-d); font-size: 38pt; } +#logo-you { color: var(--logo-b); display: inline-block; transform: rotate(-2.5deg); } -@keyframes verscale +@keyframes logo-ver_scale { 0%, 100% { @@ -211,13 +211,13 @@ a:hover { text-decoration: underline; } } } -#version_wrap +#log-ver_wrap { display: block; min-height: 30pt; } -#version +#logo-ver { display: block; float: right; @@ -227,7 +227,7 @@ a:hover { text-decoration: underline; } color: var(--fg); - animation: verscale 3.5s ease infinite; + animation: logo-ver_scale 3.5s ease infinite; } #search_pane @@ -344,6 +344,15 @@ button:focus, input[type=submit]:focus border: 1px solid var(--abtn-brdf); } +.btn-def +{ + width: 0 !important; + height: 0 !important; + padding: 0 !important; + border: 0 !important; + margin: 0 !important; +} + .hint { color: var(--fg-light); } .center { text-align: center; } diff --git a/style/man.css b/style/man.css index b804d45..ee0cfa9 100644 --- a/style/man.css +++ b/style/man.css @@ -10,7 +10,7 @@ margin-top: 3em; margin-bottom: 1em; - width: min(100% - 3rem, 10in); + width: min(100% - 5rem, 10in); } #lmmtfy diff --git a/style/search.css b/style/search.css index 8412b76..73ed99c 100644 --- a/style/search.css +++ b/style/search.css @@ -14,12 +14,12 @@ #logo { font-size: 1rem; } #logo > h1 { font-size: 1.5rem; } -#gc-let { font-size: 1.25em; } -#gc-me { font-size: 1em; } -#gc-man { font-size: 0.9em; } -#gc-that { font-size: 1em; } -#gc-for { font-size: 1.15em; } -#gc-you { font-size: 1em; } +#logo-let { font-size: 1.25em; } +#logo-me { font-size: 1em; } +#logo-man { font-size: 0.9em; } +#logo-that { font-size: 1em; } +#logo-for { font-size: 1.15em; } +#logo-you { font-size: 1em; } #main { @@ -97,7 +97,7 @@ margin: 3pt 0 0 0; } -@keyframes verscale +@keyframes logo-ver_scale { 0%, 100% { transform: rotate(-10deg); } 50% { transform: rotate( 10deg); } @@ -162,5 +162,5 @@ } #query_wrap { width: min(42rem, 95dvw); } - #version_wrap { min-height: 15pt; } + #logo-ver_wrap { min-height: 15pt; } } -- cgit v1.2.3