Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fix #1727, add GA sendEvent for right-clicks/context menu on My Shots
Browse files Browse the repository at this point in the history
  • Loading branch information
ianb committed Oct 12, 2016
1 parent accfe28 commit 5e20487
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/METRICS.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ These are events that an add-on user can encounter on a shot they own
4. [x] Clear search term `web/clear-search/submit` and click the arrow ![image](https://d17oy1vhnax1f7.cloudfront.net/items/382R0U3J0Q3K362g3E0q/Image%202016-09-07%20at%203.11.59%20PM.png?v=c006c85a)
4. [x] Clear search term `web/clear-search/keyboard` by simply backspacing
5. [x] Receive no search results `web/search-no-results` ![image](https://d17oy1vhnax1f7.cloudfront.net/items/091Z1a253a062B3R1X2c/Image%202016-09-07%20at%203.12.37%20PM.png?v=b556941e)
6. [x] Right-click (or get the context menu) anywhere on the page `contextmenu/background`, `contextmenu/shot-tile`, `contextmenu/search`, or `contextmenu/header` depending on where the user clicks.

#### Non-owner web visit

Expand Down
24 changes: 24 additions & 0 deletions server/src/pages/shotindex/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,29 @@ document.addEventListener("helper-ready", function onHelperReady(e) {
document.dispatchEvent(event);
}, false);

document.addEventListener("contextmenu", (event) => {
let place = "background";
let node = event.target;
while (node) {
if (node.nodeType != document.ELEMENT_NODE) {
node = node.parentNode;
continue;
}
if (node.classList.contains("shot")) {
place = "shot-tile";
break;
}
if (node.tagName == "FORM") {
place = "search";
break;
}
if (node.classList.contains("header")) {
place = "header";
break;
}
node = node.parentNode;
}
sendEvent("contextmenu", place);
}, false);

window.controller = exports;

0 comments on commit 5e20487

Please sign in to comment.