aboutsummaryrefslogtreecommitdiff
path: root/static/fluoride.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/fluoride.js')
-rw-r--r--static/fluoride.js21
1 files changed, 16 insertions, 5 deletions
diff --git a/static/fluoride.js b/static/fluoride.js
index e6a63ef..73d4939 100644
--- a/static/fluoride.js
+++ b/static/fluoride.js
@@ -74,8 +74,10 @@ function handleLikeForm(id, f) {
for (var i = 0; i < counts.length; i++) {
if (count > 0) {
counts[i].innerHTML = "(" + count + ")";
+ counts[i].classList.remove("hidden");
} else {
counts[i].innerHTML = "";
+ counts[i].classList.add("hidden");
}
}
}, function(err) {
@@ -113,8 +115,10 @@ function handleRetweetForm(id, f) {
for (var i = 0; i < counts.length; i++) {
if (count > 0) {
counts[i].innerHTML = "(" + count + ")";
+ counts[i].classList.remove("hidden");
} else {
counts[i].innerHTML = "";
+ counts[i].classList.add("hidden");
}
}
}, function(err) {
@@ -151,8 +155,7 @@ function handleReplyToLink(a) {
var ract = event.target.getBoundingClientRect();
copy.style["max-width"] = (window.innerWidth - ract.left - 32) + "px";
if (ract.top > window.innerHeight / 2) {
- copy.style.bottom = (window.innerHeight -
- window.scrollY - ract.top) + "px";
+ copy.style.bottom = ract.height + 'px';
}
event.target.parentElement.appendChild(copy);
}
@@ -285,6 +288,12 @@ function onPaste(e) {
fp.files = dt.files;
}
+function onKeydown(e) {
+ if (e.key == 'Enter' && e.ctrlKey) {
+ document.querySelector(".post-form").submit();
+ }
+}
+
document.addEventListener("DOMContentLoaded", function() {
checkCSRFToken();
checkAntiDopamineMode();
@@ -314,19 +323,21 @@ document.addEventListener("DOMContentLoaded", function() {
}
}
- var links = document.querySelectorAll(".user-profile-decription a, .user-fields a");
+ var links = document.querySelectorAll(".user-profile-description a, .user-fields a");
for (var j = 0; j < links.length; j++) {
links[j].target = "_blank";
}
- var links = document.querySelectorAll(".status-media-container .img-link");
+ var links = document.querySelectorAll(".status-media-container .img-link, .user-profile-img-container .img-link");
for (var j = 0; j < links.length; j++) {
handleImgPreview(links[j]);
}
var pf = document.querySelector(".post-form")
- if (pf)
+ if (pf) {
pf.addEventListener("paste", onPaste);
+ pf.addEventListener("keydown", onKeydown);
+ }
});
// @license-end