Created
March 4, 2014 19:41
-
-
Save rickcnagy/9354024 to your computer and use it in GitHub Desktop.
Delete all subjects visible in the Global Subject(Course) Setup tab. All students must be unenrolled from all visible subjects.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // DeleteSubjects.js | |
| // Rick Nagy | |
| // 2014-03-04 | |
| // | |
| // Run via js console | |
| javascript: buttons = document.getElementsByClassName('buttonWidget allButtons'); | |
| i = 0; | |
| function deleteSubject() { | |
| i++; | |
| if (i % 100 == 0) if (!confirm("continue?")) return; | |
| if (buttons[i].innerText === 'Delete') { | |
| buttons[i].click(); | |
| var bottomButtons = document.getElementsByClassName('ui-button-text'); | |
| bottomButtons[0].click(); | |
| var loadingInterval = setInterval(function() { | |
| if (!isLoading()) { | |
| clearInterval(loadingInterval); | |
| deleteSubject(); | |
| } | |
| }, 100); | |
| } else deleteSubject(); | |
| } | |
| function isLoading() { | |
| if (document.getElementsByClassName('loadingWidget').length !== 0) return true; | |
| else return false; | |
| } | |
| deleteSubject(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment