add clear shout box

This commit is contained in:
xiaomlove
2022-10-23 19:42:08 +08:00
parent c98e5153d5
commit 71bd2ad3f7
5 changed files with 39 additions and 2 deletions

View File

@@ -137,10 +137,33 @@ if ($showfunbox_main == "yes" && (!isset($CURUSER) || $CURUSER['showfb'] == "yes
// ------------- start: shoutbox ------------------//
if ($showshoutbox_main == "yes") {
?>
<h2><?php echo $lang_index['text_shoutbox'] ?> - <font class="small"><?php echo $lang_index['text_auto_refresh_after']?></font><font class='striking' id="countdown"></font><font class="small"><?php echo $lang_index['text_seconds']?></font></h2>
<h2>
<?php echo $lang_index['text_shoutbox'] ?> - <font class="small"><?php echo $lang_index['text_auto_refresh_after']?></font>
<font class='striking' id="countdown"></font><font class="small"><?php echo $lang_index['text_seconds']?></font>
<?php
if (user_can('sbmanage')) {
echo ' - <font class="small" id="clear-shout-box">[<a class="altlink" href="javascript:;"><b>'.$lang_index['clear_shout_box'].'</b></a>]</font>';
$clearShoutBoxJs = <<<JS
jQuery('#clear-shout-box').on("click", function () {
layer.confirm("{$lang_index['sure_to_clear_shout_box']}", {title: "Info", btn: ['Yes', "Cancel"], btnAlign: 'c'}, function (layerIndex) {
jQuery.post("ajax.php", {"action": "clearShoutBox"}, function (response) {
layer.close(layerIndex)
if (response.ret != 0) {
layer.alert(response.msg, {title: "Info", btn: ['OK', 'Cancel'], btnAlign: 'c'})
} else {
document.getElementById('iframe-shout-box').src='shoutbox.php?type=shoutbox';
}
}, "json")
})
})
JS;
\Nexus\Nexus::js($clearShoutBoxJs, 'footer', false);
}
?>
</h2>
<?php
print("<table width=\"100%\"><tr><td class=\"text\">\n");
print("<iframe src='shoutbox.php?type=shoutbox' width='100%' height='180' frameborder='0' name='sbox' marginwidth='0' marginheight='0'></iframe><br /><br />\n");
print("<iframe id='iframe-shout-box' src='shoutbox.php?type=shoutbox' width='100%' height='180' frameborder='0' name='sbox' marginwidth='0' marginheight='0'></iframe><br /><br />\n");
print("<form action='shoutbox.php' method='get' target='sbox' name='shbox'>\n");
print('<div style="display: flex">');
print("<label for='shbox_text'>".$lang_index['text_message']."</label><input type='text' name='shbox_text' id='shbox_text' size='100' style='flex-grow: 1; border: 1px solid gray;' /> <input type='submit' id='hbsubmit' class='btn' name='shout' value=\"".$lang_index['sumbit_shout']."\" />");