您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
try to take over the world!
当前为
- // ==UserScript==
- // @name WK Smaller Lessons And Reviews Buttons
- // @namespace http://tampermonkey.net/
- // @version 0.12
- // @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;
- }
- var settings_dialog;
- var defaults = {
- showRecentLessons: true,
- showRecentMistakes: true,
- showLevel: true
- };
- wkof.include('Apiv2, Menu, Settings');
- wkof.ready('Menu').then(install_menu);
- wkof.ready('Settings').then(install_settings);
- function install_menu() {
- wkof.Menu.insert_script_link({
- script_id: 'smaller_lessons_and_reviews_buttons',
- name: 'smaller_lessons_and_reviews_buttons',
- submenu: 'Settings',
- title: 'Smaller Lessons And Reviews Buttons',
- on_click: open_settings
- });
- }
- function open_settings() {
- settings_dialog.open();
- }
- function process_settings(){
- settings_dialog.save();
- console.log('Settings saved!');
- }
- function install_settings() {
- console.log("dfsafasfas");
- settings_dialog = new wkof.Settings({
- script_id: 'smaller_lessons_and_reviews_buttons',
- name: 'smaller_lessons_and_reviews_buttons',
- title: 'Smaller Lessons And Reviews Buttons',
- on_save: process_settings,
- settings: {
- 'grp_main': {
- type:'group',
- label:'Main',
- content:{
- 'showRecentLessons': {type:'checkbox',label:'Show Recent Lessons',default:defaults.alwaysShow,on_change:defaults.showRecentLessons},
- 'showRecentMistakes': {type:'checkbox',label:'Show Recent Mistakes',default:defaults.showRecentMistakes},
- 'showLevel': {type:'checkbox',label:'Show Level',default:defaults.showLevel},
- }
- },
- }
- });
- settings_dialog.load().then(function(){
- wkof.settings.smaller_lessons_and_reviews_buttons = $.extend(true, {}, defaults, wkof.settings.smaller_lessons_and_reviews_buttons);
- //console.log(wkof.settings.smaller_lessons_and_reviews_buttons);
- 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>'
- });
- });
- if(wkof.settings.smaller_lessons_and_reviews_buttons.showLevel == true){
- $($('.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"]');
- //if(wkof.settings.smaller_lessons_and_reviews_buttons.showRecentLessons == true){
- // 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>`;
- // $('.navigation-shortcut--reviews').after(newRecentLessons);
- //}
- //if(wkof.settings.smaller_lessons_and_reviews_buttons.showRecentMistakes == true){
- // 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(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;
- width: 80px;
- }
- .dashboard-level {
- border-right: none;
- }
- [data-react-class="ExtraStudyDashboardLegacy/ExtraStudyDashboard"] {
- display: none;
- }
- `);
- }
- }
- })(wk_smaller_lessons_and_reviews_buttons);