您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
A script to enhance evryday's life being at PULV
当前为
// ==UserScript== // @name Better-Devinci // @namespace Better-Devinci Scripts // @description A script to enhance evryday's life being at PULV // @match https://www.leonard-de-vinci.net/* // @match https://learning.devinci.fr/* // @match https://adfs.devinci.fr/* // @exclude https://learning.devinci.fr/pluginfile.php/*/mod_resource/content/*/*.pdf // @version 3.4.4 // @author Better-Devinci // @license GNU GPLv3 // @run-at document-start // @grant GM_setValue // @grant GM_getValue // @grant GM_addStyle // ==/UserScript== //fixed error on first login page //beginning IIFE (function () { 'use strict'; let betterdevinciactualversion = "3.4.4"; let CheckGM= function(Item,Base_value){ if(GM_getValue(Item)===undefined){ GM_setValue(Item,Base_value) } } CheckGM("Version_Better_Devinci",betterdevinciactualversion) CheckGM("ADFS_autologin",true) CheckGM("Hide_Slider",false) CheckGM("Number_Message_read",0) CheckGM("Footer&Scrollbar",true) CheckGM("Notification",true) CheckGM("SideBar_Diminish",false) CheckGM("Hide_news",true) CheckGM("Better_Marks",true) CheckGM("Move_Exams",false) CheckGM("Dark_Mode",false) CheckGM("Hide_sunday_calendar",false) //for LMP still not fully implemented CheckGM("Better_Courses",true) CheckGM("Better_Courses_type",true) CheckGM("Better_Courses_completion",true) CheckGM("Better_Courses_name",true) CheckGM("LMP_News",true) CheckGM("LMP_Page_Header",true) CheckGM("LMP_Annonces",true) CheckGM("No_AutoDL",true) CheckGM("View_Images",true) CheckGM("Open_PDF",true) CheckGM("Hide_Locked",true) if(betterdevinciactualversion!=GM_getValue("Version_Better_Devinci")){ GM_setValue("Version_Better_Devinci",betterdevinciactualversion) } let BasicStyle=` :root{ --main-bg-color: black; --main-color : white; } .p-3{ padding-top: 0px!important; } #page:not(.drawers.show-drawer-left) #topofscroll, #page:not(.drawers.show-drawer-right) #topofscroll{ max-width: 100%!important; } #main { padding-bottom: 0px!important; } #Slider_Button:active { background-color: #a0c7e4; box-shadow: none; color: #2c5777; } #Slider_Button { background-color: #e1ecf4; border-radius: 3px; border: 1px solid #7aa7c7; box-shadow: rgba(255, 255, 255, .7) 0 1px 0 0 inset; box-sizing: border-box; color: #39739d; cursor: pointer; display: inline-block; font-family: -apple-system,system-ui,"Segoe UI","Liberation Sans",sans-serif; font-size: 13px; font-weight: 400; line-height: 1.15385; margin: 0; outline: none; position: relative; text-align: center; text-decoration: none; user-select: none; -webkit-user-select: none; touch-action: manipulation; vertical-align: baseline; white-space: nowrap; } #Slider_Button:hover{ background-color: #b3d3ea; color: #2c5777; } `; GM_addStyle(BasicStyle) function Portal_Setup(){ if(GM_getValue("Dark_Mode")){ let DarkMode = ` .table tbody tr.warning>td { background-color: rgb(56, 48, 0); } .table tbody tr.success > td { background-color: rgb(41, 60, 23); } .table th, .table td { border-top: 0px!important; } .panel .panel-heading { border-bottom: 0px!important; } .dd-module > .dd-handle{ color:white!important; } .dd-unite-student> .dd-handle{ color:blue!important; } .dd-unite-student> .dd-handle{ color:blue!important; } .dd-unite-student { background-color: #54545566; } .dd-handle { color:var(--main-color)!important; background: var(--main-bg-color)!important; } .b-dayview-day-container .b-calendar-cell.b-nonworking-day { background-color: #54545566!important; } .dropdown-menu>li>a { color:var(--main-color)!important } .nav-indicators .nav-messages .dropdown-menu li { border-top: 0px!important; } .nav-indicators .nav-messages .dropdown-menu .nav-messages-footer { background-color: var(--main-bg-color)!important; } .nav-indicators .nav-messages .dropdown-menu .nav-messages-header>a, .nav-indicators .nav-messages .dropdown-menu .nav-messages-header>a:hover, .nav-indicators .nav-messages .dropdown-menu .nav-messages-header>a:focus { color: var(--main-color)!important; } .nav-indicators .nav-messages .dropdown-menu .nav-messages-header {background-color: var(--main-bg-color)!important;} .panel { background-color: var(--main-bg-color)!important; } .site-menu-title{ color:var(--main-color)!important; } .site-menu{ background-color:var(--main-bg-color)!important; } .dropdown-menu{ background-color:var(--main-bg-color)!important; } .breadcrumb{ color:var(--main-color)!important; background-color:var(--main-bg-color)!important; } .breadcrumb.no_margin{ border:0px; } .site-menu-icon{ color:var(--main-color)!important; } .navbar-fixed-top{ margin:0px; } .b-toolbar { background-color:var(--main-bg-color)!important; } .b-daycellcollecter .b-dayview-content { background-color:var(--main-bg-color)!important; } .b-dayview-day-container .b-calendar-cell:not(.b-last-cell) { border-right: 0px!important; } .b-dayview-day-container { border-left: 0px!important; background-image:none!important; } .b-calendarrow .b-cal-cell-header { background-color: var(--main-bg-color)!important; } .social-box { background-color: var(--main-bg-color)!important; } body{ background-color:var(--main-bg-color)!important; color:var(--main-color)!important; } .b-panel>.b-panel-body-wrap{ background-color:var(--main-bg-color)!important; } `; GM_addStyle(DarkMode); } if(GM_getValue("SideBar_Diminish")){ if(document.querySelector(".social-sidebar"+".sidebar-full")){ document.querySelector(".wraper"+".page-content"+".sidebar-full").className="wraper page-content" document.querySelector("body").style.overflowX='auto' document.querySelector("body").querySelector(".wraper"+".page-content").className = 'wraper page-content' document.querySelector(".social-sidebar").className = 'social-sidebar' } } if(GM_getValue("Footer&Scrollbar")){ document.querySelector('html').style.height="0px" //remove the scrollbar when not necessary if(document.querySelector('#footer')){ document.querySelector('#footer').remove() } } let MessageRead_Button = document.createElement("button"); MessageRead_Button.id = "Message_Read_Button"; MessageRead_Button.textContent = "Show Messages as read"; MessageRead_Button.style.color= 'red' MessageRead_Button.addEventListener("click", function() { GM_setValue("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() }) if(GM_getValue("Notification")) { if(document.querySelector('.UD_messages_new'+'.badge')){ if(parseInt(document.querySelector('.UD_messages_new'+'.badge').innerText)==GM_getValue("Number_Message_read")){ document.querySelector('.UD_messages_new'+'.badge').remove() document.querySelector(".UD_messages_new"+".strong").innerText=0 } else{ if(document.querySelector('.UD_messages_new'+'.badge')){ document.querySelector(".nav-messages-header").append(MessageRead_Button) } } } } const BetterDevinci_link = document.createElement("button"); BetterDevinci_link.id = "BetterDevinci_link" BetterDevinci_link.style.backgroundColor = 'rgba(0, 0, 0, 0)' BetterDevinci_link.textContent = "+"; BetterDevinci_link.style.color = 'red' BetterDevinci_link.style.fontWeight='bold' BetterDevinci_link.style.fontSize='20px' BetterDevinci_link.addEventListener('click', BetterDevinci_Page) if(document.querySelector(".navbar-inner-title")){ document.querySelector(".navbar-inner-title").append(BetterDevinci_link) } if(document.querySelector(".social-sidebar"+".sidebar-full")!=null && GM_getValue("SideBar_Diminish")){ document.querySelector(".switch-sidebar-icon"+".icon-align-justify").click() } let observer_Page = new MutationObserver(function (mutationsList, observer) { for (var mutation of mutationsList) { if (mutation.type === 'childList') { for (var node of mutation.addedNodes) { if (node.nodeType === Node.ELEMENT_NODE ) { if(node.matches('#footer') && GM_getValue("Footer&Scrollbar")){ node.remove() } else if(node.matches('.UD_messages_new'+'.badge') && node.innerText==GM_getValue("Number_Message_read") && GM_getValue("Notification")){ node.remove() } else if(node.matches(".nav-messages-header") && GM_getValue("Notification")){ if(document.querySelector('.UD_messages_new'+'.badge')!=undefined){ node.append(MessageRead_Button) } } else if(node.matches(".UD_messages_new"+".strong")&& node.innerText==GM_getValue("Number_Message_read") && GM_getValue("Notification")){ node.innerText=0 } else if(node.matches(".navbar-inner-title")){ node.append(BetterDevinci_link) } else if(node.innerText && node.innerText.includes("let posting = $.ajax({\n")){ node.innerHTML=node.innerHTML.replace('let posting = $.ajax({\n ',"var posting = $.ajax({\n ") } else if(GM_getValue("SideBar_Diminish")){ if(node.matches(".wraper"+".page-content"+".sidebar-full")){ node.classname='wraper page-content' document.querySelector("body").querySelector(".wraper"+".page-content").className = 'wraper page-content' } else if(node.matches(".social-sidebar"+".sidebar-full")){ node.className = 'social-sidebar' document.querySelector("body").querySelector(".wraper"+".page-content").className = 'wraper page-content' } else if(node.matches("body") && node.parentElement!=document.querySelector("html")){ node.style.overflowX='auto' document.querySelector("body").querySelector(".wraper"+".page-content").className = 'wraper page-content' } } } } } } }); observer_Page.observe(document, { childList: true, subtree: true }); } function BetterDevinci_Page(){ if(document.querySelector("#Rewrite_Container")){ return; } let Rewrite_Container = document.createElement("div"); Rewrite_Container.id = "Rewrite_Container"; Rewrite_Container.style.margin='10px' Rewrite_Container.style.paddingLeft='10px' const TextPresentation=document.createElement("div"); TextPresentation.textContent = "This page lists everything Better-Devinci does on the portal and you can activate or deactivate these options"; 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' }, { name : "ADFS_autologin",description : "Adds the ability to autologin (email and password can only be accessed by the extension and nothing else)"}, { name: "Move_Exams",description: 'Move the exams next to the calendar'},//Move_Exams { name : "Hide_sunday_calendar", description:"Remove the sunday on the calendar"}, { name: "Dark_Mode",description: '(this feature is discontinued) Enables the dark mode for the portal (refresh to apply changes)'}, ] 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 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.className='better-devinci-checkbox' checkbox.type = 'checkbox'; checkboxCell.appendChild(checkbox); row.appendChild(checkboxCell); if(GM_getValue(item.name)) { checkbox.checked = true; } checkbox.addEventListener('change', function() { if (GM_getValue(item.name)) { GM_setValue(item.name,false) } else{ GM_setValue(item.name,true) } }); table.appendChild(row); }); Rewrite_Container.append(table); if(document.querySelector("#main") && document.querySelector("#main").querySelectorAll(".container-fluid")){ if(document.querySelector("#main").querySelectorAll(".container-fluid")[1]){ document.querySelector("#main").querySelectorAll(".container-fluid")[1].remove() } else{ document.querySelector("#main").querySelectorAll(".container-fluid")[0].remove() } } if(document.querySelector("#main")){ document.querySelector("#main").append(Rewrite_Container) } let observer_Page = new MutationObserver(function (mutationsList, observer) { for (var mutation of mutationsList) { if (mutation.type === 'childList') { for (var node of mutation.addedNodes) { if (node.nodeType === Node.ELEMENT_NODE ) { if(node.matches(".container-fluid") && node.parentElement.matches("#main")){ if(node.parentElement.childElementCount==2){ document.querySelector("#main").append(Rewrite_Container) } node.remove() } } } } } }); observer_Page.observe(document, { childList: true, subtree: true }); } function Marks(){ var toggleClass = (el, name) => { if (el.classList.contains(name)) { el.classList.remove(name) } else el.className+= " "+name } [...document.querySelectorAll(".dd-handle")].filter((obj) => !obj.parentElement.classList.toString().includes("dd-module")) .forEach((item) => { //make selesters togglable if (item.parentElement.className == "dd-item" || true) { item.onclick = () => { [...item.parentElement.children].forEach((child) => { toggleClass(child, "hide") }) item.classList.remove("hide")} } }) let observer_Page = new MutationObserver(function (mutationsList, observer) { for (var mutation of mutationsList) { if (mutation.type === 'childList') { for (var node of mutation.addedNodes) { if (node.nodeType === Node.ELEMENT_NODE) { if (node.classList.toString().includes("dd-handle") && !node.parentElement.classList.toString().includes("dd-module") && !node.parentElement.classList.toString().includes("entry_elements")) { node.onclick = (e) => { let target = e.target; while (target.classList != "dd-handle") { target = target.parentElement } [...target.parentElement.children].forEach((child) => { if (child.classList.toString().includes("dd-list")) { if (!child.classList.toString().includes("hide")) { child.classList.add("hide") } else child.classList.remove("hide") } }) } } } } } } }); observer_Page.observe(document, { childList: true, subtree: true }); } let moved_exams = false function MainPage(){ //Need to check if it's the login page if(document.querySelector("#login") && document.querySelector("#login").value==''){ if(GM_getValue("Autologin email")){ document.querySelector("#login").value=GM_getValue("Autologin email") if(document.querySelector("#login").value.toLowerCase().includes("edu.devinci.fr")){ document.querySelector("#btn_next").click() } } } if(GM_getValue("Move_Exams") && document.querySelector(".social-box"+".social-blue"+".mt-20")){ moved_exams = true; let a = document.querySelector(".social-box"+".social-blue"+".mt-20") a.style.userSelect='text' document.querySelector(".social-box"+ ".social-blue" +".mt-20").remove() if(document.querySelector("[role='listbox']")){ document.querySelector("[role='listbox']").append(a) } else{ let interval_move_exams=setInterval(function(){ if(document.querySelector("[role='listbox']")){ document.querySelector("[role='listbox']").append(a) clearInterval(interval_move_exams) } }, 20) } } let SliderButton = document.createElement("button"); SliderButton.id = "Slider_Button"; SliderButton.textContent = "Hide News"; SliderButton.addEventListener("click", function() { if(GM_getValue("Hide_Slider")==false){ SliderButton.innerHTML="Show News" let Sibling = document.querySelector("#Slider_Button").parentElement.querySelector(".social-box") Sibling.className+=' hide' GM_setValue("Hide_Slider",true) } else{ SliderButton.innerHTML="Hide News" let Sibling = document.querySelector("#Slider_Button").parentElement.querySelector(".social-box") Sibling.className=Sibling.className.replace(" hide","") GM_setValue("Hide_Slider",false) } }) if(GM_getValue("Hide_news")){ const Body = document.querySelector(".body") if(Body && Body.parentElement && Body.parentElement.parentElement){ if(GM_getValue("Hide_Slider")){ SliderButton.innerHTML="Show News" Body.parentElement.className+=' hide' } Body.parentElement.parentElement.prepend(SliderButton); } } let observer_Page = new MutationObserver(function (mutationsList, observer) { for (var mutation of mutationsList) { if (mutation.type === 'childList') { for (var node of mutation.addedNodes) { if (node.nodeType === Node.ELEMENT_NODE ) { if(node.matches("#login")){ if(GM_getValue("Autologin email")){ document.querySelector("#login").value=GM_getValue("Autologin email") let interval_login=setInterval(function(){ if(document.querySelector("#login").value.toLowerCase().includes("edu.devinci.fr") && document.querySelector("#btn_next")){ document.querySelector("#btn_next").click() clearInterval(interval_login) } }, 20) } } else if(GM_getValue("Move_Exams") && !moved_exams && node.matches(".social-box"+ ".social-blue" +".mt-20")){ moved_exams = true; let a = node a.style.userSelect='text' node.remove() if(document.querySelector("[role='listbox']")){ document.querySelector("[role='listbox']").append(a) } else{ let interval_move_exams=setInterval(function(){ if(document.querySelector("[role='listbox']")){ document.querySelector("[role='listbox']").append(a) clearInterval(interval_move_exams) } }, 20) } } else if(node.matches(".alert"+".alert-success") && node.innerText.includes("Vous êtes maintenant réinscrit(e)")){ //node.parentElement.parentElement.parentElement.remove() } else if(GM_getValue("Hide_news") && node.matches('.social-box') && node.className==='social-box'){ if(GM_getValue("Hide_Slider")){ SliderButton.innerHTML="Show News" node.className+=' hide' } if(GM_getValue("Hide_news")){ node.parentElement.prepend(SliderButton); } } else if(GM_getValue("Hide_sunday_calendar")){ if(node.matches(".b-last-cell") ){ node.remove() } else if(node.matches(".b-day-name-day") && node.innerText=="dim."){ node.parentElement.remove() } } } } } } }); observer_Page.observe(document, { childList: true, subtree: true }); } function Presence(){ if(document.querySelector(".icon-question-sign") && document.querySelector(".icon-question-sign")){ document.querySelector(".icon-question-sign").parentElement.remove() } let observer_Page = new MutationObserver(function (mutationsList, observer) { for (var mutation of mutationsList) { if (mutation.type === 'childList') { for (var node of mutation.addedNodes) { if (node.nodeType === Node.ELEMENT_NODE ) { if(node.matches('.alert'+'.alert-info') && node.innerText===' Pour accéder aux détails de la séance et à la validation de présence, cliquez sur le bouton "Relevé de présence".'){ node.remove() } } } } } }); observer_Page.observe(document, { childList: true, subtree: true }); } function Evaluations(){ let interval_login=setInterval(function(){ if(document.querySelectorAll("[id*='Tout à fait']")){ document.querySelectorAll("[id*='Tout à fait']").forEach(function(UwU){UwU.click()}) clearInterval(interval_login) } }, 20) } function EDT_Page(){ if(GM_getValue("Hide_sunday_calendar")){ let observer_EDT = new MutationObserver(function (mutationsList, observer) { for (var mutation of mutationsList) { if (mutation.type === 'childList') { for (var node of mutation.addedNodes) { if (node.nodeType === Node.ELEMENT_NODE ) { if(GM_getValue("Hide_sunday_calendar")){ if(node.matches(".b-last-cell") ){ node.remove() } else if(node.matches(".b-day-name-day") && node.innerText=="dim."){ node.parentElement.remove() } } } } } } }); observer_EDT.observe(document, { childList: true, subtree: true }); } } function ADFS(){ let username = document.createElement("input") username.id = "Better-devinci-username" username.className = "text fullWidth" username.placeholder = "Autologin email" username.spellcheck = false let password = document.createElement("input") password.id = "Better-devinci-password" password.className = "text fullWidth" password.placeholder = "Autologin password" password.spellcheck = false password.type= "password" let Save_ID = document.createElement("button") Save_ID.id = "Better-devinci-Save_ID-button" Save_ID.innerText = "Autologin save" Save_ID.addEventListener("click", function() { GM_setValue("Autologin email",username.value) GM_setValue("Autologin password",password.value) if(GM_getValue("Autologin email") && GM_getValue("Autologin password")){ document.querySelector("#userNameInput").value = GM_getValue("Autologin email") document.querySelector("#passwordInput").value = GM_getValue("Autologin password") if(document.querySelector("#submitButton") && GM_getValue("Autologin email") && GM_getValue("Autologin password") && document.querySelector("#userNameInput").value!='' && document.querySelector("#passwordInput").value!=''){ document.querySelector("#submitButton").click() } } }) if(document.querySelector("#footerPlaceholder")){ document.querySelector("#footerPlaceholder").append(username) document.querySelector("#footerPlaceholder").append(password) document.querySelector("#footerPlaceholder").append(Save_ID) document.querySelector("#copyright").remove() if(GM_getValue("Autologin email") && GM_getValue("Autologin password")){ document.querySelector("#userNameInput").value = GM_getValue("Autologin email") document.querySelector("#passwordInput").value = GM_getValue("Autologin password") } } if(document.querySelector("#submitButton") && GM_getValue("Autologin email") && GM_getValue("Autologin password") && document.querySelector("#errorText").innerText=='' && document.querySelector("#userNameInput").value!='' && document.querySelector("#passwordInput").value!=''){ document.querySelector("#submitButton").click() } let observer_ADFS = new MutationObserver(function (mutationsList, observer) { for (let mutation of mutationsList) { if (mutation.type === 'childList' ) { for (let node of mutation.addedNodes) { if(node.nodeType === Node.ELEMENT_NODE){ if(node.matches('#copyright')){ node.remove() } if(node.matches("#footerPlaceholder")){ document.querySelector("#footerPlaceholder").append(username) document.querySelector("#footerPlaceholder").append(password) document.querySelector("#footerPlaceholder").append(Save_ID) if(GM_getValue("Autologin email") && GM_getValue("Autologin password") && document.querySelector("#userNameInput") && document.querySelector("#passwordInput")){ username.value = GM_getValue("Autologin email") password.value = GM_getValue("Autologin password") } if(GM_getValue("Autologin email") && GM_getValue("Autologin password")){ let interval_login=setInterval(function(){ if(document.querySelector("#submitButton") && document.querySelector("#errorText").innerText==''){ document.querySelector("#userNameInput").value = GM_getValue("Autologin email") document.querySelector("#passwordInput").value = GM_getValue("Autologin password") if(document.querySelector("#submitButton") && GM_getValue("Autologin email") && GM_getValue("Autologin password") && document.querySelector("#userNameInput").value!='' && document.querySelector("#passwordInput").value!=''){ document.querySelector("#submitButton").click() clearInterval(interval_login) } } }, 20) } } } } } } }); observer_ADFS.observe(document, { childList: true, subtree: true }); } function Learning_Main_Page(){ let BasicStyle=` .card-body .p-3{ padding-top:0px!important; } #topofscroll{ margin:0px!important; } #page #region-main { padding-bottom: 0px!important; } .pb-3{ padding-bottom: 0px!important; } `; GM_addStyle(BasicStyle) let observer_LMP = new MutationObserver(function (mutationsList, observer) { for (let mutation of mutationsList) { if (mutation.type === 'childList' ) { for (let node of mutation.addedNodes) { if(node.nodeType === Node.ELEMENT_NODE){ if(node.matches('[data-region="paged-content-page"]') && document.querySelectorAll(".dashboard-card-footer").length!=0 && GM_getValue("Better_Courses")) { if(GM_getValue("Better_Courses_completion")){ document.querySelectorAll(".dashboard-card-footer").forEach(function(UwU){UwU.remove()}) } if(GM_getValue("Better_Courses_type")){ document.querySelectorAll(".muted").forEach(function(UwU){UwU.remove()}) } document.querySelectorAll('[data-region="course-content"]').forEach(function(UwU){ UwU.style.margin='0px' UwU.style.paddingBottom='0px' }) if(GM_getValue("Better_Courses_name")){ document.querySelectorAll(".multiline").forEach(function(UwU){ if(UwU.innerText.match(/\s\([a-zA-Z0-9-]+\)/g)){ UwU.innerText=UwU.innerText.replace(UwU.innerText.match(/\s\([a-zA-Z0-9-]+\)/g)[0],"") } }) } if(document.getElementsByClassName(" block_courses_discover block card mb-3") && document.getElementsByClassName(" block_courses_discover block card mb-3")[0]){ document.getElementsByClassName(" block_courses_discover block card mb-3")[0].remove() } } else if( (node.matches("#page-header") && GM_getValue("LMP_Page_Header")) || (node.matches("#inst174") && GM_getValue("LMP_News")) || (GM_getValue("Better_Courses") && (node.matches("#instance-2524-header")|| node.matches(".mt-0"))) ){ node.remove() } else if(node.matches("#inst3124") && GM_getValue("LMP_Annonces")){ node.remove() //node.parentElement.appendChild(node) } } } } } }); observer_LMP.observe(document, { childList: true, subtree: true }); } function Courses(){ if(document.querySelector('#resourceobject'+'[type="application/pdf"]') && GM_getValue("Open_PDF")){ let OpenPdf = document.createElement("a"); OpenPdf.id = "OpenPdf" OpenPdf.href= document.querySelector('#resourceobject'+'[type="application/pdf"]').data OpenPdf.target = "_blank" OpenPdf.textContent = "Open Pdf"; OpenPdf.className="btn" OpenPdf.style.color='red' let interval_Pdf=setInterval(function(){ if(document.querySelector("#focus-navigation-buttons-start")){ document.querySelector("#focus-navigation-buttons-start").prepend(OpenPdf) clearInterval(interval_Pdf) } }, 20) } let HideLockedButton = document.createElement("button"); HideLockedButton.id = "HideLockedButton"; HideLockedButton.textContent = "Hide Locked"; let observer_Courses = new MutationObserver(function (mutationsList, observer) { for (let mutation of mutationsList) { if (mutation.type === 'childList' ) { for (let node of mutation.addedNodes) { if(node.nodeType === Node.ELEMENT_NODE){ if(node.matches('#resourceobject'+'[type="application/pdf"]') && GM_getValue("Open_PDF")){ let OpenPdf = document.createElement("a"); OpenPdf.id = "OpenPdf" OpenPdf.href= document.querySelector('#resourceobject'+'[type="application/pdf"]').data OpenPdf.target = "_blank" OpenPdf.textContent = "Open Pdf"; OpenPdf.className="btn" OpenPdf.style.color='red' let interval_Pdf=setInterval(function(){ if(document.querySelector("#focus-navigation-buttons-start")){ document.querySelector("#focus-navigation-buttons-start").prepend(OpenPdf) clearInterval(interval_Pdf) } }, 20) } else if(node.matches(".no-announces")){ if(node.innerText==="Vous n'avez pas d'annonce disponible"){ node.parentElement.previousElementSibling.remove() node.remove() } } else if(node.matches(".container"+ ".focus-completion") && GM_getValue("Better_Courses_completion")){ node.remove() } else if(node.innerHTML.includes("restrictions") && GM_getValue("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; }) } else if(node.href && node.href.includes('.pdf?forcedownload=1') && GM_getValue("No_AutoDL")){ node.href=node.href.replace('?forcedownload=1',"") node.target='_blank' console.log("here") } else if(node.href && node.href.includes(".PNG?forcedownload=1") && GM_getValue("View_Images")){ let img = document.createElement("img") img.classList+="resourceimage" img.loading="lazy" img.src = node.href img.style.display = "none"; let Hide_IMG = document.createElement("button"); Hide_IMG.setAttribute("onclick",` var img = this.nextElementSibling; if (img.style.display != "none") { img.style.display = "none"; this.textContent = "Show Img"; } else { img.style.display = "block"; this.textContent = "Hide Img"; } `) Hide_IMG.style.border = "none" Hide_IMG.style.borderRadius = "5px" if(img.style.display != "none"){ Hide_IMG.textContent = "Hide Img"; } else{ Hide_IMG.textContent = "Show Img"; } node.parentElement.appendChild(Hide_IMG) node.parentElement.appendChild(img) } else if(node.matches("iframe") && node.src.includes(".pptx") && GM_getValue("No_AutoDL")){ let noforcedllink = document.createElement("a") noforcedllink.href = node.src noforcedllink.innerText=node.title +".pptx" node.parentElement.append(noforcedllink) node.remove() GM_addStyle(".btn-fullscreen{scale:0!important}") } else if(node.matches("iframe") && node.src.includes(".csv") && GM_getValue("No_AutoDL")){ let noforcedllink = document.createElement("a") noforcedllink.href = node.src noforcedllink.innerText=node.title +".csv" node.parentElement.append(noforcedllink) node.remove() GM_addStyle(".btn-fullscreen{scale:0!important}") } else if(node.matches("iframe") && node.src.includes(".zip") && GM_getValue("No_AutoDL")){ let noforcedllink = document.createElement("a") noforcedllink.href = node.src noforcedllink.innerText=node.title +".zip" node.parentElement.append(noforcedllink) node.remove() GM_addStyle(".btn-fullscreen{scale:0!important}") } else if(node.matches("iframe") && node.src.includes(".docx") && GM_getValue("No_AutoDL")){ let noforcedllink = document.createElement("a") noforcedllink.href = node.src noforcedllink.innerText=node.title +".docx" node.parentElement.append(noforcedllink) node.remove() GM_addStyle(".btn-fullscreen{scale:0!important}") } else if(node.matches("iframe") && node.src.includes(".xlsx") && GM_getValue("No_AutoDL")){ let noforcedllink = document.createElement("a") noforcedllink.href = node.src noforcedllink.innerText=node.title +".xlsx" node.parentElement.append(noforcedllink) node.remove() GM_addStyle(".btn-fullscreen{scale:0!important}") } else if(node.href && node.href.includes("https://learning.devinci.fr/course/view.php?id=") && node.parentElement.matches(".breadcrumb-item") && node.title.match(/\s\([a-zA-Z0-9-]+\)/g)!=null){ node.innerText=node.title.replace(node.title.match(/\s\([a-zA-Z0-9-]+\)/g)[0],'') } } } } } }); observer_Courses.observe(document, { childList: true, subtree: true }); } function Page_learning_devinci(){ let observer_Learning = new MutationObserver(function (mutationsList, observer) { for (let mutation of mutationsList) { if (mutation.type === 'childList' ) { for (let node of mutation.addedNodes) { if(node.nodeType === Node.ELEMENT_NODE){ if(node.href && node.href=="https://learning.devinci.fr/my/" && node.role=="menuitem"){ node.parentElement.parentElement//cible let handler = document.createElement("li") handler.className="nav-item" handler.role="none" node.parentElement.parentElement.append(handler) let link = document.createElement("a") link.role='menuitem' link.classList='nav-link' link.href="https://learning.devinci.fr/mod/forum/view.php?id=2018" link.innerText='Annonces du site' link.previewlistener="true" handler.append(link) } } } } } }); observer_Learning.observe(document, { childList: true, subtree: true }); } function CheckPage(){ if(location.href.includes("www.leonard-de-vinci.net/")){ Portal_Setup() if(location.href === "https://www.leonard-de-vinci.net/"){ MainPage() } else if(location.href === "https://www.leonard-de-vinci.net/?my=msg&Better-Devinci"){ BetterDevinci_Page() } else if(location.href === "https://www.leonard-de-vinci.net/?my=marks"){ Marks() } else if(location.href === "https://www.leonard-de-vinci.net/student/presences/"){ Presence() } else if(location.href.includes("https://www.leonard-de-vinci.net/student/cours/evaluations/")){ Evaluations() } else if(location.href === 'https://www.leonard-de-vinci.net/?my=edt'){ EDT_Page() } } else if(location.href.includes("https://learning.devinci.fr")){ Page_learning_devinci() if(location.href.includes("https://learning.devinci.fr/course/view.php?id=")||location.href.includes("https://learning.devinci.fr/mod") && !location.href.includes("https://learning.devinci.fr/mod/forum")){ Courses() } else if(location.href.includes("https://learning.devinci.fr/my/")){ Learning_Main_Page() } } else if(location.href.includes("https://adfs.devinci.fr/adfs/ls/") && GM_getValue("ADFS_autologin")){ ADFS() } } CheckPage() //end IIFE })();