Last active
May 24, 2021 03:06
-
-
Save jared-hughes/a21dbeead4c6d0969334707cc1a735bd to your computer and use it in GitHub Desktop.
Desmos Duplicate Expression Hotkey. Now bundled into the extension https://github.com/DesModder/DesModder
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 Desmos Duplicate Expression Hotkey | |
// @namespace http://github.com/jared-hughes | |
// @version 0.1 | |
// @author fireflame241 | |
// @description Binds Ctrl+Q to duplicate the selected expression | |
// @grant none | |
// @match https://*.desmos.com/calculator* | |
// ==/UserScript== | |
/*jshint esversion: 6 */ | |
'use strict'; | |
const waitInterval = setInterval(() => { | |
const el = document.querySelector('.dcg-exppanel-outer') | |
const Calc = window.Calc | |
if (Calc && el) { | |
clearInterval(waitInterval) | |
el.addEventListener('keydown', e => { | |
if (e.code === 'KeyQ' && e.ctrlKey) { | |
Calc.controller.dispatch({ | |
type: 'duplicate-expression', | |
id: Calc.selectedExpressionId, | |
}) | |
} | |
}) | |
} | |
}, 50) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment