diff --git a/resources/public/js/main.js b/resources/public/js/main.js index 0bb1f34..dca2f00 100644 --- a/resources/public/js/main.js +++ b/resources/public/js/main.js @@ -3,3 +3,9 @@ document.body.addEventListener('configRequest.htmx', (e) => { e.detail.parameters['__anti-forgery-token'] = __csrfToken; } }); + +document.querySelectorAll('.bbc-spoiler').forEach(elem => { + elem.addEventListener('click', e => { + e.target.classList.toggle('active'); + }); +}); diff --git a/src/clojsa/saclient.clj b/src/clojsa/saclient.clj index 6ea0bed..376c9c0 100644 --- a/src/clojsa/saclient.clj +++ b/src/clojsa/saclient.clj @@ -14,6 +14,15 @@ :pagenumber page}] {:href base-url :params query}))) +(defn do-login [] + (let [login-url (str url "account.php") + cs (clj-http.cookies/cookie-store)] + (client/post login-url {:form-params {:action "login" + :username "xf86enodev" + :password "triebhaftigke1t"} + :cookie-store cs}) + (clj-http.cookies/get-cookies cs))) + (defn thread-response [session url] (with-open [client (http/create-client)] (let [{:keys [href params]} url diff --git a/src/clojsa/views.clj b/src/clojsa/views.clj index a728463..7792097 100644 --- a/src/clojsa/views.clj +++ b/src/clojsa/views.clj @@ -30,13 +30,14 @@ (include-js "/js/main.js")])) (defn index-page [req] - (main-template {} - [:div.container - [:pre - (clojure.pprint/pprint req)]])) + (main-template + {} + [:div.container + [:pre.output + [:code (with-out-str (clojure.pprint/pprint req))]]])) (defn paginate [id cur last] - [:nav.container.pagination {:hx-boot "false"} + [:nav.container.box.pagination {:hx-boot "false"} [:a.pagination-previous {:href (format "/thread/%d?page=%d" id (dec cur))} "<"] [:a.pagination-next @@ -66,10 +67,16 @@ [:h1.is-size-3.mb-4 title]] [:section.thread (for [post content] - [:article.container.box.columns - [:aside.userinfo.column - (:ui post)] - [:main.postbody.content.column.is-four-fifths - (:pb post)]])] + [:article.container.box + [:div.tile.is-ancestor + [:aside.userinfo.tile.is-3.is-parent + (:ui post)] + [:main.postbody.content.tile.is-9.is-parent.is-vertical + [:div.tile.is-child + (:pb post)] + [:div.level.tile.is-child.is-12 + [:div.level-right + [:span.postdate.level-item + (:pd post)]]]]]])] [:section (paginate id page page-count)])))