コミットを比較
5 コミット
d50e23172b
...
3e97e3c4f4
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
| 3e97e3c4f4 | |||
| b9c990d6b5 | |||
| 506c29a32d | |||
| 535e44c4e7 | |||
| ba39be8551 |
@@ -0,0 +1,44 @@
|
|||||||
|
export default class
|
||||||
|
CommonModule
|
||||||
|
{
|
||||||
|
static
|
||||||
|
isWide (chr)
|
||||||
|
{
|
||||||
|
return chr.match (/[^\x01-\x7f]/) !== null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
lenByFull (str)
|
||||||
|
{
|
||||||
|
return str.split ('').map (c => this.isWide (c) ? 1 : .5)
|
||||||
|
.reduce ((a, c) => a + c);
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
indexByFToC (str, index)
|
||||||
|
{
|
||||||
|
let i = 0;
|
||||||
|
let work = '';
|
||||||
|
|
||||||
|
for (let c of str)
|
||||||
|
{
|
||||||
|
work += c;
|
||||||
|
|
||||||
|
if (this.lenByFull (work) > index)
|
||||||
|
break;
|
||||||
|
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
midByFull (str, start, length)
|
||||||
|
{
|
||||||
|
const trimmedLeft = str.slice (this.indexByFToC (str, start));
|
||||||
|
|
||||||
|
return trimmedLeft.slice (0, this.indexByFToC (trimmedLeft, length));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -22,6 +22,12 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<?php if (!($available)): ?>
|
||||||
|
<div class="alert alert-danger" role="alert">
|
||||||
|
<strong>【警報】</strong>AIニジカが落ちてるぬ゛〜゛ん゛(泣)
|
||||||
|
</div>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
<div class="container my-5">
|
<div class="container my-5">
|
||||||
<div class="accordion mb-5" id="accordion-filter">
|
<div class="accordion mb-5" id="accordion-filter">
|
||||||
<div class="accordion-item">
|
<div class="accordion-item">
|
||||||
|
|||||||
@@ -7,6 +7,11 @@ const LOG_PATH = './log.txt';
|
|||||||
|
|
||||||
$log_data = [];
|
$log_data = [];
|
||||||
|
|
||||||
|
exec ("(ps -Af | grep -e '^miteruzo' | grep 'python3 main.py') && (ps -Af | grep -e '^miteruzo' | grep 'obs')",
|
||||||
|
$output, $exit_code);
|
||||||
|
$available = $exit_code === 0;
|
||||||
|
unset ($output, $exit_code);
|
||||||
|
|
||||||
$page = (int) ($_GET['p'] ?? 1);
|
$page = (int) ($_GET['p'] ?? 1);
|
||||||
$length = (int) ($_GET['max'] ?? 20);
|
$length = (int) ($_GET['max'] ?? 20);
|
||||||
$asc = ($_GET['asc'] ?? 0) != 0;
|
$asc = ($_GET['asc'] ?? 0) != 0;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<canvas id="canvas"></canvas>
|
<canvas id="canvas"></canvas>
|
||||||
|
|
||||||
<script src="./talk.js?<?= filemtime ('./talk.js') ?>" type="text/javascript"></script>
|
<script src="./talk.js?<?= filemtime ('./talk.js') ?>" type="module"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
+22
-2
@@ -1,3 +1,6 @@
|
|||||||
|
import CommonModule from './common_module.js';
|
||||||
|
|
||||||
|
|
||||||
class
|
class
|
||||||
Talk
|
Talk
|
||||||
{
|
{
|
||||||
@@ -46,10 +49,27 @@ Canvas
|
|||||||
this.putText (0, 0, 15, $ ('#dt').val ());
|
this.putText (0, 0, 15, $ ('#dt').val ());
|
||||||
this.putImage (this.nizika, 370, 260, 1.1);
|
this.putImage (this.nizika, 370, 260, 1.1);
|
||||||
this.putImage (this.talking, 0, 0, 640 / 1024);
|
this.putImage (this.talking, 0, 0, 640 / 1024);
|
||||||
this.putText (75, 43.75, 20, '> ' + $ ('#chat').val (),
|
this.putText (75, 43.75, 20,
|
||||||
|
('> ' + ((CommonModule.lenByFull ($ ('#chat').val ()) <= 21)
|
||||||
|
? $ ('#chat').val ()
|
||||||
|
: (CommonModule.midByFull ($ ('#chat').val (), 0, 19.5)
|
||||||
|
+ '...'))),
|
||||||
undefined, undefined,
|
undefined, undefined,
|
||||||
true);
|
true);
|
||||||
this.putText (62.5, 93.75, 31.25, $ ('#answer').val (), 'Nikumaru', '#c00000');
|
this.putText (62.5, 93.75, 31.25,
|
||||||
|
((CommonModule.lenByFull ($ ('#answer').val ()) <= 16)
|
||||||
|
? $ ('#answer').val ()
|
||||||
|
: CommonModule.midByFull ($ ('#answer').val (), 0, 16)),
|
||||||
|
'Nikumaru', '#c00000');
|
||||||
|
if (CommonModule.lenByFull ($ ('#answer').val ()) > 16)
|
||||||
|
{
|
||||||
|
this.putText (62.5, 125, 31.25,
|
||||||
|
((CommonModule.lenByFull ($ ('#answer').val ()) <= 32)
|
||||||
|
? CommonModule.midByFull ($ ('#answer').val (), 16, 16)
|
||||||
|
: (CommonModule.midByFull ($ ('#answer').val (), 16, 14.5)
|
||||||
|
+ '...')),
|
||||||
|
'Nikumaru', '#c00000');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
putBG ()
|
putBG ()
|
||||||
|
|||||||
+3
-3
@@ -3,9 +3,9 @@
|
|||||||
if ($_SERVER['HTTP_HOST'] === 'nizika.monster')
|
if ($_SERVER['HTTP_HOST'] === 'nizika.monster')
|
||||||
header ('location: //nizika.tv/talk.php');
|
header ('location: //nizika.tv/talk.php');
|
||||||
|
|
||||||
$dt = $_GET['dt'];
|
$dt = htmlspecialchars ($_GET['dt']);
|
||||||
$chat = $_GET['chat'];
|
$chat = htmlspecialchars ($_GET['chat']);
|
||||||
$answer = $_GET['answer'];
|
$answer = htmlspecialchars ($_GET['answer']);
|
||||||
|
|
||||||
require_once './talk.frm.php';
|
require_once './talk.frm.php';
|
||||||
|
|
||||||
|
|||||||
新しい課題から参照
ユーザをブロックする