Commit 06b379d2 authored by Randall Leeds's avatar Randall Leeds

Replace jquery.scrollintoview w scroll-into-view

The scroll-into-view library has no dependency on jQuery, is a proper
CommonJS module (no need for browserify-shim), handles nesting better,
and scrolls elements into the middle of the screen.

Overal, a better experience as a developer and a user.
parent e7d1b5fd
var Annotator = require('annotator'); var Annotator = require('annotator');
// Scroll plugin for jQuery
// TODO: replace me
require('jquery-scrollintoview');
// Polyfills // Polyfills
var g = Annotator.Util.getGlobal(); var g = Annotator.Util.getGlobal();
if (g.wgxpath) { if (g.wgxpath) {
......
Annotator = require('annotator') Annotator = require('annotator')
$ = Annotator.$ $ = Annotator.$
scrollIntoView = require('scroll-into-view')
highlighter = require('../highlighter') highlighter = require('../highlighter')
...@@ -31,7 +33,7 @@ scrollToClosest = (anchors, direction) -> ...@@ -31,7 +33,7 @@ scrollToClosest = (anchors, direction) ->
acc acc
, {} , {}
$(next.highlights).scrollintoview() scrollIntoView(next.highlights[0]);
class Annotator.Plugin.BucketBar extends Annotator.Plugin class Annotator.Plugin.BucketBar extends Annotator.Plugin
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
"ng-tags-input": "2.2.0", "ng-tags-input": "2.2.0",
"node-iterator-shim": "^1.0.1", "node-iterator-shim": "^1.0.1",
"node-uuid": "^1.4.3", "node-uuid": "^1.4.3",
"scroll-into-view": "^1.2.0",
"showdown": "^1.2.1", "showdown": "^1.2.1",
"uglify-js": "^2.4.14", "uglify-js": "^2.4.14",
"unorm": "^1.3.3" "unorm": "^1.3.3"
...@@ -85,7 +86,6 @@ ...@@ -85,7 +86,6 @@
"es6-promise": "./node_modules/es6-promise/dist/es6-promise.js", "es6-promise": "./node_modules/es6-promise/dist/es6-promise.js",
"hammerjs": "./node_modules/hammerjs/hammer.js", "hammerjs": "./node_modules/hammerjs/hammer.js",
"jquery": "./node_modules/jquery/dist/jquery.js", "jquery": "./node_modules/jquery/dist/jquery.js",
"jquery-scrollintoview": "./h/static/scripts/vendor/jquery.scrollintoview.js",
"moment": "./node_modules/moment/min/moment-with-locales.js" "moment": "./node_modules/moment/min/moment-with-locales.js"
}, },
"browserify-shim": { "browserify-shim": {
...@@ -103,11 +103,6 @@ ...@@ -103,11 +103,6 @@
}, },
"es6-promise": "ES6Promise", "es6-promise": "ES6Promise",
"hammerjs": "Hammer", "hammerjs": "Hammer",
"jquery": "$", "jquery": "$"
"jquery-scrollintoview": {
"depends": [
"jquery"
]
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment