Skip to content

Instantly share code, notes, and snippets.

@dvingerh
Created July 12, 2017 20:03
Show Gist options
  • Save dvingerh/cfa3566341f55ea52aa76f6e947136c8 to your computer and use it in GitHub Desktop.
Save dvingerh/cfa3566341f55ea52aa76f6e947136c8 to your computer and use it in GitHub Desktop.
HF Default Text for PMs
// ==UserScript==
// @name HF Default Text for PMs
// @namespace Cammy
// @version 0.1
// @description Sets a default greeting / signature message while writing HF PMs
// @author You
// @match *hackforums.net/private.php?action=send*
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js
// ==/UserScript==
var textStart, textEnd;
usernameTo = $("textarea#to").val().split(',')[0];
if (usernameTo.length < 1)
{
textStart = "Hey there!";
}
else
{
textStart = "Hey " + usernameTo + "!";
}
var usernameFrom = $("strong").eq(1).text().split(',')[1];
usernameFrom = usernameFrom.substring(1, usernameFrom.length);
textEnd = "\n\n\n\nIn regards,\n" + usernameFrom;
$("textarea#message_new").val(textStart + textEnd);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment