Using JS to add content to Syllabus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was wondering if anyone could help me out with a .js solution since that is not my strength and we have no programmers. All of our courses are required to uses the Syllabus as the course homepage. Currently we are embedding an iframe of a custom webpage (currently - UAB SON Slider) on all of the courses homepages so that we can periodically update the page and it updates in all of our courses. This has worked of, but I have to make some compromises that I have never been happy with.
Today I was thinking that maybe this could be done with .js below the "Jump to Today" link similar to the way we are able to append the menu across the top of the old UI:
(function() {
var menu = $('#menu');
if (!menu.length) return;
//Menu Item Support
var stuResources = $('<li/>', {
'class': 'menu-item',
html: '<a class="menu-item-title" href="https://community.canvaslms.com/">Student Resources<span class="menu-item-title-icon"></span><i class="icon-mini-arrow-down"></i></a><div class="menu-item-drop"><table cellspacing="0"><tbody><tr><td class="menu-item-drop-column">'+
//'<h2 id="test" >Resources</h2>
'<ul class="menu-item-drop-column-list">'+
//List items
'<li><a href="http://www.uab.edu/students/one-stop" target="_blank"><span class="name ellipsis">UAB One Stop</span></a></li>'+
'<li><a href="http://www.uab.edu/libraries/" target="_blank"><span class="name ellipsis">UAB Libraries</span></a></li>'+
'<li><a href="http://www.uab.edu/students/academics/exceptions-to-academic-policy" target="_blank"><span class="name ellipsis">UAB Academic Policies</span></a></li>'+
'<li><a href="http://www.uab.edu/students/academics/academic-calendar" target="_blank"><span class="name ellipsis">UAB Academic Calendar</span></a></li>'+
'<li><a href="http://www.uab.edu/handbook/" target="_blank"><span class="name ellipsis">UAB Student Handbook</span></a></li>'+
'<li><a href="http://www.uab.edu/students/services" target="_blank"><span class="name ellipsis">UAB Services Directory</span></a></li>'+
'<li><a href="http://www.uab.edu/students/services/disability-support-services" target="_blank"><span class="name ellipsis">UAB Disability Services</span></a></li>'+
'<li><a href="http://www.uab.edu/writingcenter/" target="_blank"><span class="name ellipsis">UAB Writing Center</span></a></li>'+
'<li><a href="http://www.uab.edu/elearning/students/canvas-tutorials" target="_blank"><span class="name ellipsis">Canvas Student Tutorials</span></a></li>'+
'<li><a href="http://www.uab.edu/elearning/how-online-learning-works" target="_blank"><span class="name ellipsis">Online Student Success</span></a></li>'+
'<li><a href="http://www.uab.edu/careerservices/" target="_blank"><span class="name ellipsis">UAB Career & Professional Development</span></a></li>'+
'<li><a href="http://www.uab.edu/elearning/academic-technology/student" target="_blank"><span class="name ellipsis">UAB Academic Technologies</span></a></li>'+
//Ending
'</ul></td></tr></tbody></table></div>'
});
men
menu.append(stuResources);
})
So I guess my question is this - is there a way to append the syllabus so that it will write some standard content within all of our courses? The slide we are using is created entirely out of HTML & CSS, so I would think I could add the CSS to our global CSS and add the HTML similar to above. I just don't know how to write the call to put it in the correct place.
I hope I have given enough of an idea of what I am trying to do. I am totally open to feed back on ideas or reasons that this is a completely insane idea.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This should do what you are looking for based on my understanding. This will add whatever html you decide to put within the beforeSyllabus variable. You can write out all the html that you would like, or you could use it to add an iframe like you were using before.
// Run the following on any home page that is set to the syllabus
if ($('#course_syllabus').length > 0 && $('#course_home_content').length > 0) {
var beforeSyllabus = '<p>Whatever you want inserted before the syllabus content.</p>';
$('#course_syllabus').before(beforeSyllabus);
}
I did some testing and I think that the two pieces we are looking for load with the page, but if you find that there are times it doesn't load, let me know and we can wrap it in a function that will check to make sure the necessary pieces exist before running the code.