Created
December 14, 2014 19:39
-
-
Save bjoreman/ed363d35b984e093ab7a to your computer and use it in GitHub Desktop.
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
/* | |
To use: | |
* Create a service in Automator | |
* Set it to receive text in all applications, and that the result replaces selection. | |
* Add a "Run Javascript" action, pasting in this function. | |
* Save, restart your editor app. | |
* Have a page open in Safari | |
* Select some text in your editor, activate your serive from the "Services" menu of the Application menu. | |
* For extra speed, assign a keyboard shortcut in the keyboard preference pane. | |
*/ | |
function run(input, parameters) { | |
var Safari = Application('Safari'); | |
var url = Safari.windows.at(0).currentTab.url(); | |
return '[' + input + '](' + url + ')'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment