fixed
This commit is contained in:
parent
f9616dddda
commit
a8435d3bcb
2
config.h
2
config.h
@ -6,6 +6,6 @@
|
|||||||
#define CSS "style.css"
|
#define CSS "style.css"
|
||||||
#define LOGO "logo.png"
|
#define LOGO "logo.png"
|
||||||
|
|
||||||
#define DESC "+100500 photos of windowmaker"
|
#define DESC "from outer space"
|
||||||
#define TITLE "8img gallery"
|
#define TITLE "8img gallery"
|
||||||
#define POST_PER_PAGE 5
|
#define POST_PER_PAGE 5
|
||||||
|
27
img.c
27
img.c
@ -22,7 +22,7 @@ struct UNIQ_TAGS {
|
|||||||
};
|
};
|
||||||
|
|
||||||
char *gen_id(const char *filename) {
|
char *gen_id(const char *filename) {
|
||||||
const char *alf = "qwertyUIOPasdfghjklQWERTASDFGHJKLZXCVBNMzxcvbnm1234567890";
|
const char *alf = "qwertyuiopasdfghjklzxcvbnmZXCVBNMASDFGHJKLQWERTYUIOP1234567890";
|
||||||
|
|
||||||
char *ext = strrchr(filename, '.');
|
char *ext = strrchr(filename, '.');
|
||||||
if (ext == NULL)
|
if (ext == NULL)
|
||||||
@ -256,13 +256,13 @@ RDB_CLOSE:
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct DB_STR *build_html(FILE *fp, const char *file, const struct UNIQ_TAGS ut, struct DB_STR *db, const size_t page, const size_t pages) {
|
struct DB_STR *build_html(FILE *fp, const char *file, const struct UNIQ_TAGS ut, struct DB_STR *db, const size_t page, const size_t pages) {
|
||||||
fprintf(fp, "<html>\n<head>\n<link rel='stylesheet' href='%s'>\n<title>%s</title>\n</head>\n<body>\n<center><a href='index.html'><img id='logo' src='%s'></a><h1 id='text'>%s</h1></center><h1 id='text'>Page %zu</h1><center>", CSS, TITLE, LOGO, DESC, page);
|
fprintf(fp, "<html>\n<head>\n<link rel='stylesheet' href='%s'>\n<title>%s</title>\n</head>\n<body>\n<a href='index.html'><img id='logo' src='%s'></a><h1 id='desc'>%s<br>%s/p%zu</h1><center>", CSS, TITLE, LOGO, DESC, file, page);
|
||||||
|
|
||||||
/* Tags */
|
/* Tags */
|
||||||
fputs("\n<a id='alltags' href='index.html'> [all] </a>", fp);
|
fputs("\n<a id='alltags' href='index.html'>all</a>", fp);
|
||||||
for (size_t i = 0; i < ut.size; i++)
|
for (size_t i = 0; i < ut.size; i++)
|
||||||
fprintf(fp, "<a id='alltags' href='%s.html'> [%s] </a>", ut.tags[i], ut.tags[i]);
|
fprintf(fp, "<a id='alltags' href='%s.html'> %s</a>", ut.tags[i], ut.tags[i]);
|
||||||
fputs("\n<br><br><div id='bar'></div><br>\n", fp);
|
fputs("\n<br><br><div class='bar'></div><br>\n", fp);
|
||||||
|
|
||||||
/* Images */
|
/* Images */
|
||||||
size_t images = 0;
|
size_t images = 0;
|
||||||
@ -283,9 +283,9 @@ struct DB_STR *build_html(FILE *fp, const char *file, const struct UNIQ_TAGS ut,
|
|||||||
|
|
||||||
fprintf(fp, "<a href='%s'><img src='%s' alt='%s'></a><br>", p->filename, p->filename, p->filename);
|
fprintf(fp, "<a href='%s'><img src='%s' alt='%s'></a><br>", p->filename, p->filename, p->filename);
|
||||||
for (size_t i = 0; i < p->size; i++)
|
for (size_t i = 0; i < p->size; i++)
|
||||||
fprintf(fp, "<a id='tags' href='%s.html'> %s</a>", p->tags[i], p->tags[i]);
|
fprintf(fp, "<a class='tags' href='%s.html'> %s</a>", p->tags[i], p->tags[i]);
|
||||||
|
|
||||||
fputs("\n<br><br><div id='bar'></div><br>\n", fp);
|
fputs("\n<br><br><div class='bar'></div><br>\n", fp);
|
||||||
|
|
||||||
p = i;
|
p = i;
|
||||||
images++;
|
images++;
|
||||||
@ -293,13 +293,14 @@ struct DB_STR *build_html(FILE *fp, const char *file, const struct UNIQ_TAGS ut,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fputs("<div class='pager'>\n", fp);
|
||||||
for (size_t i = 0; i <= pages; i++) {
|
for (size_t i = 0; i <= pages; i++) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
if (i == page)
|
if (i == page)
|
||||||
fprintf(fp, "<a id='pager' href='%s.html'>(0) </a> ", file);
|
fprintf(fp, "<a id='curr' href='%s.html'>0</a> ", file);
|
||||||
|
|
||||||
else
|
else
|
||||||
fprintf(fp, "<a id='pager' href='%s.html'>[0] </a> ", file);
|
fprintf(fp, "<a href='%s.html'>0</a> ", file);
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
@ -307,15 +308,15 @@ struct DB_STR *build_html(FILE *fp, const char *file, const struct UNIQ_TAGS ut,
|
|||||||
snprintf(new_path, sizeof(new_path), "%s-%zu.html", file, i);
|
snprintf(new_path, sizeof(new_path), "%s-%zu.html", file, i);
|
||||||
|
|
||||||
if (i == page)
|
if (i == page)
|
||||||
fprintf(fp, "<a id='pager' href='%s'>(%zu) </a>", new_path, i);
|
fprintf(fp, "<a id='curr' href='%s'>%zu</a>", new_path, i);
|
||||||
|
|
||||||
else
|
else
|
||||||
fprintf(fp, "<a id='pager' href='%s'>[%zu] </a>", new_path, i);
|
fprintf(fp, "<a href='%s'> %zu </a>", new_path, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(fp, "\n</center>\n</body>\n</html>\n");
|
fprintf(fp, "\n</div>\n</center>\n</body>\n</html>\n");
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,7 +463,7 @@ int main(int argc, char **argv) {
|
|||||||
else if (!strcmp(argv[0], "rebuild"))
|
else if (!strcmp(argv[0], "rebuild"))
|
||||||
rebuild();
|
rebuild();
|
||||||
|
|
||||||
else if (!strcmp(argv[0], "rebuild"))
|
else if (!strcmp(argv[0], "version"))
|
||||||
puts("8img version: 1.0\nWritten under WTFPL License.");
|
puts("8img version: 1.0\nWritten under WTFPL License.");
|
||||||
|
|
||||||
else
|
else
|
||||||
|
44
style.css
44
style.css
@ -1,22 +1,32 @@
|
|||||||
body { background-color: #1d2021; }
|
body {
|
||||||
|
margin: auto;
|
||||||
/* Links */
|
padding: 2em;
|
||||||
a { text-decoration: none; }
|
|
||||||
#tags { color: 8ec07c;}
|
|
||||||
#pager { color: #b16286; }
|
|
||||||
#alltags { color: #83a598; }
|
|
||||||
|
|
||||||
#bar {
|
|
||||||
width: 100%;
|
|
||||||
height: 10px;
|
|
||||||
background-color: #ebdbb2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#text { color: #ebdbb2; }
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pager #curr {
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bar {
|
||||||
|
width: 100%;
|
||||||
|
height: 5px;
|
||||||
|
background-color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
height: auto;
|
display: block;
|
||||||
width: auto;
|
max-width: 80%;
|
||||||
max-width: 50%;
|
|
||||||
max-height: 50%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
#desc { color: #000000; }
|
||||||
|
.tags { color: #000000; }
|
||||||
|
.pager {}
|
||||||
|
.pager a { text-decoration: underline; }
|
||||||
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user