Skip to content

Instantly share code, notes, and snippets.

@farces
Created November 11, 2012 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save farces/4054982 to your computer and use it in GitHub Desktop.
Save farces/4054982 to your computer and use it in GitHub Desktop.
SOME THING
// ==UserScript==
// @name Lurk-More-5-Golden-Manbabies
// @version 5.5.5
// @namespace https://github.com/stuartdb/lurk-more
// @author Stuart Baker + THE GRIPPER
// @description Allows quickly opening your bookmarked threads which have new posts on SA.
// @include *://forums.somethingawful.com/*
// @grant GM_openInTab
// @run-at document-end
// ==/UserScript==
function dongsCalculate(data) {
var postCount = 0;
$.each(data, function(index, value) {
postCount+=parseInt($(value).contents().html(),10)
});
$("<div/>", {
id: "newposts",
text: "There are " + postCount + " new posts in " + $(data).length + " threads. ",
}).css('color', '#ddbb00').appendTo("#globalmenu");
$('<a>',{
text: 'Click here to view.',
href: '#',
click: function(){ openUnreadLinks(data) }
}).appendTo('#newposts');
}
function openUnreadLinks(data) {
$.each(data, function(index, value) {
GM_openInTab("http://forums.somethingawful.com" + $(value).attr("href"));
});
}
//use existing loaded jQuery
var $ = unsafeWindow.jQuery;
$.get('usercp.php', function(data) {
dongsCalculate($(data).find(".count"));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment