fdsfdsfsd
This commit is contained in:
parent
96f98210de
commit
3d848d67a6
6 changed files with 46 additions and 82 deletions
|
@ -248,45 +248,6 @@ document.onpaste = function(event) {
|
|||
}
|
||||
}
|
||||
|
||||
function markdown(first, second) {
|
||||
var input = document.getElementById(first).value;
|
||||
|
||||
var emojis = Array.from(input.matchAll(/:(.{1,30}?):/gi))
|
||||
if(emojis != null){
|
||||
for(i = 0; i < emojis.length; i++){
|
||||
var emoji = emojis[i][0]
|
||||
var remoji = emoji.replace(/:/g,'');
|
||||
if (remoji.startsWith("!#") || remoji.startsWith("#!"))
|
||||
{
|
||||
input = input.replace(emoji, "<img class='emj mirrored' src='/assets/images/emojis/" + remoji.substring(2) + ".webp'>")
|
||||
} else if (remoji.startsWith("#"))
|
||||
{
|
||||
input = input.replace(emoji, "<img class='emj' src='/assets/images/emojis/" + remoji.substring(1) + ".webp'>")
|
||||
} else if (remoji.startsWith("!"))
|
||||
{
|
||||
input = input.replace(emoji, "<img height=30 class='emj mirrored' src='/assets/images/emojis/" + remoji.substring(1) + ".webp'>")
|
||||
} else {
|
||||
input = input.replace(emoji, "<img height=30 class='emj' src='/assets/images/emojis/" + remoji + ".webp'>")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!first.includes('edit'))
|
||||
{
|
||||
var options = Array.from(input.matchAll(/\s*\$\$([^\$\n]+)\$\$\s*/gi))
|
||||
if(options != null){
|
||||
for(i = 0; i < options.length; i++){
|
||||
var option = options[i][0];
|
||||
var option2 = option.replace(/\$\$/g, '').replace(/\n/g, '')
|
||||
input = input.replace(option, '');
|
||||
input += '<div class="custom-control"><input type="checkbox" class="custom-control-input" id="' + option2 + '"><label class="custom-control-label" for="' + option2 + '">' + option2 + ' - <a>0 votes</a></label></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById(second).innerHTML = marked(input)
|
||||
}
|
||||
|
||||
function poll_vote(cid, parentid) {
|
||||
for(let el of document.getElementsByClassName('presult-'+parentid)) {
|
||||
el.classList.remove('d-none');
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -74,43 +74,6 @@ function checkForRequired() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function markdown() {
|
||||
var input = document.getElementById('post-text').value;
|
||||
|
||||
var emojis = Array.from(input.matchAll(/:(.{1,30}?):/gi))
|
||||
if(emojis != null){
|
||||
for(i = 0; i < emojis.length; i++){
|
||||
var emoji = emojis[i][0]
|
||||
var remoji = emoji.replace(/:/g,'');
|
||||
if (remoji.startsWith("!#") || remoji.startsWith("#!"))
|
||||
{
|
||||
input = input.replace(emoji, "<img class='emj mirrored' src='/assets/images/emojis/" + remoji.substring(2) + ".webp'>")
|
||||
} else if (remoji.startsWith("#"))
|
||||
{
|
||||
input = input.replace(emoji, "<img class='emj' src='/assets/images/emojis/" + remoji.substring(1) + ".webp'>")
|
||||
} else if (remoji.startsWith("!"))
|
||||
{
|
||||
input = input.replace(emoji, "<img height=30 class='emj mirrored' src='/assets/images/emojis/" + remoji.substring(1) + ".webp'>")
|
||||
} else {
|
||||
input = input.replace(emoji, "<img height=30 class='emj' src='/assets/images/emojis/" + remoji + ".webp'>")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var options = Array.from(input.matchAll(/\s*\$\$([^\$\n]+)\$\$\s*/gi))
|
||||
if(options != null){
|
||||
for(i = 0; i < options.length; i++){
|
||||
var option = options[i][0];
|
||||
var option2 = option.replace(/\$\$/g, '').replace(/\n/g, '')
|
||||
input = input.replace(option, '');
|
||||
input += '<div class="custom-control"><input type="checkbox" class="custom-control-input" id="' + option2 + '"><label class="custom-control-label" for="' + option2 + '">' + option2 + ' - <a>0 votes</a></label></div>';
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('preview').innerHTML = marked(input)
|
||||
}
|
||||
|
||||
document.onpaste = function(event) {
|
||||
f=document.getElementById('file-upload');
|
||||
files = event.clipboardData.files
|
||||
|
|
|
@ -752,8 +752,8 @@
|
|||
</style>
|
||||
|
||||
{% if v %}
|
||||
<script src="/assets/js/marked.js?v=2"></script>
|
||||
<script src="/assets/js/comments_v.js?v=87"></script>
|
||||
<script src="/assets/js/marked.js?v=8"></script>
|
||||
<script src="/assets/js/comments_v.js?v=88"></script>
|
||||
{% endif %}
|
||||
|
||||
<script src="/assets/js/clipboard.js?v=3"></script>
|
||||
|
|
|
@ -847,7 +847,7 @@
|
|||
|
||||
{% if not p.comment_count %}
|
||||
{% if v %}
|
||||
<script src="/assets/js/comments_v.js?v=87"></script>
|
||||
<script src="/assets/js/comments_v.js?v=88"></script>
|
||||
{% include "award_modal.html" %}
|
||||
{% include "emoji_modal.html" %}
|
||||
{% include "gif_modal.html" %}
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
<label for="body" class="mt-3">Text<i class="fas fa-info-circle text-gray-400 ml-1" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-original-title="Uses markdown. Limited to 10000 characters."></i></label>
|
||||
|
||||
<div>
|
||||
<textarea form="submitform" id="post-text" class="form-control rounded" aria-label="With textarea" placeholder="Optional if you have a link or an image." rows="7" name="body" oninput="markdown();charLimit('post-text','character-count-submit-text-form');checkForRequired()" {% if v.longpost %}minlength="280"{% endif %} maxlength="{% if v.bird %}140{% else %}10000{% endif %}" required></textarea>
|
||||
<textarea form="submitform" id="post-text" class="form-control rounded" aria-label="With textarea" placeholder="Optional if you have a link or an image." rows="7" name="body" oninput="markdown('post-text','preview');charLimit('post-text','character-count-submit-text-form');checkForRequired()" {% if v.longpost %}minlength="280"{% endif %} maxlength="{% if v.bird %}140{% else %}10000{% endif %}" required></textarea>
|
||||
|
||||
<div class="btn btn-secondary fl-r mt-3" onclick="document.getElementById('preview').classList.toggle('d-none');">
|
||||
Toggle preview
|
||||
|
@ -173,9 +173,9 @@
|
|||
</div>
|
||||
{% endblock %}
|
||||
|
||||
<script src="/assets/js/marked.js?v=2"></script>
|
||||
<script src="/assets/js/marked.js?v=8"></script>
|
||||
<script src="/assets/js/formatting.js?v=61"></script>
|
||||
<script src="/assets/js/submit.js?v=77"></script>
|
||||
<script src="/assets/js/submit.js?v=78"></script>
|
||||
|
||||
|
||||
{% include "emoji_modal.html" %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue