blob: 5e09ffcdc1d216de358793ecf9dba254366abe06 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
//context menu for links
//largely mimics click_a.js
if (!window.hasOwnProperty('frost_context_a')) {
console.log('frost_context_a frost_click_a');
window.frost_context_a = true;
var _frostAContext = function(e) {
/*
* Commonality; check for valid target
*/
var element = e.target || e.srcElement;
if (element.tagName !== 'A') element = element.parentNode;
//Notifications is two layers under
if (element.tagName !== 'A') element = element.parentNode;
if (element.tagName === 'A' && element.getAttribute('href') !== '#') {
var url = element.getAttribute('href');
if (url.includes('photoset_token')) return;
console.log('Context Intercept', url);
Frost.contextMenu(url);
e.stopPropagation();
e.preventDefault();
}
}
document.addEventListener('contextmenu', _frostAContext, true);
}
|