/** * jQuery contextMenu v@VERSION - Plugin for simple contextMenu handling * * Version: v@VERSION * * Authors: Björn Brala (SWIS.nl), Rodney Rehm, Addy Osmani (patches for FF) * Web: http://swisnl.github.io/jQuery-contextMenu/ * * Copyright (c) 2011-@YEAR SWIS BV and contributors * * Licensed under * MIT License http://www.opensource.org/licenses/mit-license * * Date: @DATE */ // jscs:disable /* jshint ignore:start */ (function (factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as anonymous module. define(['jquery'], factory); } else if (typeof exports === 'object') { // Node / CommonJS factory(require('jquery')); } else { // Browser globals. factory(jQuery); } })(function ($) { 'use strict'; // helper function to check for rapid interactions after menu display var isInteractionTooFast = function($element) { if (!('ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0)) { return false; } var interactionTime = Date.now(); var $liItem = $element.is('input, textarea, select') ? $element.closest('.context-menu-item') : $element; if (!$liItem || !$liItem.length) { return false; } var $parentMenu = $liItem.parent(); if (!$parentMenu || !$parentMenu.length) { return false; } // only apply the check for items within submenus if ($parentMenu.hasClass('context-menu-root')) { return false; } var showTimestamp = $parentMenu.data('_showTimestamp'); var timeDifference = showTimestamp ? interactionTime - showTimestamp : Infinity; // threshold for fast interaction (e.g., mobile tap) var threshold = 50; // ms return timeDifference < threshold; }; // TODO: - // ARIA stuff: menuitem, menuitemcheckbox und menuitemradio // create