Last active
June 17, 2016 13:39
-
-
Save unarist/6e4e55a1fafec9942024 to your computer and use it in GitHub Desktop.
pso2swiki 検索結果のコメント系を折りたたむ
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 pso2swiki 検索結果のコメント系を折りたたむ | |
// @namespace https://github.com/unarist/ | |
// @updateURL https://gist.github.com/unarist/6e4e55a1fafec9942024/raw | |
// @version 0.2 | |
// @author unarist | |
// @match http://pso2.swiki.jp/?*&cmd=search&* | |
// @match http://pso2m.swiki.jp/?*&cmd=search&* | |
// @grant none | |
// ==/UserScript== | |
var $root = $('#body ul'); | |
var $commentPages = $root.find('a[href*=Comments]').parent(); | |
// ついでに日付でソート | |
$commentPages = $commentPages.map((i,e) => ({e:e, d: $(e).text().match(/\((\d+)d\)/)[1]})).sort((a,b) => a.d - b.d).map((i,x) => x.e); | |
var $li = $('<li>'); | |
$('<a style="cursor:pointer">▼Comments</a>') | |
.click(function(){ $('#commentLinks').toggle(); }) | |
.appendTo($li); | |
$('<ul id="commentLinks" style="display: none">') | |
.append($commentPages) | |
.appendTo($li); | |
$li.prependTo($root); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment