みてるぞ 9 months ago
parent
commit
88bba81cd6
4 changed files with 73 additions and 4 deletions
  1. BIN
      broadcast/favicon.ico
  2. +28
    -4
      broadcast/index.frm.php
  3. +15
    -0
      broadcast/index.php
  4. +30
    -0
      broadcast/script.js

BIN
broadcast/favicon.ico View File

Before After

+ 28
- 4
broadcast/index.frm.php View File

@@ -3,7 +3,11 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous" />
<script src="//code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="//code.jquery.com/ui/1.12.0/jquery-ui.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1/i18n/jquery.ui.datepicker-ja.min.js"></script>
<link href="//cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/themes/base/jquery-ui.min.css" />
<link href="./style.css" rel="stylesheet" />
<title>伊地知ニジカ放送局 - ニジカ返答ログ</title>
</head>
@@ -43,6 +47,20 @@
</div>
</div>

<div class="row d-flex align-items-center my-2">
<div class="col-4 fw-bold">
日時ニジカ
</div>

<div class="col input-group">
<input type="text" class="form-control" placeholder="YYYY-MM-DD" id="filter-date-start"
value="<?= $date_start ?>" />
<span class="input-group-text">〜</span>
<input type="text" class="form-control" placeholder="YYYY-MM-DD" id="filter-date-end"
value="<?= $date_end ?>" />
</div>
</div>

<div class="row d-flex align-items-center my-2">
<div class="col-4 fw-bold">
フリーワード
@@ -55,8 +73,14 @@
</div>
</div>

<div class="d-grid gap-2 mt-3">
<button type="button" class="btn btn-primary" id="btn-filter">絞り込む</button>
<div class="mt-3 row">
<div class="col gap-2 d-grid">
<button type="button" class="btn btn-secondary" id="btn-reset">元に戻す</button>
</div>

<div class="col gap-2 d-grid">
<button type="button" class="btn btn-primary" id="btn-filter">絞り込む</button>
</div>
</div>
</div>
</div>
@@ -102,7 +126,7 @@
<?php endif ?>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<script src="//cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<script src="./script.js" type="text/javascript"></script>
</body>
</html>


+ 15
- 0
broadcast/index.php View File

@@ -13,6 +13,9 @@ $asc = ($_GET['asc'] ?? 0) != 0;
$keyword = trim ($_GET['q'] ?? '');
$escaped = ($_GET['escaped'] ?? 0) != 0;

$date_start = ($_GET['start'] ?? null) ?: null;
$date_end = ($_GET['end'] ?? null) ?: null;

$f = fopen (LOG_PATH, 'r');

if ($f !== false)
@@ -41,6 +44,18 @@ if ($keyword != '')
!== false));
}

if ($date_start)
{
$log_data = array_filter ($log_data, fn ($row) => (
substr ($row['date_time'], 0, 10) >= $date_start));
}

if ($date_end)
{
$log_data = array_filter ($log_data, fn ($row) => (
substr ($row['date_time'], 0, 10) <= $date_end));
}

$pages_max = (int) ((count ($log_data) - 1) / $length) + 1;

if (!($asc))


+ 30
- 0
broadcast/script.js View File

@@ -4,6 +4,12 @@ Script
static
main ()
{
const dateOptions = {dateFormat: 'yy-mm-dd',
firstDay: 6};

$ ('#filter-date-start').datepicker (dateOptions);
$ ('#filter-date-end').datepicker (dateOptions);

const url = new URL (window.location.href);

const orderAsc = document.getElementById ('order-asc');
@@ -14,6 +20,14 @@ Script
const filter = (
function (e)
{
let dateStart = $ ('#filter-date-start').val ();
let dateEnd = $ ('#filter-date-end').val ();

if ((dateStart !== '')
&& (dateEnd !== '')
&& (dateStart > dateEnd))
[dateStart, dateEnd] = [dateEnd, dateStart];

url.searchParams.delete ('p');

url.searchParams.delete ('asc');
@@ -22,9 +36,24 @@ Script
url.searchParams.delete ('q');
url.searchParams.append ('q', filterKeyword.value);

url.searchParams.delete ('start');
url.searchParams.delete ('end');

if (dateStart !== '')
url.searchParams.append ('start', dateStart);

if (dateEnd !== '')
url.searchParams.append ('end', dateEnd);

window.location.href = url;
});

const resetFilter = (
function ()
{
window.location.href = '/';
});

filterKeyword.addEventListener ('keydown',
function (e)
{
@@ -33,6 +62,7 @@ Script
});

btnFilter.addEventListener ('click', filter);
$ ('#btn-reset').on ('click', resetFilter);
}

static


Loading…
Cancel
Save