Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

WorkFlowy Reclaim Chrome Back/Forward History

  • WorkFlowy's zoom keyboard shortcuts hijack the standard back/forward browser history shortcuts in Windows.
  • This script reclaims them, mapping the following shortcuts:
    • Alt+Down = Zoom In
    • Alt+Up = Zoom Out
    • Alt+Left = Back in History
    • Alt+Right = Forward in History
  • Click here to install into your script manager.

Version Notes

  • v2.3 (2019-02-27): Converted back to WorkFlowy's animated zoom/unzoom, because they fixed some focus issues.
  • v2.2 (2018-11-26): Added support for beta.workflowy.com
  • v2.1 (2018-11-12): Fix WorkFlowy's "sticky search" bug, and remove zoom animation.
  • v1.9 (2018-10-31): Removed focus fix code (WorkFlowy fixed the bug)
  • v1.8 (2018-10-24): Tweaked focus fix code.
  • v1.7 (2018-10-24): Fixed duplicate history when zooming out to home.
// ==UserScript==
// @name WorkFlowy Reclaim Chrome Back/Forward
// @namespace https://rawbytz.wordpress.com
// @version 2.3
// @description Reclaim Chrome's history shortcuts (Alt+Left/Right), move WorkFlowy's zoom shortcuts to Alt+Up/Down.
// @author rawbytz
// @match https://workflowy.com/*
// @match https://beta.workflowy.com/*
// @updateUrl https://gist.github.com/rawbytz/67df2d838316d331ff1b25fb24e4cc25/raw/WorkFlowyReclaimChromeHistory.user.js
// @downloadUrl https://gist.github.com/rawbytz/67df2d838316d331ff1b25fb24e4cc25/raw/WorkFlowyReclaimChromeHistory.user.js
// @grant none
// @run-at document-end
// ==/UserScript==
(function () {
'use strict';
document.addEventListener("keydown", function (event) {
if (event.altKey && !event.ctrlKey && !event.shiftKey && !event.metaKey) {
switch (event.key) {
case "ArrowDown": // Alt+Down = zoom in
WF.zoomIn(WF.focusedItem());
break;
case "ArrowUp": // Alt+Up = zoom out
WF.zoomOut();
break;
case "ArrowLeft": // Alt+Left = Go Back in History
window.history.back();
event.stopImmediatePropagation();
event.preventDefault();
break;
case "ArrowRight": // Alt+Right = Go Forward in History
window.history.forward();
event.stopImmediatePropagation();
event.preventDefault();
break;
default:
break;
}
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.