Last active
August 15, 2019 09:25
-
-
Save xiangzhuyuan/14776e4aef66fa8503fc8610b0dcfc89 to your computer and use it in GitHub Desktop.
Quickly filter by club name https://www.audax-japan.org/brm/brm-2019%E5%B9%B4%E6%9C%88%E5%88%A5%E9%96%8B%E5%82%AC%E4%BA%88%E5%AE%9A/
This file contains 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 filter aj club | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @require http://code.jquery.com/jquery-3.3.1.min.js | |
// @description try to take over the world! | |
// @author You | |
// @match https://www.audax-japan.org/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
function onlyUnique(value, index, self) { | |
return self.indexOf(value) === index; | |
}; | |
function onlyShowme(event){ | |
$("table > tbody > tr").each(function(){ | |
$(this).show(); | |
if($(this).find("td:nth-child(3)").text() !== event.target.text) | |
{ | |
$(this).hide(); | |
} | |
}); | |
}; | |
var club_list = []; | |
var only_unique=[]; | |
$("table > tbody > tr > td:nth-child(3)").each(function(){ | |
club_list.push($(this).text()); | |
only_unique = club_list.filter(onlyUnique).filter(function(e) { return e !== '' }).filter(function(e) { return e !== '主催' }); | |
}); | |
for(var i = 0; i < only_unique.length; i++) { | |
$("#post-21447 > div > div").prepend("<a id='"+ only_unique[i] +"' style='padding:3px;cursor: context-menu;'>"+ only_unique[i] +"</a>"); | |
}; | |
for(var j = 0; j < only_unique.length; j++) { | |
$("#"+ only_unique[j]).click(onlyShowme); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment