mirror of
https://git.lolcat.ca/lolcat/4get.git
synced 2024-11-08 17:43:07 -05:00
felt quirky, might commit later
This commit is contained in:
parent
bca265aea6
commit
16ee0b368f
7 changed files with 1039 additions and 456 deletions
21
images.php
21
images.php
|
@ -58,32 +58,15 @@ if(count($results["image"]) === 0){
|
|||
|
||||
foreach($results["image"] as $image){
|
||||
|
||||
$domain = htmlspecialchars(parse_url($image["url"], PHP_URL_HOST));
|
||||
|
||||
$c = count($image["source"]) - 1;
|
||||
|
||||
if(
|
||||
preg_match(
|
||||
'/^data:/',
|
||||
$image["source"][$c]["url"]
|
||||
)
|
||||
){
|
||||
|
||||
$src = htmlspecialchars($image["source"][$c]["url"]);
|
||||
}else{
|
||||
|
||||
$src = "/proxy?i=" . urlencode($image["source"][$c]["url"]) . "&s=thumb";
|
||||
}
|
||||
|
||||
$payload["images"] .=
|
||||
'<div class="image-wrapper" title="' . htmlspecialchars($image["title"]) .'" data-json="' . htmlspecialchars(json_encode($image["source"])) . '">' .
|
||||
'<div class="image">' .
|
||||
'<a href="' . htmlspecialchars($image["source"][0]["url"]) . '" rel="noreferrer nofollow" class="thumb">' .
|
||||
'<img src="' . $src . '" alt="thumbnail">' .
|
||||
'<img src="' . $frontend->htmlimage($image["source"][count($image["source"]) - 1]["url"], "thumb") . '" alt="thumbnail">' .
|
||||
'<div class="duration">' . $image["source"][0]["width"] . 'x' . $image["source"][0]["height"] . '</div>' .
|
||||
'</a>' .
|
||||
'<a href="' . htmlspecialchars($image["url"]) . '" rel="noreferrer nofollow">' .
|
||||
'<div class="title">' . htmlspecialchars($domain) . '</div>' .
|
||||
'<div class="title">' . htmlspecialchars(parse_url($image["url"], PHP_URL_HOST)) . '</div>' .
|
||||
'<div class="description">' . $frontend->highlighttext($get["s"], $image["title"]) . '</div>' .
|
||||
'</a>' .
|
||||
'</div>' .
|
||||
|
|
|
@ -143,7 +143,7 @@ class frontend{
|
|||
|
||||
$payload .=
|
||||
'">' .
|
||||
'<img class="thumb" src="/proxy?i=' . urlencode($site["thumb"]["url"]) . '&s=' . $size . '" alt="thumb">';
|
||||
'<img class="thumb" src="' . $this->htmlimage($site["thumb"]["url"], $size) . '" alt="thumb">';
|
||||
|
||||
if($duration !== null){
|
||||
|
||||
|
@ -1273,6 +1273,21 @@ class frontend{
|
|||
return http_build_query($out);
|
||||
}
|
||||
|
||||
public function htmlimage($image, $format){
|
||||
|
||||
if(
|
||||
preg_match(
|
||||
'/^data:/',
|
||||
$image
|
||||
)
|
||||
){
|
||||
|
||||
return htmlspecialchars($image);
|
||||
}
|
||||
|
||||
return "/proxy.php?i=" . urlencode($image) . "&s=" . $format;
|
||||
}
|
||||
|
||||
public function htmlnextpage($gets, $npt, $page){
|
||||
|
||||
$query = $this->buildquery($gets);
|
||||
|
|
|
@ -679,7 +679,7 @@ class ddg{
|
|||
Check for worknik results
|
||||
*/
|
||||
preg_match(
|
||||
'/nrj\(\'\/js\/spice\/dictionary\/definition\/([^\']+)\'\)/',
|
||||
'/nrj\(\'\/js\/spice\/dictionary\/definition\/([^\'\)]+)/',
|
||||
$js,
|
||||
$wordnik
|
||||
);
|
||||
|
|
1423
scraper/google.php
1423
scraper/google.php
File diff suppressed because it is too large
Load diff
|
@ -577,7 +577,6 @@ function getproxylink(url){
|
|||
return htmlspecialchars(url);
|
||||
}else{
|
||||
|
||||
console.log(url);
|
||||
return '/proxy?i=' + encodeURIComponent(url);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,8 @@
|
|||
|
||||
audio{
|
||||
max-width:100%;
|
||||
display:block;
|
||||
margin-bottom:17px;
|
||||
}
|
||||
|
||||
body,html{
|
||||
|
|
29
web.php
29
web.php
|
@ -65,7 +65,13 @@ if($results["spelling"]["type"] != "no_correction"){
|
|||
$payload["left"] .=
|
||||
'<div class="infobox">' .
|
||||
$type . ' <b>' . htmlspecialchars($results["spelling"]["using"]) . '</b>.<br>' .
|
||||
'Did you mean <a href="?s=' . urlencode($results["spelling"]["correction"]) . '">' . $results["spelling"]["correction"] . '</a>?' .
|
||||
'Did you mean <a href="?s=' .
|
||||
urlencode($results["spelling"]["correction"]) .
|
||||
'&' .
|
||||
$frontend->buildquery($get, true) .
|
||||
'">' .
|
||||
$results["spelling"]["correction"] .
|
||||
'</a>?' .
|
||||
'</div>';
|
||||
}
|
||||
|
||||
|
@ -120,24 +126,9 @@ if(count($results["image"]) !== 0){
|
|||
|
||||
foreach($results["image"] as $image){
|
||||
|
||||
$c = count($image["source"]) - 1;
|
||||
|
||||
if(
|
||||
preg_match(
|
||||
'/^data:/',
|
||||
$image["source"][$c]["url"]
|
||||
)
|
||||
){
|
||||
|
||||
$src = htmlspecialchars($image["source"][$c]["url"]);
|
||||
}else{
|
||||
|
||||
$src = "/proxy?i=" . urlencode($image["source"][$c]["url"]) . "&s=square";
|
||||
}
|
||||
|
||||
$right["image"] .=
|
||||
'<a class="image" href="' . htmlspecialchars($image["url"]) . '" rel="noreferrer nofollow" title="' . htmlspecialchars($image["title"]) . '" data-json="' . htmlspecialchars(json_encode($image["source"])) . '" tabindex="-1">' .
|
||||
'<img src="' . $src . '" alt="thumb">' .
|
||||
'<img src="' . $frontend->htmlimage($image["source"][count($image["source"]) - 1]["url"], "square") . '" alt="thumb">' .
|
||||
'<div class="duration">' . $image["source"][0]["width"] . 'x' . $image["source"][0]["height"] . '</div>' .
|
||||
'</a>';
|
||||
}
|
||||
|
@ -283,7 +274,7 @@ if(count($results["answer"]) !== 0){
|
|||
|
||||
$right["answer"] .=
|
||||
'<a href="' . htmlspecialchars($answer["thumb"]) . '" rel="noreferrer nofollow" class="photo">' .
|
||||
'<img src="/proxy?i=' . urlencode($answer["thumb"]) . '&s=cover" alt="thumb" class="openimg">' .
|
||||
'<img src="' . $frontend->htmlimage($answer["thumb"], "cover") . '" alt="thumb" class="openimg">' .
|
||||
'</a>';
|
||||
}
|
||||
|
||||
|
@ -337,7 +328,7 @@ if(count($results["answer"]) !== 0){
|
|||
|
||||
case "image":
|
||||
$right["answer"] .=
|
||||
'<a href="' . htmlspecialchars($description["url"]) . '" rel="noreferrer nofollow" tabindex="-1"><img src="/proxy?i=' . urlencode($description["url"]) . '&s=thumb" alt="image" class="fullimg openimg"></a>';
|
||||
'<a href="' . htmlspecialchars($description["url"]) . '" rel="noreferrer nofollow" tabindex="-1"><img src="' . $frontend->htmlimage($description["url"], "thumb") . '" alt="image" class="fullimg openimg"></a>';
|
||||
break;
|
||||
|
||||
case "audio":
|
||||
|
|
Loading…
Reference in a new issue