Created
December 9, 2012 06:24
-
-
Save poochin/4243583 to your computer and use it in GitHub Desktop.
dsbd で 500 以上の notes のみを表示するユーザスクリプト(Firefox でも動作するようにしました)
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== | |
| // @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