Skip to content

Instantly share code, notes, and snippets.

@rullinoiz
Last active March 11, 2022 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rullinoiz/597e6dde063d281b097c963ebb3ca970 to your computer and use it in GitHub Desktop.
Save rullinoiz/597e6dde063d281b097c963ebb3ca970 to your computer and use it in GitHub Desktop.
embed calculator soup into any positive physics assignment
// ==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