Hello again
I made this userscript in a few minutes. I thought it was a good idea to be honest.
What it does is when you visit a page, it will check if you get a new PM every 60 seconds. If you get a new PM, it will ask you if you want to read the PM.
However, if you are typing, it will simply tell you that you got a new message (you can accidentally press redirect if you're typing).
IF YOU ARE TYPING
![[Image: 9fs2E.png]](https://puu.sh/9fs2E.png)
IF YOU ARE NOT TYPING
![[Image: 9fs4v.png]](https://puu.sh/9fs4v.png)
(Annuller means Cancel)
For Firefox get GreaseMonkey.
For Chrome get TamperMonkey.
For other browsers: Get Chrome.
Go add a new script and put this code into the script:
I chose upgrade.php because it requires basically no resources. That means less load on the server and faster response for you!
Report any bugs and please give me some feedback here! Thanks :)
I made this userscript in a few minutes. I thought it was a good idea to be honest.
What it does is when you visit a page, it will check if you get a new PM every 60 seconds. If you get a new PM, it will ask you if you want to read the PM.
However, if you are typing, it will simply tell you that you got a new message (you can accidentally press redirect if you're typing).
IF YOU ARE TYPING
![[Image: 9fs2E.png]](https://puu.sh/9fs2E.png)
IF YOU ARE NOT TYPING
![[Image: 9fs4v.png]](https://puu.sh/9fs4v.png)
(Annuller means Cancel)
For Firefox get GreaseMonkey.
For Chrome get TamperMonkey.
For other browsers: Get Chrome.
Go add a new script and put this code into the script:
PHP Code
<?php
// ==UserScript==
// @name Hack Forums PM Notifications
// @namespace Snorlax
// @description Notifies you when you receive a new PM
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_openInTab
// @include *hackforums.net/*
// @version 1.0
// ==/UserScript==
function run() {
$.get("upgrade.php", function(data) {
if($(data).find("strong:contains('unread private message')").length) {
message = $(data).find("strong:contains('unread private message')").text();
username = $(data).find("strong:contains('unread private message')").next().text();
messageURL = $(data).find("strong:contains('unread private message')").next().next().attr("href");
regex = /You have (.*?) unread private message/;
match = regex.exec(message);
if(match[1] == "one") {
match[1] = "1";
}
if(match[1] > GM_getValue("messages")) {
if (confirm('You got a new message from: ' + username + '\nDisplay it now?')) {
GM_openInTab("https://hackforums.net/" + messageURL);
}
}
message = match[1];
} else {
message = 0;
}
GM_setValue("messages", message);
});
console.log("Amount of messages: " + GM_getValue("messages"));
}
setInterval(function() {
run();
}, 60000);
I chose upgrade.php because it requires basically no resources. That means less load on the server and faster response for you!
Report any bugs and please give me some feedback here! Thanks :)



![[Image: wOdD4yf.gif]](https://i.imgur.com/wOdD4yf.gif)