From de9552412cefd84222568d4fa3ad0767421e74a7 Mon Sep 17 00:00:00 2001 From: Conrad Zelck <git@simpel.cc> Date: Fri, 1 Mar 2024 00:29:47 +0100 Subject: [PATCH] fix: use shared header styles Signed-off-by: Conrad Zelck <git@simpel.cc> --- index.php | 4 +-- script.min.js | 1 + style.css | 81 ++++++++++----------------------------------------- style.min.css | 1 + 4 files changed, 20 insertions(+), 67 deletions(-) create mode 100644 script.min.js create mode 100644 style.min.css diff --git a/index.php b/index.php index 0670801..90ae4a3 100644 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ <head> <?php include dirname($_SERVER['DOCUMENT_ROOT']) . "/simpel.cc/php/head.php"; ?> - <link rel="stylesheet" href="style.css"> + <link rel="stylesheet" href="style.min.css"> </head> <body onKeyDown="keys(event,'d')" onKeyUp="keys(event,'u')"> @@ -35,6 +35,6 @@ <textarea id="textarea" autofocus placeholder="fill in lines to sort here …" spellcheck="false" autocomplete="off"></textarea> </main> </body> -<script src="script.js"></script> +<script src="script.min.js"></script> </html> diff --git a/script.min.js b/script.min.js new file mode 100644 index 0000000..642bbd5 --- /dev/null +++ b/script.min.js @@ -0,0 +1 @@ +var button_pastesortunique,button_sortunique,textarea;function natural_compare(e,t){var n=[],o=[];for(e.replace(/(\d+)|(\D+)/g,(function(e,t,o){n.push([t||1/0,o||""])})),t.replace(/(\d+)|(\D+)/g,(function(e,t,n){o.push([t||1/0,n||""])}));n.length>0&&o.length>0;){var a,r,u;if(a=n.shift(),r=o.shift(),0!==(u=a[0]-r[0]||a[1].localeCompare(r[1])))return u}return n.length-o.length}function sort_and_copy(e){var t,n=textarea.value.replace(/[\r\n]+/gm,"\n").split("\n"),o={};let a=document.querySelector("#unique");if(a.checked){for(t=0;t<n.length;t++)o[n[t]]="";n=Object.keys(o)}n=n.sort(natural_compare),a.checked&&""==n[0]&&(n=n.slice(1)),textarea.value=n.join("\n"),window.getSelection().removeAllRanges();try{textarea.select(),document.execCommand("copy")}catch(e){}window.getSelection().removeAllRanges(),textarea.selectionStart=0,textarea.selectionEnd=0,textarea.focus()}function paste(){navigator.clipboard.readText().then((e=>{textarea.value=e,sort_and_copy()}))}function keys(e,t){"1"==e.key&&"d"==t&&paste(),"2"==e.key&&"d"==t&&sort_and_copy()}button_pastesortunique=document.querySelector("body > main > div > button.button.pastesortunique"),button_sortunique=document.querySelector("body > main > div > button.button.sortunique"),textarea=document.querySelector("body > main > textarea"); \ No newline at end of file diff --git a/style.css b/style.css index ae0008a..4d6da0a 100644 --- a/style.css +++ b/style.css @@ -1,73 +1,22 @@ body { - min-height: 50vh; - font-family: helvetica, Arial, sans-serif; - font-size: 2vmin; - background-color: #555; - color: white; - margin: 3vmin 4vmin 2vmin 4vmin; -} - -/* iPad portait */ -@media (max-width: 768px) { - body { - font-size: 3vmin; - } -} - -/* iPhone landscape only */ -@media (max-width: 568px) { - body { - font-size: 4vmin; - } -} - -/* iPhone portait only */ -@media (max-width: 320px) { - body { - font-size: 4vmin; - } -} - -*:focus { - outline: 2px solid white; - outline-offset: 2px; -} - -a { - color: #ffffff; - text-decoration: none; + font-size: 2em; } header { margin-bottom: 1.5em; } -nav { - display: flex; - align-items: center; - column-gap: 0.7em; -} - -h1 { - font-size: 1.5em; - margin: 0; -} - -#github { - margin-left: auto; -} - -#github-cat { - height: 1.5em; +main { + font-size: 0.75em; } .flex { display: flex; flex-wrap: wrap; - column-gap: 1.5rem; - row-gap: 0.5rem; - padding-top: 1.5rem; - padding-bottom: 1.5rem; + column-gap: 1.5em; + row-gap: 0.5em; + padding-top: 1.5em; + padding-bottom: 1.5em; } .button { @@ -79,7 +28,7 @@ h1 { } button { - font-size: 1em; + font-size: inherit; padding: 5px 10px; color: white; border: 2px solid white; @@ -91,18 +40,20 @@ button { } input[type="checkbox"] { - margin-left: 1vmin; + margin-left: 0; } .flexlabel { display: flex; + column-gap: 0.25em } textarea { - font-size: larger; + font-size: 0.92em; width: 100%; - padding-left: 0; - padding-right: 0; - height: 50vh; - margin-top: 2vmin; + padding: 0.5em; + height: calc(100vh - 6vmin - 13em); + margin-top: 0.5em; + box-sizing: border-box; + resize: none; } diff --git a/style.min.css b/style.min.css new file mode 100644 index 0000000..c4c5e62 --- /dev/null +++ b/style.min.css @@ -0,0 +1 @@ +body{font-size:2em;}header{margin-bottom:1.5em;}main{font-size:.75em;}.flex{display:flex;flex-wrap:wrap;column-gap:1.5em;row-gap:.5em;padding-top:1.5em;padding-bottom:1.5em;}.button{align-self:flex-end;}.between_buttons,input[type="checkbox"],label{align-self:center;}button{font-size:inherit;padding:5px 10px;color:white;border:2px solid white;cursor:pointer;-webkit-border-radius:5px;border-radius:5px;border-color:white;background-color:#333;}input[type="checkbox"]{margin-left:0;}.flexlabel{display:flex;column-gap:.25em}textarea{font-size:.92em;width:100%;padding:.5em;height:calc(100vh - 6vmin - 13em);margin-top:.5em;box-sizing:border-box;resize:none;} \ No newline at end of file -- GitLab