diff options
author | FChannel <> | 2021-06-17 00:21:07 -0700 |
---|---|---|
committer | FChannel <> | 2021-06-17 00:21:07 -0700 |
commit | cc24155859b65653495747bd0b38be9bcef33298 (patch) | |
tree | c46e5b7273534e9626d746855b3b036ee06c1006 /static | |
parent | bf23a5c30ace0525e2ad67a979916af5ebab3001 (diff) |
added html meta data as well as basic hover effect on links
Diffstat (limited to 'static')
-rw-r--r-- | static/index.html | 15 | ||||
-rw-r--r-- | static/js/posts.js | 39 | ||||
-rw-r--r-- | static/main.html | 7 | ||||
-rw-r--r-- | static/ncatalog.html | 12 | ||||
-rw-r--r-- | static/npost.html | 17 | ||||
-rw-r--r-- | static/nposts.html | 11 | ||||
-rw-r--r-- | static/posts.html | 11 | ||||
-rw-r--r-- | static/sensative.png | bin | 0 -> 3737 bytes |
8 files changed, 104 insertions, 8 deletions
diff --git a/static/index.html b/static/index.html index 2840a83..1cd206b 100644 --- a/static/index.html +++ b/static/index.html @@ -1,4 +1,19 @@ {{ define "header" }} +<title>{{ .Title }}</title> +<meta name="description" content="{{ .Message }}"> + +<meta property="og:locale" content="en_US" /> +<meta property="og:type" content="website" /> +<meta property="og:url" content="{{ .Board.Domain }}"> +<meta property="og:site_name" content="{{ .Board.Actor.PreferredUsername }}" /> + +<meta property="og:title" content="{{ .Title }}"> +<meta property="og:description" content="{{ .Message }}"> + +<meta name="twitter:title" content="{{ .Title }}"> +<meta name="twitter:description" content="{{ .Message }}"> +<meta name="twitter:card" content="summary_large_image"> + {{ end }} {{ define "top" }}{{ end }} diff --git a/static/js/posts.js b/static/js/posts.js index 077b654..5be272a 100644 --- a/static/js/posts.js +++ b/static/js/posts.js @@ -124,8 +124,14 @@ function convertContent(actorName, content, opid) { isOP = " (OP)"; } - - newContent = newContent.replace(quote, '<a class="reply" title="' + link + '" href="'+ (actorName) + "/" + shortURL(actorName, opid) + '#' + shortURL(actorName, link) + '";">>>' + shortURL(actorName, link) + isOP + '</a>'); + + var q = link + + if(document.getElementById(link + "-content") != null) { + q = document.getElementById(link + "-content").innerText; + } + + newContent = newContent.replace(quote, '<a class="reply" title="' + q + '" href="'+ (actorName) + "/" + shortURL(actorName, opid) + '#' + shortURL(actorName, link) + '";">>>' + shortURL(actorName, link) + isOP + '</a>'); }) } @@ -143,6 +149,35 @@ function convertContent(actorName, content, opid) return newContent } +function convertContentNoLink(actorName, content, opid) +{ + var re = /(>>)(https?:\/\/)?(www\.)?.+\/\w+/gm; + var match = content.match(re); + var newContent = content; + if(match) + { + match.forEach(function(quote, i){ + var link = quote.replace('>>', '') + var isOP = "" + if(link == opid) + { + isOP = " (OP)"; + } + + var q = link + + if(document.getElementById(link + "-content") != null) { + q = document.getElementById(link + "-content").innerText; + } + + newContent = newContent.replace(quote, '>>>' + shortURL(actorName, link) + isOP); + + }) + } + + return newContent +} + function closeReply() { document.getElementById("reply-box").style.display = "none"; diff --git a/static/main.html b/static/main.html index 1cd2aff..172f90b 100644 --- a/static/main.html +++ b/static/main.html @@ -1,10 +1,13 @@ {{ define "layout" }} <!DOCTYPE html> <html> - <meta name="viewport" content="width=device-width, initial-scale=1"> <head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="keywords" content="Federated Imageboard based on Activtypub"> + <meta property="og:locale" content="en_US" /> + <meta property="og:type" content="website" /> <link rel="icon" type="image/png" href="/static/favicon.png"> - <title>{{ .Title }}</title> <style> a, a:link, a:visited, a:hover, a:active { text-decoration: none diff --git a/static/ncatalog.html b/static/ncatalog.html index 43fd6fd..027a938 100644 --- a/static/ncatalog.html +++ b/static/ncatalog.html @@ -1,4 +1,16 @@ {{ define "header" }} +<title>/{{ .Board.Name }}/ - catalog</title> +<meta name="description" content="{{ .Board.Summary }}"> +<meta property="og:url" content="{{ .Board.Actor.Id }}"> +<meta property="og:site_name" content="{{ .Instance.PreferredUsername }}" /> + +<meta property="og:title" content="{{ .Title }}"> +<meta property="og:description" content="{{ .Board.Summary }}"> + +<meta name="twitter:title" content="{{ .Title }}"> +<meta name="twitter:description" content="{{ .Board.Summary }}"> +<meta name="twitter:card" content="summary_large_image"> + <script src="/static/js/posts.js"></script> {{ end }} diff --git a/static/npost.html b/static/npost.html index b91b795..740018b 100644 --- a/static/npost.html +++ b/static/npost.html @@ -1,4 +1,21 @@ {{ define "header" }} +<title>/{{ .Board.Name }}/ - {{ .PostId }}</title> +<meta name="description" content="{{ (index .Posts 0).Content }}"> +<meta property="og:url" content="{{ (index .Posts 0).Id }}"> +<meta property="og:site_name" content="{{ .Instance.PreferredUsername }}" /> + +<meta property="og:title" content="{{ (index .Posts 0).Name }}"> +<meta property="og:description" content="{{ (index .Posts 0).Content }}"> + +<meta name="twitter:title" content="{{ (index .Posts 0).Name }}"> +<meta name="twitter:description" content="{{ (index .Posts 0).Content }}"> +<meta name="twitter:card" content="summary_large_image"> + +{{ if (index .Posts 0).Preview }} +<meta property="og:image" content="{{ (index .Posts 0).Preview.Href }}" /> +<meta name="twitter:image" content="{{ (index .Posts 0).Preview.Href }}" /> +{{ end }} + <script src="/static/js/posts.js"></script> {{ end }} diff --git a/static/nposts.html b/static/nposts.html index 173f175..d106f74 100644 --- a/static/nposts.html +++ b/static/nposts.html @@ -1,4 +1,15 @@ {{ define "header" }} +<title>{{ .Title }}</title> +<meta name="description" content="{{ .Board.Summary }}"> +<meta property="og:url" content="{{ .Board.Actor.Id }}"> +<meta property="og:site_name" content="{{ .Instance.PreferredUsername }}" /> + +<meta property="og:title" content="{{ .Title }}"> +<meta property="og:description" content="{{ .Board.Summary }}"> + +<meta name="twitter:title" content="{{ .Title }}"> +<meta name="twitter:description" content="{{ .Board.Summary }}"> +<meta name="twitter:card" content="summary_large_image"> <script src="/static/js/posts.js"></script> {{ end }} diff --git a/static/posts.html b/static/posts.html index ee71faf..bfcc84b 100644 --- a/static/posts.html +++ b/static/posts.html @@ -131,10 +131,13 @@ {{ if .Replies.OrderedItems }} {{ range .Replies.OrderedItems }} <span id="{{$parentId}}-replyto-{{.Id}}"></span> - <script>document.getElementById("{{ $parentId }}-replyto-{{.Id}}").innerHTML = "<a title='{{ .Id }}' href='/{{ $board.Name }}/" + shortURL("{{ $board.Actor.Id }}", "{{ $opId }}") + "#" + shortURL("{{ $board.Actor.Id }}", "{{ .Id }}") + "'>>>" + shortURL("{{ $board.Actor.Id }}", "{{ .Id }}") + "</a>";</script> - {{ end }} - {{ end }} - <p id="{{ .Id }}-content" style="white-space: pre-wrap; margin: 10px 30px 10px 30px;">{{.Content}}</p> + <script> + var content = convertContentNoLink('{{$board.Actor.Id}}', '{{ .Content }}', '{{ $opId }}') + document.getElementById("{{ $parentId }}-replyto-{{.Id}}").innerHTML = "<a title='" + content +"' href='/{{ $board.Name }}/" + shortURL("{{ $board.Actor.Id }}", "{{ $opId }}") + "#" + shortURL("{{ $board.Actor.Id }}", "{{ .Id }}") + "'>>>" + shortURL("{{ $board.Actor.Id }}", "{{ .Id }}") + "</a>"; + </script> + {{ end }} + {{ end }} + <p id="{{ .Id }}-content" style="white-space: pre-wrap; margin: 10px 30px 10px 30px;">{{.Content}}</p> </div> </div> </div> diff --git a/static/sensative.png b/static/sensative.png Binary files differnew file mode 100644 index 0000000..ea706c8 --- /dev/null +++ b/static/sensative.png |