mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-02-16 11:02:40 +01:00
New post form part one
This commit is contained in:
parent
0bbae23680
commit
c04d46933e
@ -2410,33 +2410,19 @@ function shell_exec_error($command, $suppress_stdout = false) {
|
||||
*/
|
||||
function diceRoller($post) {
|
||||
global $config;
|
||||
if(strpos(strtolower($post->email), 'dice%20') === 0) {
|
||||
$dicestr = str_split(substr($post->email, strlen('dice%20')));
|
||||
|
||||
if (isset($_POST['dx'], $_POST['dy'], $_POST['dz']) && !empty($_POST['dy'])) {
|
||||
// Get params
|
||||
$diceX = '';
|
||||
$diceY = '';
|
||||
$diceZ = '';
|
||||
|
||||
$curd = 'diceX';
|
||||
for($i = 0; $i < count($dicestr); $i ++) {
|
||||
if(is_numeric($dicestr[$i])) {
|
||||
$$curd .= $dicestr[$i];
|
||||
} else if($dicestr[$i] == 'd') {
|
||||
$curd = 'diceY';
|
||||
} else if($dicestr[$i] == '-' || $dicestr[$i] == '+') {
|
||||
$curd = 'diceZ';
|
||||
$$curd = $dicestr[$i];
|
||||
}
|
||||
}
|
||||
$diceX = $_POST['dx'];
|
||||
$diceY = $_POST['dy'];
|
||||
$diceZ = $_POST['dz'];
|
||||
|
||||
// Default values for X and Z
|
||||
if($diceX == '') {
|
||||
$diceX = '1';
|
||||
$diceX = 1;
|
||||
}
|
||||
|
||||
if($diceZ == '') {
|
||||
$diceZ = '+0';
|
||||
$diceZ = 0;
|
||||
}
|
||||
|
||||
// Intify them
|
||||
@ -2453,6 +2439,10 @@ function diceRoller($post) {
|
||||
$diceX = 200;
|
||||
}
|
||||
|
||||
if (abs($diceZ) > 1000000) {
|
||||
$diceZ = 0;
|
||||
}
|
||||
|
||||
// Continue only if we have valid values
|
||||
if($diceX > 0 && $diceY > 0) {
|
||||
$dicerolls = array();
|
||||
@ -2466,7 +2456,8 @@ function diceRoller($post) {
|
||||
// Prepend the result to the post body
|
||||
$modifier = ($diceZ != 0) ? ((($diceZ < 0) ? ' - ' : ' + ') . abs($diceZ)) : '';
|
||||
$dicesum = ($diceX > 1) ? ' = ' . $dicesum : '';
|
||||
$post->body = '<table class="diceroll"><tr><td><img src="'.$config['dir']['static'].'d10.svg" alt="Dice roll" width="24"></td><td>Rolled ' . implode(', ', $dicerolls) . $modifier . $dicesum . '</td></tr></table><br/>' . $post->body;
|
||||
$rollstring = "{$diceX}d{$diceY}";
|
||||
$post->body = '<table class="diceroll"><tr><td><img src="'.$config['dir']['static'].'d10.svg" alt="Dice roll" width="24"></td><td>Rolled ' . implode(', ', $dicerolls) . $modifier . $dicesum . " ($rollstring)</td></tr></table><br/>" . $post->body;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -137,13 +137,13 @@
|
||||
$config['additional_javascript'][] = 'js/catalog-search.js';
|
||||
$config['additional_javascript'][] = 'js/thread-stats.js';
|
||||
$config['additional_javascript'][] = 'js/quote-selection.js';
|
||||
$config['additional_javascript'][] = 'js/twemoji/twemoji.js';
|
||||
$config['additional_javascript'][] = 'js/flag-previews.js';
|
||||
$config['additional_javascript'][] = 'js/post-menu.js';
|
||||
$config['additional_javascript'][] = 'js/post-filter.js';
|
||||
$config['additional_javascript'][] = 'js/fix-report-delete-submit.js';
|
||||
$config['additional_javascript'][] = 'js/image-hover.js';
|
||||
$config['additional_javascript'][] = 'js/auto-scroll.js';
|
||||
$config['additional_javascript'][] = 'js/twemoji/twemoji.js';
|
||||
|
||||
//$config['font_awesome_css'] = '/netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css';
|
||||
|
||||
|
@ -103,7 +103,7 @@ $(window).ready(function() {
|
||||
$(form).find('input[type="submit"]').val(submit_txt);
|
||||
$(form).find('input[type="submit"]').removeAttr('disabled');
|
||||
$(form).find('input[name="subject"],input[name="file_url"],\
|
||||
textarea[name="body"],input[type="file"]').val('').change();
|
||||
textarea[name="body"],input[type="file"],input[name="embed"]').val('').change();
|
||||
},
|
||||
cache: false,
|
||||
contentType: false,
|
||||
|
@ -98,9 +98,6 @@
|
||||
#quick-reply .nonsense {\
|
||||
display: none;\
|
||||
}\
|
||||
#quick-reply td.submit {\
|
||||
width: 1%;\
|
||||
}\
|
||||
#quick-reply td.recaptcha {\
|
||||
text-align: center;\
|
||||
padding: 0 0 1px 0;\
|
||||
@ -257,7 +254,7 @@
|
||||
}
|
||||
|
||||
// Remove mod controls, because it looks shit.
|
||||
if ($td.find('input[type="checkbox"]').length) {
|
||||
/*if ($td.find('input[type="checkbox"]').length) {
|
||||
var tr = this;
|
||||
$td.find('input[type="checkbox"]').each(function() {
|
||||
if ($(this).attr('name') == 'spoiler') {
|
||||
@ -272,7 +269,7 @@
|
||||
$(tr).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
}*/
|
||||
|
||||
$td.find('small').hide();
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ tb_settings['quick-reply'] = {
|
||||
// Show remote in quick reply
|
||||
show_remote: false,
|
||||
// Show embedding in quick reply
|
||||
show_embed: false
|
||||
show_embed: true
|
||||
};
|
||||
|
||||
// ajax.js
|
||||
|
@ -79,10 +79,6 @@ header div.subtitle {
|
||||
font-size: 8pt;
|
||||
}
|
||||
|
||||
form {
|
||||
margin-bottom: 4em;
|
||||
}
|
||||
|
||||
form table {
|
||||
margin: auto;
|
||||
}
|
||||
@ -131,7 +127,10 @@ form table tr th {
|
||||
form table tr td div.center {
|
||||
text-align: center;
|
||||
float: left;
|
||||
padding-left: 3px;
|
||||
padding: 3px;
|
||||
padding-top: 0px;
|
||||
border: 1px dashed black;
|
||||
margin: 2px
|
||||
}
|
||||
|
||||
form table tr td div input {
|
||||
@ -261,6 +260,11 @@ p.intro a {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.sage {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
div.delete {
|
||||
float: right;
|
||||
}
|
||||
@ -1035,3 +1039,9 @@ div.mix {
|
||||
display: block!important;
|
||||
font-size: 12pt;
|
||||
}
|
||||
|
||||
.dx,.dy,.dz {
|
||||
width: 30px;
|
||||
text-align: right;
|
||||
display: inline-block;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
<table>
|
||||
{% if not config.field_disable_name or (mod and post.mod|hasPermission(config.mod.bypass_field_disable, board.uri)) %}<tr>
|
||||
<th>
|
||||
{% trans %}Name{% endtrans %}
|
||||
{% trans %}Name{% endtrans %} <span class="unimportant optional-text">{% trans %}(optional){% endtrans %}</span>
|
||||
{{ antibot.html() }}
|
||||
</th>
|
||||
<td>
|
||||
@ -21,7 +21,7 @@
|
||||
</tr>{% endif %}
|
||||
{% if not config.field_disable_email or (mod and post.mod|hasPermission(config.mod.bypass_field_disable, board.uri)) %}<tr>
|
||||
<th>
|
||||
{% trans %}Email{% endtrans %}
|
||||
{% trans %}Email{% endtrans %} <span class="unimportant optional-text">{% trans %}(optional){% endtrans %}</span>
|
||||
{{ antibot.html() }}
|
||||
</th>
|
||||
<td>
|
||||
@ -36,19 +36,19 @@
|
||||
{% endif %}
|
||||
{{ antibot.html() }}
|
||||
{% if not (not (config.field_disable_subject or (id and config.field_disable_reply_subject)) or (mod and post.mod|hasPermission(config.mod.bypass_field_disable, board.uri))) %}
|
||||
<input accesskey="s" style="margin-left:2px;" type="submit" name="post" value="{% if id %}{{ config.button_reply }}{% else %}{{ config.button_newtopic }}{% endif %}" />{% if config.spoiler_images %} <input id="spoiler" name="spoiler" type="checkbox"> <label for="spoiler">{% trans %}Spoiler Image{% endtrans %}</label> {% endif %}
|
||||
<input accesskey="s" style="margin-left:2px;" type="submit" name="post" value="{% if id %}{{ config.button_reply }}{% else %}{{ config.button_newtopic }}{% endif %}" />
|
||||
{% endif %}
|
||||
{{ antibot.html() }}
|
||||
</td>
|
||||
</tr>{% endif %}
|
||||
{% if not (config.field_disable_subject or (id and config.field_disable_reply_subject)) or (mod and post.mod|hasPermission(config.mod.bypass_field_disable, board.uri)) %}<tr>
|
||||
<th>
|
||||
{% trans %}Subject{% endtrans %}
|
||||
{% trans %}Subject{% endtrans %} {% if not config.force_subject_op or id %}<span class="unimportant optional-text">{% trans %}(optional){% endtrans %}</span>{% endif %}
|
||||
{{ antibot.html() }}
|
||||
</th>
|
||||
<td>
|
||||
<input style="float:left;" type="text" name="subject" size="25" maxlength="100" autocomplete="off">
|
||||
<input accesskey="s" style="margin-left:2px;" type="submit" name="post" value="{% if id %}{{ config.button_reply }}{% else %}{{ config.button_newtopic }}{% endif %}" />{% if config.spoiler_images %} <input id="spoiler" name="spoiler" type="checkbox"> <label for="spoiler">{% trans %}Spoiler Image{% endtrans %}</label>{% endif %}
|
||||
<input accesskey="s" style="margin-left:2px;" type="submit" name="post" value="{% if id %}{{ config.button_reply }}{% else %}{{ config.button_newtopic }}{% endif %}" />
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
@ -98,7 +98,7 @@
|
||||
|
||||
{% if config.user_flag %}
|
||||
<tr>
|
||||
<th>{% trans %}Flag{% endtrans %}</th>
|
||||
<th>{% trans %}Flag{% endtrans %} <span class="unimportant optional-text">{% trans %}(optional){% endtrans %}</span></th>
|
||||
<td>
|
||||
<select name="user_flag" id="user_flag">
|
||||
<option value="">{% trans %}None{% endtrans %}</option>
|
||||
@ -113,7 +113,7 @@
|
||||
{% if not config.disable_images %}
|
||||
<tr id="upload">
|
||||
<th>
|
||||
{% trans %}File{% endtrans %}
|
||||
{% trans %}File{% endtrans %} {% if not config.force_image_op or id %}<span class="unimportant optional-text">{% trans %}(optional){% endtrans %}</span>{% endif %}
|
||||
</th>
|
||||
<td>
|
||||
<input type="file" name="file" id="upload_file">
|
||||
@ -130,7 +130,7 @@
|
||||
{% if config.enable_embedding %}
|
||||
<tr id="upload_embed">
|
||||
<th>
|
||||
{% trans %}Embed{% endtrans %}
|
||||
{% trans %}Embed{% endtrans %} {% if not config.force_image_op or id %}<span class="unimportant optional-text">{% trans %}(optional){% endtrans %}</span>{% else %}<span class="unimportant optional-text">{% trans %}(or file){% endtrans %}</span>{% endif %}
|
||||
{{ antibot.html() }}
|
||||
</th>
|
||||
<td>
|
||||
@ -138,34 +138,47 @@
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if (mod and ((not id and post.mod|hasPermission(config.mod.sticky, board.uri)) or (not id and post.mod|hasPermission(config.mod.lock, board.uri)) or post.mod|hasPermission(config.mod.rawhtml, board.uri))) or (config.allow_no_country and config.country_flags) %}
|
||||
<tr>
|
||||
<tr id="options-row">
|
||||
<th>
|
||||
{% trans %}Flags{% endtrans %}
|
||||
{% trans %}Options{% endtrans %}
|
||||
</th>
|
||||
<td>
|
||||
{% if config.allow_no_country and config.country_flags %}<div class="center">
|
||||
<div class="center no-bump-option">
|
||||
<label for="no-bump">{% trans %}No bump{% endtrans %}</label>
|
||||
<input title="No bump" id="no-bump" name="no-bump" type="checkbox">
|
||||
</div>
|
||||
|
||||
{% if config.spoiler_images %}<div class="center spoiler-images-option">
|
||||
<label for="spoiler">{% trans %}Spoiler images{% endtrans %}</label>
|
||||
<input title="Spoiler images" id="spoiler" name="spoiler" type="checkbox">
|
||||
</div>{% endif %}
|
||||
|
||||
{% if config.allow_no_country and config.country_flags %}<div class="center no-country-option">
|
||||
<label for="no_country">{% trans %}No country flag{% endtrans %}</label>
|
||||
<input title="No country flag" id="no_country" name="no_country" type="checkbox">
|
||||
</div>{% endif %}
|
||||
|
||||
{% if mod %}
|
||||
{% if not id and post.mod|hasPermission(config.mod.sticky, board.uri) %}<div class="center">
|
||||
<label for="sticky">{% trans %}Sticky{% endtrans %}</label>
|
||||
<input title="{% trans %}Sticky{% endtrans %}" type="checkbox" name="sticky" id="sticky"><br>
|
||||
{% if config.allow_roll %}<div class="center dice-option">
|
||||
<label for="dy">{% trans %}Dice{% endtrans %}</label>
|
||||
<div><input class="dx" name="dx" type="number">d<input class="dy" name="dy" type="number">±<input class="dz" name="dz" type="number"></div>
|
||||
</div>{% endif %}
|
||||
{% if not id and post.mod|hasPermission(config.mod.lock, board.uri) %}<div class="center">
|
||||
|
||||
{% if mod %}
|
||||
{% if not id and post.mod|hasPermission(config.mod.sticky, board.uri) %}<div class="center sticky-option">
|
||||
<label for="sticky">{% trans %}Sticky{% endtrans %}</label>
|
||||
<input title="{% trans %}Sticky{% endtrans %}" type="checkbox" name="sticky" id="sticky">
|
||||
</div>{% endif %}
|
||||
{% if not id and post.mod|hasPermission(config.mod.lock, board.uri) %}<div class="center lock-option">
|
||||
<label for="lock">{% trans %}Lock{% endtrans %}</label><br>
|
||||
<input title="{% trans %}Lock{% endtrans %}" type="checkbox" name="lock" id="lock">
|
||||
</div>{% endif %}
|
||||
{% if post.mod|hasPermission(config.mod.rawhtml, board.uri) %}<div class="center">
|
||||
{% if post.mod|hasPermission(config.mod.rawhtml, board.uri) %}<div class="center raw-html-option">
|
||||
<label for="raw">{% trans %}Raw HTML{% endtrans %}</label><br>
|
||||
<input title="{% trans %}Raw HTML{% endtrans %}" type="checkbox" name="raw" id="raw">
|
||||
</div>{% endif %}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if not config.field_disable_password or (mod and post.mod|hasPermission(config.mod.bypass_field_disable, board.uri)) %}<tr>
|
||||
<th>
|
||||
{% trans %}Password{% endtrans %}
|
||||
@ -198,7 +211,5 @@ Max filesize is {{ config.max_filesize|filesize }}.<br />
|
||||
Max image dimensions are {{ config.max_height }} x {{ config.max_width }}.<br />
|
||||
You may upload {{ config.max_images }} per post.<br />
|
||||
{% endif %}
|
||||
{% if config.allow_roll %}
|
||||
You may roll dice on this board, type "dice XdY+Z" in the email field where X is number of dice, Y is max roll and Z is modifier.<br />
|
||||
{% endif %}
|
||||
<strong class="faq-message"><br />Confused? See the <a href="/faq.html">FAQ</a>.</strong>
|
||||
</p>
|
||||
|
Loading…
x
Reference in New Issue
Block a user