diff --git a/src/js/main.js b/src/js/main.js index 02476d35..837ebfd6 100755 --- a/src/js/main.js +++ b/src/js/main.js @@ -126,6 +126,7 @@ jQuery(function($) { util.removeRecentFeedback(); groups.interceptLinksToGroupPage(); coursepage.showCourseInvitation(); + pages.removeItemsInStudentView(); // override default view and display all courses list instead var courseView = util.isCourseFrontpageForAllCoursesList(); if (courseView == util.courseListEnum.allCoursesList) { @@ -655,7 +656,7 @@ jQuery(function($) { try { menu.injectGroupsPage(); groups.changeGroupListURLs(document.location.href); - + pages.removeItemsInStudentView(); pages.updateSidebarWhenMarkedAsDone(); pages.updateSidebarWhenContributedToDiscussion(); menu.alterCourseLink(); diff --git a/src/js/modules/pages.js b/src/js/modules/pages.js index d99f732a..ebcadd15 100755 --- a/src/js/modules/pages.js +++ b/src/js/modules/pages.js @@ -101,7 +101,24 @@ export default (function() { buttonHtml += 'Studentvisning'; addButton(buttonHtml); }, - + removeItemsInStudentView: function() { + const userIsStudent = !util.isTeacherOrAdmin(); + if (userIsStudent) { + // Get the element with the ID "sticky-container" + var adminNavigation = document.getElementById('sticky-container'); + // Check if the element is found + if (adminNavigation) { + // Remove the element from the DOM + adminNavigation.parentNode.removeChild(adminNavigation); + } + var adminHeader = document.querySelector('.header-bar-outer-container'); + // Check if the element is found + if (adminHeader) { + // Remove the element from the DOM + adminHeader.parentNode.removeChild(adminHeader); + } + } + }, updateSidebarWhenMarkedAsDone: function() { $('body').on('click', '#mark-as-done-checkbox', function() { var icon = $('ul.mmooc-module-items .active span:last-child');