Created
July 12, 2017 20:03
-
-
Save dvingerh/cfa3566341f55ea52aa76f6e947136c8 to your computer and use it in GitHub Desktop.
HF Default Text for PMs
This file contains hidden or 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
// ==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