WaniKani Regular Font Guru+

When reviewing items at guru level or higher, the font size is reduced to that of WaniKani's body text (14px)

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         WaniKani Regular Font Guru+
// @namespace    https://www.wanikani.com
// @version      1.0.2
// @description  When reviewing items at guru level or higher, the font size is reduced to that of WaniKani's body text (14px)
// @author       yndajas (they)
// @license      MIT
// @match        https://www.wanikani.com/review/session
// @grant        none
// ==/UserScript==

(function ($) {
  'use strict'

  // create style for Guru+ items

  const originalFontSizeEm = 6.125
  const waniKaniBodyFontSizeRem = 0.875
  const originalHeightEm = 3.21
  const originalHeightRem = originalFontSizeEm * originalHeightEm

  const css =
    'div#question div#character.guru-plus {' +
    `  font-size: ${waniKaniBodyFontSizeRem}rem;` +
    `  line-height: ${originalHeightRem}rem;` +
    `  height: ${originalHeightRem}rem;` +
    '  text-shadow: 0.045rem 0.045rem #0093dd;' +
    '}' +
    '' +
    'div#question div#character.guru-plus img {' +
    `  width: ${waniKaniBodyFontSizeRem}rem;` +
    `  height: ${waniKaniBodyFontSizeRem}rem;` +
    '}'

  const head = document.getElementsByTagName('head')[0]

  if (head) {
    const style = document.createElement('style')

    style.setAttribute('type', 'text/css')
    style.textContent = css
    head.appendChild(style)
  }

  // listen for changes to item and apply style if SRS level is Guru+

  const itemElement = document.getElementById('character')
  const guruPlusClass = 'guru-plus'
  const guruSrsLevel = 5

  $.jStorage.listenKeyChange('currentItem', () => {
    const srsLevel = $.jStorage.get('currentItem').srs
    const classActive = itemElement.classList.contains(guruPlusClass)

    if (srsLevel >= guruSrsLevel && !classActive) {
      itemElement.classList.add(guruPlusClass)
    }

    if (srsLevel < guruSrsLevel && classActive) {
      itemElement.classList.remove(guruPlusClass)
    }
  })
})(window.jQuery)