Reputation: 45
At our school website, the homework pages for our teachers only shows the upcoming assignments.
To show all of the assignments you click See All and then All Homework.
The URL changes in the following way
http://example.com/apps/classes/show_class.jsp?classREC_ID=000000
http://example.com/apps/classes/show_assignment.jsp?classREC_ID=000000&showAll=true
I have looked (mainly on Stack Overflow) for solutions such as User Scripts that will automatically change the URL, but I have not been able to figure out how to do this based off of other peoples questions/answers.
To keep it short, how would I be able to modify the URL so show_class becomes show_assignment and has &showAll=true appended to it at the end.
Thanks for any help.
Upvotes: 1
Views: 676
Reputation: 93473
Are you trying to modify links, or modify buttons, or redirect all show_class.jsp
pages?
If you are trying to modify links, buttons, etc. Edit your answer to show the appropriate HTML source of the target page.
If you want to redirect, a script like the following should do it:
// ==UserScript==
// @name _Redirect to see all homework assignments
// @include http://example.com/apps/classes/show_class.jsp?classREC_ID=*
// @run-at document-start
// ==/UserScript==
var newURL = location.href.replace (/show_class\.jsp/i, "show_assignment.jsp")
+ "&showAll=true"
;
//--- Keep browser history / back-button, uncluttered.
location.replace (newURL);
Upvotes: 0
Reputation: 2468
This would do it:
window.location = String(window.location).replace(/show_class/,"show_assignment") + "&showAll=true";
Upvotes: 1