Skip to content

Instantly share code, notes, and snippets.

@hasegawayosuke
Created November 12, 2009 04:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hasegawayosuke/232592 to your computer and use it in GitHub Desktop.
Save hasegawayosuke/232592 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name hide diary of the future for d:id:ripjyr
// @namespace http://d.hatena.ne.jp/ripjyr/
// @description hide diary of the future
// @include http://d.hatena.ne.jp/ripjyr/
// ==/UserScript==
(function(){
// hide diary of the future
var today = new Date();
today = today.getFullYear() + ("0" + (today.getMonth()+1)).substr(-2) + ("0" + today.getDate()).substr(-2);
var elms = document.evaluate( "//div[@class='day']", document.body, null, 7, null );
for( var i = 0; i < elms.snapshotLength; i++ ){
var n = document.evaluate( "./h2/a/@href", elms.snapshotItem( i ), null, 7, null );
var href= n.snapshotItem(0) ? n.snapshotItem(0).textContent : "";
var m = /\/(\d{8})$/.exec( href );
if( !m[1] ) continue;
if( m[1] > today ){
elms.snapshotItem( i ).style.display = "none";
}
}
// hide screenshot
elms = document.evaluate( "//*[@class='http-screenshot']", document.body, null, 7, null );
for( var i = 0; i < elms.snapshotLength; i++ ) elms.snapshotItem( i ).style.display = "none";
// hide "サシン" entry
elms = document.evaluate(
"//a[@href='/ripjyr/searchdiary?word=%2a%5b%a5%b5%a5%b7%a5%f3%5d']/../..",
document.body, null, 7, null );
for( var i = 0; i < elms.snapshotLength; i++ ) elms.snapshotItem( i ).style.display = "none";
// hide "パターン" entry
elms = document.evaluate(
"//a[@href='/ripjyr/searchdiary?word=%2a%5b%a5%d1%a5%bf%a1%bc%a5%f3%5d']/../..",
document.body, null, 7, null );
for( var i = 0; i < elms.snapshotLength; i++ ) elms.snapshotItem( i ).style.display = "none";
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment