Created
May 17, 2012 09:10
-
-
Save poochin/2717604 to your computer and use it in GitHub Desktop.
Tumblr で重複ポストのみを表示するスクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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