Refactor CSS

This commit is contained in:
ruan 2018-03-13 12:08:53 +02:00
parent b51d269b30
commit 78cec5c94b
No known key found for this signature in database
GPG Key ID: 0D2EC1C52E469C0B
5 changed files with 69 additions and 42 deletions

View File

@ -158,11 +158,9 @@ try {
$page->set_info($page->type_info($type)); $page->set_info($page->type_info($type));
$style = 'style="font-size: 13px;"';
$label_type = $page->type; $label_type = $page->type;
$label_name = Info::create($row, $page, $label_type)->name(); //ucfirst($label_type); $label_name = Info::create($row, $page, $label_type)->name(); //ucfirst($label_type);
$label = "<span $style class='label label-$label_type'>$label_name</span>"; $label = "<span class='label litebans-label-history litebans-label-$label_type'>$label_name</span>";
$page->print_table_rows($row, array( $page->print_table_rows($row, array(
$page->t("generic.type") => $label, $page->t("generic.type") => $label,

View File

@ -1,28 +1,50 @@
.noselect {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.avatar { .avatar {
margin-bottom: 5px; margin-bottom: 5px;
margin-right: 5px; margin-right: 5px;
border-radius: 2px; border-radius: 2px;
} }
/* header */
.col-lg-12 {
text-align: center;
}
/* tables */
th {
text-align: center;
}
table tr td { table tr td {
padding-left: 0; padding-left: 0;
padding-right: 0; padding-right: 0;
vertical-align: middle !important; vertical-align: middle !important;
} }
/* table links */
a,
a:hover,
a:focus {
text-decoration: none !important;
}
tr.hover {
cursor: pointer;
}
/* pager */
.litebans-pager { .litebans-pager {
font-size: 30px; font-size: 30px;
} }
.litebans-pager-number {
margin-top: 32px;
text-align: center;
font-size: 15px;
}
.litebans-pager-left { .litebans-pager-left {
float: left; float: left;
} }
@ -39,29 +61,44 @@ table tr td {
color: transparent; color: transparent;
} }
/* table links */ /* index.php */
a, .litebans-index {
a:hover, text-align: center;
a:focus {
text-decoration: none !important;
} }
tr.hover { /* info.php */
cursor: pointer; .litebans-label-info {
margin-left: 13px;
font-size: 17px;
} }
.label-ban { /* history.php */
.litebans-label-history {
font-size: 13px;
}
.litebans-label-ban {
background-color: darkred; background-color: darkred;
} }
.label-mute { .litebans-label-mute {
background-color: dimgrey; background-color: dimgrey;
} }
.label-warn { .litebans-label-warn {
background-color: darkorange; background-color: darkorange;
} }
.label-kick { .litebans-label-kick {
background-color: tomato; background-color: tomato;
} }
/* prevent mouse selection */
.noselect {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}

View File

@ -404,20 +404,13 @@ class Page {
$type = $this->type; $type = $this->type;
echo "<tr>"; echo "<tr>";
foreach ($array as $header => $text) { foreach ($array as $header => $text) {
$style = "";
if ($header === $this->t("bans_reason") || $header === $this->t("mutes_reason") || $header === $this->t("warns_reason") || $header == $this->t("kicks_reason")) {
$style = "style=\"width: 30%;\"";
if ($text === "") {
$text = "-";
}
}
$a = "a"; $a = "a";
if ($header === $this->t("warnings.received")) { if ($header === $this->t("warnings.received")) {
$icon = ($text !== "0") ? "glyphicon-ok" : "glyphicon-remove"; $icon = ($text !== "0") ? "glyphicon-ok" : "glyphicon-remove";
$a .= " class=\"glyphicon $icon\" aria-hidden=true"; $a .= " class=\"glyphicon $icon\" aria-hidden=true";
$text = ""; $text = "";
} }
echo "<td $style><$a href=\"info.php?type=$type&id=$id\">$text</a></td>"; echo "<td><$a href=\"info.php?type=$type&id=$id\">$text</a></td>";
} }
echo "</tr>"; echo "</tr>";
} }
@ -425,7 +418,7 @@ class Page {
function table_print_headers($headers) { function table_print_headers($headers) {
echo "<thead><tr>"; echo "<thead><tr>";
foreach ($headers as $header) { foreach ($headers as $header) {
echo "<th><div style=\"text-align: center;\">$header</div></th>"; echo "<th>$header</th>";
} }
echo "<tbody>"; echo "<tbody>";
} }
@ -438,9 +431,9 @@ class Page {
echo '<div class="container">'; echo '<div class="container">';
} }
echo "<div class=\"row\"><div style=\"text-align: center;\" class=\"col-lg-12\"><h1 class=\"modal-header\">$title</h1></div></div>"; echo "<div class=\"row\"><div class=\"col-lg-12\"><h1 class=\"modal-header\">$title</h1></div></div>";
if ($container_start) { if ($container_start) {
echo '<div class="row"><div style="text-align: center;" class="col-lg-12">'; echo '<div class="row"><div class="col-lg-12">';
} }
} }
@ -493,7 +486,7 @@ class Page {
if ($next_active) { if ($next_active) {
$pager_next = "<a href=\"$page?page={$next}{$args}\">$pager_next</a>"; $pager_next = "<a href=\"$page?page={$next}{$args}\">$pager_next</a>";
} }
$pager_count = '<div style=\"margin-top: 32px;\"><div style=\"text-align: center; font-size:15px;\">' . $this->t("table.pager.number") . ' ' . $cur . '/' . $pages . '</div></div>'; $pager_count = '<div><div class="litebans-pager-number">' . $this->t("table.pager.number") . ' ' . $cur . '/' . $pages . '</div></div>';
echo "$pager_prev $pager_next $pager_count"; echo "$pager_prev $pager_next $pager_count";
} }

View File

@ -6,11 +6,11 @@ $page->print_title();
?> ?>
<div class="container"> <div class="container">
<div class="jumbotron"> <div class="jumbotron">
<div style="text-align: center;"> <div class="litebans-index">
<h2><?php echo str_replace("{server}", $page->settings->name, $page->t("index.welcome.main")); ?></h2> <h2><?php echo str_replace("{server}", $page->settings->name, $page->t("index.welcome.main")); ?></h2>
</div> </div>
<div style="text-align: center;"><p><?php echo $page->t("index.welcome.sub"); ?></p></div> <div class="litebans-index"><p><?php echo $page->t("index.welcome.sub"); ?></p></div>
</div> </div>
</div> </div>
<?php $page->print_footer(false); ?> <?php $page->print_footer(false); ?>

View File

@ -152,7 +152,6 @@ if ($st->execute(array($id))) {
$header = $page->name; $header = $page->name;
if (!($info instanceof KickInfo)) { if (!($info instanceof KickInfo)) {
$style = 'style="margin-left: 13px; font-size: 16px;"';
$active = $page->active($row); $active = $page->active($row);
$ipban = $page->active($row, 'ipban'); $ipban = $page->active($row, 'ipban');
if ($ipban === true) { if ($ipban === true) {
@ -163,16 +162,16 @@ if ($st->execute(array($id))) {
$idx = "generic.ipmute"; $idx = "generic.ipmute";
} }
if ($idx !== null) { if ($idx !== null) {
$header .= "<span $style class='label label-danger'>" . $page->t($idx) . "</span>"; $header .= "<span class='label label-danger litebans-label-info'>" . $page->t($idx) . "</span>";
} }
} }
if ($active === true) { if ($active === true) {
$header .= "<span $style class='label label-danger'>" . $page->t("generic.active") . "</span>"; $header .= "<span class='label label-danger litebans-label-info'>" . $page->t("generic.active") . "</span>";
if ($permanent) { if ($permanent) {
$header .= "<span $style class='label label-danger'>" . $page->t("generic.permanent") . "</span>"; $header .= "<span class='label label-danger litebans-label-info'>" . $page->t("generic.permanent") . "</span>";
} }
} else { } else {
$header .= "<span $style class='label label-warning'>" . $page->t("generic.inactive") . "</span>"; $header .= "<span class='label label-warning litebans-label-info'>" . $page->t("generic.inactive") . "</span>";
} }
} }
$page->print_header(true, $header); $page->print_header(true, $header);