Lesson and Review Button Scaler

Scales the lessons and reviews buttons on the dashboard to scale with the number of lessons and reviews in the queues respectively.

目前为 2022-03-29 提交的版本。查看 最新版本

// ==UserScript==
// @name         Lesson and Review Button Scaler
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Scales the lessons and reviews buttons on the dashboard to scale with the number of lessons and reviews in the queues respectively.
// @author       Wantitled
// @match        https://www.wanikani.com/dashboard
// @icon         https://www.google.com/s2/favicons?sz=64&domain=wanikani.com
// @grant        none
// @license      MIT
// ==/UserScript==


var buttonsContainer = document.getElementsByClassName("lessons-and-reviews")[0];
var boxes = jQuery(buttonsContainer).find("a");
boxes.each(function(index,elem){replaceStyle(elem)});

function replaceStyle(elem){
    let span = elem.children[0]
    let lrCount = parseInt(span.innerHTML, 10);
    setGrid();
    if (lrCount <= 6){
        elem.style.padding = "16px 16px 16px";
    } else {
        let marginSize = Math.round(lrCount * 2.762);
        elem.style.padding = `${marginSize}px 16px 16px`;
    }
}

function setGrid(){
    let gridContainer = document.querySelectorAll('.progress-and-forecast.progress-and-forecast--with-extra-study');
    gridContainer.forEach(gridElem => {
        gridElem.style.gridTemplateRows = "auto auto";
    });
};

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址