Skip to content

Instantly share code, notes, and snippets.

@dot
Created July 10, 2009 14:31
Show Gist options
  • Save dot/144555 to your computer and use it in GitHub Desktop.
Save dot/144555 to your computer and use it in GitHub Desktop.
add toggle button near by pager
// ==UserScript==
// @name KomachiOwnersComments
// @namespace http://dacompatible.net/
// @include http://komachi.yomiuri.co.jp/t/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
// ==/UserScript==
(function() {
var state = 'v';
var _CNT = {
'v': '<img height="12" border="0" width="12" src="/g1/ic_minus.gif" style="visibility: visible;"/>トピ主以外のレスの本文を隠す',
'h': '<img height="12" border="0" width="12" src="/g1/ic_plus.gif" style="visibility: visible;"/>トピ主以外のレスの本文も表示する'
};
$('table.reslisttitle')
.after('<div class="allresdisp">'
+ '<div id=\"hidewithoutowner\" style=\"width:20em;\">'
+ '<span style="background-position: right 2px; color: rgb(0, 0, 170);">'
+ _CNT[state] +'</span></div></div>');
var reslist = $('table.reslist');
$('#hidewithoutowner').click(
function() {
state = (state == 'v') ? 'h' : 'v';
$('tr:not(:has(td.poster strong)):has(td.poster) + tr:has(td.resbody)').find('div.inr').toggle();
$('#hidewithoutowner span').html(_CNT[state]);
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment