Jisho Only Essential Info

Hide non-essential information from jisho search results

目前为 2020-10-21 提交的版本。查看 最新版本

// ==UserScript==
// @name         Jisho Only Essential Info
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  Hide non-essential information from jisho search results
// @author       NickNickovich
// @match        https://jisho.org/search/*
// @grant        none
// ==/UserScript==

/* jshint esversion:6 */

(function() {
    'use strict';

    // Number of words found in search
    document.querySelectorAll("h4").forEach(h => {
        if (h.innerHTML.startsWith("Words")) {
            h.style.display = "none";
        }
    });

    // Example sentences in search results
    const sentences = document.querySelectorAll("div.sentence");
    sentences.forEach(s => {
        s.style.display = "none";
    });

    // Example sentences on the right side
    const secondarySentences = document.querySelector("div#secondary > div.sentences_block");
    if (secondarySentences) {
        secondarySentences.style.display = "none";
    }

    // Links under the words (play audio, collocations, links)
    const links = document.querySelectorAll("div.concept_light-status > a");
    links.forEach(link => {
        link.style.display = "none";
    });

    // Common word tags
    const commonWordTags = document.querySelectorAll("div.concept_light-status > span.success");
    commonWordTags.forEach(tag => {
        tag.style.display = "none";
    });

    // JLPT level tags
    const jlptLevelTags = document.querySelectorAll("div.concept_light-status > span");
    jlptLevelTags.forEach(tag => {
        if (tag.innerHTML.startsWith("JLPT")) {
            tag.style.display = "none";
        }
    });

    // WK level tags
    const wkLevelTags = document.querySelectorAll("div.concept_light-status > span");
    wkLevelTags.forEach(tag => {
        if (tag.innerHTML.includes("Wanikani level")) {
            tag.style.display = "none";
        }
    });

    // Wikipedia definitions
    const wikiDefinitions = document.querySelectorAll("div.meaning-definition.zero-padding > span > a");
    wikiDefinitions.forEach(d => {
        if (d.innerHTML === " Read more") {
            d.parentNode.parentNode.style.display = "none";
        }
    });
    const meaningTags = document.querySelectorAll("div.meaning-tags");
    meaningTags.forEach(tag => {
        if (tag.innerHTML === "Wikipedia definition") {
            tag.style.display = "none";
        }
    });

    // Notes
    const notesTags = document.querySelectorAll("div.meaning-tags");
    meaningTags.forEach(tag => {
        if (tag.innerHTML === "Notes") {
            tag.style.display = "none";
        }
    });
    const notes = document.querySelectorAll("div.meaning-representation_notes");
    notes.forEach(note => {
        note.style.display = "none";
    });

    // Annotations
    const supplementalInfo = document.querySelectorAll("span.sense-tag.tag-tag");
    supplementalInfo.forEach(s => {
        if (s.innerHTML === "Usually written using kana alone") {
            s.innerHTML = "Usually kana";
        } else if (s.innerHTML === "Yojijukugo (four character compound)") {
            s.innerHTML = "Yojijukugo";
        }
    });
})();

QingJ © 2025

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