你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式
你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式
你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式
你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式
你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式
你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式
(我已經安裝了使用者樣式管理器,讓我安裝!)
// ==UserScript==
// @name Better-Devinci
// @namespace Violentmonkey Scripts
// @match https://www.leonard-de-vinci.net/*
// @match https://learning.devinci.fr/*
// @license GNU GPLv3
// @version 2.1
// @author loliprane
// @description A better leonard-de-vinci portal
// ==/UserScript==
//localstorage setup
let CheckLocalStorage= function(Item,Base_value){
if(localStorage.getItem(Item)==null){
localStorage.setItem(Item,Base_value)
}
}
let IsLocalStorageTrue= function(Item){
return localStorage.getItem(Item)=='True'
}
CheckLocalStorage("Version_Better_Devinci","1.1")
CheckLocalStorage("Hide_Slider","False")
CheckLocalStorage("Number_Message_read",0)
CheckLocalStorage("Footer&Scrollbar","True")
CheckLocalStorage("Notification","True")
CheckLocalStorage("SideBar_Diminish","False")
CheckLocalStorage("Hide_news","True")
CheckLocalStorage("Better_Marks","True")
CheckLocalStorage("Finished_Sport_Inscription","False")
//end of localstorage setup
//every page setup
let StudentLanguageFR
let Page_Setup_Portal= function(){
StudentLanguageFR = document.querySelector('img[src*="/images/flags/"]').currentSrc.includes("fr.png")
if(IsLocalStorageTrue("Footer&Scrollbar")){
document.querySelector('html').style.height="0px" //remove the scrollbar when not necessary
document.querySelector('#footer').remove() // remove the unecessary footer
}
if (IsLocalStorageTrue("Notification")) {
if(document.querySelector('.UD_messages_new'+'.badge').innerText==localStorage.getItem("Number_Message_read")){
document.querySelector('.UD_messages_new'+'.badge').remove()
document.querySelector(".UD_messages_new"+".strong").innerText=0
}
else {
let MessageRead_Button = document.createElement("button");
MessageRead_Button.id = "Message_Read_Button";
MessageRead_Button.textContent = "Show Messages as read";
MessageRead_Button.style.color= 'red'
document.querySelector(".nav-messages-header").append(MessageRead_Button)
document.querySelector('.UD_messages_new'+'.badge').innerText-=localStorage.getItem("Number_Message_read")
document.querySelector(".UD_messages_new"+".strong").innerText-=localStorage.getItem("Number_Message_read")
MessageRead_Button.addEventListener("click", function() {
localStorage.setItem("Number_Message_read",parseInt(localStorage.getItem("Number_Message_read"))+parseInt(document.querySelector('.UD_messages_new').innerText))
document.querySelector('.UD_messages_new').remove()
document.querySelector(".UD_messages_new"+".strong").innerText=0
MessageRead_Button.remove()
})
}
}
const BetterDevinci_link = document.createElement("a");
BetterDevinci_link.id = "BetterDevinci_link"
BetterDevinci_link.setAttribute("href", "/?Better-Devinci");
BetterDevinci_link.textContent = "+";
BetterDevinci_link.style.color = 'red'
BetterDevinci_link.style.fontWeight='bold'
BetterDevinci_link.style.fontSize='20px'
document.querySelector(".navbar-inner-title").append(BetterDevinci_link)
if(document.querySelector(".social-sidebar"+".sidebar-full")!=null && IsLocalStorageTrue("SideBar_Diminish")){
document.querySelector(".switch-sidebar-icon"+".icon-align-justify").click()
}
}
//end of every page setup
let Sports= function(){
if(document.querySelector(".text-center"+".alert"+".alert-success") !=null){
localStorage.setItem("Finished_Sport_Inscription","True")
}
}
let BetterDevinci_Page = function(){
document.querySelector("#main").querySelectorAll(".container-fluid")[1].remove()
let Rewrite_Container = document.createElement("div");
Rewrite_Container.id = "OwO";
Rewrite_Container.style.margin='10px'
Rewrite_Container.style.paddingLeft='10px'
document.querySelector("#main").append(Rewrite_Container)
const TextPresentation=document.createElement("div");
TextPresentation.textContent = "This page is still in beta, it lists everything Better-Devinci does and you can activate or deactivate it";
TextPresentation.style.color= 'red'
TextPresentation.style.marginBottom='20px'
Rewrite_Container.append(TextPresentation)
const data = [
{ name: 'Footer&Scrollbar', description: 'Removes the footer. The scrollbar when useful' },
{ name: 'Notification', description: "Adds a button to mark all messages as read since it's bugged..."},
{ name: 'Hide_news', description: 'Adds the ability to hide & unhide the news panel with a button' },
{ name: 'Better_Marks', description: 'Adds the ability to diminish by semester and module the marks' },
{ name: 'SideBar_Diminish', description: 'Diminish the sidebar when useful to have more place on the page' },
]
const table = document.createElement('table');
const headerRow = document.createElement('tr');
const nameHeaderCell = document.createElement('th');
nameHeaderCell.textContent = 'Name';
nameHeaderCell.style.height='50px'
nameHeaderCell.style.width='200px'
headerRow.appendChild(nameHeaderCell);
const descriptionHeaderCell = document.createElement('th');
descriptionHeaderCell.textContent = 'Description';
headerRow.appendChild(descriptionHeaderCell);
const checkboxHeaderCell = document.createElement('th');
checkboxHeaderCell.textContent = 'Checkbox';
headerRow.appendChild(checkboxHeaderCell);
table.appendChild(headerRow);
data.forEach(item => {
const row = document.createElement('tr');
const nameCell = document.createElement('td');
nameCell.textContent = item.name;
nameCell.style.textAlign = 'center';
//nameCell.style.paddingRight='70px'
row.appendChild(nameCell);
const descriptionCell = document.createElement('td');
descriptionCell.textContent = item.description;
descriptionCell.style.textAlign = 'center';
row.appendChild(descriptionCell);
const checkboxCell = document.createElement('td');
checkboxCell.style.display = 'flex'
checkboxCell.style.justifyContent = 'center';
const checkbox = document.createElement('input');
checkbox.type = 'checkbox';
checkboxCell.appendChild(checkbox);
row.appendChild(checkboxCell);
if(localStorage.getItem(item.name) === 'True') {
checkbox.checked = true;
}
checkbox.addEventListener('change', function() {
if (localStorage.getItem(item.name) === 'True') {
localStorage.setItem(item.name,"False")
}
else{
localStorage.setItem(item.name,"True")
}
});
table.appendChild(row);
});
Rewrite_Container.append(table);
}
let Marks= function() {
if(IsLocalStorageTrue("Better_Marks")){
const Semestre = document.querySelectorAll(".dd-item");
const SemestreFiltered = Array.from(Semestre).filter(element => {
return element.classList.contains("dd-item") && element.classList.length === 1;
});
SemestreFiltered.forEach((Parent) =>{
let Pullright_class=Parent.children[0].children[0]
Pullright_class.style.fontSize='20px'
Pullright_class.style.color='red'
Pullright_class.innerText= "-"
Pullright_class.style.fontWeight='bold'
Pullright_class.style.marginRight='3px'
Parent.children[0].addEventListener("click", function() {
if(Pullright_class.innerText== "-"){
Pullright_class.innerText= "+"
Pullright_class.style.marginRight='0px'
}
else{
Pullright_class.innerText= "-"
Pullright_class.style.marginRight='3px'
}
Array.from(Parent.children).forEach((Child) => {
if(Child.classList.value.includes('dd-list hide')){
Child.classList.value = 'dd-list'
}
else if (Child.classList.value=='dd-list'){
Child.classList.value = 'dd-list hide'
}
})
})
})
const Module = document.querySelectorAll(".dd-unite-student");
Module.forEach((Parent) =>{
let span = document.createElement("span");
span.className = "UwU";
span.textContent = "ㅤㅤㅤㅤ-";
span.style.fontSize='20px'
span.style.color='purple'
span.style.fontWeight='bold'
span.style.paddingRight='3px'
Parent.children[0].querySelector(".pull-right").appendChild(span)
Parent.children[0].addEventListener("click", function() {
let Span_Selector=Parent.children[0].querySelector(".UwU")
if(Span_Selector.innerText== "ㅤㅤㅤㅤ-"){
Span_Selector.innerText= "ㅤㅤㅤㅤ+"
Span_Selector.style.paddingRight='0px'
}
else{
Span_Selector.innerText= "ㅤㅤㅤㅤ-"
Span_Selector.style.paddingRight='3px'
}
Array.from(Parent.children).forEach((Child) => {
if(Child.classList.value.includes('dd-list hide')){
Child.classList.value = 'dd-list'
}
else if (Child.classList.value=='dd-list'){
Child.classList.value = 'dd-list hide'
}
})
})
})
}
}
let Message= function(){
const MessageContainer = document.querySelector("#main").children[2]
if(MessageContainer.children.length==0){
if(StudentLanguageFR){
MessageContainer.innerHTML += "<div>Toujours pas réparé... (Regardez vos mail pour les infos ici)</div>"
}
else{
MessageContainer.innerHTML += "<div>They still didn't fix this... (Check your mail for info here)</div>"
}
}
}
let MainPage= function(){
if(IsLocalStorageTrue("Hide_news")){
const Body = document.querySelector(".body")
let SliderButton = document.createElement("button");
SliderButton.id = "Slider_Button";
SliderButton.textContent = "Hide News";
Body.parentElement.parentElement.prepend(SliderButton);
let SliderContainer=Body.parentElement
if(localStorage.getItem("Hide_Slider")=="True"){
SliderButton.innerHTML="Show News"
SliderContainer.className+=' hide'
}
SliderButton.addEventListener("click", function() {
if(localStorage.getItem("Hide_Slider")=="False"){
SliderButton.innerHTML="Show News"
SliderContainer.className+=' hide'
localStorage.setItem("Hide_Slider","True")
}
else{
SliderButton.innerHTML="Hide News"
SliderContainer.className=SliderContainer.className.replace(" hide","")
localStorage.setItem("Hide_Slider","False")
}
})
}
if(document.querySelector(".social-box"+".social-blue").childNodes[1].innerText == "Réinscription"){
if(document.querySelector(".social-box"+".social-blue").childNodes[3].innerText.includes("Vous êtes maintenant réinscrit(e)")){
document.querySelector(".social-box"+".social-blue").className+=' hide'
}
}
if(document.querySelector(".alert"+".alert-info") && document.querySelector(".alert"+".alert-info").childNodes[1].innerText == 'Inscription Sports 2023-2024'){
if(IsLocalStorageTrue("Finished_Sport_Inscription")){
document.querySelector(".alert"+".alert-info").className+=' hide'
}
}
}
let CheckPage= function(){
if(location.href.includes("www.leonard-de-vinci.net/")){
Page_Setup_Portal()
if(location.href == "https://www.leonard-de-vinci.net/"){
MainPage()
}
else if(location.href == "https://www.leonard-de-vinci.net/?Better-Devinci"){
BetterDevinci_Page()
}
else if(location.href == "https://www.leonard-de-vinci.net/?my=marks"){
Marks()
}
else if(location.href.includes("https://www.leonard-de-vinci.net/?my=msg")){
Message()
}
else if(location.href == "https://www.leonard-de-vinci.net/student/sport/"){
Sports()
}
}
else{
if(location.href.includes("https://learning.devinci.fr/course/view.php?id=")||location.href.includes("https://learning.devinci.fr/mod")){
Courses()
}
else if(location.href == "https://learning.devinci.fr/my/"){
Learning_Main_Page()
}
}
}
window.addEventListener('load', function() {
CheckPage()
});
function Learning_Main_Page(){
document.querySelector("#page-header").remove()
let intervalLearning_Main_Page=setInterval(function(){
if(document.querySelectorAll(".dashboard-card-footer").length!=0){
console.log("UwU")
document.querySelectorAll(".dashboard-card-footer").forEach(function(UwU){UwU.remove()})
document.querySelectorAll(".muted").forEach(function(UwU){UwU.remove()})
document.querySelectorAll('[data-region="course-content"]').forEach(function(UwU){UwU.style.margin='0px'})
document.querySelectorAll(".multiline").forEach(function(UwU){
UwU.innerText=UwU.innerText.replace(UwU.innerText.match(/\s\([a-zA-Z0-9-]+\)/g)[0],"")
})
clearInterval(intervalLearning_Main_Page)
}
}, 20)
}
let Courses= function(){
if(document.querySelector("#theme_boost-drawers-courseindex").querySelectorAll(".restrictions").length!=0){
let HideLockedButton = document.createElement("button");
HideLockedButton.id = "Slider_Button";
HideLockedButton.textContent = "Hide Locked";
document.querySelector("#theme_boost-drawers-courseindex").childNodes[1].append(HideLockedButton);
HideLockedButton.addEventListener("click", function() {
let all_Locked = document.querySelector("#theme_boost-drawers-courseindex").querySelectorAll(".restrictions")
all_Locked.forEach((Locked_Module)=>{
Locked_Module.style.setProperty("display", "none", "important");
})
HideLockedButton.textContent = "Locked are hidden";
HideLockedButton.disabled = true;
})
}
}