Action Directory / Add map entry

Install

Add a new map entry

Shared by Manoverda

Script

var text = editor.getSelectedText();
if("" == text)
{
	ui.input('Address', null, 'Enter the Address', function(value) {
		if (value) {
			insert_link(value);
		}
	});
}
else
{
	insert_link(text);
}

function insert_link(text) {
	var map_link = '[' + text + '](http://maps.apple.com/?address=' + text + ')';

	editor.replaceSelection(map_link);
}