rendered paste body// ==UserScript==
// @name Blocked Check
// @namespace drupal.org
// @description Adds blocked status to search results
// @include http://drupal.org/search/user/*
// ==/UserScript==
var GM_JQ = document.createElement('script');
GM_JQ.src = 'http://drupal.org/misc/jquery.js';
GM_JQ.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(GM_JQ);
function GM_wait() {
if(typeof unsafeWindow.jQuery == 'undefined') {
window.setTimeout(GM_wait,100);
}
else {
jqcode(unsafeWindow.jQuery);
}
}
function jqcode($) {
$('#sidebar-right').append('<div id="greasemonkeydiv" style="position: fixed; border: 1px solid #ccc; overflow: auto; width: 350px; height: 200px; background-color: #fff; z-index: 10000; top: 5px; right: 5px; padding: 3px;"><h3>Users to be blocked:</h3></div>');
$('.search-results a').each(function() {
var elem = this;
var currcount = 1;
$.ajax({
url: this.href,
dataType: 'html',
success: function(data) {
currcount++;
$(elem).parent().append(": "+ $(elem).attr("href") + "<br />");
$(elem).parent().prepend("<input type=\"checkbox\" name=\""+ $(elem).attr("href") +"\" class=\"stuff\" />");
$('.stuff').unbind('change').bind('change', function() {
href = $(this).parent().find("a").attr("href");
if($(this).attr("checked")) {
$("#greasemonkeydiv").append('<span url="'+ href +'">'+ href +' </span>');
}
else {
$("#greasemonkeydiv").find("span[@url="+ href +"]").remove();
}
});
//user-member
$("body").append("<div style=\"display: none\" class=\"temp-"+ currcount +"\"></div>");
$('.temp-'+ currcount).append(data);
$(elem).parent().append('<div style="font-size: 9px" class="prof">' + $('.temp-'+ currcount +' dt.user-member').parent().parent().html() + "</div>").find(".prof h2").css("font-size", "10px");
$(elem).parent().find(".prof dd").css({postion: "relative", left: "-10px", paddingTop: "0px"});
$('.temp-'+ currcount).remove();
},
error: function() {
$(elem).parent().append(': <span style="color: red">Blocked!</span>');
}
});
});
}
GM_wait();