try to take over the world!
当前为
// ==UserScript==
// @name WK Smaller Lessons And Reviews Buttons
// @namespace http://tampermonkey.net/
// @version 0.9
// @description try to take over the world!
// @author You
// @icon https://i.pinimg.com/236x/5f/68/68/5f6868d18acbc1221de49387a3c07833--batman-poster-batman-batman.jpg
// @match https://www.wanikani.com/
// @match https://www.wanikani.com/dashboard
// @require https://greasyfork.org/scripts/369353-jigen-s-other-stuff/code/Jigen's%20other%20stuff.js?version=604095
// @grant none
// @license MIT
// ==/UserScript==
window.wk_smaller_lessons_and_reviews_buttons = {};
(function() {
'use strict';
if (!window.wkof) {
if (confirm('WaniKani Smaller Lessons And Reviews Buttons requires Wanikani Open Framework.\nDo you want to be forwarded to the installation instructions?'))
window.location.href = 'https://community.wanikani.com/t/instructions-installing-wanikani-open-framework/28549';
return;
}
wkof.include('Apiv2, Menu');
wkof.ready('Menu').then(adjust_buttons);
function adjust_buttons() {
if($('.lessonAndReviewButtons').length == 0){
$('.lessons-and-reviews').remove();
$('.dashboard-progress').css('grid-row','1 / 3');
//make lesson hover work with it
$('.lessonAndReviewButtons .lessons').mouseover(function(){
$('.lessonAndReviewButtons .lessons').attr('data-content',$('.navigation .navigation-shortcut--lessons a').attr('data-content')).popover({
html: true,
animation: false,
placement: 'bottom',
trigger: 'hover',
template: '<div class="popover review-time"><div class="arrow"></div><div class="popover-inner"><div class="popover-content"><p></p></div></div></div>'
});
});
$($('.sitemap__section-header')[0]).before('<button class="dashboard-level">'+$('li.user-summary__attribute a')[0].href.split('/level/')[1]+'</button>');
var extraStudy = $('[data-test="extra-study-button"]');
var newRecentLessons = `<li class="navigation-shortcut navigation-shortcut--recentLessons" data-count="${extraStudy[0].text.replace(' Recent Lessons','')}">\n <a href="https://www.wanikani.com/extra_study/session?title=Recent+Lessons">\n <span>${extraStudy[0].text.replace(' Recent Lessons','')}</span> Recent Lessons\n</a> </li>`;
var newRecentMistakes = `<li class="navigation-shortcut navigation-shortcut--recentMistakes" data-count="${extraStudy[1].text.replace(' Recent Mistakes','')}">\n <a href="https://www.wanikani.com/extra_study/session?title=Recent+Mistakes">\n <span>${extraStudy[1].text.replace(' Recent Mistakes','')}</span> Recent Mistakes\n</a> </li>`;
$('.navigation-shortcut--reviews').after(newRecentLessons);
$('.navigation-shortcut--reviews').after(newRecentMistakes);
$('[data-react-class="ExtraStudyDashboard/ExtraStudyDashboard"]').remove();
$('.sitemap__section-header--help').parent().remove();
jigen.addStyle(`
.navigation-shortcuts, .navigation-shortcuts.hidden{
display: flex !important;
visibility: visible;
}
@media (min-width: 768px){
.dashboard .progress-and-forecast .forecast {
grid-row: 1 / 3;
}
}
.dashboard-level {
min-width: 16px;
padding: 0 8px;
font-size: 0.75rem;
display: inline-block;
border-radius: 4px 0 0 4px;
vertical-align: top;
line-height: 32px;
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
font-weight: bold !important;
text-align: center;
background: transparent;
color: black;
line-height: 28px;
color: rgb(51, 51, 51);
border: 2px solid rgba(0, 0, 0, 0.1);
}
[aria-controls=sitemap__levels],[aria-controls=sitemap__vocabulary],[aria-controls=sitemap__kanji],[aria-controls=sitemap__radicals]{
border-radius: 0 4px 4px 0;
border: 2px solid rgba(0, 0, 0, 0.1);
border-left: 0
width:auto;
display: inline;
border-radius: 4px;
}
[aria-controls=sitemap__vocabulary],[aria-controls=sitemap__kanji],[aria-controls=sitemap__radicals]{
margin-right: 0;
margin-left: 0;
}
.navigation-shortcut--recentMistakes, .navigation-shortcut--recentLessons, .sitemap {
white-space: nowrap;
}
[aria-controls=sitemap__levels] {
padding: 0;
border-radius: 0 4px 4px 0;
border-left: none;
width: 80px;
}
`);
}
}
})(wk_smaller_lessons_and_reviews_buttons);