aboutsummaryrefslogtreecommitdiff
path: root/views/js/footerscript.js
diff options
context:
space:
mode:
authorFChannel <>2021-10-24 10:40:45 -0700
committerFChannel <>2022-06-19 12:53:29 -0700
commit48fefb76c0a908cc3fa00abc9c090ce3ac8cb560 (patch)
treea7a24aec9f43222949e1f004fd5cd8a247e5024e /views/js/footerscript.js
parent65e79e6a743f447f320595dafec530212a568b9d (diff)
gofiber conversion, index, board posts, board post hooked up
Diffstat (limited to 'views/js/footerscript.js')
-rw-r--r--views/js/footerscript.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/views/js/footerscript.js b/views/js/footerscript.js
new file mode 100644
index 0000000..69e56e7
--- /dev/null
+++ b/views/js/footerscript.js
@@ -0,0 +1,44 @@
+var imgs = document.querySelectorAll('#img');
+var imgArray = [].slice.call(imgs);
+
+imgArray.forEach(function(img, i){
+ img.addEventListener("click", function(e){
+ var id = img.getAttribute("id");
+ var media = document.getElementById("media-" + id);
+ var sensitive = document.getElementById("sensitive-" + id);
+
+ if(img.getAttribute("enlarge") == "0")
+ {
+ var attachment = img.getAttribute("attachment");
+ img.setAttribute("enlarge", "1");
+ img.setAttribute("style", "float: left; margin-right: 10px; cursor: pointer;");
+ img.src = attachment;
+ }
+ else
+ {
+ var preview = img.getAttribute("preview");
+ img.setAttribute("enlarge", "0");
+ if(img.getAttribute("main") == 1)
+ {
+ img.setAttribute("style", "float: left; margin-right: 10px; max-width: 250px; max-height: 250px; cursor: pointer;");
+ img.src = preview;
+ }
+ else
+ {
+ img.setAttribute("style", "float: left; margin-right: 10px; max-width: 125px; max-height: 125px; cursor: pointer;");
+ img.src = preview;
+ }
+ }
+ });
+});
+
+
+function viewLink(board, actor) {
+ var posts = document.querySelectorAll('#view');
+ var postsArray = [].slice.call(posts);
+
+ postsArray.forEach(function(p, i){
+ var id = p.getAttribute("post");
+ p.href = "/" + board + "/" + shortURL(actor, id);
+ });
+}