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');
// Scroll plugin for jQuery
// TODO: replace me
require('jquery-scrollintoview');
// Polyfills
var g = Annotator.Util.getGlobal();
if (g.wgxpath) {
......
Annotator = require('annotator')
$ = Annotator.$
scrollIntoView = require('scroll-into-view')
highlighter = require('../highlighter')
......@@ -31,7 +33,7 @@ scrollToClosest = (anchors, direction) ->
acc
, {}
$(next.highlights).scrollintoview()
scrollIntoView(next.highlights[0]);
class Annotator.Plugin.BucketBar extends Annotator.Plugin
......
......@@ -38,6 +38,7 @@
"ng-tags-input": "2.2.0",
"node-iterator-shim": "^1.0.1",
"node-uuid": "^1.4.3",
"scroll-into-view": "^1.2.0",
"showdown": "^1.2.1",
"uglify-js": "^2.4.14",
"unorm": "^1.3.3"
......@@ -85,7 +86,6 @@
"es6-promise": "./node_modules/es6-promise/dist/es6-promise.js",
"hammerjs": "./node_modules/hammerjs/hammer.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"
},
"browserify-shim": {
......@@ -103,11 +103,6 @@
},
"es6-promise": "ES6Promise",
"hammerjs": "Hammer",
"jquery": "$",
"jquery-scrollintoview": {
"depends": [
"jquery"
]
}
"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