Last active
March 11, 2022 21:28
-
-
Save rullinoiz/597e6dde063d281b097c963ebb3ca970 to your computer and use it in GitHub Desktop.
embed calculator soup into any positive physics assignment
This file contains hidden or 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 Positive Physics CalculatorSoup embed | |
// @version 1.2 | |
// @description Embeds CalculatorSoup into Positive Physics | |
// @author ollinruiz | |
// @match https://www.positivephysics.org/lesson/physics/* | |
// @grant none | |
// @run-at document-end | |
// @updateURL https://gist.githubusercontent.com/rullinoiz/597e6dde063d281b097c963ebb3ca970/raw/3a56fc839d2d9536425224a770c1a98e0281e899/PositivePhysics.user.js | |
// @downloadURL https://gist.githubusercontent.com/rullinoiz/597e6dde063d281b097c963ebb3ca970/raw/3a56fc839d2d9536425224a770c1a98e0281e899/PositivePhysics.user.js | |
// @require https://code.jquery.com/jquery-3.6.0.js | |
// @require https://code.jquery.com/ui/1.13.1/jquery-ui.js | |
// ==/UserScript== | |
var dragBox = document.createElement("div"); | |
var iframe = document.createElement("iframe"); | |
iframe.style.width = "100%"; | |
iframe.style.height = "300px" | |
iframe.src = "https://www.calculatorsoup.com/calculators/physics/"; | |
dragBox.id = "frame"; | |
dragBox.title = "Calculator Soup"; | |
dragBox.style.display = "none" | |
document.addEventListener("keydown", function (e) { | |
if(!e.shiftKey){ | |
return false; | |
} | |
if(dragBox.style.display === 'none'){ | |
dragBox.style.display = 'block'; | |
} | |
else{ | |
dragBox.style.display = 'none'; | |
} | |
}); | |
dragBox.appendChild(iframe); | |
$("#pageContent").append(dragBox); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment