NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name watchount-filter
// @namespace watchcount.com
// @description filters the items that have more watch than past sales
// @include http://www.watchcount.com/*
// @version 1
// @grant none
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
// ==/UserScript==
$('tr[itemtype]').parent().parent().attr('id','sortTag');
$('tr[itemtype]').each(function(){
var watchC = $(this).find('span[itemprop=ratingCount]').text();
var pastSales = $(this).find('span.valbids').text();
if (parseInt(watchC) > parseInt(pastSales)){
//we don't like this because pastSales has to be greater. Just remove this item.
$(this).addClass('toRemove');
}
});
$('tr[itemtype].toRemove').remove();
$('td.timestampcell span.boldface').eq(0).text($('tr[itemtype]').length);
function sortTable(){
var rows = $('tr[itemtype]').get();
rows.sort(function(a, b) {
var A = parseInt($(a).find('span.valbids').text());
var B = parseInt($(b).find('span.valbids').text());
if(A < B) {
return 1;
}
if(A > B) {
return -1;
}
return 0;
});
$.each(rows, function(index, row) {
$('#sortTag').children('tbody').append(row);
});
}
sortTable();