Skip to content

Instantly share code, notes, and snippets.

@poochin
Created December 9, 2012 06:24
Show Gist options
  • Select an option

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

Select an option

Save poochin/4243583 to your computer and use it in GitHub Desktop.
dsbd で 500 以上の notes のみを表示するユーザスクリプト(Firefox でも動作するようにしました)
// ==UserScript==
// @name Notes Filter
// @match http://www.tumblr.com/dashboard*
// @version 1.0.1
// @description Dashboard フィルター(Notes Filter)
//
// @author poochin
// @license MIT
// @updated 2012-12-09
// @updateURL https://github.com/poochin/tumblrscript/
// ==/UserScript==
(function NotesFilter() {
boot();
function filter (elm) {
var elm_notes, notes_count;
elm_notes = elm.querySelectorAll('.post_control.reblog_count span')[1];
if (elm_notes == null) {
return false;
}
nodes_count = parseInt(elm_notes.innerHTML);
return (nodes_count >= 500); /* ここの値と不等号を弄ることでフィルタリングの範囲を変更できます */
}
function main() {
var evnt = function(e) {
var elm = e.target;
if (elm && elm.nodeType == 1 && filter(elm) == false) {
elm.parentNode.removeChild(elm);
}
};
Array.prototype.slice.call(document.querySelectorAll('#posts li.post:not(.new_post)')).map(function(elm){evnt({target: elm, nodeType: 1})});
document.querySelector('#posts').addEventListener('DOMNodeInserted', evnt);
}
function isExecPage() {
return /^https?:\/\/www\.tumblr\.com\/dashboard\/?/.test(location);
}
function boot() {
if (isExecPage() === false) {
return;
}
if (window.document.body) {
main();
}
else {
window.document.addEventListener('DOMContentLoaded', main, false);
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment