diff --git a/api.php b/api.php index 255bf61..c6378a2 100644 --- a/api.php +++ b/api.php @@ -1,5 +1,6 @@ -
+ diff --git a/engines/bittorrent.php b/engines/bittorrent.php new file mode 100644 index 0000000..168641f --- /dev/null +++ b/engines/bittorrent.php @@ -0,0 +1,44 @@ + $hash, + "name" => $name, + "seeders" => $seeders, + "leechers" => $leechers, + "magnet" => $magnet + ) + ); + } + + return $results; + + } +?> \ No newline at end of file diff --git a/engines/google.php b/engines/google.php index 8eba48a..629f37f 100644 --- a/engines/google.php +++ b/engines/google.php @@ -1,5 +1,5 @@ count(explode(" ", $query))) // long queries usually wont return a wiki result thats why this check exists + else if (3 > count(explode(" ", $query))) // long queries usually wont return a wiki result thats why this check exists { require_once "results/special/wikipedia.php"; wikipedia_results($query_lower); diff --git a/index.xhtml b/index.xhtml index a19b800..7ca99b6 100644 --- a/index.xhtml +++ b/index.xhtml @@ -23,9 +23,9 @@
-
+ diff --git a/misc/tools.php b/misc/tools.php index cb312a0..b85d080 100644 --- a/misc/tools.php +++ b/misc/tools.php @@ -14,6 +14,7 @@ if ($page == 0) check_for_special_search($query); + echo "
"; foreach($results as $result) { $title = $result["title"]; @@ -21,7 +22,7 @@ $base_url = $result["base_url"]; $description = $result["description"]; - echo ""; } function print_image_results($results) @@ -45,24 +47,52 @@ echo ""; } - echo "
"; + echo "
"; } function print_video_results($results) { + echo "
"; + foreach($results as $result) { $title = $result["title"]; $url = $result["url"]; $base_url = $result["base_url"]; - echo "
"; + echo ""; } + + echo "
"; + } + + function print_bittorrent_results($results) + { + echo "
"; + + foreach($results as $result) + { + $hash = $result["hash"]; + $name = $result["name"]; + $seeders = $result["seeders"]; + $leechers = $result["leechers"]; + $magnet = $result["magnet"]; + + echo "
"; + echo ""; + echo "$hash"; + echo "

$name

"; + echo "
"; + echo "SE: $seeders - LE: $leechers"; + echo "
"; + } + + echo "
"; } function print_next_page_button($page, $button_val, $q, $type) diff --git a/results/special/currency.php b/results/special/currency.php index c588396..c10f58d 100644 --- a/results/special/currency.php +++ b/results/special/currency.php @@ -28,7 +28,7 @@ $conversion_result = ($currency_to_convert_response / $base_currency_response) * $amount_to_convert; - echo "

"; + echo "

"; echo "$amount_to_convert $base_currency = $conversion_result $currency_to_convert"; echo "

"; } diff --git a/results/special/definition.php b/results/special/definition.php index 81d20ee..dbf0c73 100644 --- a/results/special/definition.php +++ b/results/special/definition.php @@ -19,7 +19,7 @@ { $definition = $json_response[0]["meanings"][0]["definitions"][0]["definition"]; - echo "

"; + echo "

"; echo "$word_to_define meaning
"; echo "
" . $definition . "
"; echo "

"; diff --git a/results/special/wikipedia.php b/results/special/wikipedia.php index 8366825..ce9a5a7 100644 --- a/results/special/wikipedia.php +++ b/results/special/wikipedia.php @@ -20,7 +20,7 @@ if (strpos($description, "may refer to")) return; - echo "

"; + echo "

"; if (array_key_exists("thumbnail", $first_page)) { @@ -31,12 +31,12 @@ $base64_image = base64_encode($image_response); echo ""; - echo ""; + echo ""; echo ""; } echo "$description"; - echo ""; + echo ""; echo "Wikipedia"; echo ""; diff --git a/search.php b/search.php index db6714e..ee5f58e 100644 --- a/search.php +++ b/search.php @@ -12,9 +12,8 @@ -

+ - "; ?> -
- - - + +
+ + + +

@@ -48,17 +49,18 @@ require_once "engines/google.php"; require_once "engines/special.php"; require_once "misc/tools.php"; + require_once "engines/bittorrent.php"; require_once "config.php"; $page = isset($_REQUEST["p"]) ? (int) $_REQUEST["p"] : 0; $type = isset($_REQUEST["type"]) ? (int) $_REQUEST["type"] : 0; $start_time = microtime(true); - $results = get_google_results($query, $page, $type); + $results = $type != 3 ? get_google_results($query, $page, $type) : get_bittorrent_results($query); $end_time = number_format(microtime(true) - $start_time, 2, '.', ''); echo "

Fetched the results in $end_time seconds

"; - + switch ($type) { case 0: @@ -70,14 +72,17 @@ case 2: print_video_results($results); break; + case 3: + print_bittorrent_results($results); + break; default: print_text_results($results); break; } - if ($type != 1 ) + if ($type != 1 && $type != 3 ) { - echo "
"; + echo "
"; if ($page != 0) { @@ -99,9 +104,9 @@ } ?> -
+ diff --git a/static/image_result.png b/static/image_result.png index 4342eed..0fb8bfa 100644 Binary files a/static/image_result.png and b/static/image_result.png differ diff --git a/static/librex.png b/static/librex.png index c7e0237..3bc670c 100644 Binary files a/static/librex.png and b/static/librex.png differ diff --git a/static/styles.css b/static/styles.css index dbfad7b..76d05c5 100644 --- a/static/styles.css +++ b/static/styles.css @@ -1,471 +1,295 @@ html { color: #e8eaed; background-color: #202124; - font-family: Arial, Helvetica, sans-serif; - font-size: 18px; - - overflow-x: hidden; -} - -hr { - margin-top: 30px; -} - -img { - border: 1px solid #5f6368; + font-size: 16px; } +input, button { outline: none; } -/* .search-container START */ - - .search-container { - max-width: 560px; - text-align: center; - - display: flex; - flex-direction: column; - - margin-left: auto; - margin-right: auto; - margin-top:12%; - - padding-left: 16px; - padding-right: 16px; - } - - .search-container input { - display: flex; - flex-grow: 1; - } - - .search-container button:hover { - border: 1px solid #5f6368; - cursor:pointer; - } - - .search-container h1 { - font-size: 70px; - } - -/* .search-container END */ - - - -/* .small-search-container START */ - - .small-search-container { - margin:2%; - } - - .small-search-container input { - width: 600px; - } - - .small-search-container h1, a { - display: inline; - color:inherit; - text-decoration: none; - } - -/* .small-search-container END */ - - - -/* - .search-container, - .small-search-container - START -*/ - .search-container input , - .small-search-container input { - color: inherit; - background-color: inherit; - - padding: 10px; - - font-size: 16px; - - border: 1px solid #5f6368; - border-radius: 25px; - } - - .search-container input:hover , - .small-search-container input:hover { - background-color: #303134; - border-color: #303134; - } - - .search-container input:focus , - .small-search-container input:focus { - outline: none; - } -/* - .search-container, - .small-search-container - END - -*/ - - - -/* .search-button-wrapper START */ - - .search-button-wrapper { - display:flex; - flex-direction: column; - } - - .search-button-wrapper button { - color: inherit; - background-color: #303134; - - font-size: 14px; - - border: none; - border-radius: 4px; - - width: auto; - padding: 13px 10px 13px 10px; - margin-top: 30px; - } - -/* .search-button-wrapper END */ - - - -/* .info-container START */ - - .info-container { - position: fixed; - bottom: 0; - left: 0; - width: 100%; - background-color:#171717; - font-size:15px; - padding-top: 15px; - padding-bottom: 15px; - border-top:1px solid #303134; - } - - .info-container a , p { - color:#999da2; - text-decoration: none; - } - - .info-container a { - padding-left:20px; - font-size:16px; - } - - .info-container #right { - float:right; - padding-right:20px; - } - - .info-container a:hover { - text-decoration: underline; - } - -/* .info-container END */ - - - -/* .result-container START */ - - .result-container { - max-width: 550px; - margin-top: 30px; - } - - .result-container span { - font-size: 15px; - } - - .result-container a { - font-size: 14px; - color:#bdc1c6; - text-decoration: none; - } - - .result-container h2 { - font-size: 20px; - color:#8ab4f8; - padding-top:5px; - margin-top:1px; - } - - .result-container h2:hover { - text-decoration: underline; - } - - .result-container a:visited h2 { - color: #bd93f9; - } - -/* .result-container END */ - - - -/* .image-result-container START */ - - .image-result-container { - margin-left:8%; - margin-right:8%; - - margin-bottom:30px; - } - -/* .image-result-container END */ - - - -/* .page-container START */ - - .page-container { - margin-top:50px; - margin-bottom:100px; - margin-left:10%; - } - - .page-container #page { - display: inline; - } - - .page-container #page button { - color:#8ab4f8; - background-color: inherit; - - padding-right: 10px; - font-size: 16px; - border: none; - } - - .page-container #page button:hover { - cursor:pointer; - text-decoration: underline; - } - -/* .page-container END */ - - - -/* .result-change START */ - - .result-change { - width: 100%; - - } - - .result-change button { - color:#bd93f9; - background-color: inherit; - - display: inline; - - border:none; - - - margin-right: 20px; - - font-size: 18px; - } - - .result-change button:hover { - cursor: pointer; - } - - .result-change #change-image { - width: 25px; - height: 25px; - vertical-align: middle; - border:none; - } - -/* .result-change END */ - - - -/* .donate-container START */ - - .donate-container { - margin-left: 5%; - margin-right: 5%; - - padding-right: 10px; - padding-left: 10px; - - margin-top: 13%; - - - border: 1px solid #bdc1c6; - border-top: none; - border-bottom: none; - - text-align: center; - } - - .donate-container a { - color: #8ab4f8; - text-decoration: underline; - } - -/* .donate-container END */ - - - -.result-container , -#time , -#special-result { - margin-left: 10%; +button { + cursor: pointer; } -#special-result { +p { + font-size:18px; + color: #999da2; +} + +a, +.text-result-wrapper a:hover { + text-decoration: none; +} + +a:hover, .text-result-wrapper h2:hover { + text-decoration: underline; +} + +.search-container { + text-align: center; + margin-top:15%; +} + +.search-container h1 { + font-size: 70px; +} + +.search-container input, +.sub-search-container input { + width: 500px; + color: inherit; + background-color: inherit; + padding: 10px; + font-size: inherit; + font-family: inherit; + border: 1px solid #5f6368; + border-radius: 25px; +} + +.search-button-wrapper button { + color: inherit; + background-color: #303134; + font-size: 14px; + border: none; + border-radius: 4px; + padding: 13px 10px 13px 10px; + margin: 30px 60px 0px 60px; +} + +.sub-search-container { + margin: 2%; +} + +.sub-search-container hr { + margin-top: 35px; + margin-bottom: 35px; +} + +.sub-search-container input { + margin-bottom: 40px; + width: 600px; +} + +.sub-search-container #logo { + vertical-align: middle; + margin-right: 50px; +} + +.sub-search-button-wrapper { + margin-left: 150px; +} + +.search-button-wrapper button:hover { + border: 1px solid #5f6368; + cursor: pointer; +} + +.sub-search-button-wrapper img { + vertical-align: middle; + margin-right: 10px; +} + +.sub-search-button-wrapper button { + border: none; + background-color: inherit; + color: #bd93f9; + font-size: 18px; + margin-right: 25px; +} + +.text-result-container, +.special-result-container, +#time, +.next-page-button-wrapper { + margin-left:10%; +} + +.text-result-container +{ + margin-bottom:100px; +} + +.special-result-container { padding: 10px; border: 1px solid #bdc1c6; width: 500px; } -#logo { - vertical-align: middle; - width: 80px; - height: 80px; - border: none; +.text-result-wrapper { + max-width: 500px; + margin-top: 35px; } -#wiki-image { - border: none; - display: flex; +.text-result-wrapper a { + font-size: 14px; + color:#bdc1c6; +} +.text-result-wrapper h2 { + font-size: 20px; + color: #8ab4f8; + padding-top: 5px; + margin-top: 1px; +} + +.special-result-container img { + display: flex; max-width: 50%; max-height: 200px; - padding-bottom:10px; - margin-left:auto; margin-right:auto; -} +} -#wiki-link { +.special-result-container a { display: flex; - margin-top: 16px; + margin-top: 10px; + color: #bd93f9; font-size:14px; - color:#bd93f9; } -/* @media START */ +.next-page-button-wrapper { + margin-top:-50px; + margin-bottom:100px; +} - @media only screen and (min-width:900px) { - .search-button-wrapper { - flex-direction: row; - } +.next-page-button-wrapper button { + border:none; + background-color: inherit; + color: #8ab4f8; + font-size: 18px; +} - .search-button-wrapper button { - width: auto; - margin-left: auto; - margin-right: auto; - } +.next-page-button-wrapper #page { + display: inline; +} - .search-container input { - width: auto; - } +.image-result-container { + margin-left:auto; + margin-right: auto; + margin-bottom: 60px; +} - .small-search-container input { - margin-left: 40px; - } +.image-result-container img { + margin: 10px; + border: 1px solid #5f6368; +} - hr { - margin-bottom: -20px; - } +.donate-container { + text-align: center; + word-wrap: break-word; + margin-left: auto; + margin-right: auto; + margin-top: 8%; + border: 1px solid #bdc1c6; + max-width: 500px; + padding:0px 20px 20px 20px; +} - .result-change { - margin-left: 9% - } +.donate-container img { + margin-top:10px; +} + +.donate-container a { + color: #bd93f9; +} + +.footer-container { + position: fixed; + left: 0; + bottom: 0; + width: 100vw; + background-color: #171717; + padding-top: 15px; + padding-bottom: 15px; + border-top: 1px solid #303134; + text-align: center; +} + +.footer-container a { + color: #999da2; + margin-left: 15px; + margin-right: 15px; +} + +/* mobile view */ +@media only screen and (max-width: 900px) { + .search-container input { + width: 80%; + } + + .search-button-wrapper button { + display: table-row; + margin: 30px 0px 0px 0px; + width: 80%; + } + + .footer-container a { + margin:10px; + } + + .sub-search-container { + margin-left:auto; + margin-right:auto; + text-align: center; + } + + .sub-search-container #logo { + margin-left:auto; + margin-right:auto; + display: block; - .donate-container { - margin-left: 25%; - margin-right: 25%; - } - - img { - margin:10px; - } - - #time { - margin-top: 60px; - } - } - - @media only screen and (max-width:900px) { - .info-container - { - display: flex; - flex-wrap: wrap; - - flex-direction: column; - } - - .info-container a - { - margin-top:5px; - } - - .small-search-container input { - display: block; - - margin-left: auto; - margin-right: auto; - margin-top: 30px; - - width: 80%; - } - - .small-search-container a { - display: block; - width: 100%; - text-align: center; - - margin-top:10px; - } - - .result-change { - margin-left: auto; - margin-right: auto; - text-align: center; - margin-top: 5px; - } - - img { - display: block; - - margin-left: auto; - margin-right: auto; - - width: 98%; - - margin-bottom: 30px; - } - - #special-result { - width: 70%; - } - - .result-container { - width: 70%; - } - - #time { - margin-top: 30px; - } - - .page-container { - margin-bottom:130px; - } + .sub-search-container input { + width: 80%; + margin-top:30px; } -/* @media END */ \ No newline at end of file + .sub-search-button-wrapper { + margin:0; + padding:0; + display: flex; + + } + + .sub-search-button-wrapper img { + margin:0; + padding:0; + margin-bottom:20px; + } + + .sub-search-button-wrapper button { + margin-left:auto; + margin-right:auto; + padding:0; + + display: flex; + flex-direction: column; + align-items: center; + } + + + .special-result-container { + max-width: 80%; + } + + .donate-container { + max-width: 80%; + } + + .donate-container img { + display: block; + margin-left:auto; + margin-right:auto; + } + + .image-result-container img { + display:block; + margin-left:auto; + margin-right:auto; + } +} \ No newline at end of file diff --git a/static/text_result.png b/static/text_result.png index 4974d01..1462af9 100644 Binary files a/static/text_result.png and b/static/text_result.png differ diff --git a/static/torrent_result.png b/static/torrent_result.png new file mode 100644 index 0000000..47b6eaf Binary files /dev/null and b/static/torrent_result.png differ diff --git a/static/video_result.png b/static/video_result.png index 7ef397a..178f634 100644 Binary files a/static/video_result.png and b/static/video_result.png differ diff --git a/static/xmr.png b/static/xmr.png new file mode 100644 index 0000000..06f35b1 Binary files /dev/null and b/static/xmr.png differ