Advertisement
Mikescher

[Greasemonkey] Rapla - script ((TINF12B5))

Oct 15th, 2014
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        Rapla Highlighter
  3. // @namespace   https://rapla.dhbw-karlsruhe.de
  4. // @include     https://rapla.dhbw-karlsruhe.de/*
  5. // @version     1
  6. // @require     http://code.jquery.com/jquery-latest.js
  7. // @grant       none
  8. // @author      Mikescher
  9. // ==/UserScript==
  10.  
  11. this.$ = this.jQuery = jQuery.noConflict(true);
  12.  
  13. if (!('contains' in String.prototype)) {
  14.   String.prototype.contains = function(str, startIndex) {
  15.     return -1 !== String.prototype.indexOf.call(this, str, startIndex);
  16.   };
  17. }
  18.  
  19.  
  20. var excludedBlocks = [
  21.   "LPM4C", "LPM4B",
  22.   "Gamification", "Robotik", "Evolutionäre Algorithmen", "Web-Services",
  23.   "Englisch",
  24.   "Maschinenelemente für Informatiker",
  25.   "Fertigungstechnik für Informatiker",
  26.   "Konstruktionslehre für Informatiker",
  27.   "Wiederholungsklausur", "Klausurwoche",
  28.   "Nachprüfung"
  29. ];
  30.  
  31. var highlightedBlocks = [
  32.   "Klausur", "Studienarbeitstag", "Exkursion", "DevFest"
  33. ];
  34.  
  35. $(".week_block").css({
  36.   "border-radius": "0px",
  37.   "box-shadow": "none",
  38. });
  39. $(".week_header").css({
  40.   "background-color": "white",
  41. });
  42. $(".week_times").css({
  43.   "background-color": "white",
  44. });
  45. $("div.datechooser").css({
  46.   "height": "auto",
  47.   "background": "none",
  48. });
  49. $(".button").css({
  50.   "height": "30px",
  51.   "border-radius": "0px",
  52.   "background": "#000",
  53. });
  54. $(".button a, .button input").css({
  55.   "color": "#FFF",
  56.   "background-image": "none",
  57.   "background-color": "black",
  58.   "height": "20px",
  59. });
  60.  
  61. $('.week_block').each(function() {
  62.   me = $(this);
  63.   me.css({
  64.     "background-color": "#a3ddff"
  65.   });
  66.  
  67.   highlightedBlocks.forEach(function(element, index, array) {
  68.     if (me.text().toLowerCase().contains(element.toLowerCase())) {
  69.       me.css({
  70.         "background-color": "#F80"
  71.       });
  72.     }
  73.   });
  74.  
  75.   excludedBlocks.forEach(function(element, index, array) {
  76.     if (me.text().toLowerCase().contains(element.toLowerCase())) {
  77.       me.css({
  78.         "background-color": "#FFF"
  79.       });
  80.     }
  81.   });
  82. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement