Created
November 11, 2012 14:06
-
-
Save farces/4054982 to your computer and use it in GitHub Desktop.
SOME THING
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 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