エロ動画サイト閲覧を超高速化するブックマークレット
2008-10-06追記:リンク一つ毎に改行タグ(br)を入れる部分のコードが消えていたので引用記法からpre記法に変更しました。
XPathの練習として作ってみました。
yourfilehostへのリンク以外を抹殺します。yourfilehostへのリンク以外は全て騙しリンクというページで使います。
ページの読み込みが完了する前に実行できるので、騙しリンクや画像の描写に無駄なCPU時間を使わなくて済むという地球に優しい仕様となっております(グリーンIT)。
Firefox 3とGoogle Chromeで動作確認しました。
コード
javascript:(function(){document.body.style.display='none';var a='//body/*';var b=document.evaluate(a,document,null,7,null);for(var i=0;i<b.snapshotLength;i++){b.snapshotItem(i).style.display='none'}})();(function(){var a='//a[starts-with(@href, "http://www.yourfilehost.com")]';var b=document.evaluate(a,document,null,7,null);var c='';if(b.snapshotLength==0){c='なんにもないよ!!'}else{for(var i=0;i<b.snapshotLength;i++){c+='<a href="'+b.snapshotItem(i).href+'" target="_blank">'+b.snapshotItem(i).href+'</a><br />'}}var d=document.createElement('div');d.style.display='block';d.style.position='absolute';d.style.top=0;d.style.left=0;d.style.textAlign='left';d.innerHTML=c;document.body.appendChild(d);document.body.style.display='block'})();
ヒューマンリーダブル版
javascript: (function(){ document.body.style.display = 'none'; var xpath = '//body/*'; var hit = document.evaluate(xpath, document, null, 7, null); for(var i=0; i<hit.snapshotLength; i++){ hit.snapshotItem(i).style.display = 'none'; } })(); (function(){ var xpath = '//a[starts-with(@href, "http://www.yourfilehost.com")]'; var hit = document.evaluate(xpath, document, null, 7, null); var links = ''; if(hit.snapshotLength == 0){ links = 'なんにもないよ!!'; } else { for(var i=0; i<hit.snapshotLength; i++){ links += '<a href="' + hit.snapshotItem(i).href + '" target="_blank">' + hit.snapshotItem(i).href + '</a><br />'; } } var area = document.createElement('div'); area.style.display = 'block'; area.style.position = 'absolute'; area.style.top = 0; area.style.left = 0; area.style.textAlign = 'left'; area.innerHTML = links; document.body.appendChild(area); document.body.style.display = 'block'; })();
さっそくつかってみよう!
このへんのページでテストできます(エロ注意!)
ttp://omeline99.blog108.fc2.com/blog-entry-2862.html