-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c600f53
Showing
4 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
function cleanPage(e) { | ||
let header = document.getElementsByTagName('header')[0]; | ||
header.style = 'display: none'; | ||
document.getElementById('restoreHeader').style = ''; | ||
let content = document.getElementById('ContentView').parentNode; | ||
let childs = content.childNodes; | ||
childs[childs.length - 1].style = 'display: none'; | ||
let quiz = document.getElementsByTagName('iframe')[0]; | ||
quiz.height = quiz.contentWindow.document.body.scrollHeight + 'px'; | ||
quiz.style = 'height: ' + quiz.height + ' !important'; | ||
quiz.scrolling = 'no'; | ||
document.body.style = ''; | ||
} | ||
|
||
function toggleHeader(e) { | ||
let header = document.getElementsByTagName('header')[0]; | ||
if (header.style.display === 'none') { | ||
header.style = ''; | ||
document.getElementById('restoreHeader').style = 'display: none'; | ||
} else { | ||
header.style = 'display: none'; | ||
document.getElementById('restoreHeader').style = ''; | ||
} | ||
} | ||
|
||
let listMenu = document.getElementsByTagName('header')[0].querySelector('div[role="list"]'); | ||
let button = document.createElement('div'); | ||
button.classList.add('d2l-navigation-s-item'); | ||
button.onclick = cleanPage; | ||
button.innerText = 'Quiz layout'; | ||
listMenu.appendChild(button); | ||
|
||
let toggleHeaderButttonInHeader = document.createElement('div'); | ||
toggleHeaderButttonInHeader.innerText = 'Hide menu'; | ||
toggleHeaderButttonInHeader.onclick = toggleHeader; | ||
listMenu.appendChild(toggleHeaderButttonInHeader); | ||
|
||
let toggleHeaderButtton = document.createElement('button'); | ||
toggleHeaderButtton.innerText = 'Show menu'; | ||
toggleHeaderButtton.onclick = toggleHeader; | ||
toggleHeaderButtton.id = 'restoreHeader'; | ||
toggleHeaderButtton.style = 'display: none'; | ||
document.body.insertBefore(toggleHeaderButtton,document.body.firstChild); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
|
||
"description": "Add extra layout options to the Brightspace page of the TU Delft", | ||
"manifest_version": 2, | ||
"name": "Improve the TUDelft Brightspace page", | ||
"version": "1.0", | ||
"homepage_url": "https://github.com/RensHam/", | ||
|
||
"icons": { | ||
"48": "icons/border-48.png" | ||
}, | ||
|
||
"content_scripts": [ | ||
{ | ||
"matches": ["*://brightspace.tudelft.nl/*"], | ||
"js": ["background.js"] | ||
} | ||
] | ||
|
||
} |