LoginSignup
0
0

More than 3 years have passed since last update.

A tampermonkey script

Posted at
// ==UserScript==
// @name         filter event by aj club name
// @namespace    http://tampermonkey.net/
// @version      0.1
// @require http://code.jquery.com/jquery-3.3.1.min.js
// @description  add a club index in the head then you could get by event list by club!
// @author       Matt
// @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-21795 > 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);
  }

})();

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0