Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ignore-click.js « directives « common « angularjs « CoreHome « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a11c0e29c8e06b18ff12f8c45ca1533e5a0ec880 (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
/*!
 * Matomo - free/libre analytics platform
 *
 * @link https://matomo.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */

/**
 * Prevents the default behavior of the click. For instance useful if a link should only work in case the user
 * does a "right click open in new window".
 *
 * Example
 * <a piwik-ignore-click ng-click="doSomething()" href="/">my link</a>
 */
(function () {
    angular.module('piwikApp.directive').directive('piwikIgnoreClick', piwikIgnoreClick);

    function piwikIgnoreClick() {
        return function(scope, element, attrs) {
            $(element).click(function(event) {
                event.preventDefault();
            });
        };
    }
})();