您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
try to take over the world!
当前为
// ==UserScript== // @name WaniKani SRS grid // @namespace http://tampermonkey.net/ // @version 2.2 // @description try to take over the world! // @author You // @match https://www.wanikani.com/ // @match https://www.wanikani.com/dashboard // @require https://greasyfork.org/scripts/22751-wanikani-settings/code/WaniKani%20Settings.js?version=144744 // @grant none // ==/UserScript== (function() { 'use strict'; makeSettings("SRS Grid",{1: {Name: "apiKeyForSRS", Display: "Api Key", Type: "textbox"}, 2: {Name: "srsGridDisplay", Display: "Display", Type: "select", Options: {a: {Value: "left/right", Text: "Left/Right"}, b: {Value: "center/center", Text: "Center/Center"}}, Default: "center/center"}}); var apiKey = getSetting('apiKeyForSRS'); var srsGridDisplay = getSetting('srsGridDisplay'); if(apiKey !== null && apiKey !== "") { Api(apiKey); } else { notSetup(); } addStyle('.title {' + ' width: 25px;' + '}' + '.progressDetailTable {' + ' width: 100%;' + '}' + '.progressDetailTable td {' + ' color: white;' + '}' + '.popover.srs {' + ' display: none !important;' + '}' + '.progressDetailTableTDFirst {' + ' text-align: ' + srsGridDisplay.split("/")[0] +';' + ' padding-right: 10px;' + '}' + '.progressDetailTableTDSecond {' + ' text-align: ' + srsGridDisplay.split("/")[1] +';' + '}' + '.progressDetailTableTDFirst, .progressDetailTableTDSecond {' + ' color: white;' + '}' + '#txtApiKey {' + ' width: 275px;' + '}' + '.srs-progress li table {' + ' display: inline;' + '}' + '#divSRSGridLink.error {' + ' background-color: red;' + '}' + '.dashboard section.srs-progress.noClean td {' + ' font-size: 15px;' + '}' + '.dashboard section.srs-progress.noClean ul li {' + ' display: table-cell !important;' + ' padding: 10px 0px !important;' + ' width: 500px;'+ '}' + '.dashboard section.srs-progress.noClean ul li span {' + ' margin-bottom: 10px !important;' + '}' + '.dashboard section.srs-progress ul li:first-child {' + ' border-radius: 5px 0px 0px 5px !important;' + '}' + '.dashboard section.srs-progress ul li:last-child {' + ' border-radius: 0px 5px 5px 0px !important;' + '}'); killClean(); })(); //------------------------------------------------------------------- // Add a <style> section to the document. //------------------------------------------------------------------- function addStyle(aCss) { var head, style; head = document.getElementsByTagName('head')[0]; if (head) { style = document.createElement('style'); style.setAttribute('type', 'text/css'); style.textContent = aCss; head.appendChild(style); return style; } return null; } function killClean(){ if($('.dashboard section.srs-progress ul li').css('display') == 'inline-flex') { if($.browser.mozilla === true){ $('.srs-progress').addClass('noClean'); } else { //Erase conflicting portions of Clean Dashboard CSS: Thanks to rfindley var found_css = false; var styles = $('style').each(function(i,v){ if (found_css) return; css = $(v).html(); if (css.match(/-- SRS PROGRESS --/) === null) return; found_css = true; var css_arr = css.split('\n'); var len = css_arr.length; css = ''; var deleting = false; for (var idx=0; idx<len; idx++) { var line = css_arr[idx]; if (!deleting) { if (line.match(/-- SRS PROGRESS --/) !== null) { deleting = true; } else { css += line + '\n'; } } else { if (line.match(/-- REVIEW STATUS --/) !== null) { css += line + '\n'; deleting = false; } } } $(v).html(css); }); } } } function Api(apiKey){ $.getJSON('https://www.wanikani.com/api/user/' + apiKey + '/srs-distribution', function (data) { setTimeout(function () { if (data.error) { alert('API Error: ' + data.error.message); } else { var apprenticeTable = "<table>" + "<tr><td class='progressDetailTableTDFirst'>Radicals</td><td class='progressDetailTableTDSecond'>" + data.requested_information.apprentice.radicals + "</td></tr>" + "<tr><td class='progressDetailTableTDFirst'>Kanji</td><td class='progressDetailTableTDSecond'>" + data.requested_information.apprentice.kanji + "</td></tr>" + "<tr><td class='progressDetailTableTDFirst'>Vocabulary</td><td class='progressDetailTableTDSecond'>" + data.requested_information.apprentice.vocabulary + "</td></tr>" + "<tr><td class='progressDetailTableTDFirst'>Total</td><td class='progressDetailTableTDSecond'>" + data.requested_information.apprentice.total + "</td></tr>" + "</table>"; var guruTable = "<table>" + "<tr><td class='progressDetailTableTDFirst'>Radicals</td><td class='progressDetailTableTDSecond'>" + data.requested_information.guru.radicals + "</td></tr>" + "<tr><td class='progressDetailTableTDFirst'>Kanji</td><td class='progressDetailTableTDSecond'>" + data.requested_information.guru.kanji + "</td></tr>" + "<tr><td class='progressDetailTableTDFirst'>Vocabulary</td><td class='progressDetailTableTDSecond'>" + data.requested_information.guru.vocabulary + "</td></tr>" + "<tr><td class='progressDetailTableTDFirst'>Total</td><td class='progressDetailTableTDSecond'>" + data.requested_information.guru.total + "</td></tr>" + "</table>"; var masterTable = "<table>" + "<tr><td class='progressDetailTableTDFirst'>Radicals</td><td class='progressDetailTableTDSecond'>" + data.requested_information.master.radicals + "</td></tr>" + "<tr><td class='progressDetailTableTDFirst'>Kanji</td><td class='progressDetailTableTDSecond'>" + data.requested_information.master.kanji + "</td></tr>" + "<tr><td class='progressDetailTableTDFirst'>Vocabulary</td><td class='progressDetailTableTDSecond'>" + data.requested_information.master.vocabulary + "</td></tr>" + "<tr><td class='progressDetailTableTDFirst'>Total</td><td class='progressDetailTableTDSecond'>" + data.requested_information.master.total + "</td></tr>" + "</table>"; var enlightenedTable = "<table>" + "<tr><td class='progressDetailTableTDFirst'>Radicals</td><td class='progressDetailTableTDSecond'>" + data.requested_information.enlighten.radicals + "</td></tr>" + "<tr><td class='progressDetailTableTDFirst'>Kanji</td><td class='progressDetailTableTDSecond'>" + data.requested_information.enlighten.kanji + "</td></tr>" + "<tr><td class='progressDetailTableTDFirst'>Vocabulary</td><td class='progressDetailTableTDSecond'>" + data.requested_information.enlighten.vocabulary + "</td></tr>" + "<tr><td class='progressDetailTableTDFirst'>Total</td><td class='progressDetailTableTDSecond'>" + data.requested_information.enlighten.total + "</td></tr>" + "</table>"; var burnedTable = "<table>" + "<tr><td class='progressDetailTableTDFirst'>Radicals</td><td class='progressDetailTableTDSecond'>" + data.requested_information.burned.radicals + "</td></tr>" + "<tr><td class='progressDetailTableTDFirst'>Kanji</td><td class='progressDetailTableTDSecond'>" + data.requested_information.burned.kanji + "</td></tr>" + "<tr><td class='progressDetailTableTDFirst'>Vocabulary</td><td class='progressDetailTableTDSecond'>" + data.requested_information.burned.vocabulary + "</td></tr>" + "<tr><td class='progressDetailTableTDFirst'>Total</td><td class='progressDetailTableTDSecond'>" + data.requested_information.burned.total + "</td></tr>" + "</table>"; $('.srs-progress #apprentice').html("<span>Apprentice</span>").append(apprenticeTable); $('.srs-progress #guru').html("<span>Guru</span>").append(guruTable); $('.srs-progress #master').html("<span>Master</span>").append(masterTable); $('.srs-progress #enlightened').html("<span>Enlightened</span>").append(enlightenedTable); $('.srs-progress #burned').html("<span>Burned</span>").append(burnedTable); $('.dashboard section.srs-progress ul li').css('padding','10px 22.5px 10px'); } }, 0); }); } function properCase(word){ return word.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); } function notSetup(){ if($('.dropdown.account.open').length === 0){ $('.dropdown.account').addClass('open'); } $('#divSRSGridLink').addClass('error'); }