From 5b8b79b83e4c35dcde393f71ccde9d0161298a61 Mon Sep 17 00:00:00 2001 From: Thomas Lynch Date: Thu, 26 Nov 2020 04:52:30 +0000 Subject: [PATCH] Add something for anchors in catalog, to be used later as a noscript fallback for a 4chan-like catalog search link feature --- gulp/res/css/style.css | 1 + views/mixins/catalogtile.pug | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/gulp/res/css/style.css b/gulp/res/css/style.css index 9f351f8a..179548aa 100644 --- a/gulp/res/css/style.css +++ b/gulp/res/css/style.css @@ -898,6 +898,7 @@ input:invalid, textarea:invalid { } .anchor:target + .post-container, +.anchor:target + .catalog-tile, .post-container.highlighted, .post-container.hoverhighlighted, .anchor:target + table tbody tr th, diff --git a/views/mixins/catalogtile.pug b/views/mixins/catalogtile.pug index 93da734d..89d9baa2 100644 --- a/views/mixins/catalogtile.pug +++ b/views/mixins/catalogtile.pug @@ -1,4 +1,10 @@ mixin catalogtile(post, index) + - let anchorSubject = post.subject; + if post.subject + - const subjectAnchorMatch = post.subject.match(/^\/\w+\//); + if subjectAnchorMatch + - anchorSubject = subjectAnchorMatch[0] + .anchor(id=`${post.board}-${anchorSubject}`) .catalog-tile(data-board=post.board data-post-id=post.postId data-user-id=post.userId