Skip to content

Instantly share code, notes, and snippets.

@drakedevel
Last active May 12, 2018 01:24
Show Gist options
  • Save drakedevel/e06f5630bc967b6d31b7c9d8431a6927 to your computer and use it in GitHub Desktop.
Save drakedevel/e06f5630bc967b6d31b7c9d8431a6927 to your computer and use it in GitHub Desktop.
Userscript to adjust the "slide" transition time of Dropbox Paper presentations
// ==UserScript==
// @name Fix Paper slides
// @namespace https://hax.so/
// @version 0.1
// @description Adjusts the "slide" transition time of Dropbox Paper presentations
// @author Andrew Drake <adrake@adrake.org>
// @match https://paper.dropbox.com/doc/present/*
// @run-at document-body
// @grant none
// ==/UserScript==
(function() {
'use strict';
const NEW_OPTIONS = {duration: 100}; // Optional: easing: 'ease-in-out'
function hook() {
const realAnimate = $.prototype.animate;
$.prototype.animate = function (properties, durationOrOptions, easing, complete) {
if ('scrollTop' in properties) {
if (typeof durationOrOptions === 'number')
return realAnimate.call(this, properties, NEW_OPTIONS.duration, NEW_OPTIONS.easing || easing, complete);
if (typeof durationOrOptions === 'object')
return realAnimate.call(this, properties, Object.assign({}, durationOrOptions, NEW_OPTIONS));
}
return realAnimate.apply(this, arguments);
};
}
if (window.$)
hook();
else
paperDepTracker.addOnLoadHandler(hook);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment