Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function() {
- //'use strict';
- let showContextMenu = true;
- document.addEventListener("contextmenu", (e) => {
- if (!showContextMenu) {
- showContextMenu = true;
- e.preventDefault();
- }
- }, capture = false);
- window.addEventListener('mousedown', (e) => {
- if (
- e.button === 2 &&
- typeof e.target.classList === 'object' &&
- typeof e.target.className === 'string' &&
- e.target.classList.contains('dcg-hovered') &&
- (e.target.classList.contains('dcg-layered-icon') ||
- e.target.classList.contains('dcg-circular-icon'))
- ) {
- const ICON_DICTIONARY = `boxplot cross distribution dotplot-cross dotplot-default dotplot-open histogram move move-horizontal move-vertical open parametric-dashed parametric-dotted parametric-solid point points polygon-filled polygon-solid`;
- // isolate icon name using regex
- let targetName = e.target.className.match(/(?<=dcg-icon-)[a-z\-]+/im);
- if (
- ICON_DICTIONARY.search(targetName) !== -1 ||
- e.target.className.search('dcg-do-not-blur') !== -1
- ) {
- showContextMenu = false;
- Desmos.$(e.target.parentElement.parentElement).trigger('dcg-longhold');
- }
- }
- });
- }());
Advertisement
Add Comment
Please, Sign In to add comment