Tabbed Cheevos Page

Creates a tab system for the achievements page.

当前为 2016-05-10 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Tabbed Cheevos Page
  3. // @namespace PXgamer
  4. // @version 0.1
  5. // @description Creates a tab system for the achievements page.
  6. // @author PXgamer
  7. // @include *kat.cr/achievements/
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. $('h1').after(
  15. '<div class="tabs"> <ul class="tabNavigation"> <li><a class="darkButton allCheevos cheevoTab"><span>All</span></a></li> <li><a class="darkButton specialCheevos cheevoTab"><span>Special</span></a></li> <li><a class="darkButton goldCheevos cheevoTab"><span>Gold</span></a></li> <li><a class="darkButton silverCheevos cheevoTab"><span>Silver</span></a></li> <li><a class="darkButton bronzeCheevos cheevoTab"><span>Bronze</span></a></li> <li><a class="darkButton simpleCheevos cheevoTab"><span>Simple</span></a></li> </ul> <hr class="tabsSeparator"></div>'
  16. );
  17.  
  18. $('.cheevoTab').on('click', function() {
  19. $('.achTable tbody tr').hide();
  20. var tabType = $(this).attr('class').split(" ")[1];
  21. switch (tabType) {
  22. case 'allCheevos':
  23. $('.achTable tbody tr').show();
  24. break;
  25. case 'specialCheevos':
  26. $('img[src="//kastatic.com/images/achMedal_special.jpg"]').parent().parent().show();
  27. break;
  28. case 'goldCheevos':
  29. $('img[src="//kastatic.com/images/achMedal_gold.jpg"]').parent().parent().show();
  30. break;
  31. case 'silverCheevos':
  32. $('img[src="//kastatic.com/images/achMedal_silver.jpg"]').parent().parent().show();
  33. break;
  34. case 'bronzeCheevos':
  35. $('img[src="//kastatic.com/images/achMedal_bronze.jpg"]').parent().parent().show();
  36. break;
  37. case 'simpleCheevos':
  38. $('img[src="//kastatic.com/images/achMedal_simple.jpg"]').parent().parent().show();
  39. break;
  40. default:
  41. $('.achTable tbody tr').show();
  42. }
  43. });
  44. })();