NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name 4chan CHECK 'EM monitor
// @namespace Snorlax
// @description Install and check dubs, trips, quads, and quints on each thread with an easy navigation window
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
// @require http://code.stephenmorley.org/javascript/collapsible-lists/CollapsibleLists.js
// @require http://code.jquery.com/ui/1.11.4/jquery-ui.js
// @include *boards.4chan.org/*/thread/*
// @grant GM_addStyle
// @version 1.0.1
// ==/UserScript==
GM_addStyle("#information{width:200px;background-color:#f0e0d6;border:1px solid #D9BFB7;padding:2px;}#dragEm{height:18px;background-color:#EA8;color:#800;font-weight:700;border:1px solid #800;text-align:center;line-height:18px;cursor:move;}.collapsibleList li{list-style-image:none;cursor:auto;}li.collapsibleListOpen{list-style-image:url(http://code.stephenmorley.org/javascript/collapsible-lists/button-open.png);cursor:pointer;}li.collapsibleListClosed{list-style-image:url(http://code.stephenmorley.org/javascript/collapsible-lists/button-closed.png);cursor:pointer;}.collapsibleList a{display:inline-block;text-decoration:underline;padding-top:5px;}");
var regex = /(\d)\1*/g;
var magic = ["dubs", "trips", "quads", "quints"];
var object = {};
posts = $("input[value='delete']").length;
setInterval(function() {
newPosts = $("input[value='delete']").length;
if(newPosts > posts) {
run();
posts = newPosts;
}
}, 500);
function run() {
object = {
"dubs": [],
"trips": [],
"quads": [],
"quints": []
};
$(".collapsibleList li li").remove();
$("input[value='delete']").each(function() {
postID = $(this).attr("name");
match = postID.match(regex);
if(match != null && match != undefined) {
number = match[match.length - 1];
whichOne = magic[number.length - 2];
if(number.length > 1) {
object[whichOne].push(postID);
$("#" + whichOne).find("ul").append('<li><a class="quotelink" href="#p' + postID + '">>>' + postID + '</a></li>');
}
}
});
updateThis("dubs", "Dubs: " + object.dubs.length);
updateThis("trips", "Trips: " + object.trips.length);
updateThis("quads", "Quads: " + object.quads.length);
updateThis("quints", "Quints: " + object.quints.length);
}
function updateThis(element, text) {
$("#" + element).contents().filter(function(){
return this.nodeType == 3;
})[0].nodeValue = text
}
$("body").prepend('<div id="information"> \
<div id="dragEm">Drag to move</div> \
<ul class="collapsibleList"> \
<li id="dubs">Dubs: \
<ul> \
</ul> \
</li> \
<li id="trips">Trips: \
<ul> \
</ul> \
</li> \
<li id="quads">Quads: \
<ul> \
</ul> \
</li> \
<li id="quints">Quints: \
<ul> \
</ul> \
</li> \
</ul> \
</div> \
');
$("#information").css("position", "fixed").css("right", "30px").css("top", "30px");
$("#information").draggable({handle:'#dragEm'});
CollapsibleLists.apply();
run();