Compare commits

..

1 Commits

8 changed files with 106 additions and 175 deletions

View File

@ -1,14 +0,0 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.css]
indent_style = space
indent_size = 2
[*.js]
indent_style = space
indent_size = 2

View File

@ -1,68 +0,0 @@
#main {
display: flex;
flex-flow: column;
width: 100%;
text-align: center;
}
@media screen and (min-width: 360px) {
#main {
margin: auto;
width: 360px;
}
}
#about img {
width: 100%;
height: auto;
}
#search {
display: flex;
flex-direction: column;
align-items: center;
}
#search > * {
margin: 0.25rem;
}
.search-inputs {
width: 100%;
height: 2rem;
display: flex;
}
.search-inputs > * {
height: 100%;
}
.search-inputs input[name="query"] {
width: 100%;
box-sizing: border-box;
}
.search-radio-buttons {
display: flex;
flex-wrap: wrap;
}
.search-radio-buttons > .category {
display: flex;
}
.search-radio-buttons > .category:not(:last-child) {
margin-right: 1rem;
}
.search-radio-buttons > .category > input[type="radio"] {
margin: 0;
margin-right: 0.25rem;
}
#status {
font-size: smaller;
}

View File

@ -1,43 +0,0 @@
:root {
--primary-color: #bc5151;
}
body {
background: url('https://www.tromsite.com/wp-content/uploads/2018/09/tromsite-bg-pattern-light-5.png');
background-repeat: repeat;
background-attachment: fixed;
font-family: sans-serif;
}
a {
color: var(--primary-color);
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.search-inputs input[name="query"] {
border: 1px solid darkgrey;
border-radius: 0.5rem 0 0 0.5rem;
}
.search-inputs input[type="submit"] {
background-color: var(--primary-color);
color: white;
cursor: pointer;
border: none;
border-radius: 0 0.5rem 0.5rem 0;
}
.search-radio-buttons input[type="radio"] {
accent-color: var(--primary-color);
}
#status {
color: gray;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 343 B

View File

@ -1,54 +1,110 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<title>TROM Search</title> <title></title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="referrer" content="no-referrer"> <meta name="referrer" content="no-referrer">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#bc5151">
<link rel="shortcut icon" href="img/favicon.png">
<link rel="search" title="TROM Search" type="application/opensearchdescription+xml" href="opensearchdescription.xml"> <link rel="search" title="TROM Search" type="application/opensearchdescription+xml" href="opensearchdescription.xml">
<link rel="stylesheet" type="text/css" href="css/index.css"> <style>
<link rel="stylesheet" type="text/css" href="css/theme.css"> * { margin: 0; }
<script type="module" src="js/index.js"></script> html, body { width: 100%; height: 100%; }
body {
background: url('https://www.tromsite.com/wp-content/uploads/2018/09/tromsite-bg-pattern-light-5.png') !important; background-repeat: repeat !important; background-attachment: fixed !important;
height: auto !important;}
#search:before {
content: url("https://www.tromsite.com/wp-content/uploads/2021/02/trom-logo-dark.png");
transform: scale(.6);
display: block;
width: 100%;
margin: 0 auto;}
#search-box {
position: fixed;
left: 50%;
top: 1rem;
transform: translateX(-50%);
}
#info {
color: black;
text-align: center;
font-weight: bold;
}
#info.error { color: #7b7b7b; margin-top: 20px;font-size: 13px;font-style: italic;}
#search input[name="query"] {
width: 500px;
height: 40px;
background-color: white;
border: 2px solid darkgrey;
border-radius: 4px;
box-sizing: border-box;
}
#search {
display: flex;
flex-direction: column;
align-items: center;
}
#search-inputs {
display: flex;
align-items: center;
margin-bottom: 10px;
}
#search input[type="submit"] {
height: 40px;
background-color: #bc5151;
color: white;
font-weight: bold;
border: none;
border-radius: 4px;
margin-left: 10px;
cursor: pointer;
padding: 0 10px;
box-sizing: border-box;
width: 20%;
}
.search-radio-buttons {
display: flex;
justify-content: center;
width: 100%;
}
#search label {
margin-left: 5px;
margin-right: 15px;
}
</style>
<script type="module" src="index.js"></script>
</head> </head>
<body> <body>
<div id="main"> <div id="search-box">
<div id="about">
<img src="img/about.png">
<p class="description">This is a <a href="https://www.trade-free.org">trade-free</a> tool, part of the <a href="https://trom.tf">trom.tf</a> suite of trade-free services.</p>
</div>
<main>
<form id="search"> <form id="search">
<div class="search-inputs"> <div id="search-inputs">
<input name="query" type="text" placeholder="Query"> <input name="query" type="text" placeholder="Query">
<input type="submit" value="Search"> <input type="submit" value="Search">
</div> </div>
<div class="search-radio-buttons"> <div class="search-radio-buttons">
<div class="category">
<input type="radio" id="search-category-all" name="category" value="all" checked> <input type="radio" id="search-category-all" name="category" value="all" checked>
<label for="search-category-all">All</label> <label for="search-category-all">All</label>
</div>
<div class="category">
<input type="radio" id="search-category-images" name="category" value="images"> <input type="radio" id="search-category-images" name="category" value="images">
<label for="search-category-images">Images</label> <label for="search-category-images">Images</label>
</div>
<div class="category">
<input type="radio" id="search-category-news" name="category" value="news"> <input type="radio" id="search-category-news" name="category" value="news">
<label for="search-category-news">News</label> <label for="search-category-news">News</label>
</div>
<div class="category">
<input type="radio" id="search-category-videos" name="category" value="videos"> <input type="radio" id="search-category-videos" name="category" value="videos">
<label for="search-category-videos">Videos</label> <label for="search-category-videos">Videos</label>
</div>
<div class="category">
<input type="radio" id="search-category-files" name="category" value="files"> <input type="radio" id="search-category-files" name="category" value="files">
<label for="search-category-files">Files</label> <label for="search-category-videos">Files</label>
</div>
</div> </div>
</form> </form>
</main> <p id="info"></p>
<p id="status"></p>
</div> </div>
</body> </body>
</html> </html>

View File

@ -2,12 +2,12 @@ const storageType = 'localStorage'
let data = {} let data = {}
const statusEl = document.getElementById('status') const infoEl = document.getElementById('info')
const formEl = document.getElementById('search') const formEl = document.getElementById('search')
const errors = { const errors = {
missingQuery: new TypeError('Query is missing.'), missingQuery: new TypeError('Query is missing.'),
noFoundInstances: new Error('No instances were found.'), noFoundInstances: new TypeError('No instances were found.'),
} }
function buildSearchURL (opts = {}) { function buildSearchURL (opts = {}) {
@ -102,7 +102,7 @@ if (location.search.length > 0) {
} }
} }
statusEl.textContent = `${data.instances.length} instances` infoEl.textContent = `${data.instances.length} instances`
if (data.instances.length === 0) { if (data.instances.length > 0) {
statusEl.classList.add('error') infoEl.classList.add('error')
} }

View File

@ -2,6 +2,6 @@
<ShortName>TROM</ShortName> <ShortName>TROM</ShortName>
<Description>TROM Search</Description> <Description>TROM Search</Description>
<InputEncoding>UTF-8</InputEncoding> <InputEncoding>UTF-8</InputEncoding>
<Url type="application/opensearchdescription+xml" rel="self" template="https://search.trom.tf/opensearchdescription.xml"></Url> <Url type="application/opensearchdescription+xml" rel="self" template="https://testsearch.trom.tf/opensearchdescription.xml"></Url>
<Url type="text/html" template="https://search.trom.tf/?q={searchTerms}"></Url> <Url type="text/html" template="https://testsearch.trom.tf/?q={searchTerms}"></Url>
</OpenSearchDescription> </OpenSearchDescription>