Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name ChangePCRBackground
- // @namespace https://github.com/HarkerDev/
- // @version 1.0.1
- // @description Color codes PCR assignments based on which class assigned them
- // @match *webappsca.pcrsoft.com/Clue/Student-Assignments/7536
- // @copyright 2014+, HarkerDev
- // ==/UserScript==
- function changeBackground() {
- // Put the names of your classes within the quotation marks. The names does not have to be exact but must be unique.
- // i.e. "Phys" would work but "P" would not, as you may have other classes that have a 'p' in them.
- // The classes may be in any order you want.
- //This is case sensitive.
- //For example, you would have to type "econ" for "AP Microeconomics" because "Econ" has a capital E
- var class1 = "";
- var class2 = "";
- var class3 = "";
- var class4 = "";
- var class5 = "";
- var class6 = "";
- var class7 = "";
- // The colors for each class. Naturally class1 corresponds to color1, etc. Tests and quizzes are colored seperately.
- // If you would like to change the colors, you must provide a hexidecimal code between the quotation marks.
- // Your edited color must be formatted as such: color[number] = "#hexcode".
- // If you are not familiar with colors in hexadecimal code, check the color table in README.md and insert
- // the specifc hex code. Alternatively, you may visit www.colorpicker.com and choose a hex version of
- // any color from their databases.
- var color1 = "#FF0000"; //red
- var color2 = "#FF00F7"; //pink
- var color3 = "#3FEDFF"; //cyan
- var color4 = "#00FF40"; //green
- var color5 = "#FDFF41"; //yellow
- var color6 = "#FF9100"; //orange
- var color7 = "#B520FF"; //purple
- var colorTest = "#FFFFFF"; //white
- //main script to change colors in PCR
- var allClasses = document.getElementsByClassName("rsApt rsAptSimple");
- try {
- for (var i = 0; i < allClasses.length; i++) {
- if (allClasses[i].getAttribute("title").indexOf(class1) != -1)
- allClasses[i].style.backgroundColor = color1;
- if (allClasses[i].getAttribute("title").indexOf(class2) != -1)
- allClasses[i].style.backgroundColor = color2;
- if (allClasses[i].getAttribute("title").indexOf(class3) != -1)
- allClasses[i].style.backgroundColor = color3;
- if (allClasses[i].getAttribute("title").indexOf(class4) != -1)
- allClasses[i].style.backgroundColor = color4;
- if (allClasses[i].getAttribute("title").indexOf(class5) != -1)
- allClasses[i].style.backgroundColor = color5;
- if (allClasses[i].getAttribute("title").indexOf(class6) != -1)
- allClasses[i].style.backgroundColor = color6;
- if (allClasses[i].getAttribute("title").indexOf(class7) != -1)
- allClasses[i].style.backgroundColor = color7;
- 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))
- allClasses[i].style.backgroundColor = colorTest;
- }
- }
- //should we throw an exception here?
- catch(err)
- { alert("Script failed. Please report the bug at https://github.com/HarkerDev/PCRChanges/issues"); return;}
- }
- changeBackground();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement