forked from Adleraci/adlerka.top
Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -70,6 +70,9 @@ async function handlePageResponse(data) {
|
||||
if (data.Navigation) {
|
||||
navbar.innerHTML = data.Navigation;
|
||||
}
|
||||
if (data.PageTitle) {
|
||||
document.title = data.PageTitle;
|
||||
}
|
||||
|
||||
if (data.Page) {
|
||||
pageArea.innerHTML = data.Page;
|
||||
@@ -181,7 +184,7 @@ async function togglearticlecreate(){
|
||||
}
|
||||
|
||||
async function renderarticles(){
|
||||
let template = document.querySelector('template[data-template-name="article"]').content.toString();
|
||||
let template = document.querySelector('template[data-template-name="article"]').innerHTML;
|
||||
let articles = await doAction(
|
||||
"/newsarticle",
|
||||
{
|
||||
@@ -193,7 +196,7 @@ async function renderarticles(){
|
||||
);
|
||||
|
||||
let articleout = "";
|
||||
for (const article of articles) {
|
||||
for (const article of articles.Articles) {
|
||||
articleout += template.replace("__TEMPLATE_ARTICLE_TITLE__", article.Title).replace("__TEMPLATE_ARTICLE_AUTHOR__", article.WrittenByName).replace("__TEMPLATE_ARTICLE_DATE__", article.WrittenAt).replace("__TEMPLATE_ARTICLE_BODY__", article.Body)
|
||||
}
|
||||
document.getElementById("articleslist").innerHTML = articleout;
|
||||
@@ -213,17 +216,26 @@ async function submitarticle(){
|
||||
"Nastala chyba pri pridávaní článku",
|
||||
false
|
||||
);
|
||||
togglearticlecreate();
|
||||
await togglearticlecreate();
|
||||
}
|
||||
|
||||
async function articleInit(){
|
||||
let articleContainerElement = document.getElementById("articlecreatecontainer");
|
||||
let articleCreateOpenElement = document.getElementById("articlecreateopen");
|
||||
articleContainerElement.addEventListener("keyup", function (ev) {
|
||||
if(ev.which === 27){
|
||||
if(ev.key === "Escape"){
|
||||
togglearticlecreate();
|
||||
}
|
||||
})
|
||||
PageIntervals.push(setInterval(renderarticles, 300000));
|
||||
document.getElementById("articleprivilegeinput").setAttribute("max", UserInfo.Privileges);
|
||||
if(UserInfo.Privileges < 2){
|
||||
articleContainerElement.style.display = "none";
|
||||
articleCreateOpenElement.style.display = "none";
|
||||
}
|
||||
else{
|
||||
articleCreateOpenElement.style.display = "inline-block";
|
||||
}
|
||||
}
|
||||
|
||||
async function onPageLoad() {
|
||||
@@ -247,7 +259,7 @@ async function onPageLoad() {
|
||||
if (currentSite === "home" && currentPage === "account" && isLoggedIn()) {
|
||||
await showDashboardGreeting();
|
||||
}
|
||||
if (currentSite === "news" && currentPage === "index" && isLoggedIn()) {
|
||||
if (currentSite === "news" && currentPage === "index") {
|
||||
await articleInit();
|
||||
}
|
||||
}
|
||||
|
@@ -342,11 +342,22 @@ header a,
|
||||
input, textarea {
|
||||
background-color: var(--third-bg);
|
||||
border: 2px solid var(--primary);
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
||||
input::placeholder, textarea::placeholder{
|
||||
color: var(--primary-text);
|
||||
}
|
||||
|
||||
input{
|
||||
border-radius: 25px;
|
||||
}
|
||||
|
||||
textarea{
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
button {
|
||||
border-radius: 50px;
|
||||
border-radius: 25px;
|
||||
border: 2px solid var(--primary);
|
||||
background: var(--third-bg);
|
||||
color: var(--primary-text);
|
||||
@@ -368,14 +379,12 @@ button:hover {
|
||||
}
|
||||
|
||||
header.ye-span:hover + body{
|
||||
background: url('/assets/images/ye.jpg') !important;
|
||||
background-repeat: repeat !important;
|
||||
background: url('/assets/images/ye.jpg') repeat !important;
|
||||
background-size: 10% !important;
|
||||
}
|
||||
|
||||
body:has(.ye-span:hover) {
|
||||
background: url('/assets/images/ye.jpg') !important;
|
||||
background-repeat: repeat !important;
|
||||
background: url('/assets/images/ye.jpg') repeat !important;
|
||||
background-size: 10% !important;
|
||||
}
|
||||
|
||||
@@ -384,6 +393,17 @@ body:has(.ye-span:hover) {
|
||||
border: 5px solid var(--primary);
|
||||
z-index: 5;
|
||||
margin: auto;
|
||||
padding: 40px;
|
||||
background-color: var(--primary-bg);
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
||||
#articlecreate > * {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
#articlecreateopen {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#articlecreatecontainer{
|
||||
@@ -399,6 +419,30 @@ body:has(.ye-span:hover) {
|
||||
backdrop-filter: blur(2px);
|
||||
}
|
||||
|
||||
|
||||
.hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
div#articleslist{
|
||||
width: 80vw;
|
||||
left: 10vw;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
div#articleslist > article > div.articleinfo > *{
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
div#articleslist > article > div.articleinfo{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
div#articleslist>article{
|
||||
border: 4px solid var(--primary);
|
||||
}
|
||||
|
||||
a.navsite_link.active:after{
|
||||
|
||||
}
|
Reference in New Issue
Block a user