HideEmptyModules

hides empty modules in the uspace overview

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

  1. // ==UserScript==
  2. // @name HideEmptyModules
  3. // @namespace hem
  4. // @description hides empty modules in the uspace overview
  5. // @include https://uspace.univie.ac.at/web/studierende/pruefungspass*
  6. // @author oerpli
  7. // @version 1.1
  8. // @grant none
  9. // ==/UserScript==
  10. String.prototype.contains = function(it) { return this.indexOf(it) != -1; };
  11. var textH = $('#language_selection_dropdown').text().contains('DE')?'Leere Module ausblenden':'Hide empty modules';
  12. //var textS = $('#language_selection_dropdown').text().contains('DE')?'Leere Module einblenden':'Show empty modules';
  13. var emptyM = true;
  14. $('.nav-pills').append('<li id=\'switchB\'><a href=\'#\' id=\'sBT\'>' + textH + '</a></li>');
  15. $('#switchB').toggle('highlight').toggle('highlight');
  16. $('#switchB').click(function () {
  17. var eelems = $('.ectsLabel').parent().filter(function () {
  18. return $(this).html().startsWith('0/');
  19. }).parent().parent().parent().parent().parent().parent();
  20. if (emptyM) {
  21. $('#sBT').html($(this).html().replace('aus', 'ein').replace('Hide','Show'));
  22. eelems.hide();
  23. } else {
  24. $('#sBT').html($(this).html().replace('ein', 'aus').replace('Show','Hide'));
  25. eelems.show();
  26. }
  27. emptyM = !emptyM
  28. });