PageSourceSearch

https://malawiheritage.net/galleries/js/singleclick.js

js malawiheritage.net collected 2026-10-05 02:44:16 UTC 1,213 bytes, 39 lines download raw bytes

1L.Evented.addInitHook( function () {
2    this._singleClickTimeout = null;
3    this.on( 'click', this._scheduleSingleClick, this );
4    this.on( 'dblclick dragstart zoomstart', this._cancelSingleClick, this );
5});
6
7L.Evented.include({
8
9    _cancelSingleClick : function(){
10        // This timeout is key to workaround an issue where double-click events
11        // are fired in this order on some touch browsers: ['click', 'dblclick', 'click']
12        // instead of ['click', 'click', 'dblclick']
13        setTimeout( this._clearSingleClickTimeout.bind(this), 0 );
14    },
15
16    _scheduleSingleClick: function(e) {
17        this._clearSingleClickTimeout();
18
19        this._singleClickTimeout = setTimeout(
20            this._fireSingleClick.bind(this, e),
21            (this.options.singleClickTimeout || 500)
22        );
23    },
24
25    _fireSingleClick: function(e){
26        if ( !e.originalEvent._stopped ) {
27            this.fire( 'singleclick', L.Util.extend( e, { type : 'singleclick' } ) );
28        }
29    },
30
31    _clearSingleClickTimeout: function(){
32        if (this._singleClickTimeout != null) {
33            clearTimeout( this._singleClickTimeout );
34            this._singleClickTimeout = null;
35        }
36    }
37
38});
39

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.