Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save angelworm/1917514 to your computer and use it in GitHub Desktop.
Save angelworm/1917514 to your computer and use it in GitHub Desktop.
quoteをすべて削除する機能に書き換え
// ==UserScript==
// @name quote remover
// @namespace test
// @description quote/regular postを全部削除します
// @include http://www.tumblr.com/dashboard*
// @author joodle
// @compatibility Firefox 5.0(Scriptish 0.1), Chrome 12.0.742.112, Opera 11.50
// @charset UTF-8
// @version 1.4
// ==/UserScript==
/* jslint browser: true, maxerr: 50, maxlen: 80, indent: 4 */
// Edition 2011-07-04
(function (doc) {
'use strict';
var styleSheet, xpathExp, addClassName;
styleSheet = doc.head.appendChild(doc.createElement('style')).sheet;
styleSheet.insertRule(
'.quote:not(.new_post) {' +
'display: none !important; }',
0
);
styleSheet.insertRule(
'.quote:not(.new_post) > .post_content {' +
'display: none !important; }',
1
);
styleSheet.insertRule(
'.regular:not(.new_post) {' +
'display: none !important; }',
2
);
styleSheet.insertRule(
'.regular:not(.new_post) > .post_content {' +
'display: none !important; }',
3
);
styleSheet.insertRule(
'.link:not(.new_post) {' +
'display: none !important; }',
4
);
styleSheet.insertRule(
'.link:not(.new_post) > .post_content {' +
'display: none !important; }',
5
);
styleSheet.insertRule(
'.note:not(.new_post) {' +
'display: none !important; }',
6
);
styleSheet.insertRule(
'.note:not(.new_post) > .post_content {' +
'display: none !important; }',
7
);
addClassName = function addClassName(target) {
var e = target.target;
//console.log(target);
if(target.target.nodeType != Node.ELEMENT_NODE) return;
console.log(Math.max(Math.max(e.className.toString().indexOf(" quote "), e.className.toString().indexOf(" regular ")), e.className.toString().indexOf(" link ")));
if(e.className.toString().indexOf(" quote ") != -1
|| e.className.toString().indexOf(" regular ") != -1
|| e.className.toString().indexOf(" link ") != -1
|| e.className.toString().indexOf(" note ") != -1 ) {
e.outerHTML = "";
return false;
}
return true;
};
doc.getElementById('posts').addEventListener(
'DOMNodeInserted',
addClassName,
false
);
}(document));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment