dtps

Description
Global DTPS object All global DTPS functions and variables are stored in this object
Properties
Name Type Description
ver number Comparable version number
env string DTPS enviornment ("prod" or "dev")
readableVer string Formatted semantic version number
classes Array.<Class> Array of classes the current user is in
baseURL string The base URL that DTPS is being loaded from
unstable boolean This is true if loading an unstable version of DTPS
gradebookExpanded boolean True if gradebook details (Show more...) is open. Used in the generic gradebook and may be used in custom gradebook implementations.
reloadPending boolean True if the user has made changes that require a reload
popup string | undefined Popup to show when loaded. Either undefined (no popup), "firstrun", or "changelog".
user User Current user, fetched with dtps.init
selectedClass number | string The selected class number, or "dash" if the dashboard is selected. Set when the first screen is loaded in dtps.init.
selectedContent string The selected class content/tab. Set when the first class content is loaded. Defaults to "stream".
bgTimeout number | undefined Background transition timeout when switching between classes
updates Array.<(Assignment|Announcement)> Array of up to 10 recently graded assignments or announcements.
dashboardItems Array.<DashboardItem> Array of items that can be shown on the dashboard
leftDashboard Array.<DashboardItem> Items on the left side of the dashboard based on dtps.dashboardItems and user prefrences. Set in dtps.loadDashboardPrefs.
rightDashboard Array.<DashboardItem> Items on the right side of the dashboard based on dtps.dashboardItems and user prefrences. Set in dtps.loadDashboardPrefs.
remoteConfig object Configuration variables that can be remotely changed
searchScrollListener boolean True if the search scroll listener has been added
cblSpec string A URL to the CBL specification document used by dangerous Power+ CBL features
Details

Methods


<static> usersList( courseID )

Description
Renders the people tab for a class
Parameters
Name Type Description
courseID string The course ID to render the people tab for
Details

<static> globalSearch( term )

Description
Searches Power+ globally and shows results on the "Search Results" screen
Parameters
Name Type Description
term string The search term typed in the input box
Details

<static> renderAssignment( assignment [, childDisplay ] ) → {string}

Description
Renders HTML for an assignment item in a list
Parameters
Name Type Attributes Description
assignment Assignment The assignment object to render
childDisplay string <optional>
Text to display for specifying the child or children this assignment is for
Returns
Assignment HTML for use in a list
Details

<static> loadThreadsList( courseID [, defaultThread [, fromModules [, defaultPost ] ] ] )

Description
Renders the discussions list for a class
Parameters
Name Type Attributes Description
courseID string The course ID to render discussion threads for
defaultThread string <optional>
The thread to load by default
fromModules boolean <optional>
True if this page is being loaded from the moduleStream
defaultPost string <optional>
The post to load by default
Details

<static> renderAssignmentScore( assignment ) → {string}

Description
Renders HTML for an assignment score if the assignment is graded
Parameters
Name Type Description
assignment Assignment The assignment object to render a score for
Returns
Assignment score HTML
Details

<static> class() → {object|undefined}

Description
Debugging shortcut for getting the selected class. This should only be used in the web inspector and not in actual code.
Returns
The selected class
Details

<static> mergeAndRenderChildAssignments( assignments ) → {string}

Description
Merges and renders assignments for children in the same class
Parameters
Name Type Description
assignments Array.<Assignment> An array of assignment objects to merge
Returns
HTML with the assignments merged and labelled
Details

<static> mainStream()

Description
Renders the DTPS dashboard and calls dtps.renderCalendar, dtps.renderUpdates, and dtps.renderUpcoming
Details

<static> changelog( fromVersion, draft )

Description
Fetches and displays the DTPS changelog modal
Parameters
Name Type Description
fromVersion number The previous version of DTPS installed. Will show popup changelogs since that version, if there aren't any, it will silently skip.
draft boolean True to show draft changelogs
Details

<static> loadThreadPosts( classNum, threadID [, fromModules [, defaultPost ] ] )

Description
Fetches and displays posts in a discussion
Parameters
Name Type Attributes Description
classNum number The class number to render
threadID string The discussion thread to render
fromModules boolean <optional>
True if this page is being loaded from the moduleStream
defaultPost string <optional>
The post ID to jump to

<static> isDueOnDate( date [, onDate ] )

Description
Checks if a due date is on a date
Parameters
Name Type Attributes Description
date Date Date to check
onDate Date <optional>
Date checked against (defaults to today)
Details

<static> log( ...msg )

Description
Logs debugging messages
Parameters
Name Type Attributes Description
msg * <repeatable>
The debugging messages to log
Details

<static> renderDueToday( doneLoading [, fromDate ] )

Description
Compiles and displays due today / to-do stream
Parameters
Name Type Attributes Description
doneLoading boolean True if all classes have finished loading their assignment lists
fromDate Date <optional>
The date to display assignments from. Defaults to the current date.
Details

<static> error( msg [, devNotes [, err ] ] )

Description
Shows an error message alert and logs to console
Parameters
Name Type Attributes Description
msg string The error to display
devNotes string <optional>
Technical error details displayed in a smaller font
err Error <optional>
An error object to log to the console. If this is null, DTPS will assume the error has been handled elsewhere.
Details

<static> firstrun()

Description
Renders "Welcome to Project DTPS" screen on the first run
Details

<static> renderUpcoming( [ fromDate ] )

Description
Compiles and displays upcoming assignments stream
Parameters
Name Type Attributes Description
fromDate Date <optional>
The date to display assignments from. Defaults to the current date.
Details

<static> loadPagesList( courseID [, defaultPage ], fromModules )

Description
Renders the pages list for a class
Parameters
Name Type Attributes Description
courseID string The course ID to render pages for
defaultPage string <optional>
If provided, load the pageID by default
fromModules boolean True if this page is being loaded from the moduleStream

<static> renderLoadingScreen()

Description
Renders the DTPS loading screen
Details

<static> JS( cb )

Description
Load all external JavaScript libraries
Parameters
Name Type Description
cb function Callback function
Details

<static> CSS()

Description
Load all DTPS CSS files
Details

<static> renderUpdates( [ dateSelected ] )

Description
Renders updates stream (recently graded & announcements)
Parameters
Name Type Attributes Description
dateSelected boolean <optional>
True if a date is selected in the dashboard
Details

<static> dayTimeMinutes( d )

Description
Gets the amount of minutes elapsed in the day
Parameters
Name Type Description
d date The day
Returns
The amount of minutes or null if the date is invalid
Details

<static> filterSearch( [ toggleItem ] )

Description
Filters search results
Parameters
Name Type Attributes Description
toggleItem Element | string <optional>
The selector for the element to toggle
Details

<static> init()

Description
Starts DTPS (entrypoint function)
Details

<static> calendar( doneLoading )

Description
Compiles and displays the assignment calendar
Parameters
Name Type Description
doneLoading boolean True if all classes have finished loading their assignment lists
Details

<static> loadPage( classNum, pageID, fromModules )

Description
Fetches and renders a page and its contents
Parameters
Name Type Description
classNum string The class number of the page to render
pageID string The page ID to render
fromModules boolean True if this page is being loaded from the moduleStream

<static> renderSearchResult( result, matchData [, mixedClasses ] ) → {string}

Description
Renders a Search data object into HTML for display in the search results list
Parameters
Name Type Attributes Description
result SearchData The search result to render
matchData Array.<Object> The list of matches from Lunr
mixedClasses boolean <optional>
True if there are results from multiple classes
Returns
The HTML for this result in the results list
Details

<static> classStream( classID [, searchResults ] )

Description
Shows the assignments stream for a class
Parameters
Name Type Attributes Description
classID string The class ID to show assignments for
searchResults Array.<Assignment> <optional>
An array of assignemnts to render instead of course.assignments. Used for assignment search.
Details

<static> assignment( id, classNum [, generic ] )

Description
Shows details for an assignment given the assignment ID and class number
Parameters
Name Type Attributes Description
id string Assignment ID
classNum number Assignment class number
generic boolean <optional>
True if user-specific details, such as grades, should not be displayed
Details

<static> moduleStream( classID )

Description
Shows the module stream for a class
Parameters
Name Type Description
classID string Class number to fetch modules for
Details

<static> formatDate( date ) → {string}

Description
Formats a date to a readable date string
Parameters
Name Type Description
date Date The date to format
Returns
Formatted date and time string
Details

<static> iframeLoad( iframeID )

Description
Adjusts the height of an iFrame to match its content
Parameters
Name Type Description
iframeID string The ID of the iFrame element to adjust
Details

<static> clearData()

Description
Clears all DTPS data
Details

<static> showClasses( [ override ] )

Description
Renders the class list in the sidebar
Parameters
Name Type Attributes Description
override boolean <optional>
True if the sidebar should be forcefully re-rendered
Details

<static> moduleCollapse( ele, classID, modID )

Description
Collapses a module
Parameters
Name Type Description
ele Element Element of the module collapse arrow
classID string Class ID
modID string Module ID of the module to collapse
Details

<static> moduleCollapseAll( collapse )

Description
Collapses all module
Parameters
Name Type Description
collapse boolean If true, modules will be collapsed, otherwise, they will all be expanded
Details

<static> presentClass( classNum )

Description
Renders the class header (color, name, tabs, etc.) and sets the class as the selected class
Parameters
Name Type Description
classNum number | string The class number to load or "dash" if loading the dashboard
Details

<static> renderStreamTools( num, type ) → {string}

Description
Gets stream tools HTML (search box, class info, and modules/assignment switcher)
Parameters
Name Type Description
num number Class number
type string Class content these tools are for (e.g. "stream")
Returns
Stream tools HTML
Details

<static> gradebook( classID )

Description
Shows the generic gradebook
Parameters
Name Type Description
classID string Class ID
Details

<static> classHome( num )

Description
Displays the class homepage
Parameters
Name Type Description
num number Class number to show the homepage for
Details

<static> showLMSGradebook( classID )

Description
Shows the gradebook using HTML from dtpsLMS.gradebook
Parameters
Name Type Description
classID string Class ID
Details

<static> showIFrameCard( url )

Description
Shows a URL in the iFrame card
Parameters
Name Type Description
url string The URL to load
Details

<static> brightenTextForDarkMode( html [, bg ] ) → {string}

Description
Brightens text in an HTML string for dark mode
Parameters
Name Type Attributes Description
html string The HTML to brighten text for
bg string <optional>
The background color that the HTML will be displayed on
Returns
HTML string with brightened colors
Details

<static> logGrades( classNum )

Description
Stores grade data locally for the previous grade feature
Parameters
Name Type Description
classNum Class number to log grade
Details

<static> settings( [ forceRerenderDashboard ] )

Description
Opens the settings page
Parameters
Name Type Attributes Description
forceRerenderDashboard boolean <optional>
If this is true, the dashboard settings will be re-rendered
Details

<static> settingsReloadWarning()

Description
Enables the reload warning when the user exists settings
Details

<static> dangerousCBLPrompt( [ accepted ] )

Description
Prompts for dangerous CBL enablement
Parameters
Name Type Attributes Description
accepted boolean <optional>
True if the disclaimer has been accepted
Details

<static> renderGradesInSettings()

Description
Renders the grades tab in settings
Details

<static> saveDashboardPrefs()

Description
Saves dashboard prefrences
Details

<static> resetDashboardPrefs()

Description
Resets dashboard prefrences
Details

<static> classicEntry()

Description
Redirects to DTPS classic edition
Details

<static> loadDashboardPrefs()

Description
Loads dashboard prefrences
Details

<static> render()

Description
Renders initial static DTPS HTML
Details

<static> setSearchBox()

Description
Sets the search box text based on the current page or keywords
Details

<static> renderLite()

Description
Renders basic content after the user has been loaded
Details

<static> closeScreen()

Description
A callback for blocking Fluid UI card closes
Details