From 12d4141400d05e4749a95bb169e73544c0048439 Mon Sep 17 00:00:00 2001 From: Malte Bublitz Date: Sun, 8 May 2022 05:50:18 +0200 Subject: [PATCH] Git-Import --- config.inc.php | 28 ++++++++ favicon.png | Bin 0 -> 5059 bytes index.php | 62 ++++++++++++++++ main.js | 139 ++++++++++++++++++++++++++++++++++++ mini/greeting.js | 73 +++++++++++++++++++ mini/index.html | 55 +++++++++++++++ mini/style.css | 154 ++++++++++++++++++++++++++++++++++++++++ old/config.inc.php | 29 ++++++++ old/index.php | 58 +++++++++++++++ old/main.js | 103 +++++++++++++++++++++++++++ old/style.css | 93 ++++++++++++++++++++++++ old/template.inc.php | 90 ++++++++++++++++++++++++ style.css | 164 +++++++++++++++++++++++++++++++++++++++++++ template.inc.php | 134 +++++++++++++++++++++++++++++++++++ tty/index.php | 65 +++++++++++++++++ 15 files changed, 1247 insertions(+) create mode 100644 config.inc.php create mode 100644 favicon.png create mode 100644 index.php create mode 100644 main.js create mode 100644 mini/greeting.js create mode 100644 mini/index.html create mode 100644 mini/style.css create mode 100644 old/config.inc.php create mode 100644 old/index.php create mode 100644 old/main.js create mode 100644 old/style.css create mode 100644 old/template.inc.php create mode 100644 style.css create mode 100644 template.inc.php create mode 100644 tty/index.php diff --git a/config.inc.php b/config.inc.php new file mode 100644 index 0000000..8ad490b --- /dev/null +++ b/config.inc.php @@ -0,0 +1,28 @@ + diff --git a/favicon.png b/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..252f056fea6974cdde9647233f4d0074584768b7 GIT binary patch literal 5059 zcmV;!6FlsRP)004R>004l5008;`004mK004C`008P>0026e000+ooVrmw00006 zVoOIv0RI600RN!9r;`8x00(qQO+^Rd1rZYmEY##kt^fcM$4Nv%RCwCmn^}w;$9=|s z|GuVYX77W?^1iPnMT(M48VqeqieUz{WjirISchfDvE{@8Bs;R;*p49C3ZTe$HAH@( zwN^wV@!&1)oB1mS->%_l+c3VgaplV9t?Sm|8U`)4je_h{x%_UWbs+HHKq$b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9neP14X>@g<{ z!+8g~(FKEOxhOL-GSa+y^=h+`0+iC#j?FQFtNE}73P?&apP#QRCR(ITpj<9nKnsyG zEYlz_s3$;T@HxOOl}fopC38(6@&{rpWCHVdv>wpSSV&Fxu~MlRKt2YZ%%N)>V?6-| z(I$xlWPIPxYORg>W$qdim?s4m=1Y)flczM0n+ZNqfbaVTkd1MLL`n#l-9v3ifEicI z_kGb?s~`xlEQ@S5TYZu1y7A(rIsas+5iv5mbCm2CUMmS#yVtTTip3&f7~=bWkiwJH znvT{JkmMH%&;tVl6O~Hk?3puX*0!{?kjZ4KFD@2~R4Nt9#xJ0(&0-0^w zwk=(|cI^hkFkG#*B%v`)#I<(vRusc96rje($1fc{dbBSHf*GI!%*3^_7y=*_3ge>{ z6Jw<6Z(<3Vm3*RRF9zOlYP`_URUKj-0k`}Im)B7=v%k4W2neYC9mbq;E!ve-{Y_PX zf|~C|ELi>*RB&@`Q&b(f0000bbVXQnWMOn=I%9HWVRU5xGB7bXEigANGBs2(GdeOk zIx;saFfuwYF!DEaMF0Q*C3HntbYx+4WjbwdWNBu305UK!I4v+WEipG#F*iCeH##&l ZD=;!TFfcA2Vafmi002ovPDHLkV1fg}hB*KL literal 0 HcmV?d00001 diff --git a/index.php b/index.php new file mode 100644 index 0000000..07a23c7 --- /dev/null +++ b/index.php @@ -0,0 +1,62 @@ += 2) { + $lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2); +} else { + $lang = "en"; +} + +$Data = Array( + "Meta" => Array( + "Lang" => "en", + "Charset" => "UTF-8", + //"Title" => "Homepage @ ".$host, + "Title" => "Homepage", + "Author" => "malte70@".$host, + "Stylesheet" => "style.css", + //"Icon" => "https://xyz.malte70.de/img/icons_tango/go-home-512.png", + "Icon" => "favicon.png", + ), + "Links" => NULL, + "Notepad" => true, + "WhoAmI" => "john_doe@pc", + "JS" => true, + "Search" => "Google", // Google/searX + "Footer" => Array( + "CopyrightYear" => date("Y"), + "AuthorName" => "malte70", + "AuthorURL" => "https://malte70.de/" + ) +); + +$Data["Links"] = Array(); +foreach ($Links as $Links_Row) { + $L_row = Array(); + foreach ($Links_Row as $L_Link) { + $L_row[] = Array( + "Title" => $L_Link[0], + "URL" => $L_Link[1] + ); + } + $Data["Links"][] = $L_row; +} + +/** + * Modify $Data if Accept-Language is German + */ +if ($lang == "de") { + $Data["Meta"]["Lang"] = "de"; + $Data["Meta"]["Title"] = "Startseite"; +} + + +require_once("template.inc.php"); + +?> diff --git a/main.js b/main.js new file mode 100644 index 0000000..e7aced2 --- /dev/null +++ b/main.js @@ -0,0 +1,139 @@ +window.whoami = { + init: function() { + console.log("whoami.init()"); + if (!this.section) { + this.section = document.getElementById("whoami") + } + + this.whoami_user = localStorage.getItem("whoami_user"); + this.whoami_host = localStorage.getItem("whoami_host"); + this.whoami_format = localStorage.getItem("whoami_format"); + + if (!this.whoami_user) { + console.log("Asking for username"); + this.whoami_user = prompt("Your user name", "malte70"); + if (this.whoami_user === null) + this.whoami_user = "malte70"; + } + if (!this.whoami_host) { + console.log("Asking for hostname"); + this.whoami_host = prompt("Hostname", "localhost"); + if (this.whoami_host === null) + this.whoami_host = "pc"; + } + if (!this.whoami_format) { + console.log("Asking for format"); + this.whoami_format = prompt("Format (unix|windows)", "unix"); + if (this.whoami_format === null) + this.whoami_format = "windows"; + } + + /*var urlParams = new URLSearchParams(window.location.search); + if (!urlParams.has('user')) { + this.whoami_user = null; + } else { + this.whoami_user = urlParams.get('user'); + this.whoami_host = "PLUTO"; + }*/ + + }, + deinit: function() { + localStorage.removeItem("whoami_user"); + localStorage.removeItem("whoami_host"); + localStorage.removeItem("whoami_format"); + }, + settings: function() { + console.log("whoami.settings()"); + this.whoami_user = prompt("Your user name", localStorage.getItem("whoami_user")); + this.whoami_host = prompt("Hostname", localStorage.getItem("whoami_host")); + this.whoami_format = prompt("Format (unix|windows)", localStorage.getItem("whoami_format")); + + if (this.whoami_user === null) + this.whoami_user = "malte70"; + if (this.whoami_host === null) { + if (localStorage.getItem("whoami_host") !== null) { + this.whoami_host = localStorage.getItem("whoami_host"); + } else { + this.whoami_host = "pc"; + } + } + if (this.whoami_format === null) + this.whoami_format = "windows"; + + console.table( + [ + ["whoami_user", this.whoami_user], + ["whoami_host", this.whoami_host], + ["whoami_format", this.whoami_format], + ] + ); + + this.update(); + }, + update: function() { + // Update localstorage + localStorage.setItem("whoami_user", this.whoami_user); + localStorage.setItem("whoami_host", this.whoami_host); + localStorage.setItem("whoami_format", this.whoami_format); + + if (this.whoami_format.toLowerCase() == "windows") { + if (this.whoami_user == "root" || this.whoami_user == "admin") + this.whoami_user = "Administrator"; + + if (this.whoami_host == this.whoami_host.toLowerCase() && this.whoami_host != "localhost") + this.whoami_host = this.whoami_host.toUpperCase() + + // strip domain from fqdn + this.whoami_host = this.whoami_host.substr( + 0, + this.whoami_host.indexOf(".") + ); + user_login = '\\\\' + + this.whoami_host + + '\\' + + this.whoami_user; + + } else { + user_login = this.whoami_user + + '@' + + this.whoami_host; + + } + + this.section.innerHTML = '

'+user_login+'

'; + }, +}; +window.notepad = function(selector, storageKey) { + //console.log("window.notepad(\""+selector+"\", \""+storageKey+"\")") + + elem = document.querySelector(selector); + if (localStorage.getItem(storageKey) !== null) { + console.log("window.notepad(): Loading from LocalStorage") + elem.innerHTML = localStorage.getItem("notepad"); + } + elem.addEventListener("focusout", function() { + console.log("window.notepad(): Focus lost. Storing on LocalStorage"); + localStorage.setItem(storageKey, document.querySelector(selector).innerHTML); + }); + //document.querySelector(selector).onclick = function() { + // localStorage.setItem(storageKey, document.querySelector(selector).innerHTML); + //}; +}; +window.onload = function() { + window.whoami.init(); + window.whoami.update(); + + document.querySelector( + "button#settings" + ).onclick = function() { + window.whoami.settings(); + //window.whoami.update(); + }; + + window.notepad("#notepadContent", "notepad"); + + /** + * Hide footer + */ + //document.getElementsByTagName("footer")[0].remove() +}; diff --git a/mini/greeting.js b/mini/greeting.js new file mode 100644 index 0000000..93fb2ce --- /dev/null +++ b/mini/greeting.js @@ -0,0 +1,73 @@ +var greeting = { + config: { + storageKey: "greeting", + greetingSelector: "header h1" + }, + // current greeting + text: "", + + /** + * Initialize greeting.js + */ + init: function(greetingSelector = null, storageKey = null){ + if (greetingSelector !== null) { + greeting.config.greetingSelector = greetingSelector; + } + if (storageKey !== null) { + greeting.config.storageKey = storageKey; + } + + // Read storage + greeting.readStorage(); + + // Update/set greeting element's content + greeting.update(); + }, + + /** + * Get the HTMLElement matching config.greetingSelector + */ + getElem: function() { + return document.querySelector(greeting.config.greetingSelector); + }, + + /** + * Set greeting.text to the value in localStorage. + * If the storage entry did not exist, default to getElem()'s + * innerText + */ + readStorage: function(){ + greeting.text = localStorage.getItem(greeting.config.storageKey); + if (greeting.text == null) { + // No greeting stored until now + greeting.text = greeting.getElem().innerText; + if (greeting.text.length < 1) { + greeting.text = "hello"; + } + } + }, + + /** + * Set a new greeting + */ + set: function(newGreeting){ + if (newGreeting.length < 1) + return false; + + greeting.text = newGreeting; + //localStorage.setItem(greeting.config.storageKey, greeting.text); + greeting.update(); + }, + + /** + * Update the greeting HTML element by setting it + * to greeting.text, and store it in localStorage + */ + update: function(){ + greeting.getElem().innerText = greeting.text; + localStorage.setItem( + greeting.config.storageKey, + greeting.text + ); + }, +}; diff --git a/mini/index.html b/mini/index.html new file mode 100644 index 0000000..3c720aa --- /dev/null +++ b/mini/index.html @@ -0,0 +1,55 @@ + + + + + + + + Startseite + + + + + + +
+

hello world

+
+
+ +
+ + + + + diff --git a/mini/style.css b/mini/style.css new file mode 100644 index 0000000..5ff6c8d --- /dev/null +++ b/mini/style.css @@ -0,0 +1,154 @@ +@charset "UTF-8"; + +/** + * Startseite für malte70@pluto + * + * + * + * Farbpalette: + * Vintage Modern + * Hintergrund: + * Verner Panton // #F2C45A // rgb(242,196,90) + * Highlight: + * Eames // #8C2318 // rgb(140,35,24) + * Text: + * Knoll // #5E8C6A // rgb(94,140,106) + * + * EDIT 2021-05-22: + * Es werden die Farben von tiny[1] verwendet, da sie + * nicht so unangenehm grell sind. + * + * [1]: https://dev.malte70.de/webdesigns/Startseiten/tiny/ + */ + +@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,200;0,400;1,400&display=swap'); + +/** + * @url https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties + */ +:root { + --color-background: #eee; + --color-foreground: #888; + --color-highlight: #ff8000; +} + +body { + background: var(--color-background); + color: var(--color-foreground); + font: 18px 'Source Sans Pro', sans-serif; +} + +/* =============== Page Header =============== */ +header { + margin-top: 3.5em; + text-align: center; +} +header h1 { + font-size: 3em; + font-weight: 200; + color: var(--color-highlight); +} + +/* =============== Main Area :: Search Widget =============== */ +main { + margin-top: 3.25em; + text-align: center; +} +main #search { + width: 25em; + margin: 0.5em auto; + padding: 0; +} +main #search input[type=text], +main #search input[type=search] { + display: inline-block; + border: 1px solid var(--color-highlight); + /*border-right: 0;*/ + background: var(--color-background); + margin: 0; + margin-right: -5px; + padding: 6px 5px; + width: 70%; + /*font: 16px "Source Sans Pro",sans-serif;*/ + font: 0.8em "Inconsolata-g"; +/* +} +main #search input[type=text]::placeholder, +main #search input[type=text]::-moz-placeholder, +main #search input[type=search]::placeholder, +main #search input[type=search]::-moz-placeholder {*/ + /*color: rgb(136,166,94);*/ + font-style: italic; + text-align: center; +} + +main #search input[type=text]:active, +main #search input[type=text]:focus, +main #search input[type=search]:active, +main #search input[type=search]:focus { + border-color: var(--color-highlight); + font-style: normal; +} +main #search button[type=submit] { + display: inline-block; + border: 1px solid var(--color-highlight); + background: var(--color-highlight); + color: var(--color-background); + margin: .5em 0; + padding: 5px; + width: 27%; + font: 16px "Source Sans Pro",sans-serif; + display: none; +} +main #search button[type=submit]:hover, +main #search button[type=submit]:active { + cursor: pointer; + background: none; + color: var(--color-foreground); +} + +/* =============== Main Area :: Link Section =============== */ +main #links { + display: none; +} +main #links ul { + list-style: none; + padding: 0; +} +main #links ul li { + display: inline-block; + padding: 0; + margin: 0; +} +main #links a:link, main #links a:visited { + width: 7em; + display: inline-block; + padding: 1.2em; + font-size: 1.2em; + text-decoration: none; + color: #2ecc71; + border: .17em solid #2ecc71; + margin: .6em; + margin-bottom: 0; +} +main #links a:hover, main #links a:active { + color: #ecf0f1; + background: #2ecc71; +} + +/* =============== Footer =============== */ +footer { + position: absolute; + bottom: .3em; + right: .3em; + left: 0; + width: 100%; + text-align: right; + font: .7em Consolas, 'Inconsolata-g', monospace; +} +footer a:link, footer a:visited { + color: #111111; +} +footer a:hover, footer a:active { + color: #2ecc71; +} diff --git a/old/config.inc.php b/old/config.inc.php new file mode 100644 index 0000000..36c3808 --- /dev/null +++ b/old/config.inc.php @@ -0,0 +1,29 @@ + diff --git a/old/index.php b/old/index.php new file mode 100644 index 0000000..5168736 --- /dev/null +++ b/old/index.php @@ -0,0 +1,58 @@ += 2) { + $lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2); +} else { + $lang = "en"; +} + +$Data = Array( + "Meta" => Array( + "Lang" => "en", + "Charset" => "UTF-8", + //"Title" => "Homepage @ ".$host, + "Title" => "Homepage", + "Author" => "malte70@".$host, + "Stylesheet" => "style.css", + //"Icon" => "https://xyz.malte70.de/img/icons_tango/go-home-512.png", + "Icon" => "favicon.png", + ), + "Links" => NULL, + "Footer" => Array( + "CopyrightYear" => date("Y"), + "AuthorName" => "malte70", + "AuthorURL" => "https://malte70.de/" + ) +); + +$Data["Links"] = Array(); +foreach ($Links as $Links_Row) { + $L_row = Array(); + foreach ($Links_Row as $L_Link) { + $L_row[] = Array( + "Title" => $L_Link[0], + "URL" => $L_Link[1] + ); + } + $Data["Links"][] = $L_row; +} + +/** + * Modify $Data if Accept-Language is German + */ +if ($lang == "de") { + $Data["Meta"]["Lang"] = "de"; + $Data["Meta"]["Title"] = "Startseite"; +} + + +require_once("template.inc.php"); + +?> diff --git a/old/main.js b/old/main.js new file mode 100644 index 0000000..0043c65 --- /dev/null +++ b/old/main.js @@ -0,0 +1,103 @@ +window.whoami = { + init: function() { + console.log("whoami.init()"); + if (!this.section) { + this.section = document.getElementById("whoami") + } + + this.whoami_user = localStorage.getItem("whoami_user"); + this.whoami_host = localStorage.getItem("whoami_host"); + this.whoami_format = localStorage.getItem("whoami_format"); + + if (!this.whoami_user) { + console.log("Asking for username"); + this.whoami_user = prompt("Your user name", "malte70"); + } + if (!this.whoami_host) { + console.log("Asking for hostname"); + this.whoami_host = prompt("Hostname", "localhost"); + } + if (!this.whoami_format) { + console.log("Asking for format"); + this.whoami_format = prompt("Format (unix|windows)", "unix"); + } + + /*var urlParams = new URLSearchParams(window.location.search); + if (!urlParams.has('user')) { + this.whoami_user = null; + } else { + this.whoami_user = urlParams.get('user'); + this.whoami_host = "PLUTO"; + }*/ + + }, + deinit: function() { + localStorage.removeItem("whoami_user"); + localStorage.removeItem("whoami_host"); + localStorage.removeItem("whoami_format"); + }, + settings: function() { + console.log("whoami.settings()"); + this.whoami_user = prompt("Your user name", localStorage.getItem("whoami_user")); + this.whoami_host = prompt("Hostname", localStorage.getItem("whoami_host")); + this.whoami_format = prompt("Format (unix|windows)", localStorage.getItem("whoami_format")); + + console.table( + [ + ["whoami_user", this.whoami_user], + ["whoami_host", this.whoami_host], + ["whoami_format", this.whoami_format], + ] + ); + + this.update(); + }, + update: function() { + // Update localstorage + localStorage.setItem("whoami_user", this.whoami_user); + localStorage.setItem("whoami_host", this.whoami_host); + localStorage.setItem("whoami_format", this.whoami_format); + + if (this.whoami_format.toLowerCase() == "windows") { + if (this.whoami_user == "root" || this.whoami_user == "admin") + this.whoami_user = "Administrator"; + + if (this.whoami_host == this.whoami_host.toLowerCase() && this.whoami_host != "localhost") + this.whoami_host = this.whoami_host.toUpperCase() + + // strip domain from fqdn + this.whoami_host = this.whoami_host.substr( + 0, + this.whoami_host.indexOf(".") + ); + user_login = '\\\\' + + this.whoami_host + + '\\' + + this.whoami_user; + + } else { + user_login = this.whoami_user + + '@' + + this.whoami_host; + + } + + this.section.innerHTML = '

'+user_login+'

'; + }, +}; +window.onload = function() { + window.whoami.init(); + window.whoami.update(); + + document.querySelector( + "button#settings" + ).onclick = function() { + window.whoami.settings(); + //window.whoami.update(); + }; + + /** + * Hide footer + */ + //document.getElementsByTagName("footer")[0].remove() +}; diff --git a/old/style.css b/old/style.css new file mode 100644 index 0000000..13f40a3 --- /dev/null +++ b/old/style.css @@ -0,0 +1,93 @@ +@charset "UTF-8"; + +body { + background: #eee; + font: 26px "Source Code Pro", monospace; +} +main { + width: 30em; + margin: 3em auto 1em; + color: #444; + + /* ALT: zentriert + text-align: center; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + width: 600px; + height: 350px; + margin: 100px auto;*/ +} +a:link, a:visited { + color: #888; + text-decoration: none; +} +a:hover, a:active { + color: #444; +} +.red { + color: #ff8000; +} + +/** + * WhoAmI / User name + */ +#whoami p { + text-align: center; + margin-bottom: 1.5em; + /*font-size: 1.3em;*/ +} + +/** + * Google Search + */ +#google-search p * { + display: inline-block; +} +#google-search input[type=text] { + font: 1em "Source Code Pro", monospace; + display: inline-block; + padding: 6px; + background: #eee; + color: #888; + border: 0; + border-bottom: 2px solid #888; +} +/*#google-search input[type=text]:active { + color: #ff8000; +}*/ +#google-search input[type=text]:focus { + outline: 0; + /*border-bottom-color: #ff8000;*/ +} +#google-search input[type=text]:hover { + border-bottom-color: #ff8000; +} + +/** + * Footer + */ +footer { + position: absolute; + right: 0; + bottom: 0; + margin: 7px; + padding: 0; + text-align: right; +} +footer p { + margin: 0; + padding: 0; + font-size: 0.6em; + color: #444; +} +footer p a:link, footer p a:visited { + color: #444; + text-decoration: underline; +} +footer p a:hover, footer p a:active { + color: #888; +} + diff --git a/old/template.inc.php b/old/template.inc.php new file mode 100644 index 0000000..5d9f57e --- /dev/null +++ b/old/template.inc.php @@ -0,0 +1,90 @@ + +"> + + "> + + + + <?=$Data["Meta"]["Title"]?> + + "> + "> + " sizes="64x64"> + + + +
+
+ + + + +
+ + + + + + diff --git a/style.css b/style.css new file mode 100644 index 0000000..96f3602 --- /dev/null +++ b/style.css @@ -0,0 +1,164 @@ +@charset "UTF-8"; +/** + * startseite.malte70.de + * + * Farben + * #eee Hellgrau + * #888 Grau + * #444 Dunkelgrau + * #ff8000 Orange + */ + +body { + background: #eee; + font: 26px "Source Code Pro", monospace; +} +main { + /*width: 30em;*/ + width: 40em; + margin: 3em auto 1em; + color: #444; + + /* ALT: zentriert + text-align: center; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + width: 600px; + height: 350px; + margin: 100px auto;*/ +} +a:link, a:visited { + color: #888; + text-decoration: none; +} +a:hover, a:active { + color: #444; +} +.red { + color: #ff8000; +} + +/** + * WhoAmI / User name + */ +#whoami p { + text-align: center; + margin-bottom: 1.5em; + /*font-size: 1.3em;*/ +} + +/** + * Google Search + */ +#google-search p * { + display: inline-block; +} +#google-search input[type=text] { + font: 1em "Source Code Pro", monospace; + display: inline-block; + padding: 6px; + background: #eee; + color: #888; + border: 0; + border-bottom: 2px solid #888; +} +/*#google-search input[type=text]:active { + color: #ff8000; +}*/ +#google-search input[type=text]:focus { + outline: 0; + /*border-bottom-color: #ff8000;*/ +} +#google-search input[type=text]:hover { + border-bottom-color: #ff8000; +} + +/** + * Notepad + */ +#notepad p { + margin: 0; + color: #888; +} +#notepadContent { + border-left: 2px solid #888; + font: 1em "Source Code Pro", monospace; + padding: .3em .8em; + color: #888; + margin: .5em 0; +} +#notepadContent:focus { + outline: 0; + border-left-color: #444; + color: #444; +} +#notepadContent:hover { + border-left-color: #ff8000; +} + +/** + * Footer + */ +footer { + position: absolute; + right: 0; + bottom: 0; + margin: 7px; + padding: 0; + text-align: right; +} +footer p { + margin: 0; + padding: .1em; + font-size: 0.6em; + color: #444; +} +footer p a:link, footer p a:visited { + color: #444; + text-decoration: underline; +} +footer p a:hover, footer p a:active { + color: #888; +} + + +/** + * Dark theme variant + */ +@media (prefers-color-scheme: dark) { + body { + background: #444; + } + main { + color: #eee; + } + a:hover, a:active { + background: #444; + color: #eee; + } + #google-search input[type=text] { + color: #eee; + background: #444; + border-bottom: 1px solid #ff8000; + } + footer p a:link, footer p a:visited { + color: #888; + } + footer p a:hover, footer p a:active { + color: #eee; + } + button#settings { + background: #888; + color: #eee; + border-color: #eee; + padding: .2em.4em; + border-radius: 8%; + } + #notepadContent:focus { + color: #eee; + border-left-color: #eee; + } +} diff --git a/template.inc.php b/template.inc.php new file mode 100644 index 0000000..96c5d1a --- /dev/null +++ b/template.inc.php @@ -0,0 +1,134 @@ + +"> + + "> + + + + <?=$Data["Meta"]["Title"]?> + + "> + "> + " sizes="64x64"> + + + +
+ +

 

+ + +
+ + +

 

+ + + + + + + + + + +

 

+ + + + +
+

+ cat <<EOF +

+
+ My Notes +
+

+ EOF +

+
+ +
+ + + + + + + + diff --git a/tty/index.php b/tty/index.php new file mode 100644 index 0000000..55388d0 --- /dev/null +++ b/tty/index.php @@ -0,0 +1,65 @@ + "malte70", + "host" => !empty($_GET["host"]) ? $_GET["host"] : "localhost", +); + +if (strlen($_SERVER["HTTP_ACCEPT_LANGUAGE"]) >= 2) { + $lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2); +} else { + $lang = "en"; +} + +$Data = Array( + "Meta" => Array( + "Lang" => "en", + "Charset" => "UTF-8", + //"Title" => "Homepage @ ".$host, + "Title" => "Homepage", + "Author" => "malte70@".$host, + "Stylesheet" => "../style.css", + //"Icon" => "https://xyz.malte70.de/img/icons_tango/go-home-512.png", + "Icon" => "../favicon.png", + ), + "Links" => NULL, + "Notepad" => false, + "WhoAmI" => $user["name"]."@".$user["host"], + "JS" => false, + "Footer" => Array( + "CopyrightYear" => date("Y"), + "AuthorName" => "malte70", + "AuthorURL" => "https://malte70.de/" + ) +); + +$Data["Links"] = Array(); +foreach ($Links as $Links_Row) { + $L_row = Array(); + foreach ($Links_Row as $L_Link) { + $L_row[] = Array( + "Title" => $L_Link[0], + "URL" => $L_Link[1] + ); + } + $Data["Links"][] = $L_row; +} + +/** + * Modify $Data if Accept-Language is German + */ +if ($lang == "de") { + $Data["Meta"]["Lang"] = "de"; + $Data["Meta"]["Title"] = "Startseite"; +} + + +require_once("../template.inc.php"); + +?> -- 2.30.2