Merge branch 'work'

This commit is contained in:
rdiedrich 2020-06-23 11:18:39 +02:00
commit 442c80ea98
3 changed files with 32 additions and 10 deletions

View File

@ -3,3 +3,9 @@ document.body.addEventListener('configRequest.htmx', (e) => {
e.detail.parameters['__anti-forgery-token'] = __csrfToken; e.detail.parameters['__anti-forgery-token'] = __csrfToken;
} }
}); });
document.querySelectorAll('.bbc-spoiler').forEach(elem => {
elem.addEventListener('click', e => {
e.target.classList.toggle('active');
});
});

View File

@ -14,6 +14,15 @@
:pagenumber page}] :pagenumber page}]
{:href base-url :params query}))) {: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] (defn thread-response [session url]
(with-open [client (http/create-client)] (with-open [client (http/create-client)]
(let [{:keys [href params]} url (let [{:keys [href params]} url

View File

@ -30,13 +30,14 @@
(include-js "/js/main.js")])) (include-js "/js/main.js")]))
(defn index-page [req] (defn index-page [req]
(main-template {} (main-template
{}
[:div.container [:div.container
[:pre [:pre.output
(clojure.pprint/pprint req)]])) [:code (with-out-str (clojure.pprint/pprint req))]]]))
(defn paginate [id cur last] (defn paginate [id cur last]
[:nav.container.pagination {:hx-boot "false"} [:nav.container.box.pagination {:hx-boot "false"}
[:a.pagination-previous [:a.pagination-previous
{:href (format "/thread/%d?page=%d" id (dec cur))} "<"] {:href (format "/thread/%d?page=%d" id (dec cur))} "<"]
[:a.pagination-next [:a.pagination-next
@ -66,10 +67,16 @@
[:h1.is-size-3.mb-4 title]] [:h1.is-size-3.mb-4 title]]
[:section.thread [:section.thread
(for [post content] (for [post content]
[:article.container.box.columns [:article.container.box
[:aside.userinfo.column [:div.tile.is-ancestor
[:aside.userinfo.tile.is-3.is-parent
(:ui post)] (:ui post)]
[:main.postbody.content.column.is-four-fifths [:main.postbody.content.tile.is-9.is-parent.is-vertical
(:pb post)]])] [:div.tile.is-child
(:pb post)]
[:div.level.tile.is-child.is-12
[:div.level-right
[:span.postdate.level-item
(:pd post)]]]]]])]
[:section [:section
(paginate id page page-count)]))) (paginate id page page-count)])))