Created
May 3, 2017 13:56
This script will customize the content of the Add People window in Canvas.
This file contains 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
$(document).ready(function(){ | |
//The function below checks to see that an element has rendered. When called | |
//the function will look for a particular selector. Do not remove. | |
function onElementRendered(selector, cb, _attempts) { | |
var el = $(selector); | |
_attempts = ++_attempts || 1; | |
if (el.length) return cb(el); | |
if (_attempts == 60) return; | |
setTimeout(function() { | |
onElementRendered(selector, cb, _attempts); | |
}, 250); | |
} | |
onElementRendered('#addUsers', function() { | |
$('#addUsers').on('click', function() { | |
if (window.location.pathname.indexOf('courses') > -1) { | |
// Hide the "Login ID" on the "Add People" screen on the people page within a course | |
$('[for="peoplesearch_radio_cc_path"]').hide(); | |
// Hide the example text | |
$("div.addpeople div>span:contains('Example:')").parent().hide() | |
// Change the text for "Login ID" and "SIS ID" to "NID" and "UCFID", respectively | |
$('[for="peoplesearch_radio_unique_id"] span:nth-child(2) span:nth-child(2)').text('NID'); | |
$('[for="peoplesearch_radio_sis_user_id"] span:nth-child(2) span:nth-child(2)').text('UCFID'); | |
} | |
}); | |
}); | |
}); |
I'm glad it helped! I believe I got that function from the Canvas Community somewhere. Others have moved from this method to using a MutationObserver, but I haven't experimented with that yet.
Thanks, Jacob for your reply. Since you mentioned MutationObserver, I will look into it.
I hope we will have a session in the annual conference of Canvas(Oct. 15th) to share what can be done through the Global JS; showcases of the implementation from all schools. It would be very helpful for the newbies like Princeton.
Have a great day, Jacob.
Best,
-Kim
Kim Huang
Package Adoption and Configuration |OIT
Princeton University
701 Carnegie Center, 234J
Princeton, NJ 08540
(609)258-8532
From: Jacob Bates <notifications@github.com>
Reply-To: bagofarms <reply@reply.github.com>
Date: Wednesday, June 10, 2020 at 9:53 AM
To: bagofarms <bagofarms@noreply.github.com>
Cc: "Kim Y. Huang" <kimhuang@princeton.edu>, Comment <comment@noreply.github.com>
Subject: Re: bagofarms/customize_add_people.js
@bagofarms commented on this gist.
…________________________________
I'm glad it helped! I believe I got that function from the Canvas Community somewhere. Others have moved from this method to using a MutationObserver, but I haven't experimented with that yet.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<https://gist.github.com/2f2b51bbccc7ee1d3abd4010773868f4#gistcomment-3337109>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AH5ZXC7GZ66MXXUA7JM6KEDRV6F5NANCNFSM4N2MPZIQ>.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am inspired by your function onElementRendered(selector, cb, _attempts) to tweak some other elements on the course site. Thank you