diff options
| author | 2022-09-29 10:27:09 +0200 | |
|---|---|---|
| committer | 2022-09-29 10:27:09 +0200 | |
| commit | 6317c9678de9e5a9d6100bcc520bcc15609a2f0b (patch) | |
| tree | fd34413b973de6bd56da9ed51684d5ab41dea1ed | |
| parent | More HTML work. (diff) | |
| download | snac2-6317c9678de9e5a9d6100bcc520bcc15609a2f0b.tar.gz snac2-6317c9678de9e5a9d6100bcc520bcc15609a2f0b.tar.xz snac2-6317c9678de9e5a9d6100bcc520bcc15609a2f0b.zip | |
Simplified HTML.
| -rw-r--r-- | html.c | 58 |
1 files changed, 18 insertions, 40 deletions
| @@ -371,6 +371,17 @@ d_char *html_top_controls(snac *snac, d_char *s) | |||
| 371 | } | 371 | } |
| 372 | 372 | ||
| 373 | 373 | ||
| 374 | d_char *html_button(d_char *s, char *clss, char *label) | ||
| 375 | { | ||
| 376 | xs *s1 = xs_fmt( | ||
| 377 | "<input type=\"submit\" name=\"action\" " | ||
| 378 | "class=\"snac-btn-%s\" value=\"%s\">\n", | ||
| 379 | clss, label); | ||
| 380 | |||
| 381 | return xs_str_cat(s, s1); | ||
| 382 | } | ||
| 383 | |||
| 384 | |||
| 374 | d_char *html_entry_controls(snac *snac, d_char *os, char *msg) | 385 | d_char *html_entry_controls(snac *snac, d_char *os, char *msg) |
| 375 | { | 386 | { |
| 376 | char *id = xs_dict_get(msg, "id"); | 387 | char *id = xs_dict_get(msg, "id"); |
| @@ -410,63 +421,30 @@ d_char *html_entry_controls(snac *snac, d_char *os, char *msg) | |||
| 410 | l = xs_dict_get(meta, "liked_by"); | 421 | l = xs_dict_get(meta, "liked_by"); |
| 411 | if (xs_list_in(l, snac->actor) == -1) { | 422 | if (xs_list_in(l, snac->actor) == -1) { |
| 412 | /* not already liked; add button */ | 423 | /* not already liked; add button */ |
| 413 | xs *s1 = xs_fmt( | 424 | s = html_button(s, "like", L("Like")); |
| 414 | "<input type=\"submit\" name=\"action\" " | ||
| 415 | "class=\"snac-btn-like\" value=\"%s\">\n", | ||
| 416 | L("Like") | ||
| 417 | ); | ||
| 418 | |||
| 419 | s = xs_str_cat(s, s1); | ||
| 420 | } | 425 | } |
| 421 | 426 | ||
| 422 | l = xs_dict_get(meta, "announced_by"); | 427 | l = xs_dict_get(meta, "announced_by"); |
| 423 | if (xs_list_in(l, snac->actor) == -1) { | 428 | if (xs_list_in(l, snac->actor) == -1) { |
| 424 | /* not already boosted; add button */ | 429 | /* not already boosted; add button */ |
| 425 | xs *s1 = xs_fmt( | 430 | s = html_button(s, "boost", L("Boost")); |
| 426 | "<input type=\"submit\" name=\"action\" " | ||
| 427 | "class=\"snac-btn-boost\" value=\"%s\">\n", | ||
| 428 | L("Boost") | ||
| 429 | ); | ||
| 430 | |||
| 431 | s = xs_str_cat(s, s1); | ||
| 432 | } | 431 | } |
| 433 | 432 | ||
| 434 | if (following_check(snac, actor)) { | 433 | if (following_check(snac, actor)) { |
| 435 | xs *s1 = xs_fmt( | 434 | s = html_button(s, "unfollow", L("Unfollow")); |
| 436 | "<input type=\"submit\" name=\"action\" " | ||
| 437 | "class=\"snac-btn-unfollow\" value=\"%s\">\n", | ||
| 438 | L("Unfollow") | ||
| 439 | ); | ||
| 440 | |||
| 441 | s = xs_str_cat(s, s1); | ||
| 442 | } | 435 | } |
| 443 | else { | 436 | else { |
| 444 | xs *s1 = xs_fmt( | 437 | s = html_button(s, "follow", L("Follow")); |
| 445 | "<input type=\"submit\" name=\"action\" " | 438 | s = html_button(s, "mute", L("MUTE")); |
| 446 | "class=\"snac-btn-follow\" value=\"%s\">\n" | ||
| 447 | "<input type=\"submit\" name=\"action\" " | ||
| 448 | "class=\"snac-btn-mute\" value=\"%s\">\n", | ||
| 449 | L("Follow"), | ||
| 450 | L("MUTE") | ||
| 451 | ); | ||
| 452 | |||
| 453 | s = xs_str_cat(s, s1); | ||
| 454 | } | 439 | } |
| 455 | } | 440 | } |
| 456 | 441 | ||
| 457 | { | 442 | s = html_button(s, "delete", L("Delete")); |
| 458 | xs *s1 = xs_fmt( | ||
| 459 | "<input type=\"submit\" name=\"action\" " | ||
| 460 | "class=\"snac-btn-delete\" value=\"%s\">\n", | ||
| 461 | L("Delete") | ||
| 462 | ); | ||
| 463 | |||
| 464 | s = xs_str_cat(s, s1); | ||
| 465 | } | ||
| 466 | 443 | ||
| 467 | s = xs_str_cat(s, "</form>\n"); | 444 | s = xs_str_cat(s, "</form>\n"); |
| 468 | 445 | ||
| 469 | { | 446 | { |
| 447 | /* the post textarea */ | ||
| 470 | xs *ct = xs_str_new(""); | 448 | xs *ct = xs_str_new(""); |
| 471 | 449 | ||
| 472 | xs *s1 = xs_fmt( | 450 | xs *s1 = xs_fmt( |