Revert "deps: Upgrade and move `jquery-mousewheel` from `static/third` to `npm`"

Apparently, the updated version of this has a serious scrolling
performance problem in the left sidebar that basically makes scrolling
in that area unusable.

This reverts commit b683b2d3c3.
This commit is contained in:
Tim Abbott 2017-01-26 11:02:54 -08:00
parent 71e6eb68c0
commit b52f606c3a
6 changed files with 95 additions and 8 deletions

View File

@ -150,6 +150,10 @@ Copyright: 2011-2013 Henrique Boaventura
License: Expat License: Expat
Comment: The software has been modified. 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/* Files: static/third/jquery-perfect-scrollbar/*
Copyright: 2012 HyeonJe Jun Copyright: 2012 HyeonJe Jun
License: Expat License: Expat

View File

@ -12,7 +12,6 @@
"i18next-browser-languagedetector": "0.3.0", "i18next-browser-languagedetector": "0.3.0",
"i18next-localstorage-cache": "0.3.0", "i18next-localstorage-cache": "0.3.0",
"jquery": "1.12.1", "jquery": "1.12.1",
"jquery-mousewheel": "3.1.6",
"jquery-validation": "1.15.1", "jquery-validation": "1.15.1",
"plotly.js": "1.19.2", "plotly.js": "1.19.2",
"string.prototype.codepointat": "0.2.0", "string.prototype.codepointat": "0.2.0",

View File

@ -371,7 +371,7 @@ $(function () {
viewport.last_movement_direction = delta; viewport.last_movement_direction = delta;
}); });
viewport.message_pane.mousewheel(function (e) { viewport.message_pane.mousewheel(function (e, delta) {
// Ignore mousewheel events if a modal is visible. It's weird if the // 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. // user can scroll the main view by wheeling over the grayed-out area.
// Similarly, ignore events on settings page etc. // Similarly, ignore events on settings page etc.
@ -380,7 +380,7 @@ $(function () {
// select the compose box and then wheel over the message stream. // select the compose box and then wheel over the message stream.
var obscured = exports.home_tab_obscured(); var obscured = exports.home_tab_obscured();
if (!obscured) { if (!obscured) {
throttled_mousewheelhandler(e, e.deltaY); throttled_mousewheelhandler(e, delta);
} else if (obscured === 'modal') { } else if (obscured === 'modal') {
// The modal itself has a handler invoked before this one (see below). // The modal itself has a handler invoked before this one (see below).
// preventDefault here so that the tab behind the modal doesn't scroll. // preventDefault here so that the tab behind the modal doesn't scroll.
@ -400,7 +400,7 @@ $(function () {
// propagation in all cases. Also, ignore the event if the // propagation in all cases. Also, ignore the event if the
// element is already at the top or bottom. Otherwise we get a // element is already at the top or bottom. Otherwise we get a
// new scroll event on the parent (?). // new scroll event on the parent (?).
$('.modal-body, .scrolling_list, input, textarea').mousewheel(function (e) { $('.modal-body, .scrolling_list, input, textarea').mousewheel(function (e, delta) {
var self = $(this); var self = $(this);
var scroll = self.scrollTop(); var scroll = self.scrollTop();
@ -409,8 +409,8 @@ $(function () {
var max_scroll = this.scrollHeight - self.innerHeight() - 1; var max_scroll = this.scrollHeight - self.innerHeight() - 1;
e.stopPropagation(); e.stopPropagation();
if ( ((e.deltaY > 0) && (scroll <= 0)) if ( ((delta > 0) && (scroll <= 0))
|| ((e.deltaY < 0) && (scroll >= max_scroll))) { || ((delta < 0) && (scroll >= max_scroll))) {
e.preventDefault(); e.preventDefault();
} }
}); });

View File

@ -0,0 +1,84 @@
/*! 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);

View File

@ -1,2 +1,2 @@
ZULIP_VERSION = "1.4.1+git" ZULIP_VERSION = "1.4.1+git"
PROVISION_VERSION = '4.4' PROVISION_VERSION = '4.3'

View File

@ -760,7 +760,7 @@ JS_SPECS = {
'third/jquery-filedrop/jquery.filedrop.js', 'third/jquery-filedrop/jquery.filedrop.js',
'third/jquery-caret/jquery.caret.1.5.2.js', 'third/jquery-caret/jquery.caret.1.5.2.js',
'node_modules/xdate/src/xdate.js', 'node_modules/xdate/src/xdate.js',
'node_modules/jquery-mousewheel/jquery.mousewheel.js', 'third/jquery-mousewheel/jquery.mousewheel.js',
'third/jquery-throttle-debounce/jquery.ba-throttle-debounce.js', 'third/jquery-throttle-debounce/jquery.ba-throttle-debounce.js',
'third/jquery-idle/jquery.idle.js', 'third/jquery-idle/jquery.idle.js',
'third/jquery-autosize/jquery.autosize.js', 'third/jquery-autosize/jquery.autosize.js',