Skip to content

Instantly share code, notes, and snippets.

@poochin
Created May 17, 2012 09:10
Show Gist options
  • Select an option

  • Save poochin/2717604 to your computer and use it in GitHub Desktop.

Select an option

Save poochin/2717604 to your computer and use it in GitHub Desktop.
Tumblr で重複ポストのみを表示するスクリプト
/**
* Tumblr で reblog-key を用いて重複ポストのみ拾うスクリプト
*/
(function(){
var frag = document.createDocumentFragment();
var reblog_keys = {};
$$('#posts>.post:not(.new_post)').map(function(node) {
var reblog_key = node.querySelector('.reblog_button').getAttribute('data-reblog-key');
if (!reblog_keys[reblog_key]) reblog_keys[reblog_key] = [];
reblog_keys[reblog_key].push(node);
});
for (var key in reblog_keys) {
var list = reblog_keys[key];
if (list.length >= 2) {
list.map(function(node){frag.appendChild(node);});
}
}
$$('#posts>.post:not(.new_post)').map(Element.remove);
$('posts').appendChild(frag);
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment