First version.
parent
5f175c4e9e
commit
4bf92d552b
|
@ -0,0 +1,10 @@
|
|||
* { box-sizing: border-box; }
|
||||
html { background-color: #2c3e50; color: #eee; }
|
||||
.wrapper { max-width: 1284px; margin: 0 auto; }
|
||||
a { color: #00aced; }
|
||||
ul.gallery { background-color: #eee; padding: 0; }
|
||||
ul.gallery li { display: inline-block; list-style-type: none; outline: 2px solid #00aced; background-color: #000; }
|
||||
ul.gallery li a { text-decoration: none; }
|
||||
ul.gallery li a:hover { color: yellow; }
|
||||
ul.gallery li p { font-size: large; text-align: center; color: #fff; }
|
||||
ul.gallery li img { max-width: 100%; }
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
$html = file_get_contents('https://tilde.town/');
|
||||
|
||||
$download = [];
|
||||
$gallery = [];
|
||||
|
||||
$download[] = '@echo off';
|
||||
|
||||
$gallery[] = <<<HTML
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<title>tilde.town gallery</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="gallery.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<h1>tilde.town gallery</h1>
|
||||
<p>by <a href="https://tilde.town/~severak">Severák</a></p>
|
||||
<p>I really like <a href="https://neocities.org/browse">Neocities browse page</a>. I was wondering how would it look for tilde.town.</p>
|
||||
<p>So here is it:</p>
|
||||
<ul class="gallery">
|
||||
HTML;
|
||||
|
||||
$regex = '/<a href="\/~(\w+)">[\w]+<\/a>/';
|
||||
$matches = [];
|
||||
preg_match_all($regex, $html, $matches);
|
||||
|
||||
foreach ($matches[1] as $match) {
|
||||
$download[] = sprintf('echo downloading %s...', $match);
|
||||
$download[] = sprintf('capture-website --overwrite --no-javascript --scale-factor 0.5 http://tilde.town/~%s/ --output %s.png', $match, $match);
|
||||
$gallery[] = sprintf('<li><a href="https://tilde.town/~%s"><img src="%s.png" title="%s"><p>%s</p></a></li>', $match, $match, $match, $match);
|
||||
}
|
||||
$download[] = 'echo ALL OK';
|
||||
|
||||
$gallery[] = <<<HTML
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
<small>Generated using <a href="">this code</a>. Updated manually, because you need headless browser to generate all these thumbnails.</small>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
HTML;
|
||||
|
||||
|
||||
file_put_contents('download.bat', implode(PHP_EOL, $download));
|
||||
file_put_contents('index.html', implode(PHP_EOL, $gallery));
|
||||
|
||||
echo 'OK - generated index.html + download.bat' . PHP_EOL;
|
Loading…
Reference in New Issue