Greasy Fork

TVmaze watchlist collapse/expand

By clicking on the show name you can collapse/expand the episodes

目前为 2018-03-05 提交的版本。查看 最新版本

// ==UserScript==
// @name        TVmaze watchlist collapse/expand
// @namespace   tvmazewatchlistcollapseexpand
// @description By clicking on the show name you can collapse/expand the episodes
// @include     http://www.tvmaze.com/watchlist*
// @version     1
// @require     http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// ==/UserScript==
$ = this.jQuery = jQuery.noConflict(true);
$(document).on('click','a',function(e){
  var regex = /\/shows\/(\d+)\//g;
  var m;     
  while ((m = regex.exec($(this).attr('href'))) !== null) {
    // This is necessary to avoid infinite loops with zero-width matches
    if (m.index === regex.lastIndex) {
      regex.lastIndex++;
    };
    e.preventDefault();
    $(".watchlist-show[data-show_id='"+m[1]+"']").slideToggle();
  }
});