Skip to content

Instantly share code, notes, and snippets.

@jkishner
Created July 31, 2013 15:53
Show Gist options
  • Save jkishner/6123262 to your computer and use it in GitHub Desktop.
Save jkishner/6123262 to your computer and use it in GitHub Desktop.
Gmail to Pushover
key = "YOUR_PUSHOVER_KEY_HERE";
a = op.getLineText();
b = encodeURIComponent(a);
c = b.replace(/%/g,"%25");
dialog.ask ("Drafts Action?", "", "Enter it here", function (name) {
action = encodeURIComponent(name);
actionrep = action.replace(/%/g,"%25");
notification = "drafts:///create?text=" + c + "%26action=" + actionrep;<br>
var long = notification.length + 5;
var longish = long - 507;
if (long>512) {
dialog.alert ("Your notification is too long by " + longish + " encoded characters.");
}
else {
window.open("https://mail.google.com/mail/?view=cm&ui=2&tf=0&fs=1&to=" + key + "@api.pushover.net&su=draft&body=" + notification,"_blank");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment