Last active
September 2, 2020 09:50
-
-
Save icecoldfire/bf8a6ba81cceb8d9115d879e52433f23 to your computer and use it in GitHub Desktop.
Improve smartschool.be
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
// ==UserScript== | |
// @name Smartschool | |
// @namespace http://stijngoethals.be/ | |
// @version 0.1 | |
// @description Improve smartschool.be | |
// @author Stijn Goethals | |
// @match https://*.smartschool.be/index.php?module=Yearplan&file=teacher&yearplanID=* | |
// @grant none | |
// @run-at document-idle | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Your code here... | |
const editModeButton = document.getElementById("editModeButton"); | |
editModeButton.addEventListener("click", changeRowWidth, false); | |
function changeRowWidthDelayed(){ | |
setTimeout(changeRowWidth, 100); | |
} | |
function changeRowWidth(){ | |
const list = document.querySelectorAll(".row"); | |
var index; | |
for (index = 0; index < list.length; index++) { | |
var row = list[index]; | |
if(row.childElementCount === 8){ | |
const selector = row.children[0]; | |
if(selector.className === "selector"){ | |
const voet = row.children[6]; | |
selector.style.width = "20px"; | |
selector.style.backgroundColor = "black"; | |
selector.style.backgroundImage = "none"; | |
const voetWidth = +voet.style.width.replace("px", ""); | |
voet.style.width = (voetWidth - 20) + "px"; | |
}else{ | |
changeRowWidthDelayed(); | |
break; | |
} | |
} | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment