IMDb Full Summary

Automatically show the full plot summary on IMDb

目前为 2016-09-23 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name IMDb Full Summary
  3. // @namespace https://github.com/chocolateboy/userscripts
  4. // @description Automatically show the full plot summary on IMDb
  5. // @author chocolateboy
  6. // @version 1.4.0
  7. // @license GPL: http://www.gnu.org/copyleft/gpl.html
  8. // @include http://*.imdb.tld/title/tt*
  9. // @include http://*.imdb.tld/*/title/tt*
  10. // @require https://code.jquery.com/jquery-3.1.0.min.js
  11. // @grant GM_log
  12. // ==/UserScript==
  13.  
  14. // XXX note: the unused grant is a workaround for a Greasemonkey bug:
  15. // https://github.com/greasemonkey/greasemonkey/issues/1614
  16.  
  17. /*
  18. * Tests
  19. *
  20. * truncated: http://www.imdb.com/title/tt0109374/
  21. * not truncated: http://www.imdb.com/title/tt0062474/
  22. * no summary: http://www.imdb.com/title/tt0162757/
  23. * refspam URL: http://www.imdb.com/title/tt1776222/?ref_=fn_tt_tt_1
  24. */
  25.  
  26. // the truncated summary
  27. var $summary = $('.summary_text').has('a[href*="/plotsummary"]');
  28.  
  29. if ($summary.length && $summary.clone().children().remove().end().text().match(/\S/)) {
  30. // the full summary (usually)
  31. var $storyline = $('div.canwrap[itemprop="description"]');
  32.  
  33. if ($storyline.length) {
  34. $summary.html($storyline.clone().find('em.nobr').remove().end());
  35. }
  36. }