Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
face-hh committed May 26, 2024
0 parents commit 108b8fd
Show file tree
Hide file tree
Showing 3 changed files with 217 additions and 0 deletions.
74 changes: 74 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<html>

<head>
<title>Dingle</title>
<link href="https://i.imgur.com/8ncMRS2.png">

<meta name="theme-color" content="#000000">
<meta name="description" content="Search websites across the Web X! Find anything and everything">

<link href="styles.css">
<script src="main.lua" />
</head>

<body>
<div class="main">
<img src="https://i.imgur.com/LTT80Zv.png"/>
<p class="subheader">The official Bussin Web X search engine.</p>
<input type="text" placeholder="Search..." class="query">
</div>
<div class="submain">
<div class="card">
<a href="https://ok.com" class="result1link"></a>
<p class="result1desc"></p>
<p class="domain result1domain"></p>
</div>
<div class="card">
<a href="https://ok.com" class="result2link"></a>
<p class="result2desc"></p>
<p class="domain result2domain"></p>
</div>
<div class="card">
<a href="https://ok.com" class="result3link"></a>
<p class="result3desc"></p>
<p class="domain result3domain"></p>
</div>
<div class="card">
<a href="https://ok.com" class="result4link"></a>
<p class="result4desc"></p>
<p class="domain result4domain"></p>
</div>
<div class="card">
<a href="https://ok.com" class="result5link"></a>
<p class="result5desc"></p>
<p class="domain result5domain"></p>
</div>
<div class="card">
<a href="https://ok.com" class="result6link"></a>
<p class="result6desc"></p>
<p class="domain result6domain"></p>
</div>
<div class="card">
<a href="https://ok.com" class="result7link"></a>
<p class="result7desc"></p>
<p class="domain result7domain"></p>
</div>
<div class="card">
<a href="https://ok.com" class="result8link"></a>
<p class="result8desc"></p>
<p class="domain result8domain"></p>
</div>
<div class="card">
<a href="https://ok.com" class="result9link"></a>
<p class="result9desc"></p>
<p class="domain result9domain"></p>
</div>
<div class="card">
<a href="https://ok.com" class="result10link"></a>
<p class="result10desc"></p>
<p class="domain result10domain"></p>
</div>
</div>
</body>

</html>
95 changes: 95 additions & 0 deletions main.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
local query = get("query")
local cards = get("card", true);

local links = {
["1"] = get("result1link"),
["2"] = get("result2link"),
["3"] = get("result3link"),
["4"] = get("result4link"),
["5"] = get("result5link"),
["6"] = get("result6link"),
["7"] = get("result7link"),
["8"] = get("result8link"),
["9"] = get("result9link"),
["10"] = get("result10link")
}

local descriptions = {
["1"] = get("result1desc"),
["2"] = get("result2desc"),
["3"] = get("result3desc"),
["4"] = get("result4desc"),
["5"] = get("result5desc"),
["6"] = get("result6desc"),
["7"] = get("result7desc"),
["8"] = get("result8desc"),
["9"] = get("result9desc"),
["10"] = get("result10desc")
}

local domains = {
["1"] = get("result1domain"),
["2"] = get("result2domain"),
["3"] = get("result3domain"),
["4"] = get("result4domain"),
["5"] = get("result5domain"),
["6"] = get("result6domain"),
["7"] = get("result7domain"),
["8"] = get("result8domain"),
["9"] = get("result9domain"),
["10"] = get("result10domain")
}

local visible = false;

query.on_submit(function(content)
if not visible then
print("turning shit visible....")

for k,v in pairs(cards) do
v.set_opacity(1.0)
end

visible = true
end

local res = fetch({
url = "http://search.buss.lol/search",
method = "POST",
headers = { ["Content-Type"] = "application/json" },
body = '{ "query": "' .. content .. '" }',
})

for k, v in pairs(res) do
local i = tostring(k);

local link = links[i];
local desc = descriptions[i];
local domain = domains[i];

local URL = percentage(v["rating"], -999, 2) .. "% | buss://" .. v["domain"];

domain.set_content(URL)
link.set_content(v["title"])
link.set_href("buss://" .. v["domain"])
desc.set_content(v["description"])
end
end)

function percentage(value, min, max)
if value < min then
value = min
elseif value > max then
value = max
end

local percentage = ((value - min) / (max - min)) * 100

if percentage < 0 then
percentage = 0
elseif percentage > 100 then
percentage = 100
end

return string.format("%.2f", percentage)
end
48 changes: 48 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
main {
direction: column;
gap: 20px;
}

query {
width: 520px;
height: 5px;
padding: 10px;
font-size: 20px;
}

submain {
direction: column;
gap: 10px;
}

card {
opacity: 0.0;

direction: column;
padding: 10px;
border-radius: 12px;
border-width: 2px;
border-color: rgb(0, 0, 0);
border-style: solid;
gap: 5px;
}

a {
font-family: Cascadia Code;
letter-spacing: 4px;
font-size: 12px;
}

p {
font-family: Corbel;
font-size: 12px;
}

domain {
font-family: Cascadia Code;
font-size: 9px;
}
subheader {
font-family: Cascadia Code;
color: gainsboro;
}

0 comments on commit 108b8fd

Please sign in to comment.