diff options
author | FChannel <> | 2021-06-03 01:19:37 -0700 |
---|---|---|
committer | FChannel <> | 2021-06-03 01:19:37 -0700 |
commit | 9d937e6f895ca7213ae759efca9b292a1d014ab3 (patch) | |
tree | eecfbe1c593afc5c1c2e4017a109cfb94a51a014 /static | |
parent | 60b6bdf1c021fcffff397c7b1439a1407ed90f0a (diff) |
cleaning up removing posts
Diffstat (limited to 'static')
-rw-r--r-- | static/js/posts.js | 15 | ||||
-rw-r--r-- | static/ncatalog.html | 11 | ||||
-rw-r--r-- | static/posts.html | 2 |
3 files changed, 15 insertions, 13 deletions
diff --git a/static/js/posts.js b/static/js/posts.js index b2bfd7a..077b654 100644 --- a/static/js/posts.js +++ b/static/js/posts.js @@ -26,6 +26,8 @@ function shortURL(actorName, url) { re = /.+\//g; temp = re.exec(url) + + var output if(stripTransferProtocol(temp[0]) == stripTransferProtocol(actorName) + "/") { @@ -39,11 +41,8 @@ function shortURL(actorName, url) re = /\w+$/g; - u = re.exec(short); - - return u; + output = re.exec(short); }else{ - var short = url.replace("https://", ""); short = short.replace("http://", ""); short = short.replace("www.", ""); @@ -64,10 +63,10 @@ function shortURL(actorName, url) v = re.exec(str) - v = "f" + v[0] + "-" + u - - return v; + output = "f" + v[0] + "-" + u } + + return output } function shortImg(url) @@ -113,7 +112,7 @@ function getBoardId(url) function convertContent(actorName, content, opid) { - var re = /(>>)(https:\/\/|http:\/\/)?(www\.)?.+\/\w+/gm; + var re = /(>>)(https?:\/\/)?(www\.)?.+\/\w+/gm; var match = content.match(re); var newContent = content; if(match) diff --git a/static/ncatalog.html b/static/ncatalog.html index 81d31f3..a399d13 100644 --- a/static/ncatalog.html +++ b/static/ncatalog.html @@ -24,6 +24,7 @@ {{ end }} <a id="{{ .Id }}-anchor" href="/{{ $board.Name }}/"> <div id="media-{{ .Id }}" style="width:180px;"></div> + </a> <script> media = document.getElementById("media-{{ .Id }}") if(getMIMEType({{ (index .Attachment 0).MediaType }}) == "image"){ @@ -56,9 +57,12 @@ video.style = "margin-right: 10px; margin-bottom: 10px; max-width: 180px; max-height: 180px;" video.innerText = 'Video is not supported.' media.appendChild(video) - } + } + + document.getElementById("{{ .Id }}-anchor").href = "/{{ $board.Name }}/" + shortURL("{{$board.Actor.Id}}", "{{ .Id }}") </script> {{ end }} + <a id="{{ .Id }}-link" href="/{{ $board.Name }}/"> <div> {{ $replies := .Replies }} {{ if $replies }} @@ -71,12 +75,11 @@ {{ if .Content }} <span style="display: block">{{.Content}}</span> {{ end }} - </div> - </a> + </a> </div> <script> - document.getElementById("{{ .Id }}-anchor").href = "/{{ $board.Name }}/" + shortURL("{{$board.Actor.Id}}", "{{ .Id }}") + document.getElementById("{{ .Id }}-link").href = "/{{ $board.Name }}/" + shortURL("{{$board.Actor.Id}}", "{{ .Id }}") </script> {{ end }} </div> diff --git a/static/posts.html b/static/posts.html index aaf10c9..ee71faf 100644 --- a/static/posts.html +++ b/static/posts.html @@ -79,7 +79,7 @@ {{ end }} {{ if .Attachment }} {{ if eq $board.ModCred $board.Domain $board.Actor.Id }} - <a href="/deleteattach?id={{ .Id }}&board={{ $board.Actor.Id }}">[Delete Attachment]</a> + <a href="/deleteattach?id={{ .Id }}&board={{ $board.Actor.Name }}">[Delete Attachment]</a> {{ end }} <span style="display: block;">File <a id="{{ .Id }}-img" href="{{ (index .Attachment 0).Href}}">{{ (index .Attachment 0).Name }}</a> <span id="{{ .Id }}-size">({{ (index .Attachment 0).Size }})</span></span> <div id="media-{{ .Id }}"></div> |