PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 1.3.2
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v1.3.2
5.13.0 5.12.1 5.12.0 5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / libs / jquery / mwheelIntent.js
matomo / app / libs / jquery Last commit date
images 6 years ago stylesheets 6 years ago themes 6 years ago LICENSE-sizzle.txt 6 years ago MIT-LICENSE-history.txt 6 years ago gpl-2.0.txt 6 years ago gpl-3.0.txt 6 years ago jquery.browser.js 6 years ago jquery.truncate.js 6 years ago mwheelIntent.js 6 years ago
mwheelIntent.js
77 lines
1 /**
2 * @author trixta
3 * @version 1.2
4 */
5 (function($){
6
7 var mwheelI = {
8 pos: [-260, -260]
9 },
10 minDif = 3,
11 doc = document,
12 root = doc.documentElement,
13 body = doc.body,
14 longDelay, shortDelay
15 ;
16
17 function unsetPos(){
18 if(this === mwheelI.elem){
19 mwheelI.pos = [-260, -260];
20 mwheelI.elem = false;
21 minDif = 3;
22 }
23 }
24
25 $.event.special.mwheelIntent = {
26 setup: function(){
27 var jElm = $(this).bind('mousewheel', $.event.special.mwheelIntent.handler);
28 if( this !== doc && this !== root && this !== body ){
29 jElm.bind('mouseleave', unsetPos);
30 }
31 jElm = null;
32 return true;
33 },
34 teardown: function(){
35 $(this)
36 .unbind('mousewheel', $.event.special.mwheelIntent.handler)
37 .unbind('mouseleave', unsetPos)
38 ;
39 return true;
40 },
41 handler: function(e, d){
42 var pos = [e.clientX, e.clientY];
43 if( this === mwheelI.elem || Math.abs(mwheelI.pos[0] - pos[0]) > minDif || Math.abs(mwheelI.pos[1] - pos[1]) > minDif ){
44 mwheelI.elem = this;
45 mwheelI.pos = pos;
46 minDif = 250;
47
48 clearTimeout(shortDelay);
49 shortDelay = setTimeout(function(){
50 minDif = 10;
51 }, 200);
52 clearTimeout(longDelay);
53 longDelay = setTimeout(function(){
54 minDif = 3;
55 }, 1500);
56 e = $.extend({}, e, {type: 'mwheelIntent'});
57 return $.event.dispatch.apply(this, arguments);
58 }
59 }
60 };
61 $.fn.extend({
62 mwheelIntent: function(fn) {
63 return fn ? this.bind("mwheelIntent", fn) : this.trigger("mwheelIntent");
64 },
65
66 unmwheelIntent: function(fn) {
67 return this.unbind("mwheelIntent", fn);
68 }
69 });
70
71 $(function(){
72 body = doc.body;
73 //assume that document is always scrollable, doesn't hurt if not
74 $(doc).bind('mwheelIntent.mwheelIntentDefault', $.noop);
75 });
76 })(jQuery);
77