From 1d213b9234790b24f2a55243c509e5ea899ce1f9 Mon Sep 17 00:00:00 2001 From: kek7198 Date: Sat, 1 Jan 2022 17:58:28 -0600 Subject: [PATCH 1/4] fix --- files/assets/CHRISTMAS/css/main.css | 25 ++++++ files/assets/CHRISTMAS/js/submission.js | 24 +++++ files/assets/CHRISTMAS/js/submit.js | 47 +++++++++- files/templates/CHRISTMAS/banner.html | 18 ++++ files/templates/CHRISTMAS/default.html | 4 +- files/templates/CHRISTMAS/header-tw.html | 7 +- files/templates/CHRISTMAS/settings.html | 4 +- .../CHRISTMAS/sidebars/SubmissionSidebar.html | 87 +++++++++++++++++++ files/templates/CHRISTMAS/submission.html | 5 +- .../submission/SubmissionActions.html | 4 +- files/templates/CHRISTMAS/submit.html | 7 +- 11 files changed, 217 insertions(+), 15 deletions(-) create mode 100644 files/templates/CHRISTMAS/banner.html diff --git a/files/assets/CHRISTMAS/css/main.css b/files/assets/CHRISTMAS/css/main.css index e326f72b8..ee5cee109 100644 --- a/files/assets/CHRISTMAS/css/main.css +++ b/files/assets/CHRISTMAS/css/main.css @@ -4799,6 +4799,9 @@ blockquote p { .text-warning { color: #facc15; } +.text-yellow { + color: #facc15; +} .text-danger { color: #dc2626; } @@ -4820,3 +4823,25 @@ blockquote p { .text-black-50 { color: #57534e; } + +.text-rainbow:hover { + -webkit-animation: zomg 0.5s infinite; + animation: zomg 0.5s infinite; +} + +@-webkit-keyframes zomg { + 0%, 100% { color: #7ccdea; } + 16% { color: #0074d9; } + 32% { color: #2ecc40; } + 48% { color: #ffdc00; } + 64% { color: #b10dc9; } + 80% { color: #ff4136; } +} +@keyframes zomg { + 0%, 100% { color: #7ccdea; } + 16% { color: #0074d9; } + 32% { color: #2ecc40; } + 48% { color: #ffdc00; } + 64% { color: #b10dc9; } + 80% { color: #ff4136; } +} diff --git a/files/assets/CHRISTMAS/js/submission.js b/files/assets/CHRISTMAS/js/submission.js index edc045674..0e616c92a 100644 --- a/files/assets/CHRISTMAS/js/submission.js +++ b/files/assets/CHRISTMAS/js/submission.js @@ -33,4 +33,28 @@ function bet_vote(cid) { scoretext.textContent = score + 1; post('/bet/' + cid); document.getElementById("user-coins-amount").innerText = parseInt(document.getElementById("user-coins-amount").innerText) - 200; +} + +function checkboxSticky(el, id) { + if (el.checked) { + postToast(`/sticky/${id}`) + } else { + postToast(`/unsticky/${id}`) + } +} + +function checkboxClub(el, id) { + if (el.checked) { + postToast(`/toggle_club/${id}`) + } else { + postToast(`/toggle_club/${id}`) + } +} + +function checkboxNSFW(el, id) { + if (el.checked) { + postToast(`/toggle_post_nsfw/${id}`) + } else { + postToast(`/toggle_post_nsfw/${id}`) + } } \ No newline at end of file diff --git a/files/assets/CHRISTMAS/js/submit.js b/files/assets/CHRISTMAS/js/submit.js index a127c8bc2..f9dbc001f 100644 --- a/files/assets/CHRISTMAS/js/submit.js +++ b/files/assets/CHRISTMAS/js/submit.js @@ -75,4 +75,49 @@ document.getElementById('file-upload').addEventListener('change', function(){ fileReader.addEventListener("load", function () {document.getElementById('image-preview').setAttribute('src', this.result);}); checkForRequired(); } -}) \ No newline at end of file +}) + +// Set local storage +const storage = window.localStorage; + +// Get the input box +let bodyInput = document.getElementById('post-text'); + +// Init a timeout variable to be used below +let timeout = null; + +// Draft helpter text +const helper = document.getElementById('draft-text'); + +window.onload = function() { + // Get the input box + const input = document.getElementById('post-text'); + // If storage contains post draft + // set the input to draft and show helper text + if (storage.getItem('bodyText') !== null) { + input.value = JSON.parse(storage.getItem('bodyText')); + helper.innerText = 'Draft loaded from storage'; + } +} + +// Listen for keystroke events +bodyInput.addEventListener('keyup', function (e) { + // Clear the timeout if it has already been set. + // This will prevent the previous task from executing + // if it has been less than + clearTimeout(timeout); + // Make a new timeout set to go off in 1000ms (1 second) + timeout = setTimeout(function () { + storage.setItem('bodyText', JSON.stringify(bodyInput.value)); + helper.innerText = 'Draft saved'; + }, 1000); +}); + +// Clear local storage on form submit, use "bind()" method to pass key paramater to specifcy with storage to clear +document.getElementById('submitform').addEventListener('submit', emptyStorage.bind(event, 'bodyText')); + +// Clear local storage by key name +function emptyStorage(key) { + // Specify data and clear it + window.localStorage.removeItem(key); +} \ No newline at end of file diff --git a/files/templates/CHRISTMAS/banner.html b/files/templates/CHRISTMAS/banner.html new file mode 100644 index 000000000..a53a6a267 --- /dev/null +++ b/files/templates/CHRISTMAS/banner.html @@ -0,0 +1,18 @@ + + {% if v %} +
+ + 💖🌈 rdrama.net stands with the LGBTQ+ community.  + + Learn more! + +
+ {% else %} +
+ + ✋😕 You are viewing a cached version of rdrama.net  + + Login! + +
+ {% endif %} \ No newline at end of file diff --git a/files/templates/CHRISTMAS/default.html b/files/templates/CHRISTMAS/default.html index 3fd063d5b..4b5d500ba 100644 --- a/files/templates/CHRISTMAS/default.html +++ b/files/templates/CHRISTMAS/default.html @@ -192,7 +192,7 @@ {% block stylesheets %} - + @@ -237,7 +237,7 @@ {% block postNav %} {% endblock %} -
+
{% block desktopUserBanner %} diff --git a/files/templates/CHRISTMAS/header-tw.html b/files/templates/CHRISTMAS/header-tw.html index cdfaf67c0..82e112255 100644 --- a/files/templates/CHRISTMAS/header-tw.html +++ b/files/templates/CHRISTMAS/header-tw.html @@ -1,7 +1,10 @@