Advertisement
Guest User

old working changepcr

a guest
Sep 1st, 2014
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.03 KB | None | 0 0
  1. // ==UserScript==
  2. // @name ChangePCRBackground
  3. // @namespace https://github.com/HarkerDev/
  4. // @version 1.0.1
  5. // @description Color codes PCR assignments based on which class assigned them
  6. // @match *webappsca.pcrsoft.com/Clue/Student-Assignments/7536
  7. // @copyright 2014+, HarkerDev
  8. // ==/UserScript==
  9.  
  10. function changeBackground() {
  11.  
  12. // Put the names of your classes within the quotation marks. The names does not have to be exact but must be unique.
  13. // i.e. "Phys" would work but "P" would not, as you may have other classes that have a 'p' in them.
  14. // The classes may be in any order you want.
  15.  
  16. //This is case sensitive.
  17. //For example, you would have to type "econ" for "AP Microeconomics" because "Econ" has a capital E
  18. var class1 = "";
  19. var class2 = "";
  20. var class3 = "";
  21. var class4 = "";
  22. var class5 = "";
  23. var class6 = "";
  24. var class7 = "";
  25.  
  26. // The colors for each class. Naturally class1 corresponds to color1, etc. Tests and quizzes are colored seperately.
  27. // If you would like to change the colors, you must provide a hexidecimal code between the quotation marks.
  28. // Your edited color must be formatted as such: color[number] = "#hexcode".
  29.  
  30. // If you are not familiar with colors in hexadecimal code, check the color table in README.md and insert
  31. // the specifc hex code. Alternatively, you may visit www.colorpicker.com and choose a hex version of
  32. // any color from their databases.
  33. var color1 = "#FF0000"; //red
  34. var color2 = "#FF00F7"; //pink
  35. var color3 = "#3FEDFF"; //cyan
  36. var color4 = "#00FF40"; //green
  37. var color5 = "#FDFF41"; //yellow
  38. var color6 = "#FF9100"; //orange
  39. var color7 = "#B520FF"; //purple
  40. var colorTest = "#FFFFFF"; //white
  41.  
  42. //main script to change colors in PCR
  43. var allClasses = document.getElementsByClassName("rsApt rsAptSimple");
  44.  
  45. try {
  46. for (var i = 0; i < allClasses.length; i++) {
  47. if (allClasses[i].getAttribute("title").indexOf(class1) != -1)
  48. allClasses[i].style.backgroundColor = color1;
  49. if (allClasses[i].getAttribute("title").indexOf(class2) != -1)
  50. allClasses[i].style.backgroundColor = color2;
  51. if (allClasses[i].getAttribute("title").indexOf(class3) != -1)
  52. allClasses[i].style.backgroundColor = color3;
  53. if (allClasses[i].getAttribute("title").indexOf(class4) != -1)
  54. allClasses[i].style.backgroundColor = color4;
  55. if (allClasses[i].getAttribute("title").indexOf(class5) != -1)
  56. allClasses[i].style.backgroundColor = color5;
  57. if (allClasses[i].getAttribute("title").indexOf(class6) != -1)
  58. allClasses[i].style.backgroundColor = color6;
  59. if (allClasses[i].getAttribute("title").indexOf(class7) != -1)
  60. allClasses[i].style.backgroundColor = color7;
  61. if ((allClasses[i].getAttribute("title").indexOf("Test") != -1 || allClasses[i].getAttribute("title").indexOf("quiz") != -1 || allClasses[i].getAttribute("title").indexOf("Quiz") != -1 || allClasses[i].getAttribute("title").indexOf("test") != -1) && (allClasses[i].getAttribute("title").indexOf("study") == -1 && allClasses[i].getAttribute("title").indexOf("Study") == -1) && (allClasses[i].getAttribute("title").indexOf("review") == -1 && allClasses[i].getAttribute("title").indexOf("Review") == -1))
  62. allClasses[i].style.backgroundColor = colorTest;
  63. }
  64. }
  65.  
  66. //should we throw an exception here?
  67. catch(err)
  68. { alert("Script failed. Please report the bug at https://github.com/HarkerDev/PCRChanges/issues"); return;}
  69.  
  70. }
  71. changeBackground();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement