Skip to content

Instantly share code, notes, and snippets.

@tacke
Created March 15, 2011 10:16
Show Gist options
  • Select an option

  • Save tacke/870547 to your computer and use it in GitHub Desktop.

Select an option

Save tacke/870547 to your computer and use it in GitHub Desktop.
hide-duplication.user.js
// ==UserScript==
// @name de-duplication
// @namespace http://www.dolpen.net/
// @description find duplicated tweet
// @include http://www.sinsai.info/ushahidi/index.php/admin/messages/index/3*
// @require http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js
// ==/UserScript==
(function(){
// 取り急ぎ機能追加&修正版 by tacke
var strs=[];
var flags=[];
var found=0;
var objs=$('div.post');
objs.each(function(){
strs.push($.trim($(this).text()));
flags.push(true);
});
for(i=strs.length-1;i>=1;i--){
var temp=strs[i];
var t=false;
if(!flags[i])continue;
for(j=0;j<i;j++){
if(!flags[j])continue;
if(strs[j]==temp){
found++;
objs.eq(j).css('font-weight','bold');
objs.eq(j).parent().parent().find('input').attr('checked',true);
objs.eq(j).parent().parent().addClass('dupli');
flags[j]=false;
t=true;
}
}
if(t){
objs.eq(i).css('background','#ffbbbb');
objs.eq(j).parent().parent().addClass('dupli');
}
}
$('th.col-1').append($('<span></span>').text('('+found+')'));
// ↓重そう...
$('tbody tr').hide();
$('tbody tr.dupli').show();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment