Last active
May 12, 2018 01:24
-
-
Save drakedevel/e06f5630bc967b6d31b7c9d8431a6927 to your computer and use it in GitHub Desktop.
Userscript to adjust the "slide" transition time of Dropbox Paper presentations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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