mirror of https://github.com/zulip/zulip.git
deps: Upgrade and move `jquery-mousewheel` from `static/third` to `npm`
- Remove `jquery-mousewheel` from `static/third` and fetch it from npm. - Upgrade `jquery-mousewheel` to 3.1.6. - Bump up the `PROVISION_VERSION` to 4.5. - Change some js code to comply with this `jquery-mousewheel` version. Part of #1709.
This commit is contained in:
parent
10a8c3d2ae
commit
b683b2d3c3
|
@ -150,10 +150,6 @@ Copyright: 2011-2013 Henrique Boaventura
|
|||
License: Expat
|
||||
Comment: The software has been modified.
|
||||
|
||||
Files: static/third/jquery-mousewheel/jquery.mousewheel.js
|
||||
Copyright: 2011 Brandon Aaron
|
||||
License: Expat
|
||||
|
||||
Files: static/third/jquery-perfect-scrollbar/*
|
||||
Copyright: 2012 HyeonJe Jun
|
||||
License: Expat
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
"i18next-browser-languagedetector": "0.3.0",
|
||||
"i18next-localstorage-cache": "0.3.0",
|
||||
"jquery": "1.12.1",
|
||||
"jquery-mousewheel": "3.1.6",
|
||||
"jquery-validation": "1.15.1",
|
||||
"plotly.js": "1.19.2",
|
||||
"string.prototype.codepointat": "0.2.0",
|
||||
|
|
|
@ -384,7 +384,7 @@ $(function () {
|
|||
viewport.last_movement_direction = delta;
|
||||
});
|
||||
|
||||
viewport.message_pane.mousewheel(function (e, delta) {
|
||||
viewport.message_pane.mousewheel(function (e) {
|
||||
// Ignore mousewheel events if a modal is visible. It's weird if the
|
||||
// user can scroll the main view by wheeling over the grayed-out area.
|
||||
// Similarly, ignore events on settings page etc.
|
||||
|
@ -393,7 +393,7 @@ $(function () {
|
|||
// select the compose box and then wheel over the message stream.
|
||||
var obscured = exports.home_tab_obscured();
|
||||
if (!obscured) {
|
||||
throttled_mousewheelhandler(e, delta);
|
||||
throttled_mousewheelhandler(e, e.deltaY);
|
||||
} else if (obscured === 'modal') {
|
||||
// The modal itself has a handler invoked before this one (see below).
|
||||
// preventDefault here so that the tab behind the modal doesn't scroll.
|
||||
|
@ -413,7 +413,7 @@ $(function () {
|
|||
// propagation in all cases. Also, ignore the event if the
|
||||
// element is already at the top or bottom. Otherwise we get a
|
||||
// new scroll event on the parent (?).
|
||||
$('.modal-body, .scrolling_list, input, textarea').mousewheel(function (e, delta) {
|
||||
$('.modal-body, .scrolling_list, input, textarea').mousewheel(function (e) {
|
||||
var self = $(this);
|
||||
var scroll = self.scrollTop();
|
||||
|
||||
|
@ -422,8 +422,8 @@ $(function () {
|
|||
var max_scroll = this.scrollHeight - self.innerHeight() - 1;
|
||||
|
||||
e.stopPropagation();
|
||||
if ( ((delta > 0) && (scroll <= 0))
|
||||
|| ((delta < 0) && (scroll >= max_scroll))) {
|
||||
if ( ((e.deltaY > 0) && (scroll <= 0))
|
||||
|| ((e.deltaY < 0) && (scroll >= max_scroll))) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
|
||||
* Licensed under the MIT License (LICENSE.txt).
|
||||
*
|
||||
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
|
||||
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
|
||||
* Thanks to: Seamus Leahy for adding deltaX and deltaY
|
||||
*
|
||||
* Version: 3.0.6
|
||||
*
|
||||
* Requires: 1.2.2+
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
var types = ['DOMMouseScroll', 'mousewheel'];
|
||||
|
||||
if ($.event.fixHooks) {
|
||||
for ( var i=types.length; i; ) {
|
||||
$.event.fixHooks[ types[--i] ] = $.event.mouseHooks;
|
||||
}
|
||||
}
|
||||
|
||||
$.event.special.mousewheel = {
|
||||
setup: function() {
|
||||
if ( this.addEventListener ) {
|
||||
for ( var i=types.length; i; ) {
|
||||
this.addEventListener( types[--i], handler, false );
|
||||
}
|
||||
} else {
|
||||
this.onmousewheel = handler;
|
||||
}
|
||||
},
|
||||
|
||||
teardown: function() {
|
||||
if ( this.removeEventListener ) {
|
||||
for ( var i=types.length; i; ) {
|
||||
this.removeEventListener( types[--i], handler, false );
|
||||
}
|
||||
} else {
|
||||
this.onmousewheel = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.extend({
|
||||
mousewheel: function(fn) {
|
||||
return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
|
||||
},
|
||||
|
||||
unmousewheel: function(fn) {
|
||||
return this.unbind("mousewheel", fn);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function handler(event) {
|
||||
var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
|
||||
event = $.event.fix(orgEvent);
|
||||
event.type = "mousewheel";
|
||||
|
||||
// Old school scrollwheel delta
|
||||
if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta/120; }
|
||||
if ( orgEvent.detail ) { delta = -orgEvent.detail/3; }
|
||||
|
||||
// New school multidimensional scroll (touchpads) deltas
|
||||
deltaY = delta;
|
||||
|
||||
// Gecko
|
||||
if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
|
||||
deltaY = 0;
|
||||
deltaX = -1*delta;
|
||||
}
|
||||
|
||||
// Webkit
|
||||
if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; }
|
||||
if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; }
|
||||
|
||||
// Add event and delta to the front of the arguments
|
||||
args.unshift(event, delta, deltaX, deltaY);
|
||||
|
||||
return ($.event.dispatch || $.event.handle).apply(this, args);
|
||||
}
|
||||
|
||||
})(jQuery);
|
|
@ -1,2 +1,2 @@
|
|||
ZULIP_VERSION = "1.4.1+git"
|
||||
PROVISION_VERSION = '4.3'
|
||||
PROVISION_VERSION = '4.4'
|
||||
|
|
|
@ -760,7 +760,7 @@ JS_SPECS = {
|
|||
'third/jquery-filedrop/jquery.filedrop.js',
|
||||
'third/jquery-caret/jquery.caret.1.5.2.js',
|
||||
'node_modules/xdate/src/xdate.js',
|
||||
'third/jquery-mousewheel/jquery.mousewheel.js',
|
||||
'node_modules/jquery-mousewheel/jquery.mousewheel.js',
|
||||
'third/jquery-throttle-debounce/jquery.ba-throttle-debounce.js',
|
||||
'third/jquery-idle/jquery.idle.js',
|
||||
'third/jquery-autosize/jquery.autosize.js',
|
||||
|
|
Loading…
Reference in New Issue