Created
March 2, 2017 06:23
-
-
Save vjk2005/39ad785203c30da114a08f57157210ad to your computer and use it in GitHub Desktop.
Inject jquery into the most active tab using JXA (Javascript for Automation, OSX)
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
// put this inside a Run Javascript block in Automator | |
app.doJavaScript("var script = document.createElement('script'); script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js'; document.getElementsByTagName('head')[0].appendChild(script);", { | |
in: app.windows[0].currentTab | |
}) | |
delay(1); // wait for jQuery to load | |
//... jQuery is now loaded, now add the rest of the script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment