Created
July 30, 2013 06:44
-
-
Save saitamanodoruji/6110812 to your computer and use it in GitHub Desktop.
list-up tumblr followings
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
// ==UserScript== | |
// @id list-up tumblr followings | |
// @name list-up tumblr followings | |
// @version 1.0 | |
// @namespace http://www.tumblr.com/ | |
// @author saitamanodoruji | |
// @description | |
// @include http://www.tumblr.com/following | |
// @run-at document-end | |
// @grant GM_registerMenuCommand | |
// @grant GM_log | |
// ==/UserScript== | |
(function() { | |
// This function removes duplicate from the array given as an argument | |
// and return an array which contains removed elements. | |
var removeDuplicate2 = function(a) { | |
var b = [], i = 1, j, k | |
while (i < a.length) { | |
k = a.length | |
for (j = 0; j < i; j++) { | |
if (a[i] === a[j]) { | |
b.push(a[j]) | |
a.splice(i,1) | |
break | |
} | |
} | |
if (k == a.length) i++ | |
} | |
return b | |
} | |
GM_registerMenuCommand('make the list of names', function() { | |
var followings = Array.prototype.slice.call(document.querySelectorAll('.name')) | |
var names = followings.map(function(n) { return n.textContent }) | |
var dupNames = removeDuplicate2(names) | |
GM_log('\n' + document.location | |
+ '\n\n' + dupNames.length + ' followings are duplicated.\n' + dupNames.join('\n') | |
+ '\n\nfollowing ' + names.length + ' tumblelogs.\n' + names.join('\n')) | |
}) | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment