Skip to content

Instantly share code, notes, and snippets.

@connyay
Last active December 31, 2016 19:47
Show Gist options
  • Save connyay/5a579690425c6ab0872eb97c40a13f6c to your computer and use it in GitHub Desktop.
Save connyay/5a579690425c6ab0872eb97c40a13f6c to your computer and use it in GitHub Desktop.
/u/ProudMod Bookmarklet
(function(messageNum) {
var messages = {
1: ["Warning Subject", "Yo! Knock it off.\n\nYou are not respecting the rules."],
2: ["Last Chance Subject", "This is your last chance!\n\nPlease review [the rules](https://www.reddit.com/r/ProudMod/wiki)"]
}
if (/reddit\.com\/user\/*/.test(location.href)) {
if (!messageNum) {
messageNum = prompt("Which message would you like to compose?");
}
var message = messages[messageNum];
if (!message) {
return alert("Message not found");
}
var user = location.href.split('/').pop();
var subject = message[0];
var body = message[1];
location.href = "https://www.reddit.com/message/compose/?to=" + user + '&subject=' + encodeURIComponent(subject) + '&message=' + encodeURIComponent(body);
}
})();
javascript:!function(a){var b={1:["Warning Subject","Yo! Knock it off.\n\nYou are not respecting the rules."],2:["Last Chance Subject","This is your last chance!\n\nPlease review [the rules](https://www.reddit.com/r/ProudMod/wiki)"]};if(/reddit\.com\/user\/*/.test(location.href)){a||(a=prompt("Which message would you like to compose?"));var c=b[a];if(!c)return alert("Message not found");var d=location.href.split("/").pop(),e=c[0],f=c[1];location.href="https://www.reddit.com/message/compose/?to="+d+"&subject="+encodeURIComponent(e)+"&message="+encodeURIComponent(f)}}();
javascript:!function(a){var b={1:["Warning Subject","Yo! Knock it off.\n\nYou are not respecting the rules."],2:["Last Chance Subject","This is your last chance!\n\nPlease review [the rules](https://www.reddit.com/r/ProudMod/wiki)"]};if(/reddit\.com\/user\/*/.test(location.href)){a||(a=prompt("Which message would you like to compose?"));var c=b[a];if(!c)return alert("Message not found");var d=location.href.split("/").pop(),e=c[0],f=c[1];location.href="https://www.reddit.com/message/compose/?to="+d+"&subject="+encodeURIComponent(e)+"&message="+encodeURIComponent(f)}}(1);
javascript:!function(a){var b={1:["Warning Subject","Yo! Knock it off.\n\nYou are not respecting the rules."],2:["Last Chance Subject","This is your last chance!\n\nPlease review [the rules](https://www.reddit.com/r/ProudMod/wiki)"]};if(/reddit\.com\/user\/*/.test(location.href)){a||(a=prompt("Which message would you like to compose?"));var c=b[a];if(!c)return alert("Message not found");var d=location.href.split("/").pop(),e=c[0],f=c[1];location.href="https://www.reddit.com/message/compose/?to="+d+"&subject="+encodeURIComponent(e)+"&message="+encodeURIComponent(f)}}(2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment