forked from MarseyWorld/MarseyWorld
sneed
parent
5a95589267
commit
88b9d185ce
|
@ -1,8 +1,78 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
{% include "bootstrap.html" %}
|
||||
|
||||
<script>
|
||||
|
||||
// Text Formatting
|
||||
|
||||
// Bold Text
|
||||
|
||||
makeBold = function (form) {
|
||||
var text = document.getElementById(form);
|
||||
var startIndex = text.selectionStart,
|
||||
endIndex = text.selectionEnd;
|
||||
var selectedText = text.value.substring(startIndex, endIndex);
|
||||
|
||||
var format = '**'
|
||||
|
||||
if (selectedText.includes('**')) {
|
||||
text.value = selectedText.replace(/\*/g, '');
|
||||
|
||||
}
|
||||
else if (selectedText.length == 0) {
|
||||
text.value = text.value.substring(0, startIndex) + selectedText + text.value.substring(endIndex);
|
||||
}
|
||||
else {
|
||||
text.value = text.value.substring(0, startIndex) + format + selectedText + format + text.value.substring(endIndex);
|
||||
}
|
||||
}
|
||||
|
||||
// Italicize Comment Text
|
||||
|
||||
makeItalics = function (form) {
|
||||
var text = document.getElementById(form);
|
||||
var startIndex = text.selectionStart,
|
||||
endIndex = text.selectionEnd;
|
||||
var selectedText = text.value.substring(startIndex, endIndex);
|
||||
|
||||
var format = '*'
|
||||
|
||||
if (selectedText.includes('*')) {
|
||||
text.value = selectedText.replace(/\*/g, '');
|
||||
|
||||
}
|
||||
else if (selectedText.length == 0) {
|
||||
text.value = text.value.substring(0, startIndex) + selectedText + text.value.substring(endIndex);
|
||||
}
|
||||
else {
|
||||
text.value = text.value.substring(0, startIndex) + format + selectedText + format + text.value.substring(endIndex);
|
||||
}
|
||||
}
|
||||
|
||||
// Quote Comment Text
|
||||
|
||||
makeQuote = function (form) {
|
||||
var text = document.getElementById(form);
|
||||
var startIndex = text.selectionStart,
|
||||
endIndex = text.selectionEnd;
|
||||
var selectedText = text.value.substring(startIndex, endIndex);
|
||||
|
||||
var format = '>'
|
||||
|
||||
if (selectedText.includes('>')) {
|
||||
text.value = text.value.substring(0, startIndex) + selectedText.replace(/\>/g, '') + text.value.substring(endIndex);
|
||||
|
||||
}
|
||||
else if (selectedText.length == 0) {
|
||||
text.value = text.value.substring(0, startIndex) + selectedText + text.value.substring(endIndex);
|
||||
}
|
||||
else {
|
||||
text.value = text.value.substring(0, startIndex) + format + selectedText + text.value.substring(endIndex);
|
||||
}
|
||||
}
|
||||
|
||||
// Expand Images on Desktop
|
||||
|
||||
function expandDesktopImage(image, link) {
|
||||
|
@ -684,8 +754,6 @@
|
|||
|
||||
{% include "expanded_image_modal.html" %}
|
||||
|
||||
{% include "bootstrap.html" %}
|
||||
|
||||
<script src="/assets/js/all_js.js"></script>
|
||||
|
||||
<!-- ClipboardJS -->
|
||||
|
|
|
@ -3,16 +3,100 @@
|
|||
|
||||
<head>
|
||||
<script>
|
||||
jQuery(function($) {
|
||||
(document).ready(function() {
|
||||
$('#submitform').submit(function() {
|
||||
// disable button
|
||||
$("#create_button").prop("disabled", true);
|
||||
// add spinner to button
|
||||
$("#create_button").html('<span class="spinner-border spinner-border-sm mr-2" role="status" aria-hidden="true"></span>Creating post');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Text Formatting
|
||||
|
||||
// Bold Text
|
||||
|
||||
makeBold = function (form) {
|
||||
var text = document.getElementById(form);
|
||||
var startIndex = text.selectionStart,
|
||||
endIndex = text.selectionEnd;
|
||||
var selectedText = text.value.substring(startIndex, endIndex);
|
||||
|
||||
var format = '**'
|
||||
|
||||
if (selectedText.includes('**')) {
|
||||
text.value = selectedText.replace(/\*/g, '');
|
||||
|
||||
}
|
||||
else if (selectedText.length == 0) {
|
||||
text.value = text.value.substring(0, startIndex) + selectedText + text.value.substring(endIndex);
|
||||
}
|
||||
else {
|
||||
text.value = text.value.substring(0, startIndex) + format + selectedText + format + text.value.substring(endIndex);
|
||||
}
|
||||
}
|
||||
|
||||
// Italicize Comment Text
|
||||
|
||||
makeItalics = function (form) {
|
||||
var text = document.getElementById(form);
|
||||
var startIndex = text.selectionStart,
|
||||
endIndex = text.selectionEnd;
|
||||
var selectedText = text.value.substring(startIndex, endIndex);
|
||||
|
||||
var format = '*'
|
||||
|
||||
if (selectedText.includes('*')) {
|
||||
text.value = selectedText.replace(/\*/g, '');
|
||||
|
||||
}
|
||||
else if (selectedText.length == 0) {
|
||||
text.value = text.value.substring(0, startIndex) + selectedText + text.value.substring(endIndex);
|
||||
}
|
||||
else {
|
||||
text.value = text.value.substring(0, startIndex) + format + selectedText + format + text.value.substring(endIndex);
|
||||
}
|
||||
}
|
||||
|
||||
// Quote Comment Text
|
||||
|
||||
makeQuote = function (form) {
|
||||
var text = document.getElementById(form);
|
||||
var startIndex = text.selectionStart,
|
||||
endIndex = text.selectionEnd;
|
||||
var selectedText = text.value.substring(startIndex, endIndex);
|
||||
|
||||
var format = '>'
|
||||
|
||||
if (selectedText.includes('>')) {
|
||||
text.value = text.value.substring(0, startIndex) + selectedText.replace(/\>/g, '') + text.value.substring(endIndex);
|
||||
|
||||
}
|
||||
else if (selectedText.length == 0) {
|
||||
text.value = text.value.substring(0, startIndex) + selectedText + text.value.substring(endIndex);
|
||||
}
|
||||
else {
|
||||
text.value = text.value.substring(0, startIndex) + format + selectedText + text.value.substring(endIndex);
|
||||
}
|
||||
}
|
||||
|
||||
// Character Count
|
||||
|
||||
function charLimit(form, text) {
|
||||
|
||||
var input = document.getElementById(form);
|
||||
|
||||
var text = document.getElementById(text);
|
||||
|
||||
var length = input.value.length;
|
||||
|
||||
var maxLength = input.getAttribute("maxlength");
|
||||
|
||||
if (length >= maxLength) {
|
||||
text.style.color = "#E53E3E";
|
||||
}
|
||||
else if (length >= maxLength * .72){
|
||||
text.style.color = "#FFC107";
|
||||
}
|
||||
else {
|
||||
text.style.color = "#A0AEC0";
|
||||
}
|
||||
|
||||
text.innerText = maxLength - length;
|
||||
|
||||
}
|
||||
|
||||
//part of submit page js
|
||||
|
||||
|
|
Loading…
Reference in New Issue