sneed
This commit is contained in:
parent
d2c4a88fac
commit
073576114b
3 changed files with 164 additions and 114 deletions
|
@ -621,15 +621,6 @@ function post_toast(url, callback) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Element deleter
|
|
||||||
|
|
||||||
function deleteElement(eid) {
|
|
||||||
x=document.getElementById(eid)
|
|
||||||
x.parentElement.removeChild(x)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Signup js
|
//Signup js
|
||||||
// Display username and password requirements on input
|
// Display username and password requirements on input
|
||||||
|
|
||||||
|
@ -731,99 +722,6 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// 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;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mobile bottom navigation bar
|
// Mobile bottom navigation bar
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,78 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
{% include "bootstrap.html" %}
|
||||||
|
|
||||||
<script>
|
<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
|
// Expand Images on Desktop
|
||||||
|
|
||||||
function expandDesktopImage(image, link) {
|
function expandDesktopImage(image, link) {
|
||||||
|
@ -684,8 +754,6 @@
|
||||||
|
|
||||||
{% include "expanded_image_modal.html" %}
|
{% include "expanded_image_modal.html" %}
|
||||||
|
|
||||||
{% include "bootstrap.html" %}
|
|
||||||
|
|
||||||
<script src="/assets/js/all_js.js"></script>
|
<script src="/assets/js/all_js.js"></script>
|
||||||
|
|
||||||
<!-- ClipboardJS -->
|
<!-- ClipboardJS -->
|
||||||
|
|
|
@ -3,16 +3,100 @@
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<script>
|
<script>
|
||||||
jQuery(function($) {
|
|
||||||
(document).ready(function() {
|
// Text Formatting
|
||||||
$('#submitform').submit(function() {
|
|
||||||
// disable button
|
// Bold Text
|
||||||
$("#create_button").prop("disabled", true);
|
|
||||||
// add spinner to button
|
makeBold = function (form) {
|
||||||
$("#create_button").html('<span class="spinner-border spinner-border-sm mr-2" role="status" aria-hidden="true"></span>Creating post');
|
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
|
//part of submit page js
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue