diff --git a/assets/script.js b/assets/script.js
index 3ada946..8f11ac0 100644
--- a/assets/script.js
+++ b/assets/script.js
@@ -269,7 +269,7 @@ async function onPageLoad() {
clearInterval(interval);
}
- if (currentSite === "home" && currentPage === "settings") {
+ if (currentSite === "account" && currentPage === "settings") {
if (document.getElementById("user-settings")) {
await populateUserInfoFields(UserInfo);
}
@@ -656,11 +656,9 @@ async function reloadMemeVotes(memeID) {
if (0 < memeVotes) {
memeVoteCounterElement.classList.add("positive");
- }
- else if (0 > memeVotes) {
+ } else if (0 > memeVotes) {
memeVoteCounterElement.classList.add("negative");
- }
- else {
+ } else {
memeVoteCounterElement.classList.add("neutral");
}
@@ -681,18 +679,17 @@ async function reloadMemeVotes(memeID) {
}
-async function voteMeme(memeID, isUpvote){
+async function voteMeme(memeID, isUpvote) {
let memeVoteUpvoteElement = document.getElementById(`meme_votes_upvote_${memeID}`);
let memeVoteDownvoteElement = document.getElementById(`meme_votes_downvote_${memeID}`);
let memeVoteDelete = false;
- if(isUpvote) {
- if(memeVoteUpvoteElement.classList.contains("ri-arrow-up-circle-fill")){
+ if (isUpvote) {
+ if (memeVoteUpvoteElement.classList.contains("ri-arrow-up-circle-fill")) {
await deleteVoteMeme(memeID);
memeVoteDelete = true;
}
- }
- else {
- if(memeVoteDownvoteElement.classList.contains("ri-arrow-down-circle-fill")){
+ } else {
+ if (memeVoteDownvoteElement.classList.contains("ri-arrow-down-circle-fill")) {
await deleteVoteMeme(memeID);
memeVoteDelete = true;
}
@@ -713,4 +710,20 @@ async function deleteVoteMeme(memeId) {
meme_id: memeId
}, "Hlas na meme bol zmazaný", "Nastala chyba pri mazaní hlasu na meme", true);
await reloadMemeVotes(memeId);
+}
+
+async function surveySubmit() {
+ const satisfaction = document.querySelector('input[name="satisfaction"]:checked').value;
+ const functionality = document.querySelector('input[name="functionality"]:checked').value;
+ const content = document.querySelector('input[name="content"]:checked').value;
+ const comment = document.querySelector('textarea[name="comment"]').value;
+ if (satisfaction && functionality && content && comment) {
+ doAction("/survey", {
+ action: "surveySubmit",
+ satisfaction: satisfaction,
+ functionality: functionality,
+ content: content,
+ comment: comment
+ });
+ }
}
\ No newline at end of file
diff --git a/assets/style.css b/assets/style.css
index 0244d1e..613c95a 100644
--- a/assets/style.css
+++ b/assets/style.css
@@ -183,7 +183,7 @@ ul.navpage_list {
.navsite_item:hover .navpage_list {
border: 4px solid var(--pico-primary-hover) !important;
display: flex !important;
- max-height: 200px;
+ max-height: unset;
width: inherit;
transition: max-height .3s ease, border .325s ease !important;
box-sizing: border-box;
@@ -406,6 +406,9 @@ div#articleslist>article{
@media (max-width: 1050px) {
+ .navsite_item .navpage_list {
+ max-height: unset !important;
+ }
div#articleslist {
width: 100vw !important;
left: 0 !important;
@@ -444,6 +447,7 @@ div#articleslist>article{
width: inherit;
box-sizing: content-box;
transition-delay: .1s;
+ position: unset !important;
}
.navsite_item:not(:hover) .navpage_list {
transition-delay: .1s;
diff --git a/endpoints/survey.php b/endpoints/survey.php
new file mode 100644
index 0000000..a69a6f3
--- /dev/null
+++ b/endpoints/survey.php
@@ -0,0 +1,11 @@
+ submitSurvey($endpoint_data["satisfaction"], $endpoint_data["functionality"], $endpoint_data["content"], $endpoint_data["comment"]),
+ default => ["Status" => "Fail", "message" => "Invalid action"],
+ };
+}
\ No newline at end of file
diff --git a/lib/survey.php b/lib/survey.php
new file mode 100644
index 0000000..375639c
--- /dev/null
+++ b/lib/survey.php
@@ -0,0 +1,21 @@
+ "Fail", "Opinion" => "Ignored unsuccessfully!"];
+ if (isLoggedIn()
+ && $satisfaction >= 1 && $satisfaction <= 5
+ && $functionality >= 1 && $functionality <= 5
+ && $content >= 1 && $content <= 5
+ && !empty($comment)) {
+ $stmtMemeAdd = $mysqli->prepare('INSERT INTO Survey (AuthorID, Satisfaction, Functionality, Content, Comment) VALUES (?, ?, ?, ?, ?)');
+ $stmtMemeAdd->bind_param('issi', $_SESSION['ID'], $satisfaction, $functionality, $content, htmlspecialchars($comment));
+ if ($stmtMemeAdd->execute() && $stmtMemeAdd->affected_rows > 0) {
+ $output["Status"] = "Success";
+ $output["Opinion"] = "Ignored successfully!";
+ }
+ }
+ return $output;
+}
\ No newline at end of file
diff --git a/pages/account/survey.html b/pages/account/survey.html
new file mode 100644
index 0000000..b67c504
--- /dev/null
+++ b/pages/account/survey.html
@@ -0,0 +1,43 @@
+
+
__TEMPLATE_MEME_TEXT__