aboutsummaryrefslogtreecommitdiff
path: root/app/src/web/assets/js/context_a.js
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-02-05 23:02:50 -0500
committerAllan Wang <me@allanwang.ca>2019-02-05 23:02:50 -0500
commitddfc310fde5f50ba52ef930287449c2e08faaca8 (patch)
treed96d38769b841f55e493a84805b99a294d7bc0ac /app/src/web/assets/js/context_a.js
parent8b850711ceb7c38f9368ce840831c1c0bdb4ba74 (diff)
downloadfrost-ddfc310fde5f50ba52ef930287449c2e08faaca8.tar.gz
frost-ddfc310fde5f50ba52ef930287449c2e08faaca8.tar.bz2
frost-ddfc310fde5f50ba52ef930287449c2e08faaca8.zip
Add ability to copy comments, resolves #454
Diffstat (limited to 'app/src/web/assets/js/context_a.js')
-rw-r--r--app/src/web/assets/js/context_a.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/app/src/web/assets/js/context_a.js b/app/src/web/assets/js/context_a.js
index d0f5c622..410553bd 100644
--- a/app/src/web/assets/js/context_a.js
+++ b/app/src/web/assets/js/context_a.js
@@ -1,6 +1,15 @@
"use strict";
(function () {
var longClick = false;
+ var _frostCopyComment = function (e, target) {
+ if (!target.hasAttribute('data-commentid')) {
+ return false;
+ }
+ var text = target.innerText;
+ console.log("Copy comment " + text);
+ Frost.contextMenu(null, text);
+ return true;
+ };
var _frostCopyPost = function (e, target) {
if (target.tagName !== 'A') {
return false;
@@ -55,12 +64,12 @@
Frost.contextMenu(url, text);
return true;
};
- var handlers = [_frostCopyPost, _frostImage];
+ var handlers = [_frostCopyComment, _frostCopyPost, _frostImage];
var _frostAContext = function (e) {
Frost.longClick(true);
longClick = true;
var target = e.target || e.currentTarget || e.srcElement;
- if (!(target instanceof Element)) {
+ if (!(target instanceof HTMLElement)) {
console.log("No element found");
return;
}