Automatically scrolls to the last completed checkpoint when Duolingo loads.
当前为
// ==UserScript==
// @name Duolingo autoScroller
// @description Automatically scrolls to the last completed checkpoint when Duolingo loads.
// @version 1.1
// @namespace minirock
// @match https://www.duolingo.com/learn
// ==/UserScript==
window.onload = function () {
let lessons = document.querySelectorAll("div[class='_2albn']");
for (let i = 0; i < lessons.length; ++i) {
var lesson = lessons[i].querySelector("div[data-test='level-crown']");
if (lesson === null) {
var last_finished = i;
break;
}
}
lessons[last_finished].click();
};
// window.onload = function(){
// let elem = document.querySelectorAll("div[data-test='level-crown']");
// elem = elem[elem.length - 1];
// if(elem !== null) elem.scrollIntoView(true);
// };