Skip to content

Node.js based forum software built for the modern web

closes #5152

Julian Lam9a0d81ef6bbf
diff --git a/package.json b/package.json
index f62006105d..d90e4a710c 100644
--- a/package.json
+++ b/package.json
@@ -52,7 +52,7 @@
"morgan": "^1.3.2",
"mousetrap": "^1.5.3",
"nconf": "~0.8.2",
- "nodebb-plugin-composer-default": "4.2.12",
+ "nodebb-plugin-composer-default": "4.2.13",
"nodebb-plugin-dbsearch": "1.0.3",
"nodebb-plugin-emoji-extended": "1.1.1",
"nodebb-plugin-emoji-one": "1.1.5",
diff --git a/public/src/modules/scrollStop.js b/public/src/modules/scrollStop.js
new file mode 100644
index 0000000000..3bb96aed8b
--- /dev/null
+++ b/public/src/modules/scrollStop.js
@@ -0,0 +1,32 @@
+'use strict';
+
+/* globals console, define */
+
+/*
+ The point of this library is to enhance(tm) a textarea so that if scrolled,
+ you can only scroll to the top of it and the event doesn't bubble up to
+ the document... because it does... and it's annoying at times.
+
+ While I'm here, might I say this is a solved issue on Linux?
+*/
+
+define('scrollStop', function () {
+ var Module = {};
+
+ Module.apply = function (element) {
+ $(element).on('mousewheel', function (e) {
+ var scrollTop = this.scrollTop;
+ var scrollHeight = this.scrollHeight;
+ var elementHeight = this.getBoundingClientRect().height;
+
+ if (
+ (e.originalEvent.deltaY < 0 && scrollTop === 0) || // scroll up
+ (e.originalEvent.deltaY > 0 && (elementHeight + scrollTop) > scrollHeight) // scroll down
+ ) {
+ return false;
+ }
+ });
+ };
+
+ return Module;
+});
\ No newline at end of file