Skip to content

Commit

Permalink
fix: change front post logic
Browse files Browse the repository at this point in the history
  • Loading branch information
laigasus committed May 10, 2024
1 parent c17a08e commit 3549fc2
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/src/main/resources/static/assets/js/app.mjs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
const t=window.location.pathname;document.addEventListener("DOMContentLoaded",(function(){var t=document.title;t=t.split("-",1),document.getElementById("page-title").innerText=t,"분리ㅅㄱ"==t&&(document.getElementById("navbar-mobile-arrow").style.display="none",document.getElementById("page-title").innerText="🪴")})),document.body.addEventListener("htmx:configRequest",(function(t){if(t.detail.headers.accept="text/html-partial","get"!==t.detail.verb){const e=document.querySelector("meta[name='_csrf_header']").getAttribute("content");t.detail.headers[e]=document.querySelector("meta[name='_csrf']").getAttribute("content")}})),("/"===t||t.startsWith("/dictionary"))&&import("./dictionary/algolia.mjs").then((t=>{t.init()})),t.startsWith("/community/")&&(import("./community/editorjs.umd.min.js").then((()=>{import("./community/editor.mjs").then((t=>{t.init()}))})),import("./community/jquery.timeago.min.js").then((()=>{import("./community/time-ago.mjs").then((t=>{t.init()}))}))),t.startsWith("/community/write")&&import("./community/post-color-changer.mjs").then((t=>{t.init()}));
const t=window.location.pathname;if(document.addEventListener("DOMContentLoaded",(function(){var t=document.title;t=t.split("-",1),document.getElementById("page-title").innerText=t,"분리ㅅㄱ"==t&&(document.getElementById("navbar-mobile-arrow").style.display="none",document.getElementById("page-title").innerText="🪴")})),document.body.addEventListener("htmx:configRequest",(function(t){if(t.detail.headers.accept="text/html-partial","get"!==t.detail.verb){const e=document.querySelector("meta[name='_csrf_header']").getAttribute("content");t.detail.headers[e]=document.querySelector("meta[name='_csrf']").getAttribute("content")}})),("/"===t||t.startsWith("/dictionary"))&&import("./dictionary/algolia.mjs").then((t=>{t.init()})),t.startsWith("/community/")){let e=!t.endsWith("write");import("./community/editorjs.umd.min.js").then((()=>{import("./community/editor.mjs").then((t=>{t.init(e)}))})),import("./community/jquery.timeago.min.js").then((()=>{import("./community/time-ago.mjs").then((t=>{t.init()}))}))}t.startsWith("/community/write")&&import("./community/post-color-changer.mjs").then((t=>{t.init()}));
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import e from"https://cdn.jsdelivr.net/npm/@editorjs/attaches/+esm";import t from"https://cdn.jsdelivr.net/npm/@editorjs/checklist/+esm";import n from"https://cdn.jsdelivr.net/npm/@editorjs/code/+esm";import o from"https://cdn.jsdelivr.net/npm/@editorjs/delimiter/+esm";import r from"https://cdn.jsdelivr.net/npm/@editorjs/embed/+esm";import i from"https://cdn.jsdelivr.net/npm/@editorjs/header/+esm";import d from"https://cdn.jsdelivr.net/npm/@editorjs/image/+esm";import s from"https://cdn.jsdelivr.net/npm/@editorjs/inline-code/+esm";import l from"https://cdn.jsdelivr.net/npm/@editorjs/link/+esm";import a from"https://cdn.jsdelivr.net/npm/@editorjs/list/+esm";import c from"https://cdn.jsdelivr.net/npm/@editorjs/marker/+esm";import m from"https://cdn.jsdelivr.net/npm/@editorjs/quote/+esm";import p from"https://cdn.jsdelivr.net/npm/@editorjs/raw/+esm";import u from"https://cdn.jsdelivr.net/npm/@editorjs/table/+esm";import h from"https://cdn.jsdelivr.net/npm/@editorjs/warning/+esm";export function init(){document.addEventListener("htmx:afterSwap",(function(){let f=document.getElementById("form").getAttribute("data-content"),g="true"===document.getElementById("form").getAttribute("data-edit"),v=(document.querySelector("meta[name='_csrf_header']").getAttribute("content"),document.querySelector("meta[name='_csrf']").getAttribute("content")),j=new EditorJS({holder:"editorjs",readOnly:g,tools:{checklist:{class:t,inlineToolbar:!0},code:{class:n,shortcut:"CMD+SHIFT+D"},delimiter:o,embed:r,header:{class:i,inlineToolbar:["link"],config:{placeholder:"Header"},shortcut:"CMD+SHIFT+H"},image:{class:d,config:{field:"file",additionalRequestHeaders:{"X-XSRF-TOKEN":v},endpoints:{byFile:"/api/editor/upload/file",byUrl:"/api/editor/upload/url"}}},attaches:{class:e,config:{field:"file",additionalRequestHeaders:{"X-XSRF-TOKEN":v},endpoint:"/api/editor/upload/file"}},inlineCode:{class:s,shortcut:"CMD+SHIFT+M"},linkTool:{class:l,additionalRequestHeaders:{"X-XSRF-TOKEN":v},config:{endpoint:"/api/editor/link-preview"}},list:{class:a,inlineToolbar:!0},marker:{class:c,shortcut:"CMD+SHIFT+M"},quote:{class:m,inlineToolbar:!0},raw:p,table:{class:u,inlineToolbar:!0},warning:h},onReady:function(){var e=JSON.parse(f);null!=e?j.render(e):(f=function(e){for(var t=e+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){for(var r=n[o];" "==r.charAt(0);)r=r.substring(1,r.length);if(0==r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}return null}("editorjsContentBackup"),null!=f&&(e=JSON.parse(f),j.render(e)))},onChange:function(){j.save().then((function(e){!function(e,t,n){var o="";if(n){var r=new Date;r.setTime(r.getTime()+60*n*1e3),o="; expires="+r.toUTCString()}document.cookie=e+"="+encodeURIComponent(t||"")+o+"; path=/"}("editorjsContentBackup",JSON.stringify(e),1)})).catch((function(e){console.error("Saving error",e)}))},rendered:function(){},i18n:{messages:{ui:{blockTunes:{toggler:{"Click to tune":"옵션 확장","or drag to move":"또는 드래그하여 이동"}},inlineToolbar:{converter:{"Convert to":"변환하기"}},toolbar:{toolbox:{Add:"추가"}},popover:{Filter:"필터","Nothing found":"찾을 수 없습니다"}},toolNames:{Text:"텍스트",Heading:"제목",List:"리스트",Warning:"경고",Checklist:"체크리스트",Quote:"인용문",Code:"코드",Delimiter:"구분선","Raw HTML":"HTML",Table:"테이블",Link:"링크",Marker:"마커",Bold:"굵게",Italic:"기울임",InlineCode:"인라인 코드",Image:"이미지",Attachment:"첨부"},tools:{warning:{Title:"제목",Message:"메시지"},link:{"Add a link":"링크 추가"},stub:{"The block can not be displayed correctly.":"블록을 올바르게 표시할 수 없습니다."},image:{Caption:"캡션","Select an Image":"이미지 선택","With border":"테두리 추가","Stretch image":"이미지 확장","With background":"배경 추가"},code:{"Enter a code":"코드를 입력하세요"},linkTool:{Link:"링크","Couldn't fetch the link data":"링크 데이터를 가져올 수 없습니다","Couldn't get this link data, try the other one":"이 링크 데이터를 가져올 수 없습니다. 다른 링크를 시도하세요","Wrong response format from the server":"서버로부터 잘못된 응답 형식"},header:{Header:"헤딩"},paragraph:{"Enter something":"내용을 입력하세요"},list:{Ordered:"번호",Unordered:"글머리"},quote:{"Enter a quote":"인용절 입력","Enter a caption":"캡션 입력"},attachment:{"File upload failed":"파일을 올리지 못했습니다","Select file to upload":"파일을 선택하여 업로드"},table:{"With headings":"헤딩 추가","Without headings":"헤딩 삭제"}},blockTunes:{delete:{Delete:"삭제","Click to delete":"클릭하여 삭제"},moveUp:{"Move up":"위로 이동"},moveDown:{"Move down":"아래로 이동"}}}}}),b=document.getElementById("save-button");null!=b&&b.addEventListener("click",(function(){j.save().then((e=>{document.getElementById("editorjs-content").value=JSON.stringify(e,null,0)})).catch((e=>{console.error("Saving error",e)}))}))}))}
import e from"https://cdn.jsdelivr.net/npm/@editorjs/attaches/+esm";import t from"https://cdn.jsdelivr.net/npm/@editorjs/checklist/+esm";import n from"https://cdn.jsdelivr.net/npm/@editorjs/code/+esm";import o from"https://cdn.jsdelivr.net/npm/@editorjs/delimiter/+esm";import r from"https://cdn.jsdelivr.net/npm/@editorjs/embed/+esm";import i from"https://cdn.jsdelivr.net/npm/@editorjs/header/+esm";import d from"https://cdn.jsdelivr.net/npm/@editorjs/image/+esm";import l from"https://cdn.jsdelivr.net/npm/@editorjs/inline-code/+esm";import s from"https://cdn.jsdelivr.net/npm/@editorjs/link/+esm";import a from"https://cdn.jsdelivr.net/npm/@editorjs/list/+esm";import m from"https://cdn.jsdelivr.net/npm/@editorjs/marker/+esm";import c from"https://cdn.jsdelivr.net/npm/@editorjs/quote/+esm";import p from"https://cdn.jsdelivr.net/npm/@editorjs/raw/+esm";import u from"https://cdn.jsdelivr.net/npm/@editorjs/table/+esm";import h from"https://cdn.jsdelivr.net/npm/@editorjs/warning/+esm";export function init(e){let t=document.querySelector("meta[name='_csrf']").getAttribute("content"),n=setInterval((function(){document.getElementById("editorjs")&&(f(e,t),document.addEventListener("htmx:afterSwap",(function(){f(e,t)})),clearInterval(n))}),10)}function f(f,g){let v=new EditorJS({holder:"editorjs",readOnly:f,tools:{checklist:{class:t,inlineToolbar:!0},code:{class:n,shortcut:"CMD+SHIFT+D"},delimiter:o,embed:r,header:{class:i,inlineToolbar:["link"],config:{placeholder:"Header"},shortcut:"CMD+SHIFT+H"},image:{class:d,config:{field:"file",additionalRequestHeaders:{"X-XSRF-TOKEN":g},endpoints:{byFile:"/api/editor/upload/file",byUrl:"/api/editor/upload/url"}}},attaches:{class:e,config:{field:"file",additionalRequestHeaders:{"X-XSRF-TOKEN":g},endpoint:"/api/editor/upload/file"}},inlineCode:{class:l,shortcut:"CMD+SHIFT+M"},linkTool:{class:s,additionalRequestHeaders:{"X-XSRF-TOKEN":g},config:{endpoint:"/api/editor/link-preview"}},list:{class:a,inlineToolbar:!0},marker:{class:m,shortcut:"CMD+SHIFT+M"},quote:{class:c,inlineToolbar:!0},raw:p,table:{class:u,inlineToolbar:!0},warning:h},onReady:function(){let e=document.getElementById("form").getAttribute("data-content"),t=JSON.parse(e);null!=t?v.render(t):null!=e&&(t=JSON.parse(e),v.render(t))},onChange:function(){1!=f&&v.save().then((function(e){})).catch((function(e){console.error("Saving error",e)}))},rendered:function(){},i18n:{messages:{ui:{blockTunes:{toggler:{"Click to tune":"옵션 확장","or drag to move":"또는 드래그하여 이동"}},inlineToolbar:{converter:{"Convert to":"변환하기"}},toolbar:{toolbox:{Add:"추가"}},popover:{Filter:"필터","Nothing found":"찾을 수 없습니다"}},toolNames:{Text:"텍스트",Heading:"제목",List:"리스트",Warning:"경고",Checklist:"체크리스트",Quote:"인용문",Code:"코드",Delimiter:"구분선","Raw HTML":"HTML",Table:"테이블",Link:"링크",Marker:"마커",Bold:"굵게",Italic:"기울임",InlineCode:"인라인 코드",Image:"이미지",Attachment:"첨부"},tools:{warning:{Title:"제목",Message:"메시지"},link:{"Add a link":"링크 추가"},stub:{"The block can not be displayed correctly.":"블록을 올바르게 표시할 수 없습니다."},image:{Caption:"캡션","Select an Image":"이미지 선택","With border":"테두리 추가","Stretch image":"이미지 확장","With background":"배경 추가"},code:{"Enter a code":"코드를 입력하세요"},linkTool:{Link:"링크","Couldn't fetch the link data":"링크 데이터를 가져올 수 없습니다","Couldn't get this link data, try the other one":"이 링크 데이터를 가져올 수 없습니다. 다른 링크를 시도하세요","Wrong response format from the server":"서버로부터 잘못된 응답 형식"},header:{Header:"헤딩"},paragraph:{"Enter something":"내용을 입력하세요"},list:{Ordered:"번호",Unordered:"글머리"},quote:{"Enter a quote":"인용절 입력","Enter a caption":"캡션 입력"},attachment:{"File upload failed":"파일을 올리지 못했습니다","Select file to upload":"파일을 선택하여 업로드"},table:{"With headings":"헤딩 추가","Without headings":"헤딩 삭제"}},blockTunes:{delete:{Delete:"삭제","Click to delete":"클릭하여 삭제"},moveUp:{"Move up":"위로 이동"},moveDown:{"Move down":"아래로 이동"}}}}}),j=document.getElementById("save-button");return null!=j&&j.addEventListener("click",(function(){v.save().then((e=>{document.getElementById("editorjs-content").value=JSON.stringify(e,null,0)})).catch((e=>{console.error("Saving error",e)}))})),v}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export function init(){let t=document.getElementById("post-color"),e=document.querySelector(".card");null!=t&&t.addEventListener("input",(function(){e.style.backgroundColor=this.value}))}
export function init(){document.addEventListener("htmx:afterSwap",(function(){let t=document.getElementById("post-color"),e=document.querySelector(".card");null!=t&&t.addEventListener("input",(function(){e.style.backgroundColor=this.value}))}))}
2 changes: 1 addition & 1 deletion app/src/main/resources/templates/base/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@
<span th:text="#{base.header.nav.theme.auto.text}">Auto</span>
</a>
</div>
</div></li></ul></div></div></nav></header><script src="/assets/js/jquery.min.js"></script><script src="/assets/bootstrap/js/bootstrap.min.js"></script><script src="/assets/js/script.min.js"></script><script src="/assets/js/cmmn/htmx.min.js"></script><script src="/assets/js/cmmn/theme-switch.mjs" type="module"></script><script src="/assets/js/cmmn/toast.mjs" type="module"></script></body></html>
</div></li></ul></div></div></nav></header><script src="/assets/js/jquery.min.js"></script><script src="/assets/bootstrap/js/bootstrap.min.js"></script><script src="/assets/js/script.min.js"></script><script src="/assets/js/cmmn/htmx.min.js"></script><script src="/assets/js/app.mjs" type="module"></script><script src="/assets/js/cmmn/theme-switch.mjs" type="module"></script><script src="/assets/js/cmmn/toast.mjs" type="module"></script></body></html>
3 changes: 2 additions & 1 deletion app/src/main/resources/templates/base/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
<meta name="htmx-config" content='{"globalViewTransitions":"true"}' />
<script src="/assets/js/cmmn/theme-switch.mjs" type="module" async></script>
<script src="/assets/js/cmmn/htmx.min.js" async></script>
<script src="/assets/js/cmmn/toast.mjs" type="module" async></script><meta name="viewport" content="width=device-width, shrink-to-fit=0, user-scalable=0, initial-scale=1"><title>분리ㅅㄱ</title><meta name="theme-color" content="#ffffff"><link rel="canonical" href="https://blisgo.org/templates/base/layout.html"><meta property="og:url" content="https://blisgo.org/templates/base/layout.html"><meta name="twitter:description" content="분리배출 도우미 사전"><meta name="twitter:image" content="https://blisgo.org/assets/img/favicon/512x512.png"><meta name="twitter:title" content="분리ㅅㄱ"><meta name="twitter:card" content="summary_large_image"><meta property="og:type" content="website"><meta http-equiv="X-UA-Compatible" content="ie=edge"><meta property="og:image" content="https://blisgo.org/assets/img/favicon/512x512.png"><meta name="description" content="분리배출 도우미 사전"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="/assets/img/favicon/180x180.png"><link rel="icon" type="image/png" sizes="16x16" href="/assets/img/favicon/16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="/assets/img/favicon/32x32.png"><link rel="icon" type="image/png" sizes="180x180" href="/assets/img/favicon/180x180.png"><link rel="icon" type="image/png" sizes="192x192" href="/assets/img/favicon/192x192.png"><link rel="icon" type="image/png" sizes="512x512" href="/assets/img/favicon/512x512.png"><link rel="stylesheet" href="/assets/bootstrap/css/bootstrap.min.css"><link rel="stylesheet" href="/assets/css/cmmn/style.min.css"><link rel="stylesheet" href="/assets/css/community/editorjs.min.css"><link rel="stylesheet" href="/assets/css/dictionary/autocomplete-theme-bootstrap.min.css"></head><body oncontextmenu="return false" ondragstart="return false"><header th:replace="~{/base/header::header}"></header><main layout:fragment="main"></main><div class="toast-container position-fixed bottom-0 start-50 translate-middle-x p-3" id="toast" th:insert="~{/base/toast::toast}"></div><script src="/assets/js/jquery.min.js"></script><script src="/assets/bootstrap/js/bootstrap.min.js"></script><script src="/assets/js/script.min.js"></script><script src="/assets/js/community/editorjs.umd.min.js"></script><script src="/assets/js/community/jquery.timeago.min.js"></script><script src="/assets/js/app.mjs" type="module"></script><script src="/assets/js/community/editor.mjs" type="module"></script><script src="/assets/js/community/post-color-changer.mjs" type="module"></script><script src="/assets/js/community/time-ago.mjs" type="module"></script><script src="/assets/js/dictionary/algolia.mjs" type="module"></script></body></html>
<script src="/assets/js/cmmn/toast.mjs" type="module" async></script>
<script src="/assets/js/app.mjs" type="module" async></script><meta name="viewport" content="width=device-width, shrink-to-fit=0, user-scalable=0, initial-scale=1"><title>분리ㅅㄱ</title><meta name="theme-color" content="#ffffff"><link rel="canonical" href="https://blisgo.org/templates/base/layout.html"><meta property="og:url" content="https://blisgo.org/templates/base/layout.html"><meta name="twitter:description" content="분리배출 도우미 사전"><meta name="twitter:image" content="https://blisgo.org/assets/img/favicon/512x512.png"><meta name="twitter:title" content="분리ㅅㄱ"><meta name="twitter:card" content="summary_large_image"><meta property="og:type" content="website"><meta http-equiv="X-UA-Compatible" content="ie=edge"><meta property="og:image" content="https://blisgo.org/assets/img/favicon/512x512.png"><meta name="description" content="분리배출 도우미 사전"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="/assets/img/favicon/180x180.png"><link rel="icon" type="image/png" sizes="16x16" href="/assets/img/favicon/16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="/assets/img/favicon/32x32.png"><link rel="icon" type="image/png" sizes="180x180" href="/assets/img/favicon/180x180.png"><link rel="icon" type="image/png" sizes="192x192" href="/assets/img/favicon/192x192.png"><link rel="icon" type="image/png" sizes="512x512" href="/assets/img/favicon/512x512.png"><link rel="stylesheet" href="/assets/bootstrap/css/bootstrap.min.css"><link rel="stylesheet" href="/assets/css/cmmn/style.min.css"><link rel="stylesheet" href="/assets/css/community/editorjs.min.css"><link rel="stylesheet" href="/assets/css/dictionary/autocomplete-theme-bootstrap.min.css"></head><body oncontextmenu="return false" ondragstart="return false"><header th:replace="~{/base/header::header}"></header><main layout:fragment="main"></main><div class="toast-container position-fixed bottom-0 start-50 translate-middle-x p-3" id="toast" th:insert="~{/base/toast::toast}"></div><script src="/assets/js/jquery.min.js"></script><script src="/assets/bootstrap/js/bootstrap.min.js"></script><script src="/assets/js/script.min.js"></script><script src="/assets/js/community/editorjs.umd.min.js"></script><script src="/assets/js/community/jquery.timeago.min.js"></script><script src="/assets/js/community/editor.mjs" type="module"></script><script src="/assets/js/community/post-color-changer.mjs" type="module"></script><script src="/assets/js/community/time-ago.mjs" type="module"></script><script src="/assets/js/dictionary/algolia.mjs" type="module"></script></body></html>
Loading

0 comments on commit 3549fc2

Please sign in to comment.